I'm running an RSK node and I'm trying to send a transaction using personal_sendTransaction
but I get this error:
The local wallet feature is disabled
How can I fix this? thanks in advance
You are trying to use personal
module
and this feature implies importing your account to the node.
In the other answer,
the account is imported into the node by adding
the public key and private key in plain text within
RSKj config file, and this is insecure,
as obtaining access to the file system is enough
to compromise your private key.
Thus this approach should probably be only used for convenience,
and on Testnet or Regtest only -
not for any accounts on Mainnet.
An alternative approach is with the personal
module enabled,
to use the personal_importRawKey
RPC to add new accounts.
This way is a bit more secure because the passphrase
is not persisted to the file system.
Even if the machine running the node is compromised, and the attacker can read the config file, your private keys would therefore not be compromised as a result.
The full steps are detailed below:
(1) Enable thepersonal
module (enabled by default):
rpc {
modules = [
...,
{
name: "personal",
version: "1.0",
enabled: "true"
},
...
]
}
(2) Call the personal_importRawKey
RPC
to add new accounts:
curl \
-X POST \
--data '{"jsonrpc":"2.0","method":"personal_importRawKey","params":["YOUR_RAW_KEY", "YOUR_PASSPHRASE"],"id":1}' \
--header "Content-Type:application/json" \
http://localhost:4444/
(3) Prior to signing transactions using this account,
you will need to call the personal_unlockAccount
for the account that you just created.
Note that DURATION
is optional,
and defaults to 300
(5 minutes).
curl \
-X POST \
--data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["YOUR_ACCOUNT_ADDRESS", "YOUR_PASSPHRASE", DURATION],"id":1}' \
--header "Content-Type:application/json" \
http://localhost:4444/
You are trying to use personal
module
and this feature implies importing your account to the node
NOTE: For security reasons, this approach is not recommended, however, it is possible to do.
In order to do this,
you need to configure your node for this in the RSKj config file.
This should be main.conf
for RSK Mainnet:
(1) Enable thepersonal
module (enabled by default):
rpc {
modules = [
...,
{
name: "personal",
version: "1.0",
enabled: "true"
},
...
]
}
(2) Enable wallet
and add your account:
wallet {
enabled = true
accounts = [
{
"publicKey" : "<PUBLIC_KEY>"
"privateKey" : "<PRIVATE_KEY>"
}
]
}
After this, you will be able to use all of the following RPC methods:
personal_sendTransaction
personal_importRawKey
personal_listAccounts
personal_lockAccount
personal_newAccount
personal_unlockAccount
Example:
curl \
-X POST \
--data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["password"],"id":1}' \
--header "Content-Type:application/json" \
http://localhost:4444
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With