personal
The JSON-RPC API's personal namespace has historically been used to manage accounts and sign transactions and data over RPC. However, it has now been deprecated in favour of using Clef as an external signer and account manager. One of the major changes is moving away from indiscriminate locking and unlocking of accounts and instead using Clef to explicitly approve or deny specific actions. The first section on this page shows the suggested replacement for each method in personal. The second section shows the deprecated methods for archival purposes.
Method replacements
The following list shows each method from the personal namespace and the intended method in Clef that supercedes it.
personal_listAccounts
personal_listAccounts displays the addresses of all accounts in the keystore. It is identical to eth.accounts. Calling eth.accounts requires manual approval in Clef (unless a rule for it has been attested). There is also Clef's list-accounts command that can be called from the terminal.
Examples:
personal_deriveAccount
personal_deriveAccount requests a hardware wallet to derive a new account, optionally pinning it for later use. This method is identical to clef_deriveAccount. The Clef method is not externally exposed so it must be called via a UI.
personal.ecRecover
personal_ecRecover returns the address for the account that was used to create a signature. An equivalent method, account_ecRecover is available on the Clef external API.
Example call:
personal_importRawKey
personal.importRawKey was used to create a new account in the keystore from a raw private key. Clef has an equivalent method that can be invoked in the terminal using:
personal_listWallets
As opposed to listAccounts, this method lists full details, including usb path or keystore-file paths. The equivalent method is clef_listWallets. This method can be called from the terminal using:
personal_newAccount
personal_newAccount was used to create a new accoutn and save it in the keystore. Clef has an equivalent method, account_new. It can be accessed on the terminal using an http request or using a Clef command:
Example call (curl):
Example call (Clef command):
Both require manual approval in Clef unless a custom ruleset is in place.
personal_openWallet
personal_OpenWallet initiates a hardware wallet opening procedure by establishing a USB connection and then attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge). personal_openWallet is identical to clef_openWallet. The Clef method is not externally eposed, meaning it must be called via a UI.
personal_sendTransaction
personal_sendTransaction ws used to sign and submit a transaction. This can be done using eth_sendTransaction, requiring manual approval in Clef.
Example call (Javascript console):
Example call (terminal)
personal_sign
The sign method calculates an Ethereum specific signature with sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)). Adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
personal.sign is equivalent to Clef's account_signData. It returns the calculated signature.
Example call:
Clef also has account_signTypedData that signs data structured according to EIP-712 and returns the signature.
Example call (use the following as a template for <data> in curl --data <data> -X POST localhost:8550 -H "Content-Type: application/json")
personal_signTransaction
personal_signTransaction was used to create and sign a transaction from the given arguments. The transaction was returned in RLP-form, not broadcast to other nodes. The equivalent method is Clef's account_signTransaction from the external API. The arguments are a transaction object ({"from": , "to": , "gas": , "maxPriorityFeePerGas": , "MaxFeePerGas": , "value": , "data": , "nonce": })) and an optional method signature that enables Clef to decode the calldata and show the user the methods, arguments and values being sent.
Example call (terminal):
Methods without replacements
Thjere are a few methods that were available in the personal namepsace that have been deprecated without replacements. These are:
personal_unlockAccount
There is no need for a direct replacement for personal_unlockAccount. Using Clef to manually approve actions or to attest custom rulesets is a much more secure way to interact with accounts without needing to indiscriminately unlock accounts.
personal_lockAccount
There is no need for a direct replacement for personal_lockAccount because account locking/unlocking is replaced by Clef's approve/deny logic. This is a more secure way to interact with accounts.
personal.unpair
Unpair deletes a pairing between some specific types of smartcard wallet and Etn-sc. There is not yet an equivalent method in Clef.
personal_initializeWallet
InitializeWallet is for initializing some specific types of smartcard wallet at a provided URL. There is not yet a corresponding method in Clef.
Deprecated method documentation
The personal API managed private keys in the key store. It is now deprecated in favour of using Clef for interacting with accounts. The following documentation should be treated as archive information and users should migrate to using Clef for account interactions.
personal_deriveAccount
Requests a HD wallet to derive a new account, optionally pinning it for later reuse.
personal_importRawKey
Imports the given unencrypted private key (hex string) into the key store, encrypting it with the passphrase.
Returns the address of the new account.
personal_initializeWallets
Initializes a new wallet at the provided URL by generating and returning a new private key.
personal_listAccounts
Returns all the Ethereum account addresses of all keys in the key store.
Example
personal_listWallets
Returns a list of wallets this node manages.
Example
personal_lockAccount
Removes the private key with given address from memory. The account can no longer be used to send transactions.
personal_newAccount
Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account. At the etn-sc console, newAccount will prompt for a passphrase when it is not supplied as the argument.
Example
The passphrase can also be supplied as a string.
personal_openWallet
Initiates a hardware wallet opening procedure by establishing a USB connection and then attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge).
personal_unlockAccount
Decrypts the key with the given address from the key store.
Both passphrase and unlock duration are optional when using the JavaScript console. If the passphrase is not supplied as an argument, the console will prompt for the passphrase interactively. The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until etn-sc exits.
The account can be used with eth_sign and eth_sendTransaction while it is unlocked.
Examples
Supplying the passphrase and unlock duration as arguments:
To type in the passphrase and still override the default unlock duration, pass null as the passphrase.
personal_unpair
Deletes a pairing between wallet and Etn-sc.
personal_sendTransaction
Validate the given passphrase and submit transaction.
The transaction is the same argument as for eth_sendTransaction (i.e. transaction object) and contains the from address. If the passphrase can be used to decrypt the private key belogging to tx.from the transaction is verified, signed and send onto the network. The account is not unlocked globally in the node and cannot be used in other RPC calls.
Examples
personal_sign
The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)).
By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
See ecRecover to verify the signature.
Examples
personal_signTransaction
SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with tx.from. If the given passwd isn't able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast to other nodes. The first argument is a transaction object and the second argument is the password, similar to personal_sendTransaction.
personal_ecRecover
ecRecover returns the address associated with the private key that was used to calculate the signature in personal_sign.
Examples
Last updated