package.json
file should exist on the same install path. If it does not exist, package.json
should be generated via npm init
.caver-js
to create an account as shown below. You can also create an account via Klaytn Wallet.sendTransaction
.caver.klay.sendTransaction
. Note that caver.klay.sendTransaction
performs both signature generation and submission of the transaction at once.caver.klay.accounts.signTransaction
- The process of signing a transaction with a private key and getting a RLP-encoded transaction.caver.klay.sendSignedTransaction
- sends the RLP-encoded transaction to the node connected to caver-js.rawTransaction
) using caver.klay.accounts.signTransaction as above and use this to transfer the transaction to the Klaytn network as below..on('transactionHash', console.log)
.txError
of the receipt. For more information about txError
, see txError: Detailed Information of Transaction Failures.rawTransaction
), the fee payer can send the transaction after attaching the one's signature. The fee payer sets the rawTransaction
to senderRawTransaction and signs with the address of the fee payer, as in the example below.data
field as shown below:contractAddress
of the transaction receipt. Before sending a smart contract execution transaction, set the address to the address of the contract instance as follows:caver.klay.Contract
or use SMART_CONTRACT_EXECUTION.test.js
file created in the working directory.AccountKeyPublic
, AccountKeyMultiSig
, or AccountKeyRoleBased
transactionKey
, updateKey
, and feePayerKey
return a private key string or an array of private key strings that should be used for the role. So rather than using privateKey property, it is recommended that you use transactionKey
, updateKey
and feePayerKey
as appropriate, without worrying about the accountKey type.caver.klay.accounts.createAccountKey
. This function determines which AccountKey to generate based on the type of the parameter. It creates AccountKeyPublic if a private key string comes as a parameter, or AccountKeyMultiSig if an array of private key strings comes. And if there is an object with a different key for each role, it creates AccountKeyRoleBased.AccountKey
defined in caver-js are data structures for storing private keys for use in caver-js. It can be different from the key in your account on Klaytn network.keys
, transactionKey
, updateKey
and feePayerKey
all represent the same private key string.keys
, transactionKey
, updateKey
and feePayerKey
all represent the same multiple private key strings.from
or fee payer
and sign with it. In this case, if your account has multiple private keys, caver-js will sign the transaction with all of those keys.keys
property. Therefore, unlike other AccountKey (AccountKeyPublic or AccountKeyMultiSig), transactionKey, updateKey and feePayerKey each represents a different key.createAccountForUpdate()
with the target account address and the new key you want to use.ACCOUNT_UPDATE
, FEE_DELEGATED_ACCOUNT_UPDATE
and FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO
.account
is an account that has enough KLAY balance, and accountForUpdate
is an AccountForUpdate instance that contains the new key and the target account address. accountForUpdate is created using
caver.klay.accounts.createAccountForUpdate`.FEE_DELEGATED_ACCOUNT_UPDATE
transaction, see the example below.FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO
transaction, define updateTx
in the above example as:accountKey
of the account stored in caver-js as follows.accountKey
property of an account directly, the assigning value must be an instance of AccountKeyPublic, AccountKeyMultiSig, or AccountKeyRoleBased.rawTransaction
has an RLP encoded transaction that contains both signatures
and feePayerSignatures
. feePayerSignature
is included only when the transaction is a fee delegated transaction.signTransaction
or feePayerSignTransaction
. See the example below.caver.klay.accounts.signTransaction
or caver.klay.accounts.feePayerSignTransaction
from several people, you can create a single RLP encoded transaction that contains all the signature information.signatures
or feePayerSignatures
from multiple signers, you can send a transaction as follows:caver.klay.accounts.getRawTransactionWithSignatures
to get an RLP encoded transaction containing the signatures and feePayerSignatures of the transaction object.