Skip to content

BTC SBTC conversion

Meri Herrera edited this page Jul 17, 2018 · 14 revisions

Summary

This document describes the 2-way peg mechanism. This is for converting BTC to SBTC to use within the RSK Blockchain and for transfering your SBTC balance back to the BTC network.

Requirements

  • You need to be in full control of your private key
  • You need a BTC Wallet properly configured using the previously mentioned private key
  • 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?)
  • You need to be whitelisted in the RSK network (what's to be whitelisted?)

Sending money from BTC to SBTC

IMPORTANT the minimum amount to send is 0.01 BTC

  1. Send a BTC transaction to the Federation Address (check Notes #1).
  2. Obtain the BTC transaction hash ID
  3. Open your preferred BTC block explorer (i.e. Blocktrail)
  4. Search for your BTC transaction (check Notes #2)
  5. You have to wait a minimum of 100 confirmations plus a minimum of 5 minutes for checking your SBTC balance

Checking your SBTC balance

  1. Convert the private key to RSK format using https://utils.rsk.co (this can be run offline), write down your RSK address
  2. Execute this command (check Notes #3)
  $ curl -X POST --data '{"method":"eth_getBalance", "params":["<RSKAddress>"], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>

Returning your balance from SBTC to BTC

  1. Convert the private key to RSK format using https://utils.rsk.co (this can be run offline), you'll obtain a derived RSK private key and your RSK address
  2. Add your obtained RSK private key to your RSK node:
  $ curl -X POST --data '{"method":"personal_importRawKey", "params":["<RSKConvertedPrivateKey>", "<passPhraseToEncryptPrivKey>"], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Unlock your account for transfers:
  $ curl -X POST --data '{"method":"personal_unlockAccount", "params":["<RSKAddress>", "<passPhraseJustUsedToEncryptPrivKey>", ""], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Transfer your desired amount
  $ curl -X POST --data '{"method":"eth_sendTransaction", "params":[{"from": "<RSKAddress>", "to": "0x0000000000000000000000000000000001000006", "gasPrice": 183000000, "gas": 100000, "value": <valueToReleaseInWeis>}], "jsonrpc":"2.0", "id":1}' http://<RSKNode>:<RSKNodePort>
  1. Wait 4000 RSK confirmations and then wait at least 10 more minutes for your funds to arrive to your BTC address.

Notes

  1. You can get the Federation Address invoking getFederationAddress method of the bridge contract at address: 0x0000000000000000000000000000000001000006 (for both: testnet and mainnet).
  2. Check that the first input should spend a P2PKH (pay to public key hash) output.
  3. Rsk addresses must start with 0x
Clone this wiki locally