Skip to content

Peg using node and console

Meri Herrera edited this page Sep 12, 2018 · 5 revisions

Summary

This document explains how to try the 2-way peg mechanism using your RSK node and a command line.

General Requirements

  • You need to be in full control of your BTC private key.
  • You need a BTC Wallet properly configured using the previously mentioned private key.
  • [Only for release process] You need an RSK node up and running, with the RPC interface enabled with the personal and eth modules enabled (how do I run an RSK Node?).

From BTC to SBTC

Before start: read lock requirements

  1. With your whitelisted Bitcoin address, send a BTC transaction to the RSK Federation Address.
  2. Using your preferred BTC block explorer (i.e. Blocktrail) follow your transaction and wait the stipulated time.
  3. Convert the private key to RSK format using https://utils.rsk.co (this can be run offline), and write down your RSK account information.
  4. Then use our Testnet Explorer or Mainnet Explorer to see your SBTC balance (remember that RSK addresses must start with 0x).

From SBTC to BTC

Before start: read release requirements.

  1. Add your obtained RSK private key to your RSK node. Replace RSKConvertedPrivateKey, RSKNode and RSKNodePort and run this command:
  $ curl -X POST --data '{"method":"personal_importRawKey", "params":["<RSKConvertedPrivateKey>", "<passPhraseToEncryptPrivKey>"], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Unlock your account for transfers. Replace RSKAddress, passPhraseJustUsedToEncryptPrivKey, RSKNode and RSKNodePort and run:
  $ curl -X POST --data '{"method":"personal_unlockAccount", "params":["<RSKAddress>", "<passPhraseJustUsedToEncryptPrivKey>", ""], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Transfer your desired amount. Replace RSKAddress, valueToReleaseInWeis, RSKNode and RSKNodePort and run:
  $ curl -X POST --data '{"method":"eth_sendTransaction", "params":[{"from": "<RSKAddress>", "to": "0x0000000000000000000000000000000001000006", "gasPrice": 59240000, "gas": 44000, "value": <valueToReleaseInWeis>}], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Wait the stipulated time and check your BTC balance.
Clone this wiki locally