As Defiant is a self-custodial wallet, you have control of your keys at all time. This means that whenever you want, you can take those keys and import them in any wallet or app you might like. This process can sometimes be complex or vary from wallet to wallet, so we thought we’d write a post explaining how to export and import Defiant’s keys to and from a few of the most common and compatible wallets out there. But first of all, tables, because everybody loves tables.
With MetaMask logged out tap on ‘Import using a seed phrase’
Enter the seeds, enter a password and tap on restore
As MetaMask does not follow the BIP-44 which defines coin types that allow to derive different addresses depending on the blockchain being used, no matter which network you connect to, you will always see the same address and, as Defiant does follow the BIP-44, the only address that will match will be the Ethereum mainnet one.
In order to solve this, the best way to use Defiant’s different addresses on MetaMask is to import accounts with the private keys rather than the seeds.
With NiftyWallet logged out tap on ‘Restore from seed phrase’
Enter the seeds, enter a password and tap on ‘Ok’
Although NiftyWallet was originaly created using MetaMask’s base code, Nifty does follow the BIP-44 which means that with just importing the 12 words it will correctly deduce the addressess of both ETH and RSK networks in mainnet and testnet exactly as they are shown in Defiant.
But we can also import a private key to use a specific address in any blochchain so:
Choose the corresponding option There are a few options, and also if you choose the last one, you can enter a custom derivation path. In most cases (TrustWallet, NiftyWallet, etc.) you can leave the default option and the importing will work just fine. If it’s not a common case, choose the one that best fits your needs.
Tap outside of the bottom sheet, enter the seeds, choose the coins and tap on continue.
Go to your newly created wallet
Tap on a coin which address you want to verify (say RBTC)
Tap on receive
Check the address against the one from the original wallet
When Defiant first started it was just an app for P2P trading. After a short while in the streets, we realised that, to be competitive, we needed to add wallet functionalities to the app.
In doing so, we had to decide which blockchains would be added, and apart from Bitcoin and Ethereum, we went all in with RSK, a side chain of Bitcoin with all the power of Smart Contracts.
RSK’s strength came from joining the programability of smart contracts with the security of Bitcoin. That last part due to the fact that for every one RBTC (RSK’s base coin) in the RSK system, there was exactly one BTC locked. This ensures that the RBTC price is pegged to the BTC price, and that the whole blockchain is backed by those locked BTCs.
There has been a number of ways a user that has BTC can “change” it for RBTC, CoinSwitch, Kucoin, Bitfinex, etc. When we started, we decided CoinSwitch was the simplest way for us to provide a simple and clean way for our users to change their BTCs for RBTCs, and so we leveraged their API and the solution holded up for a few good months.
CoinSwitch gave us what we needed at the time, but there were a few things that didn’t click with us. The fees weren’t always grateful, operations could take hours (sometimes up to a day) to complete and primarily, CoinSwitch is centralized which means there is people in between and that we really didn’t like…
When, last month, CoinSwitch stopped giving liquidity to all RSK pairs (BTC-RBTC and BTC-DOC) we decided it was time we pointed in a new direction…
Apart from the solutions mentioned above, there has always been a clean and simple way to go from BTC to RBTC (and viceversa), the native way, the Powpeg (formerly Two Way Peg). This is the system that gives RSK its liquidity, the mechanism with which for an RBTC to be released into the system, a BTC has to be locked.
How does it work?
There are two players in this game, a Federation Address and a Bridge.
The federation address is a Bitcoin address that holds the BTCs for locking.
The bridge is a pre-compiled smart contract that lives inside the RSK network and manages the RBTC that is released into the system.
This is the “tricky” part of the process. In order for the Peg-In and Peg-Out to work correctly, at the moment (there are changes being developed), the address that sends the funds from the BTC side has to be a Legacy one and there has to be a correlation between that address and the address that receives the RBTC on the other side. This relation is the following: the derivation path that generated the address on the BTC side needs to be the same to generate the RBTC address. The only way the bridge can know to which address the RBTCs should be sent (when pegging in) is by respecting the derivation path.
An example (with derivation paths)
The derivation path is what “describes” the way a blockchain address should be constructed. The BIP-44 explains this in more detail.
Imagine I have a 12 word seed phrase (never use this seed phrase):
We wanted to make it extremely easy for our users to change BTC for RBTC (and viceversa), so we adjusted our wallet to integrate “seamlessly” with the great system that RSK had developed.
Setting up tester mode (this post section will desapear in a few days)
The Powpeg is curently being tested, so, to enable it, there are a few steps required.
Go to the drawer menu
Scroll to the bottom of the drawer
Tap rapidly 7 times on the version of the app (pretty cool right?)
Go to settings, you will see a new item ‘Tester settings’
Tap on it
In the next page, enable the Powpeg
Setting up the wallet
As described above, there is a relation between your BTC address and your RBTC address when using the Powpeg, so you can’t use a regular wallet generated in Defiant, but despair not! We got you covered. With a regular wallet follow these steps. Note: The whole process will be shown on testnet, but doing it on mainnet is exactly the same. In fact, you can try doing it in testnet first to be sure and then mainnet 😉😉
From your wallet’s dashboard, go to “change”
Select BTC and RBTC and press continue
A message will show up explaining that this wallet is not correclty configured for the Powpeg (we wanted this to happen)
Let’s tap on “create”. This will create a new wallet using the same seed pharase and coins but using the First BTC Legacy External derivation path to generate the RSK address (m/44’/0’/0’/0/0 for mainnet and m/44’/1’/0’/0/0 for testnet)
Wait for the wallet to finish creating
When it finishes, we have 2 wallets, the original one and the new ‘PEG’ one
Change BTC for RBTC (PegIn)
With a wallet correctly configured we’ll make the change
Go to the PEG wallet (created above)
Tap on change
Choose BTC and RBTC and tap on continue
Enter the amount you want to change (we will use the minimum here) and tap on continue
Verify the information and scroll to the bottom of the page
Take a look at the warning “THIS WILL TAKE A FEW HOURS” and, when ready, tap on continue
Enter your PIN
When the operation gets dispatched, you’ll be redirected to the “done” page. Tap on the arrow to continue
You just changed BTC for RBTC using the Powpeg. Have a party with friends 🥳🥳🥳
Change RBTC for BTC (PegOut)
To change RBTC for BTC the process is exactly the same. The minimum changes a little and the time for completion is different, but all in all, it’s the same. Just change the origin coin and the destination coin.
How to see the progress of the swap?
As these changes take a long time to finish, we wanted to make it simple for users to check how it’s going so:
Go to the History section
Scroll to the right until you reach the Powpeg history section and tap on it
A list of your Powpeg operations will be shown
Tap on the operation you just made
The “show history operation” is shown
Scroll to the bottom
A progress bar is shown with the current state of the operation
As confirmations/blocks pass by, the bar will fill up until it reaches 100%. At this point, you should have received your BTCs (or RBTCs if you were changing the other way around).
You can also tap on the “receiver” address and see if you received the changed amount in the explorer.
Notes and “caveats”
As mentioned above, the BTC address that does the PegIn needs to be Legacy. If you know how Bitcoin UTXOs work, you should ask “but, if I send using more than one UTXO and mix addresses up?”
Great question! Yes, the BTC you send can come from multiple UTXOs that are from different addresses and can be Legacy, Segwit, Segwit Compatible, etc. In fact, we (Defiant) do this…
The first address in the inputs HAS TO BE A LEGACY ONE
Meaning that that address has to have some BTC, maybe not all the amount you are trying to swap, but it has to have some BTC.
If you don’t do this and the first address is not Legacy… You’ll lose your funds.
Note: Soon you’ll be able to choose the RBTC reception address, but as of right now, you cannot.
These changes take time, from 17 hours to 34 hours depending on the direction of the change. At the moment, this will not be changing in a near future as it is a security measure.
The minimums are high, we know it. Sadly, it’s not in our control how that is managed. We’ll probably have a solution for smaller amounts soon (stay tuned).
Note: Soon the minimum amounts will be lowered, but as of right now, they are what they are.