How to access native pegout funds with a private key
This guide explains how to access the Bitcoin funds received from a native pegout on Atlas Bridge when you hold the wallet's private key directly (for example a MetaMask account), rather than using a hardware wallet.
Why use a private key to access funds?
If you signed the native pegout with a wallet where you hold the private key directly, you don't need a derivation path to find your destination address. The private key itself is enough, once converted to the right format, you can import it directly into Electrum as a single address.
If instead you signed with a hardware wallet (Trezor or Ledger), use Accessing the address derived by a native pegout instead, which browses your account using the derivation path.
Prerequisites
- Wallet private key
- Electrum
- Rootstock Utils
Getting your wallet private key
Follow these steps to export your private key from your wallet.
Using MetaMask
Step 1: Open the MetaMask wallet in your browser. You can find this in your browser's extensions.
Step 2: Click the menu icon on the right.
Step 3: Choose "Account details".
Step 4: Click the "Export private key" button.
Step 5: Fill out your wallet password and click "Confirm".
Step 6: Copy the private key and click "Done".
Converting your private key to WIF
Before you can import the key into Electrum, convert it into a Wallet Import Format (WIF). A WIF private key is just another way of representing your original private key, it can always be converted back to its original format.
For more info on WIF, see the Bitcoin Wiki.
Using Rootstock Utils (Recommended)
Rootstock Utils converts keys between Bitcoin and Rootstock formats offline, without exposing your key to a website.
Step 1: Clone the Rootstock Utils project.
Step 2: Follow the steps explained in the README.
Step 3: Install webpack:
npm install webpack@4.46.0 -g
npm i webpack-cli@3.3.12 -g
npm install
webpack
[Optional] you will need npm to install webpack:
npm install --save-dev webpack
Step 4: Run webpack:
webpack
Step 5: Open the file in your browser:
./build/index.html
Step 6: In the generated application, add your private key and convert it to WIF.
Using LearnMeABitcoin
IMPORTANT: We discourage using websites on the internet for this. If your private key is exposed, your funds are also exposed. Use the offline option, Rootstock Utils, whenever possible.
Step 1: Visit https://learnmeabitcoin.com/technical/wif.
You will find Ruby code and a tool to convert the private key into a WIF.
Step 2: Paste the private key from Getting your wallet private key into the "Private Key" field.
Step 3: Choose the network: Mainnet or Testnet.
Step 4: Choose the compressed option true.
Step 5: Copy the WIF value.
IMPORTANT: Using the Ruby code directly is highly recommended over the web form. This code requires the
checksum.rbandbase58_encode.rbfunctions shown below.
Download the checksum file here.
Download the base58_encode file here.
require_relative 'checksum'
require_relative 'base58_encode'
privatekey = "<YOUR_32_BYTE_PRIVATE_KEY_HEX>"
network_prefix = "80" # Mainnet ("ef" for Testnet)
compressed_suffix = "01" # Omit for uncompressed keys
extended = network_prefix + privatekey + compressed_suffix
puts wif