Klaytn 문서 아카이브
시작하기스마트 컨트랙트노드 운영dApp 개발자
  • Klaytn 문서
  • -
    • Klaytn Overview
      • 왜 클레이튼일까요?
      • 클레이튼 디자인
        • 합의 메커니즘
        • 계정
        • 트랜잭션
          • 기본
          • 수수료 위임 트랜잭션
          • 수수료 부분 위임 트랜잭션
          • Ethereum
        • 연산
          • 클레이튼 스마트 컨트랙트
          • 실행 모델(Execution Model)
          • Computation Cost
            • 연산 비용 (구 버전 문서)
          • Klaytn 가상머신
            • 클레이튼 가상머신 (구 버전 문서)
        • 스토리지
        • 트랜잭션 비용
          • 트랜잭션 비용 (구 버전 문서)
        • 클레이튼의 네이티브 코인 - KLAY
        • 토큰 이코노미
        • 거버넌스
        • 다중 채널
        • KNI
      • 확장성 솔루션
    • Getting Started
      • Deploying Smart Contract Using Foundry
      • Deploying Smart Contract Using Hardhat
      • Deploying Smart Contract Using KEN
        • Launch an Endpoint Node
        • Top up your Account
        • Install Development Tools
        • Deploy a Smart Contract
        • Check the Deployment
        • Account Management
          • Creating Accounts
          • Managing Accounts
      • Development Environment
      • Getting KLAY
    • 스마트 컨트랙트
      • 솔리디티 - 스마트 컨트랙트 언어
      • 미리 컴파일된 컨트랙트
        • 미리 컴파일된 컨트랙트 (구 버전 문서)
      • IDE 및 도구
        • Truffle
      • 샘플 컨트랙트
        • KlaytnGreeter
        • ERC-20
          • 1. ERC-20 스마트 컨트랙트 작성
          • 2. 스마트 컨트랙트 배포
          • 3. 클레이튼 월렛에서 ERC-20 토큰 사용
        • ERC-721
          • 1. ERC-721 스마트 컨트랙트 작성
          • 2. Deploying Smart Contract
      • 테스트 가이드
      • 배포 가이드
      • 클레이튼 호환 토큰
      • 이더리움 컨트랙트 이식
    • Run a Node
      • 배포
        • Endpoint Node
          • 시스템 요구사항
          • 설치 가이드
            • 다운로드
            • Installation Guide
            • 환경설정
            • EN 실행하기
            • 설치 테스트하기
          • ken CLI 명령어
          • JSON-RPC API
        • 코어 셀
          • System Requirements
          • 네트워크 설정
          • Installation Guide
            • Download
            • 설치하기 전에
            • 컨센서스 노드 설정
              • Installation Guide
              • Configuration
              • CN 실행하기
            • 프록시 노드 설정
              • Installation Guide
              • Configuration
              • PN 실행하기
            • 코어 셀 테스트하기
          • 모니터링 설정
          • H/A 설정
        • Service Chain
          • Getting Started
            • 4개 노드 서비스 체인 설정하기
            • Connecting to Baobab
            • 크로스체인 토큰 전송
            • HA(High Availability) for ServiceChain
            • Nested ServiceChain
            • Value Transfer between Sibling ServiceChains
          • 참조 매뉴얼
            • System Requirements
            • Download
            • SCN User Guide
              • Installation
              • Configuration
              • SCN 실행 및 중지하기
              • 노드 상태 확인하기
              • kscn commands
              • homi commands
            • SPN/SEN User Guide
              • Installation
              • Configuration
              • 노드 실행 및 중지
              • Checking Node Status
            • Bridge Configuration
            • 앵커링
            • KAS 앵커링
            • 토큰 전송
            • Configuration Files
            • 로그 파일
            • Genesis JSON
            • 업그레이드 및 하드포크
          • How-To Guides
        • Download Node Packages
          • v1.11.1
          • v1.11.0
          • v1.10.2
          • v1.10.1
          • v1.10.0
          • v1.9.1
          • v1.9.0
          • v1.8.4
          • v1.8.3
          • v1.8.2
          • v1.8.1
          • v1.8.0
          • v1.7.3
          • v1.7.2
          • v1.7.1
          • v1.7.0
          • v1.6.4
          • v1.6.3
          • v1.6.2
          • v1.6.1
          • v1.6.0
          • v1.5.3
          • v1.5.2
          • v1.5.1
          • v1.5.0
          • v1.4.2
          • v1.4.1
          • v1.4.0
          • v1.3.0
          • v1.2.0
          • v1.1.1
          • v1.0.0
          • v0.9.6
          • v0.8.2
    • 운영 가이드
      • Configuration
      • 노드 로그
      • Log operation
      • 에러 및 문제 해결
      • Klaytn Command
      • Chaindata Change
      • Chaindata Migration
    • dApp Developers
      • JSON-RPC APIs
        • API references
          • eth
            • Caution
            • Account
            • Block
            • Transaction
            • Config
            • Filter
            • Gas
            • Miscellaneous
          • klay
            • Account
            • Block
            • Transaction
              • Working with Klaytn Transaction Types
            • Configuration
            • Filter
            • Gas
            • Miscellaneous
          • net
          • debug
            • Logging
            • Profiling
            • Runtime Tracing
            • Runtime Debugging
            • VM Tracing
            • VM Standard Tracing
            • Blockchain Inspection
          • admin
          • personal
          • txpool
          • governance
        • Service Chain API references
          • mainbridge
          • subbridge
        • Transaction Error Codes
      • RPC Service Providers
        • Public Endpoints
      • SDK & Libraries for interacting with Klaytn Node
        • caver-js
          • Getting Started
          • Sending a sample transaction
          • API references
            • caver.account
            • caver.wallet
              • caver.wallet.keyring
            • caver.transaction
              • Basic
              • Fee Delegation
              • Partial Fee Delegation
            • caver.rpc
              • caver.rpc.klay
              • caver.rpc.net
              • caver.rpc.governance
            • caver.contract
            • caver.abi
            • caver.kct
              • caver.kct.kip7
              • caver.kct.kip17
              • caver.kct.kip37
            • caver.validator
            • caver.utils
            • caver.ipfs
          • caver-js ~v1.4.1
            • Getting Started (~v1.4.1)
            • API references
              • caver.klay
                • Account
                • Block
                • Transaction
                  • Legacy
                  • Value Transfer
                  • Value Transfer Memo
                  • Account Update
                  • Smart Contract Deploy
                  • Smart Contract Execution
                  • Cancel
                • Configuration
                • Filter
                • Miscellaneous
              • caver.klay.net
              • caver.klay.accounts
              • caver.klay.Contract
              • caver.klay.KIP7
              • caver.klay.KIP17
              • caver.klay.abi
              • caver.utils (~v1.4.1)
            • Porting from web3.js
        • caver-java
          • Getting Started
          • API references
          • caver-java ~v1.4.0
            • Getting Started (~v1.4.0)
            • Porting from web3j
        • ethers.js
        • web3.js
      • Tutorials
        • Klaytn Online Toolkit
        • Fee Delegation Example
        • Count DApp
          • 1. Environment Setup
          • 2. Clone Count DApp
          • 3. Directory Structure
          • 4. Write Smart Contract
          • 5. Frontend Code Overview
            • 5-1. Blocknumber Component
            • 5-2. Auth Component
            • 5-3. Count Component
          • 6. Deploy Contract
          • 7. Run App
        • Klaystagram
          • 1. Environment Setup
          • 2. Clone Klaystagram DApp
          • 3. Directory Structure
          • 4. Write Klaystagram Smart Contract
          • 5. Deploy Contract
          • 6. Frontend Code Overview
          • 7. FeedPage
            • 7-1. Connect Contract to Frontend
            • 7-2. UploadPhoto Component
            • 7-3. Feed Component
            • 7-4. TransferOwnership Component
          • 8. Run App
        • Building a Buy Me a Coffee dApp
          • 1. Project Setup
          • 2. Creating a BMC Smart Contract
          • 3. Testing the contract using scripts
          • 4. Deploying BMC Smart contract
          • 5. Building the BMC Frontend with React and Web3Onboard
          • 6. Deploying Frontend code on IPFS using Fleek
          • 7. Conclusion
        • Migrating Ethereum App to Klaytn
        • Connecting MetaMask
        • Connecting Remix
        • Verifying Smart Contracts Using Block Explorers
      • Developer Tools
        • Wallets
          • Kaikas
          • Klaytn Wallet
          • Klaytn Safe
            • Klaytn Safe Design
            • Create a Safe
            • Add assets
            • Send assets
            • Contract Interaction
            • Transaction Builder
            • Points to Note
            • Frequently Asked Questions
          • Wallet Libraries
            • Web3Auth
            • Web3Modal
            • Web3-Onboard
        • Oracles
          • Orakl Network
          • Witnet
          • SupraOracles
        • Block Explorers
          • Klaytnscope
          • Klaytnfinder
        • Klaytn Contracts Wizard
    • Glossary
  • ---
    • Klaytn 하드포크
    • 클레이튼 2.0
      • 메타버스 패키지
      • 완결성과 개선 사항들
      • 이더리움 호환성
      • 거버넌스 탈중앙화
      • 대규모 에코 펀드
    • FAQ
    • 오픈 소스
    • 이용약관
    • 지원 언어
  • ℹ️최신 Klaytn 문서
