Personal
The page describes the APIs and console methods for managing accounts.
Load an existing or imported account as the console default account. The loaded account will be used to sign transactions. If the passphrase is not provided as a argument, an interactive session is started to collect your passphrase in a way that does not reveal it as you type.
Parameters
Argument | Type | Required | Description |
address | String | True | The address of the account. |
passphrase | String | False | The passphrase of the account. (not recommended, use interactive mode) |
> personal.loadAccount("e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx", "my passphrase")
Get the loaded account.
Parameters: None
> personal.loadedAccount()
String
- The address of the loaded account."e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"
Create an account. If the passphrase is not provided as a argument, an interactive session is started to collect your passphrase in a way that does not reveal it as you type.
Parameters
Argument | Type | Required | Description |
passphrase | String | False | The passphrase of the account. (not recommended, use interactive mode) |
> personal.createAccount("my passphrase")
String
- The address of the new account."e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"
Import a private key. Creates an account from a private key.
Parameters
Argument | Type | Required | Description |
privateKey | String | True | A private key. |
passphrase | String | False | The passphrase of the account. (not recommended, use interactive mode) |
> personal.importAccount("wL3gTWrJ2iZYcRNfodBL92...c6NXaD4n5LfNLPZooW", "my passphrase")
String
- The address of the newly imported account."e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"
List all accounts that exist on the node. It the console is attached to a remote node, it will return the addresses of accounts on the node and not those on the attaching node. Accounts are stored in
DATA_DIR/accounts
. Parameters: None
Curl Example:
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_listAccounts", "id":21}'
> personal.listAccounts()
Array<String>
- A list of addresses.{
"id": 21,
"jsonrpc": "2.0",
"result": [
"eKkFDxaWMMUS2XQauugzAWGXBimnkQZfXt",
"e9JQY3HYjF74Pdp2rnHf1pamJJAtkWKjF9"
]
}
List all accounts that exist locally on the node. It the console is attached to a remote node, it will return the addresses of accounts on the attaching node. Accounts are stored in
DATA_DIR/accounts
.Parameters: None
> personal.listLocalAccounts()
Array<String>
- A list of addresses.{
"id": 21,
"jsonrpc": "2.0",
"result": [
"eKkFDxaWMMUS2XQauugzAWGXBimnkQZfXt",
"e9JQY3HYjF74Pdp2rnHf1pamJJAtkWKjF9"
]
}
Last modified 4yr ago