Personal

The page describes the APIs and console methods for managing accounts.

personal.loadAccount

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)

Console Example

> personal.loadAccount("e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx", "my passphrase")

personal.loadedAccount

Get the loaded account.

Parameters: None

Console Example

> personal.loadedAccount()

Returns:

String - The address of the loaded account.

Output:

"e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"

personal.createAccount

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)

Console Example

> personal.createAccount("my passphrase")

Returns:

String - The address of the new account.

Output:

"e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"

personal.importAccount

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)

Console Example

> personal.importAccount("wL3gTWrJ2iZYcRNfodBL92...c6NXaD4n5LfNLPZooW", "my passphrase")

Returns:

String - The address of the newly imported account.

Output:

"e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx"

personal_listAccounts

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}'

Console Example

> personal.listAccounts()

Returns:

Array<String> - A list of addresses.

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": [
    "eKkFDxaWMMUS2XQauugzAWGXBimnkQZfXt",
    "e9JQY3HYjF74Pdp2rnHf1pamJJAtkWKjF9"
  ]
}

personal.listLocalAccounts

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

Console Example

> personal.listLocalAccounts()

Returns:

Array<String> - A list of addresses.

Output:

{
  "id": 21,
  "jsonrpc": "2.0",
  "result": [
    "eKkFDxaWMMUS2XQauugzAWGXBimnkQZfXt",
    "e9JQY3HYjF74Pdp2rnHf1pamJJAtkWKjF9"
  ]
}

Last updated