Powered by GitBook
On this page
  • Class
  • caver.transaction.decode
  • caver.transaction.getTransactionByHash
  • caver.transaction.recoverPublicKeys
  • caver.transaction.recoverFeePayerPublicKeys
  • transaction.sign
  • transaction.signAsFeePayer
  • transaction.appendSignatures
  • transaction.appendFeePayerSignatures
  • transaction.combineSignedRawTransactions
  • transaction.getRLPEncoding
  • transaction.getRawTransaction
  • transaction.getTransactionHash
  • transaction.getSenderTxHash
  • transaction.getRLPEncodingForSignature
  • transaction.getRLPEncodingForFeePayerSignature
  • transaction.fillTransaction
  • transaction.recoverPublicKeys
  • transaction.recoverFeePayerPublicKeys
  • transaction.suggestGasPrice

Was this helpful?

  1. -
  2. dApp Developers
  3. SDK & Libraries for interacting with Klaytn Node
  4. caver-js
  5. API references

caver.transaction

Previouscaver.wallet.keyringNextBasic

Last updated 2 years ago

Was this helpful?

caver.transaction는 트랜잭션 관련 기능을 제공하는 패키지입니다.

Class

각 트랜잭션 클래스에 대한 자세한 설명이 있습니다:

Basic
Fee Delegation
Partial Fee Delegation

