Bitcoin Integration
Finn Exchange has integrated with Provable.xyz's (the same company providing the Oracle services) new service called pTokens that offers a trustworthy way to move Bitcoin to the Ethereum blockchain and back.
How does it work?
Provable is running a TEE (Trusted Execution Environment), or in other words a blackbox machine that is preprogrammed to act in a certain way and has no access to it from external parties. This machine once started generates private keys for two blockchains (Bitcoin and Ethereum), no-one has access to the private keys, just the TEE.
The TEE can be contacted to request a BTC deposit address that would be linked to an Etheruem address. Every time a user sends BTC to the BTC deposit address, the TEE mints an equal amount of pBTC (a ERC777 Ethereum Token which is pegged 1:1 with Bitcoin, 1 pBTC = 1 BTC) and sends the newly minted pBTC tokens to the Ethereum address specified when requesting the BTC address.
At anytime, a user can redeem his/her pBTC into BTC by calling the redeem() method on the pBTC contract.
Why this approach is superior to other BTC pegged tokens?
pBTC is a direct representation of Bitcoin on the Ethereum blockchain. Other pegged tokens (such as WBTC) require an exchange to switch between BTC and WBTC which adds fees and spread costs. pBTC on the other hand allows switching from BTC to pBTC and the other way around without any cost and not requiring liquidity. All bitcoins sent to the TEE are converted into the exactly the same amount of pBTC minus the blockchain fees and a small fee taken by Provable for the service.
How is pBTC integrated into Finn Exchange?
Finn Exchange was designed from the get go with user experience in mind, therefore we were not satisfied with simply adding pBTC as a token. That would require users to also have ETH in order to be able to deposit funds into the Finn Exchange contract. We wanted to give our users the ability to use Bitcoin on Finn Exchange without needing to purchase any ETH (users still need an Ethereum account in order to sign orders, but no ETH is required).
In order to provide the best user experience, we have adopted the following approach:
When a user clicks on the "Deposit" button, while having BTC chosen as the margin currency. The website generates a deposit contract for the user (everything is done in the browser). This contract is specific to the user's wallet, all funds sent to it will be credited to the users' account on Finn Exchange).
The deposit contract code is as follows:
2. The deposit contract address is used when requesting the BTC address from pTokens. The BTC address received from pTokens is displayed to the user. All Bitcoins sent to the BTC address will be forwarded in pBTC token form to the user's deposit contract.
3. When the user wants to withdraw his BTC from FiNN Exchange, the redeem function is called from the Finn Exchange contract on the pBTC contract with the Bitcoin withdrawal address as argument. This redeem() call triggers the TEE to release the specified bitcoin amount to the BTC withdrawal address and burn the associated pBTC.
This approach allows for users not familiar with Ethereum to use their Bitcoins in a trustworthy way while using Finn Exchange. All the user needs to do, is send his/her bitcoins to the BTC deposit address and the Bitcoins will appear in the user's account on Finn Exchange.
The deposit processing time will be equal to: Bitcoin transaction confirmation (1 confirmation) + Ethereum transaction confirmation (1 confirmation)
Last updated