caver.klay.accounts
caver-js APIs related to managing accounts.
caver.klay.accounts
contains functions to generate Klaytn accounts and sign transactions and data.caver.klay.accounts.create([entropy])
Generates an account object with private key and public key.
Parameters
Name | Type | Description |
---|---|---|
entropy | String | (optional) A random string to increase entropy. If none is given, a random string will be generated using randomHex. |
Return Value
Object
- The account object with the following structure:Name | Type | Description |
---|---|---|
address | String | The account address. |
privateKey | String | The accounts private key. This should never be shared or stored unencrypted in local storage! Also make sure to null the memory after usage. |
signTransaction(tx [, callback]) | Function | |
sign(data) | Function | |
encrypt | Function | The function to encrypt private key with given password. |
Example
> caver.klay.accounts.create();
{
address: '0x79FF91738661760AC67b3E951c0B4f1F70F80478',
privateKey: '0x{private key}',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
> caver.klay.accounts.create('entropy');
{
address: '0x205fffB1025F4af604fEB1d3a22b46C0D2326585',
privateKey: '0x{private key}',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
> caver.klay.accounts.create(caver.utils.randomHex(32));
{
address: '0x62Ca8964610A9D447E1a64753a09fC8b3D40b405',
privateKey: '0x{private key}',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.createWithAccountKey(address, accountKey)
Creates an instance of Account with the given AccountKey. Account is for managing an account's address and AccountKey.
NOTE This is merely a data structure used in caver-js. This method does not create or update an account in the Klaytn network. NOTE
caver.klay.accounts.createWithAccountKey
is supported since caver-js v1.2.0.Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
accountKey | String | Array | Object | An AccountKey instance ( AccountKeyPublic , AccountKeyMultiSig or AccountKeyRoleBased ) or a data structure that contains the key info (a private key string, an array of private key strings or an object that defines the key for each role). |
Return Value
Object
- An Account instance is returned, with the following properties:Name | Type | Description |
---|---|---|
address | String | The address of the account. |
privateKey | String | Default key string of accountKey that the account has. This property is left for backward compatibility. privateKey only represents the default key of accountKey, so using privateKey to sign or send a transaction is not recommended. It is recommended to use transactionKey, updateKey, or feePayerKey in context. |
accountKeyType | String | Type of accountKey the account has. This can be AccountKeyPublic , AccountKeyMultiSig , or AccountKeyRoleBased |
accountKey | Object | The key of the account. This is AccountKeyPublic, AccountKeyMultiSig or AccountKeyRoleBased. |
keys | String | Array | Object | All keys inside accountKey that the Account has. For AccountKeyPublic, this is a single private key string; for AccountKeyMultiSig, this returns an array containing all the private key strings. In the case of AccountKeyRoleBased, an object with keys associated with each role is returned. |
transactionKey | String | Array | Key used for the RoleTransaction. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so transactionKey holds the same value as keys. |
updateKey | String | Array | Key used for the RoleAccountUpdate. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so updateKey holds the same value as keys. |
feePayerKey | String | Array | Key used for RoleFeePayer. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so feePayerKey holds the same value as keys. |
signTransaction(tx [, callback]) | Function | |
sign(data) | Function | |
encrypt | Function | The function to encrypt an Account with given password. |
getKlaytnWalletKey | Function |
Example
// Create an Account with AccountKeyPublic
> caver.klay.accounts.createWithAccountKey('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', '0x{private key}')
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
// Create an Account with AccountKeyMultiSig
> caver.klay.accounts.createWithAccountKey('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', ['0x{private key}', '0x{private key}'])
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
// Create an Account with AccountKeyRoleBased
> caver.klay.accounts.createWithAccountKey('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', {
transactionKey: ['0x{private key}', '0x{private key}'], '0x{private key}',
updateKey: ['0x{private key}', '0x{private key}', '0x{private key}'],
feePayerKey: ['0x{private key}', '0x{private key}', '0x{private key}']
})
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.createWithAccountKeyPublic(address, accountKey)
Creates an instance of Account with AccountKeyPublic.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
accountKey | String | Object | An AccountKeyPublic instance or a private key string. |
Return Value
Example
> caver.klay.accounts.createWithAccountKeyPublic('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', '0x{private key}')
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.createWithAccountKeyMultiSig(address, accountKey)
Creates an instance of Account with AccountKeyMultiSig.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
accountKey | String | Object | An AccountKeyMultiSig instance or an array of private key strings. |
Return Value
Example
> caver.klay.accounts.createWithAccountKeyMultiSig('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', ['0x{private key}', '0x{private key}'])
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.createWithAccountKeyRoleBased(address, accountKey)
Creates an instance of Account with AccountKeyRoleBased.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
accountKey | String | Object | An AccountKeyRoleBased instance or an object that defines the key for each role. |
Return Value
Example
> caver.klay.accounts.createWithAccountKeyRoleBased('0x62ca8964610a9d447e1a64753a09fc8b3d40b405', {
transactionKey: ['0x{private key}', '0x{private key}', '0x{private key}'],
updateKey: ['0x{private key}', '0x{private key}', '0x{private key}'],
feePayerKey: ['0x{private key}', '0x{private key}', '0x{private key}']
})
Account {
address: [Getter/Setter],
accountKey: [Getter/Setter],
privateKey: [Getter/Setter],
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.createAccountKey(key)
Creates an instance of
AccountKeyPublic
, AccountKeyMultiSig
, or AccountKeyRoleBased
depending on the type of parameter.AccountKey is a data structure for managing keys in caver-js. Use AccountKeyPublic if you want to use a single private key, AccountKeyMultiSig if you want to use multiple private keys, or AccountKeyRoleBased if you want to use a different key for each role.
Parameters
Name | Type | Description |
---|---|---|
key | String | Array | Object | Key for generating AccountKey. If key is a single private key string, an AccountKeyPublic instance is created. If key is an array containing multiple private key strings, an AccountKeyMultiSig instance is created. If key is an object defining a key (a private key string or an array of private key strings) for each role, an AccountKeyRoleBased instance is created. AccountKeyRoleBased instance can have AccountKeyPublic or AccountKeyMultiSig for each role. |
Return Value
Object
- An AccountKeyPublic, AccountKeyMultiSig or AccountKeyRoleBased instance is returned with the following properties:Name | Type | Description |
---|---|---|
type | String | The type of AccountKey instance. |
defaultKey | String | Default private key of AccountKey. The default private key represents a single private key string defined for AccountKeyPublic, and a private key string in the zeroth index of the array if AccountKeyMultiSig. For AccountKeyRoleBased, it represents the defaultKey of the first found AccountKey, where the AccountKey is searched in the following order: transactionkey, updateKey, feePayerKey. |
keys | String | Array | Object | All private keys defined inside the AccountKey instance. For AccountKeyPublic, this is a single private key string; for AccountKeyMultiSig, this returns an array containing all the private key strings. In the case of AccountKeyRoleBased, an object with keys associated with each role is returned. |
transactionKey | String | Array | Key used for the RoleTransaction. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so transactionKey holds the same value as keys. |
updateKey | String | Array | Key used for the RoleAccountUpdate. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so updateKey holds the same value as keys. |
feePayerKey | String | Array | Key used for RoleFeePayer. AccountKeyPublic or AccountKeyMultiSig are not bound to any roles, so feePayerKey holds the same value as keys. |
Example
// Create an AccountKeyPublic
> caver.klay.accounts.createAccountKey('0x{private key}')
AccountKeyPublic {
_key: '0x{private key}'
}
// Create an AccountKeyMultiSig
> caver.klay.accounts.createAccountKey(['0x{private key}', '0x{private key}'])
AccountKeyMultiSig {
_keys: [
'0x{private key}',
'0x{private key}'
]
}
// Create an AccountKeyRoleBased
> caver.klay.accounts.createAccountKey({
transactionKey: '0x{private key}',
updateKey: ['0x{private key}', '0x{private key}'],
feePayerKey: '0x{private key}'
})
AccountKeyRoleBased {
_transactionKey:
AccountKeyPublic {
_key: '0x{private key}'
},
_updateKey:
AccountKeyMultiSig {
_keys: [
'0x{private key}',
'0x{private key}'
]
},
_feePayerKey:
AccountKeyPublic {
_key: '0x{private key}'
}
}
caver.klay.accounts.createAccountKeyPublic(key)
Creates an instance of
AccountKeyPublic
with the given private key string.Parameters
Name | Type | Description |
---|---|---|
key | String | A string of private key for generating AccountKeyPublic. |
Return Value
Example
> caver.klay.accounts.createAccountKeyPublic('0x{private key}')
AccountKeyPublic {
_key: '0x{private key}'
}
caver.klay.accounts.createAccountKeyMultiSig(keys)
Creates an instance of
AccountKeyMultiSig
with the given multiple private keys.Parameters
Name | Type | Description |
---|---|---|
keys | Array | An array of private key strings for generating AccountKeyMultiSig. |
Return Value
Example
> caver.klay.accounts.createAccountKeyMultiSig(['0x{private key}', '0x{private key}'])
AccountKeyMultiSig {
_keys: [
'0x{private key}',
'0x{private key}'
]
}
caver.klay.accounts.createAccountKeyRoleBased(keyObject)
Creates an instance of
AccountKeyRoleBased
with the given keys associated with each role.Parameters
Name | Type | Description |
---|---|---|
keyObject | Object | An object with role-key pairs. A key for each role can be a private key string or an array of private key strings. |
Return Value
Example
> caver.klay.accounts.createAccountKeyRoleBased({
transactionKey: '0x{private key}',
updateKey: ['0x{private key}', '0x{private key}'],
feePayerKey: '0x{private key}'
})
AccountKeyRoleBased {
_transactionKey:
AccountKeyPublic {
_key: '0x{private key}'
},
_updateKey:
AccountKeyMultiSig {
_keys: [
'0x{private key}',
'0x{private key}'
]
},
_feePayerKey:
AccountKeyPublic {
_key: '0x{private key}'
}
}
caver.klay.accounts.accountKeyToPublicKey(accountKey)
This function converts the private key of AccountKey to public key.
Parameters
Name | Type | Description |
---|---|---|
accountKey | String | Array | Object | An AccountKey instance ( AccountKeyPublic , AccountKeyMultiSig or AccountKeyRoleBased ) or a data structure that contains the key info (a private key string, an array of private key strings or an object that defines the key for each role). |
Return Value
Type | Description |
---|---|
String | Array | Object | If the parameter is an AccountKeyPublic instance or a private key string, a public key string is returned. If the parameter is an AccountKeyMultiSig instance or an array of private key strings, an array of public-key strings is returned. If the parameter is an AccountKeyRoleBased instance or an object defining a key (a private key string or an array of private key strings) for each role, an object with role and public-key (a public-key string or an array of public-key strings) pairs is returned. |
Example
// Convert a private key string
> caver.klay.accounts.accountKeyToPublicKey('0x{private key}')
'0x67f20d1198abcdc036a4d8f3ea0cf837527716c90f71d0b0410dfe3e1b405eded9ea818eedd5e8ad79658b2cdf4862ab0956a6f7fd0a4886afe6110b2e9803a4'
// Convert an array of private key strings
> caver.klay.accounts.accountKeyToPublicKey(['0x{private key}', '0x{private key}'])
[
'0x67f20d1198abcdc036a4d8f3ea0cf837527716c90f71d0b0410dfe3e1b405eded9ea818eedd5e8ad79658b2cdf4862ab0956a6f7fd0a4886afe6110b2e9803a4',
'0x7c5415f99628618b3fe78e14606c83a22488769b3361e3758c7c98a204a23b615cf07af65490895d70a7b7e7e885fc2f597d65ea69ed586c7ae7cb0241656036'
]
// Convert a role-based key
> caver.klay.accounts.accountKeyToPublicKey({transactionKey: ['0x{private key}', '0x{private key}'], updateKey: '0x{private key}', feePayerKey: ['0x{private key}', '0x{private key}']})
{
transactionKey: [
'0x67f20d1198abcdc036a4d8f3ea0cf837527716c90f71d0b0410dfe3e1b405eded9ea818eedd5e8ad79658b2cdf4862ab0956a6f7fd0a4886afe6110b2e9803a4',
'0x7c5415f99628618b3fe78e14606c83a22488769b3361e3758c7c98a204a23b615cf07af65490895d70a7b7e7e885fc2f597d65ea69ed586c7ae7cb0241656036'
],
updateKey: '0x21aa42e0232e6c7607a0028bcbd690400b92574c44b17af8b036f3f4f01b0586f90578976a040debf6aecef4a5d00b5315b8c82e999ed8e5fbacd5fcbee82080',
feePayerKey: [
'0xb82bb74e902b1fa3594c7cc8bd33a727eb1c85a9bfc991327a0215fc413eafe0b3723cc7f3c6e79981b409e82b8bf7033fed2d2878c26502bea64f84d592b167',
'0x39acd887f32ccecd1b13c890854d2dfd0016f0be477155d81a848e971ff59412b0e4c0b5bfc1fd548b971f98cd9ef19367309d0475033fda3c8028ba9df27734'
]
}
caver.klay.accounts.privateKeyToAccount(privateKey)
Creates an account object from a private key.
Parameters
Name | Type | Description |
---|---|---|
privateKey | string | The private key to convert. |
Return Value
Object
- The account objectExample
> caver.klay.accounts.privateKeyToAccount('0x{private key}');
{
address: '0x62ca8964610a9d447e1a64753a09fc8b3d40b405',
privateKey: '0x{private key}',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt],
getKlaytnWalletKey: [Function: getKlaytnWalletKey]
}
caver.klay.accounts.privateKeyToPublicKey(privateKey)
Gets public key from a given private key
Parameters
Name | Type | Description |
---|---|---|
privateKey | string | The private key to convert. |
Return Value
String
- The public key (64 bytes)Example
> caver.klay.accounts.privateKeyToPublicKey('0x{private key}')
'0xbb1846722a4c27e71196e1a44611ee7174276a6c51c4830fb810cac64b0725f217cb8783625a809d1303adeeec2cf036ab74098a77a6b7f1003486e173b29aa7'
caver.klay.accounts.createAccountForUpdate(address, accountKey, options)
Creates an instance of
AccountForUpdate
. AccountForUpdate contains the address of the account and the new public key to update.AccountForUpdate
can be used in the account update transaction object (ACCOUNT_UPDATE
, FEE_DELEGATED_ACCOUNT_UPDATE
, or FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO
) as a key
. If you want to know how to use AccountForUpdate
in the transaction, see Account update with AccountForUpdate.The accountKey parameter of caver.klay.accounts.createAccountForUpdate must be a private key.
You can create an AccountForUpdate instance using the public key with caver.klay.accounts.createAccountForUpdateWithPublicKey.
You can also use caver.klay.accounts.createAccountForUpdateWithLegacyKey to create an AccountForUpdate instance for updating to AccountKeyLegacy, and caver.klay.accounts.createAccountForUpdateWithFailKey to create an AccountForUpdate instance for updating to AccountKeyFail.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
accountKey | String | Array | Object | AccountKey instance ( AccountKeyPublic , AccountKeyMultiSig or AccountKeyRoleBased ) or the equivalent key info (a private key string, an array of private key strings or an object defining key(s) with role(s)). If accountKey is not an AccountKey instance, this method internally calls caver.klay.accounts.createAccountKey to create an AccountKey instance from the given key info. |
options | Object | An optional object containing the threshold and weight. This is required when using AccountKeyMultiSig. The usage is shown in the example below. |
Return Value
Object
- An AccountForUpdate instance is returned, with the following properties:Name | Type | Description |
---|---|---|
address | String | Address of the account to be updated. |
keyForUpdate | Object | An object containing the new public key derived from the given accountKey. |
Example
// Create AccountForUpdate for AccountKeyPublic
> caver.klay.accounts.createAccountForUpdate('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', '0x{private key}')
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
publicKey: '0x24c32ee4f908ceed89e7501de2980fcb1d2add69080d3921f86c49de863eb2d507e24d9aaf91328b7f7cef2a94b538cb33b3f8cdd64925855ce0a4bf6e11f3db'
}
}
// Create AccountForUpdate for AccountKeyMultiSig with an options object
> caver.klay.accounts.createAccountForUpdate('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', ['0x{private key}', '0x{private key}'], { threshold: 2, weight: [1,1] })
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
multisig: {
threshold: 2,
keys: [
{
weight: 1,
publicKey: '0xc89f551ce9c569cf978f4f64833e447f177a83eda4f1883d770360ab35002dbdeb2d502cd33217238add013ea1c4ff5055ceda46473569824e336d0d64e9eeb2'
},
{
weight: 1,
publicKey: '0xab0837fa3d61cf33dc4f3af4aca692d8c939566e1abbca0036fa3b29cd55b38a387f73baf59510d96680062bd129dd2bb8dcbb5ea5ed16c881f83a3251f73600'
}
]
}
}
}
// Create AccountForUpdate for AccountKeyRoleBased with an options object
> caver.klay.accounts.createAccountForUpdate('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', { transactionKey: '0x{private key}', updateKey: ['0x{private key}', '0x{private key}'], feePayerKey: '0x{private key}' }, { updateKey: { threshold: 2, weight: [1,1] } })
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
roleTransactionKey: {
publicKey: '0x2b4a1d4ca1ee828f17e8c4c0ac0c0c46cf08f4b27fafc01e4b3481a4fe0891cacf315ed10b1df85bfd6797ea6c5ebafac437a7564eff355b11ad1e3d6e6c43a7'
},
roleAccountUpdateKey: {
multisig: {
threshold: 2,
keys: [
{
weight: 1,
publicKey: '0x26156615c8e503d96cd332a2fba6aab88b6156b983c89f586bcfc0443c0a7f2372d892d73c66d30f726f8269c75920a082eb2e57f6662d855389bb922ee263f3'
},
{
weight: 1,
publicKey: '0xafc139d2bcace02fa3d4b12926f976cf672f35a6ea2bc0f7e2e6d2ada0dd28f672acb8dcaedc694d6134a2f6c4aae472c9d67d30f760e16e742e01758c4daf83'
}
]
}
},
roleFeePayerKey: {
publicKey: '0xe55d39e147a0d5542d4bb965aeaa01e918c81a332ce47e0d3173179fe5b68c8c9264bec516d50bea0a7da7c3d8f98e124761a9b27434221d138ff8e22d932a0a'
}
}
}
// Create AccountForUpdate for AccountKeyRoleBased with legacy key or fail key
// When updating the key used for a specific role in AccountKeyRoleBased to AccountKeyLegacy or AccountKeyFailKey, define the role to update as follows.
> caver.klay.accounts.createAccountForUpdate('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', { transactionKey: 'legacyKey', updateKey: 'failKey' })
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
roleTransactionKey: { legacyKey: true },
roleAccountUpdateKey: { failKey: true }
}
}
caver.klay.accounts.createAccountForUpdateWithPublicKey(address, keyForUpdate, options)
Creates an instance of
AccountForUpdate
with the public key of the new key to update.AccountForUpdate
can be used in the account update transaction object (ACCOUNT_UPDATE
, FEE_DELEGATED_ACCOUNT_UPDATE
, or FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO
) as a key
. If you want to know how to use AccountForUpdate
in the transaction, see Account update with AccountForUpdate.Parameters
Name | Type | Description |
---|---|---|
address | String | Address of an Account. |
keyForUpdate | String | Array | Object | The public-key of the new key to update. This value is a single public-key string when the key is AccountKeyPublic, an array of public-key strings when AccountKeyMultiSig, an object when the key is AccountKeyRoleBased. |
options | Object | An optional object containing the threshold and weight. This is required when using AccountKeyMultiSig. If you use AccountkeyMultiSig as one of the keys in AccountKeyRoleBased, specify the role of the threshold and weight. The usage is shown in the example below. |
Return Value
Example
// Create AccountForUpdate for AccountKeyPublic
> caver.klay.accounts.createAccountForUpdateWithPublicKey('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', '0x24c32ee4f908ceed89e7501de2980fcb1d2add69080d3921f86c49de863eb2d507e24d9aaf91328b7f7cef2a94b538cb33b3f8cdd64925855ce0a4bf6e11f3db')
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
publicKey: '0x24c32ee4f908ceed89e7501de2980fcb1d2add69080d3921f86c49de863eb2d507e24d9aaf91328b7f7cef2a94b538cb33b3f8cdd64925855ce0a4bf6e11f3db'
}
}
// Create AccountForUpdate for AccountKeyMultiSig with an options object
> caver.klay.accounts.createAccountForUpdateWithPublicKey('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', ['0xc89f551ce9c569cf978f4f64833e447f177a83eda4f1883d770360ab35002dbdeb2d502cd33217238add013ea1c4ff5055ceda46473569824e336d0d64e9eeb2', '0xab0837fa3d61cf33dc4f3af4aca692d8c939566e1abbca0036fa3b29cd55b38a387f73baf59510d96680062bd129dd2bb8dcbb5ea5ed16c881f83a3251f73600'], { threshold: 2, weight: [1,1] })
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
multisig: {
threshold: 2,
keys: [
{
weight: 1,
publicKey: '0xc89f551ce9c569cf978f4f64833e447f177a83eda4f1883d770360ab35002dbdeb2d502cd33217238add013ea1c4ff5055ceda46473569824e336d0d64e9eeb2'
},
{
weight: 1,
publicKey: '0xab0837fa3d61cf33dc4f3af4aca692d8c939566e1abbca0036fa3b29cd55b38a387f73baf59510d96680062bd129dd2bb8dcbb5ea5ed16c881f83a3251f73600'
}
]
}
}
}
// Create AccountForUpdate for AccountKeyRoleBased with an options object
> caver.klay.accounts.createAccountForUpdateWithPublicKey('0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef', { transactionKey: '0x2b4a1d4ca1ee828f17e8c4c0ac0c0c46cf08f4b27fafc01e4b3481a4fe0891cacf315ed10b1df85bfd6797ea6c5ebafac437a7564eff355b11ad1e3d6e6c43a7', updateKey: ['0x26156615c8e503d96cd332a2fba6aab88b6156b983c89f586bcfc0443c0a7f2372d892d73c66d30f726f8269c75920a082eb2e57f6662d855389bb922ee263f3', '0xafc139d2bcace02fa3d4b12926f976cf672f35a6ea2bc0f7e2e6d2ada0dd28f672acb8dcaedc694d6134a2f6c4aae472c9d67d30f760e16e742e01758c4daf83'], feePayerKey: '0xe55d39e147a0d5542d4bb965aeaa01e918c81a332ce47e0d3173179fe5b68c8c9264bec516d50bea0a7da7c3d8f98e124761a9b27434221d138ff8e22d932a0a' }, { updateKey: { threshold: 2, weight: [1,1] } })
AccountForUpdate {
address: '0x5B4EF8e2417DdE1b9B80BcfC35d1bfeF3D7234ef',
keyForUpdate: {
roleTransactionKey: {
publicKey: '0x2b4a1d4ca1ee828f17e8c4c0ac0c0c46cf08f4b27fafc01e4b3481a4fe0891cacf315ed10b1df85bfd6797ea6c5ebafac437a7564eff355b11ad1e3d6e6c43a7'
},
roleAccountUpdateKey: {
multisig: {
threshold: 2,
keys: [
{
weight: 1