LegacyTransaction

N/A

N/A

ValueTransfer

ValueTransferMemo

SmartContractDeploy

SmartContractExecution

AccountUpdate

Cancel

ChainDataAnchoring

EthereumAccessList

N/A

N/A

EthereumDynamicFee

N/A

N/A

caver.transaction.decode

caver.transaction.decode(rlpEncoded)

Decodes RLP-encoded transaction string, a raw transaction, and returns a instance.

Parameters

Name
Type
Description

rlpEncoded

string

디코딩할 RLP 인코딩된 트랜잭션 문자열입니다.

Return Value

Type
Description

object

Example

> caver.transaction.decode('0x08f87...')
ValueTransfer {
    _type: 'TxTypeValueTransfer',
    _from: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
    _gas: '0xf4240',
    _nonce: '0x4d2',
    _gasPrice: '0x19',
    _signatures: [ 
        SignatureData { _v: '0x25', _r: '0xf3d0c...', _s: '0x6748a...' }
    ],
    _to: '0x7b65b75d204abed71587c9e519a89277766ee1d0',
    _value: '0xa'
}

caver.transaction.getTransactionByHash

caver.transaction.getTransactionByHash('0x{transaction hash}')

Queries a transaction from Klaytn and converts to a caver transaction instance.

Parameters

Name
Type
Description

transactionHash

string

The transaction hash string to query from Klaytn.

Return Value

Type
Description

object

Example

> caver.transaction.getTransactionByHash('0x30575f5a76a4477502aa1e5e707e47f05b92c3450132529cf55764cc94f780b0').then(console.log)
LegacyTransaction {
  _type: 'TxTypeLegacyTransaction',
  _from: '0x9ce618d097ea54c00d1562cb060576ff64139f10',
  _gas: '0x81b320',
  _nonce: '0x1de',
  _gasPrice: '0x5d21dba00',
  _signatures: SignatureData {
    _v: '0x07f5',
    _r: '0x359a09ebd2842cfc9cad6fd93c299da8629292bb3a69410c73837f7ca15cfd51',
    _s: '0x6f348cc656b90e79cfc1e748c3371fbd0128b83b787a110622f3aa5143a017f8'
  },
  _to: '0x',
  _input: '0x60806...',
  _value: '0x0'
}

caver.transaction.recoverPublicKeys

caver.transaction.recoverPublicKeys('0x{RLP-encoded transaction}')

Recovers the public key strings from signatures field of the given transaction.

Parameters

Name
Type
Description

rawTx

string

The RLP-encoded transaction string to recover public keys from signatures.

Return Value

Type
Description

Array

An array containing public keys recovered from signatures.

Example

