Skip to content

Get an RSK account

Meri Herrera edited this page Jun 14, 2018 · 13 revisions

In this article there are explained some ways to get an RSK address:

After getting your account maybe you want to add it to your node for testing purposes.

Using Jaxx

Jaxx is a wallet that supports RSK and many other cryptocurrencies.

If you don't have Jaxx:

  1. Download the app on any device.
  2. 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!
  3. Choose RSK MainNet and/or RSK TestNet options.
  4. Follow the instructions.

If you already have Jaxx:

You can just add RSK MainNet and/or RSK TestNet options using the wallets menu.

Using the node

To use this option, you need the Fat JAR or Uber JAR. It can be downloaded or compiled (in a reproducible way or not). You also need Java 8 JDK. Then, type this command on terminal:

$ java -cp <PATH-TO-THE-RSKJ-FATJAR> co.rsk.GenNodeKeyId
  • Replace <PATH-TO-THE-RSKJ-FATJAR> with your path to the jar file. As an example: C:/RskjCode/rskj-core-0.4.3-BAMBOO-all.jar

It creates an unique identifier for the node and generates a valid key to be used.

Using RPC

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:

Using RSK console

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!

Using JSON RPC

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
Clone this wiki locally