-
Notifications
You must be signed in to change notification settings - Fork 266
Get an RSK account
In this article there are explained some ways to get an RSK address:
- Using MyCrypto
- Using Jaxx
- Using RPC (only for testing purposes)
After getting your account maybe you want to add it to your node for testing purposes.
Jaxx is a wallet that supports RSK and many other cryptocurrencies.
- Download the app on any device.
- If you already have an account, you can just pair/restore it with the recovery phrase. Otherwise create a new account (express or custom) and remember to write down your recovery phrase and keep it safe!
- Choose RSK MainNet and/or RSK TestNet options.
- Follow the instructions.
You can just add RSK MainNet and/or RSK TestNet options using the wallets menu.
With this approach, method personal.newAccount
will be used.
❗ It's NOT recommended to use RPC personal module on MainNet. Use it only for testing purposes (on TestNet or RegTest).
Be sure your node has enabled personal module in the config file. There are two simple ways to call RPC methods:
There's a interactive console that allows you to send commands to an RSK node, it's just a node.js application that can be downloaded from here.
From the command line, execute node console.js -server HOST:PORT
.
If everything worked as expected, you should see the RSK command prompt displayed.
Run this command with a passphrase that you choose as parameter:
RSK > web3.personal.newAccount("passphrase")
❗ Don't forget this passphrase!
This command generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Finally, it returns the address of the new account.
You can fetch the existing accounts by running any of this two commands:
RSK > web3.personal.listAccounts
RSK > web3.eth.accounts
Now, you get an RSK account ready to be used!
JSON-RPC is a remote procedure call protocol encoded in JSON. We are going to use curl to send the HTTP requests. You can use any other tools, like Postman.
Run this command with the passphrase you chose before as parameter and replace with your node URL (used http://localhost:4444
as an example):
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["password"],"id":1}' --header "Content-Type:application/json" http://localhost:4444
This command generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. It returns the address of the new account. As an example:
{"jsonrpc":"2.0","id":1,"result":"0x66248b177197a75501eb999356f811aabd37f38f"}
You can fetch the existing accounts by running any of this two commands:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}' --header "Content-Type:application/json" http://localhost:4444
curl -X POST --data '{"jsonrpc":"2.0","method":"personal_listAccounts","params":[],"id":1}' --header "Content-Type:application/json" http://localhost:4444