> caver.transaction.recoverPublicKeys('0x08f9010e808505d21dba008402faf0809459177716c34ac6e49e295a0e78e33522f14d61ee0194f21460730845e3652aa3cc9bc13b345e4f53984af8d5f845820feaa02b5934c6d26bb3e65edf099d79c57c743d2f70744ca09d3ba9a1099edff9f173a00797886edff4b449c1a599943e3a6003ae9e46b3f3f34862ced327e43fba3a6af845820fe9a063177648732ef855f800eb9f80f68501abb507f84c0d660286a6e0801334a1d2a0620a996623c114f2df35b11ec8ac4f3758d3ad89cf81ba13614e51908cfe9218f845820fe9a086c8ecbfd892be41d48443a2243274beb6daed3f72895045965a3baede4c350ea069ea748aff6e4c106d3a8ba597d8f134745b76f12dacb581318f9da07351511a')
[
  '0x8bb6aaeb2d96d024754d3b50babf116cece68977acbe8ba6a66f14d5217c60d96af020a0568661e7c72e753e80efe084a3aed9f9ac87bf44d09ce67aad3d4e01',
  '0xc7751c794337a93e4db041fb5401c2c816cf0a099d8fd4b1f3f555aab5dfead2417521bb0c03d8637f350df15ef6a6cb3cdb806bd9d10bc71982dd03ff5d9ddd',
  '0x3919091ba17c106dd034af508cfe00b963d173dffab2c7702890e25a96d107ca1bb4f148ee1984751e57d2435468558193ce84ab9a7731b842e9672e40dc0f22'
]

caver.transaction.recoverFeePayerPublicKeys

caver.transaction.recoverFeePayerPublicKeys('0x{RLP-encoded transaction}')

Recovers the public key strings from feePayerSignatures field of the given transaction.

Parameters

Name
Type
Description

rawTx

string

The RLP-encoded transaction string to recover public keys from feePayerSignatures. To recover fee payer's public keys, the transaction should be a fee-delegated transaction with the feePayerSignatures field inside.

Return Value

Type
Description

Array

An array containing public keys recovered from feePayerSignatures.

Example

> caver.transaction.recoverFeePayerPublicKeys('0x09f901fa808505d21dba008402faf0809459177716c34ac6e49e295a0e78e33522f14d61ee019407a9a76ef778676c3bd2b334edcf581db31a85e5f8d5f845820feaa0cb2bbf04a12ec3a06163c30ce8782739ec4745a53e265aa9443f1c0d678bb871a07dd348c7d8fce6be36b661f116973d1c36cc92a389ad4a1a4053bd486060a083f845820fe9a06d5dfca992d6833c0da272578bc6ea941be45f44fb2fa114310ebe18d673ed52a04dc5cd7985c9ce7d44d46d65e65c995a4a8c97159a1eed8b2efb0510b981ab7cf845820feaa0945151edf556fbcebf832092d4534b9a3b1f3d46f85bce09e7d7211070cb57bea01617c8f918f96970baddd12f240a9824eca6b29d91eb7333adacb987f2dcd8dd94b5db72925b1b6b79299a1a49ae226cd7861083acf8d5f845820feaa086fd17d788e89a6e0639395b3c0a04f916103debd6cbe639d6f4ff5034dde3e8a00795551c551d9096234c290689767f34f2d409c95166ab18d216dbc93845ba16f845820feaa00653b6d1cdb90462094b089ce8e2fed0e3b8ec2c44125965e1a5af286644c758a0259b10e3bf594d48535fd0d95e15d095897c8d075c01dd56e7417d5943b0d53af845820fe9a0ce8d051427adab10d1dc93de49123aeab18ba8aadedce0d57ef5b7fa451b1f4fa04fe2a845d92ff48abca3e1d59637fab5f4a4e3172d91772d9bfce60760edc506')
[
  '0x2b557d80ddac3a0bbcc8a7861773ca7434c969e2721a574bb94a1e3aa5ceed3819f08a82b31682c038f9f691fb38ee4aaf7e016e2c973a1bd1e48a51f60a54ea',
  '0x1a1cfe1e2ec4b15520c57c20c2460981a2f16003c8db11a0afc282abf929fa1c1868f60f91b330c423aa660913d86acc2a0b1b15e7ba1fe571e5928a19825a7e',
  '0xdea23a89dbbde1a0c26466c49c1edd32785432389641797038c2b53815cb5c73d6cf5355986fd9a22a68bb57b831857fd1636362b383bd632966392714b60d72'
]

transaction.sign

transaction.sign(keyring [, index] [, hasher])

Signs the transaction as a transaction sender with the private key(s) in the keyring and appends signatures in the transaction object.

Parameters

Name
Type
Description

keyring

object \

string

index

number

(선택 사항) 사용하고자 하는 개인키의 인덱스입니다. 인덱스는 각각의 역할에 정의된 개인키들의 배열 길이보다 작아야 합니다. 인덱스가 정의되지 않았을 경우, 이 메서드는 모든 개인키를 사용합니다.

hasher

Function

(optional) The hash function to get the hash of the transaction.

Return Value

Promise는 객체를 반환: 서명된 트랜잭션입니다.

Type
Description

object

Example

// 이 예시는 ValueTransfer 트랜잭션 사용
> const transaction = caver.transaction.valueTransfer.create({
    from: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    value: 1,
    gas: 30000,
})

> const customHasher = () => { ... }

// roleTransactionKey에 두 개인키를 사용하는 roleBasedKeyring로 트랜잭션 서명
> transaction.sign(roleBasedKeyring).then(console.log)
ValueTransfer {
    _type: 'TxTypeValueTransfer',
    _from: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _gas: '0x7530',
    _signatures: [
        SignatureData { _v: '0x4e43', _r: '0xd78a2...', _s: '0x379e9...' },
        SignatureData { _v: '0x4e43', _r: '0x70a58...', _s: '0x2ab28...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// roleTransactionKey와 인덱스에 두 개인키를 사용하는 roleBasedKeyring로 트랜잭션 서명
> transaction.sign(roleBasedKeyring, 1).then(console.log)
ValueTransfer {
    _type: 'TxTypeValueTransfer',
    _from: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _gas: '0x7530',
    _signatures: [
        SignatureData { _v: '0x4e43', _r: '0x70a58...', _s: '0x2ab28...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// roleTransactionKey와 hasher에 두 개인키를 사용하는 roleBasedKeyring로 트랜잭션 서명
> transaction.sign(roleBasedKeyring, customHasher).then(console.log)
ValueTransfer {
    _type: 'TxTypeValueTransfer',
    _from: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _gas: '0x7530',
    _signatures: [
        SignatureData { _v: '0x4e44', _r: '0x7a8b6...', _s: '0x17139...' },
        SignatureData { _v: '0x4e43', _r: '0x7f978...', _s: '0x1a532...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// roleTransactionKey, 인덱스, hasher에 두 개인키를 사용하는 roleBasedKeyring로 트랜잭션 서명
> transaction.sign(roleBasedKeyring, 1, customHasher).then(console.log)
ValueTransfer {
    _type: 'TxTypeValueTransfer',
    _from: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _gas: '0x7530',
    _signatures: [
        SignatureData { _v: '0x4e43', _r: '0x7f978...', _s: '0x1a532...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

transaction.signAsFeePayer

transaction.signAsFeePayer(keyring [, index] [, hasher])

트랜잭션 fee payer로서 서명하며, keyring 내 개인키를 사용하여 트랜잭션 객체에 feePayerSignatures를 첨부합니다.

transaction.feePayer가 정의되어 있지 않은 경우, 주어진 keyring의 주소는 transaction.feePayer로 설정됩니다.

참고 이 함수는 "수수료 대납" 트랜잭션 또는 "수수료 부분 대납" 트랜잭션에서만 작동합니다.

Parameters

Name
Type
Description

keyring

object \

string

index

number

(optional) The index of the private key you want to use. The index must be less than the length of the array of the private keys defined for each role. If an index is not defined, this method will use all the private keys.

hasher

Function

(optional) The hash function to get the hash of the transaction.

Return Value

Promise returning object: The signed transaction.

Type
Description

object

Example

// This example uses the FeeDelegatedValueTransfer transaction.
> const transaction = caver.transaction.feeDelegatedValueTransfer.create({
    from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
    to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    value: 1,
    gas: 30000,
})

> const customHasher = () => { ... }

// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey
> transaction.signAsFeePayer(roleBasedKeyring).then(console.log)
FeeDelegatedValueTransfer {
    _type: 'TxTypeFeeDelegatedValueTransfer',
    _from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
    _gas: '0x7530',
    _signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
    _feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _feePayerSignatures: [
        SignatureData { _v: '0x4e44', _r: '0x7010e...', _s: '0x65d6b...' },
        SignatureData { _v: '0x4e43', _r: '0x96ef2...', _s: '0x77f34...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey and index
> transaction.signAsFeePayer(roleBasedKeyring, 1).then(console.log)
FeeDelegatedValueTransfer {
    _type: 'TxTypeFeeDelegatedValueTransfer',
    _from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
    _gas: '0x7530',
    _signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
    _feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _feePayerSignatures: [
        SignatureData { _v: '0x4e43', _r: '0x96ef2...', _s: '0x77f34...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey and hasher
> transaction.signAsFeePayer(roleBasedKeyring, customHasher).then(console.log)
FeeDelegatedValueTransfer {
    _type: 'TxTypeFeeDelegatedValueTransfer',
    _from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
    _gas: '0x7530',
    _signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
    _feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _feePayerSignatures: [
        SignatureData { _v: '0x4e43', _r: '0xe48bf...', _s: '0x1cf36...' },
        SignatureData { _v: '0x4e43', _r: '0x82976...', _s: '0x3c5e0...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey, index and hasher
> transaction.signAsFeePayer(roleBasedKeyring, 1, customHasher).then(console.log)
FeeDelegatedValueTransfer {
    _type: 'TxTypeFeeDelegatedValueTransfer',
    _from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
    _gas: '0x7530',
    _signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
    _feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
    _feePayerSignatures: [
        SignatureData { _v: '0x4e43', _r: '0x82976...', _s: '0x3c5e0...' }
    ],
    _to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
    _value: '0x1',
    _chainId: '0x2710',
    _gasPrice: '0x5d21dba00',
    _nonce: '0x0'
}

transaction.appendSignatures

transaction.appendSignatures(signatures)

Appends signatures to the transaction.

Parameters

Name
Type
Description

signatures

object \

Array

Example

> transaction.appendSignatures([ '0x4e44', '0x7010e...', '0x65d6b...' ])

transaction.appendFeePayerSignatures

transaction.appendFeePayerSignatures(signatures)

Appends feePayerSignatures to the transaction.

NOTE This function works only for "fee-delegated" transactions or "fee-delegated with ratio" transactions.

Parameters

Name
Type
Description

feePayerSignatures

object \

Array

Example

> transaction.appendFeePayerSignatures([ '0x4e44', '0x7010e...', '0x65d6b...' ])

transaction.combineSignedRawTransactions

transaction.combineSignedRawTransactions(rlpEncodedTxs)

Collects signs in each RLP-encoded transaction string in the given array, combines them with the transaction instance, and returns a RLP-encoded transaction string which includes all signs. Note that the transaction instance doesn't necessarily be signed in advance. If the transaction is either a type of "fee-delegated" or "fee-delegated with ratio", feePayerSignatures is also merged and included in the output RLP-encoded transaction string.

Parameters

Name
Type
Description

rlpEncodedTxs

Array

An array of signed RLP-encoded transaction strings.

Return Value

Type
Description

string

A RLP-encoded transaction string which includes all signatures (and feePayerSignatures if transaction is a type of either "fee-delgated" or "fee-delegated with ratio").

Example

> transaction.combineSignedRawTransactions(['0x09f88...'])
'0x09f885018505d21dba00830f4240947b65b75d204abed71587c9e519a89277766ee1d00a9404bb86a1b16113ebe8f57071f839b002cbcbf7d0f847f845820feaa068e56f3da7fbe7a86543eb4b244ddbcb13b2d1cb9adb3ee8a4c8b046821bc492a068c29c057055f68a7860b54184bba7967bcf42b6aae12beaf9f30933e6e730c280c4c3018080'

transaction.getRLPEncoding

transaction.getRLPEncoding()

RLP 인코딩된 트랜잭션 문자열을 반환합니다.

Return Value

Type
Description

string

RLP 인코딩된 트랜잭션 문자열입니다.

Example

> transaction.getRLPEncoding()
'0x09f885018505d21dba00830f4240947b65b75d204abed71587c9e519a89277766ee1d00a9404bb86a1b16113ebe8f57071f839b002cbcbf7d0f847f845820feaa068e56f3da7fbe7a86543eb4b244ddbcb13b2d1cb9adb3ee8a4c8b046821bc492a068c29c057055f68a7860b54184bba7967bcf42b6aae12beaf9f30933e6e730c280c4c3018080'

transaction.getRawTransaction

transaction.getRawTransaction()

Return Value

Type
Description

string

A RLP-encoded transaction string.

Example

> transaction.getRawTransaction()
'0x09f885018505d21dba00830f4240947b65b75d204abed71587c9e519a89277766ee1d00a9404bb86a1b16113ebe8f57071f839b002cbcbf7d0f847f845820feaa068e56f3da7fbe7a86543eb4b244ddbcb13b2d1cb9adb3ee8a4c8b046821bc492a068c29c057055f68a7860b54184bba7967bcf42b6aae12beaf9f30933e6e730c280c4c3018080'

transaction.getTransactionHash

transaction.getTransactionHash()

transactionHash를 반환합니다.

Return Value

Type
Description

string

트랜잭션 해시입니다.

Example

> transaction.getTransactionHash()
'0x8ac53afbba014201b02398545653683fe0536c49707fe302c59423012c0e8697'

transaction.getSenderTxHash

transaction.getSenderTxHash()

Return Value

Type
Description

string

전송자의 트랜잭션 해시(senderTxHash) 입니다.

Example

> transaction.getSenderTxHash()
'0xb61cc1ddadb6f2ec34c9f9e6a7b6cf0a606422654d649d998587c77daa3c31fe'

transaction.getRLPEncodingForSignature

transaction.getRLPEncodingForSignature()

트랜잭션 전송자의 서명을 만들기 위한 RLP 인코딩된 트랜잭션 문자열을 반환합니다. 반환된 RLP 인코딩된 트랜잭션 문자열은 서명에 추가되는 것이 아니라, 이 서명을 생성하는 데 사용된다는 점을 참고하세요.

Return Value

Type
Description

string

서명이 첨부되지 않은 RLP 인코딩된 트랜잭션 문자열입니다.

Example

> transaction.getRLPEncodingForSignature()
'0xf83fb838f709018505d21dba00830f4240947b65b75d204abed71587c9e519a89277766ee1d00a9404bb86a1b16113ebe8f57071f839b002cbcbf7d08207e38080'

transaction.getRLPEncodingForFeePayerSignature

transaction.getRLPEncodingForFeePayerSignature()

수수료 납부자의 서명을 생성하기 위한 RLP 인코딩된 트랜잭션 문자열을 반환합니다. Note that the returned RLP-encoded transaction string is not added with the signature and rather is used to generate this signature.

NOTE This function works only for "fee-delegated" transactions or "fee-delegated with ratio" transactions.

Return Value

Type
Description

string

A RLP-encoded transaction string without any signature attached.

Example

> transaction.getRLPEncodingForFeePayerSignature()
'0xf840b838f709018505d21dba00830f4240947b65b75d204abed71587c9e519a89277766ee1d00a9404bb86a1b16113ebe8f57071f839b002cbcbf7d0808207e38080'

transaction.fillTransaction

transaction.fillTransaction()

트랜잭션의 선택 사항 변수들을 기입해 줍니다.

이 메서드는 트랜잭션의 선택 변수 gasPrice, nonce, 또는 chainId가 정의되지 않은 경우, 각각의 기본값을 조회하여 연결된 Klaytn Node에 JSON RPC 호출을 함으로서 이 값들을 지정시킵니다.

Return Value

Promise는 void을 반환합니다.

Example

> transaction.fillTransaction()

transaction.recoverPublicKeys

transaction.recoverPublicKeys()

signatures에서 공개키 스트링을 복구합니다.

Return Value

Type
Description

Array

An array containing public keys recovered from signatures.

Example

> transaction.recoverPublicKeys()
[
  '0x8bb6aaeb2d96d024754d3b50babf116cece68977acbe8ba6a66f14d5217c60d96af020a0568661e7c72e753e80efe084a3aed9f9ac87bf44d09ce67aad3d4e01',
  '0xc7751c794337a93e4db041fb5401c2c816cf0a099d8fd4b1f3f555aab5dfead2417521bb0c03d8637f350df15ef6a6cb3cdb806bd9d10bc71982dd03ff5d9ddd',
  '0x3919091ba17c106dd034af508cfe00b963d173dffab2c7702890e25a96d107ca1bb4f148ee1984751e57d2435468558193ce84ab9a7731b842e9672e40dc0f22'
]

transaction.recoverFeePayerPublicKeys

transaction.recoverFeePayerPublicKeys()

feePayerSignatures 필드에서 공개키 문자열을 복구합니다.

Return Value

Type
Description

Array

An array containing public keys recovered from feePayerSignatures.

Example

> transaction.recoverFeePayerPublicKeys()
[
  '0x2b557d80ddac3a0bbcc8a7861773ca7434c969e2721a574bb94a1e3aa5ceed3819f08a82b31682c038f9f691fb38ee4aaf7e016e2c973a1bd1e48a51f60a54ea',
  '0x1a1cfe1e2ec4b15520c57c20c2460981a2f16003c8db11a0afc282abf929fa1c1868f60f91b330c423aa660913d86acc2a0b1b15e7ba1fe571e5928a19825a7e',
  '0xdea23a89dbbde1a0c26466c49c1edd32785432389641797038c2b53815cb5c73d6cf5355986fd9a22a68bb57b831857fd1636362b383bd632966392714b60d72'
]

transaction.suggestGasPrice

transaction.suggestGasPrice()

Before the Magma hard fork, suggestGasPrice returns the unit price of the network. After the Magma hard fork, suggestGasPrice returns baseFee * 2 which is recommended to use as gasPrice.

Return Value

Promise returning string: The suggested gas price in hexadecimal string.

Type
Description

string

The suggested gas price.

Example

> tx.suggestGasPrice().then(console.log)
0xba43b7400

An instance of . For details of each transaction, refer to .

NOTE caver.transaction.getTransactionByHash is supported since caver-js .

Promise returning object: An instance of . If it fails to receive a transaction object from Klaytn, an error occurs.

An instance of . For details of each transaction, refer to .

NOTE caver.transaction.recoverPublicKeys is supported since caver-js .

NOTE caver.transaction.recoverFeePayerPublicKeys is supported since caver-js .

For transaction, use , or otherwise, use in . If the user has not defined an index, transaction.sign signs the transaction using all the private keys used by the role. If index is defined, the transaction.sign signs the transaction using only one private key at the given index.

An instance of signed . The signature is appended to the transaction.signatures.

For signing a transaction as a fee payer, use in keyring. 사용자가 index를 정의하지 않았다면, transaction.signAsFeePayer이 해당 역할에 의해 사용되는 모든 개인키를 가지고 트랜잭션에 서명합니다. index가 정의되어 있다면, transaction.signAsFeePayer이 주어진 인덱스에 대응하는 하나의 개인키를 가지고 트랜잭션에 서명합니다.

If the keyring to be used for signing the transaction was added to caver.wallet, you can use .

An instance of signed . The signature is appended to the transaction.feePayerSignatures.

For information on how to make the RLP-encoded string for each transaction type, see .

rawTransaction 문자열을 반환합니다(RLP 인코딩된 트랜잭션 문자열). This function is same with .

For information on how to make the transaction hash for each transaction type, see .

Returns a of transaction.

The is a hash of the transaction except for the fee payer's address and signature, so and are the same for basic transactions.

For information on how to make the for each transaction type, see .

For information on how to make a RLP-encoded transaction string to generate the transaction sender's signature for each transaction type, see .

For information on how to make a RLP-encoded transaction string to generate the fee payer's signature for each transaction type, see .

Use to get gasPrice, to get nonce and call to get chainId.

참고 transaction.recoverPublicKeys는 caver-js 부터 지원됩니다.

참고 transaction.recoverFeePayerPublicKeys는 caver-js 부터 지원됩니다.

Returns suggested gas price. This function is used to set gasPrice field in the .

NOTE transaction.suggestGasPrice is supported since caver-js .

v1.6.3
v1.6.3
v1.6.3
caver.wallet.signAsFeePayer
Klaytn Design - Transactions
Klaytn Design - Transactions
Klaytn Design - Transactions
Klaytn Design - Transactions
v1.6.3
v1.6.3
v1.9.0
Transaction
Transaction
transaction.getRLPEncoding
fillTransaction
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
roleFeePayerKey
senderTxHash
transactionHash
senderTxHash
senderTxHash
Klaytn Design - Transactions
senderTxHash
roleAccountUpdateKey
roleTransactionKey
FeeDelegatedValueTransfer
FeeDelegatedValueTransferMemo
FeeDelegatedSmartContractDeploy
FeeDelegatedSmartContractExecution
FeeDelegatedAccountUpdate
FeeDelegatedCancel
FeeDelegatedChainDataAnchoring
caver.rpc.klay.getGasPrice
caver.rpc.klay.getTransactionCount
caver.rpc.klay.getChainId
FeeDelegatedValueTransferWithRatio
FeeDelegatedValueTransferMemoWithRatio
FeeDelegatedSmartContractDeployWithRatio
FeeDelegatedSmartContractExecutionWithRatio
FeeDelegatedAccountUpdateWithRatio
FeeDelegatedCancelWithRatio
FeeDelegatedChainDataAnchoringWithRatio
LegacyTransaction
ValueTransfer
ValueTransferMemo
SmartContractDeploy
SmartContractExecution
AccountUpdate
Cancel
ChainDataAnchoring
EthereumAccessList
EthereumDynamicFee
Account Update
RoleBasedKeyring