Sitemap
Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

Can Bitcoin Beat Ethereum in Its Own Game

DeFi and Smart Contracts on Bitcoin

9 min readNov 18, 2021

--

Created With Canva

Bitcoin was created to improve the monetary system of the world and become the most valuable, trusted, and safest store of value. As the space developed, other projects emerged such as Ethereum which introduced the concept of smart contracts, and DeFi that are now trying to revolutionize the applications on the internet and finance.

This begs the question, can digital gold become the currency of the internet? But first, let’s get a clear understanding of what DeFi and Smart Contracts are.

What is DeFi?

DeFi (short for Decentralized Finance) is an umbrella term that includes any sort of blockchain based transactions that take place without the inclusion of a middle man.

How does this happen? Well, the blockchain enables anyone with internet access to connect with a whole network of other computers across the world, all working together to verify and complete various peer-to-peer transactions. When someone in Argentina wants to send Bitcoin to a friend in Peru they can simply click a couple of buttons and complete a transaction that will be verified and pushed through by the hundreds of thousands of other computers on the network.

The DeFi world often completes tasks similar to banks such as borrowing and lending, sending money, providing insurance, and even accruing interest on your assets. The key advantage to this is that when compared to previous methods of working with money, DeFi is faster, more accessible, censorship-resistant, and provides an opportunity for anyone with an internet connection.

What are Smart Contracts?

Smart Contracts are simply coded mechanisms that can automatically execute transactions and store them on the blockchain without needing any approval from a central authority.

They are fundamental to the DeFi realm due to their endless possibility of applications. Companies often use smart contracts in “if this then that” situations. For example, a smart contract could be as simple as “if X entity completes Y task then they will receive a payout of Z tokens”.

This eliminates any sort of work or worry either end may have because the result of the transaction is automatically determined based on whether the set requirements are or are not met. In addition to efficiency, smart contracts are also extremely reliable and provide both entities with a sense of assurance. Once the smart contract has been created and agreed upon by both parties, neither of the parties can alter or back out of the transaction.

It is easy to understand that DeFi and smart contracts are among the most important capabilities of the blockchain ecosystem, but for many years the conversation has revolved around the idea that they are not possible on Bitcoin. But what if there was a way?

Enter Smart Contracts on Bitcoin

While Bitcoin’s launch set out to establish the first decentralized, digital currency built on blockchain technology, it was not designed as a platform that anticipated the endless applications and possibilities within the blockchain ecosystem. This is due to the non-Turing complete nature of Bitcoin which does not support smart contracts natively. The Ethereum network enabled smart contracts to exist and therefore the emergence of DeFi powered by their native currency Ether (ETH).

Ethereum has been the go-to spot for many DeFi applications for years, but there has been an increasing concern about computation frequency, gas fees, and centralization of the network. Since Ethereum usage grows exponentially every year, the price of any transaction grows as well since there are always many transactions being attempted at any time, clogging the network.

Bitcoin is already considered a safe haven or digital gold by major institutions. Now imagine if you could use that asset as a financial instrument. It’s true that Bitcoin experiences the same problems as Ethereum and Ethereum already has existing smart contracts. But it does not have the same level of trust and credibility that Bitcoin has. To provide Bitcoin with Etheruem’s superpowers, people are creating something called sidechains.

Bitcoin sidechains are independent blockchains that operate parallel to the Bitcoin network. These sidechains can have their own rules and features unique to the Bitcoin network while using BTC as its native currency.

One of the main advantages of a sidechain is that it essentially solve the scaling issues with the main chain because sidechains are independent of the base layer. This way concurrent transactions on the base layer and the sidechain won’t slow each other down on the network. Most importantly, Bitcoin is the largest, most accessible cryptocurrency that exists. Having the DeFi and smart contract capabilities on Bitcoin would attract more individuals and institutions, thus growing the whole crypto space.

Rootstock is one such sidechain that is powering up Bitcoin

What is Rootstock

Rootstock (RSK) is a Bitcoin sidechain that features Ethereum compatible Smart Contracts and is secured by merge-mining in the Bitcoin blockchain.

In terms of hash power, RSK is the most mined blockchain (after Bitcoin itself), making it the most permissionless and censorship-resistant Bitcoin sidechain. Currently, RSK has more than 63% of Bitcoin’s hashing rate. RSK provides several advantages for a wide number of stakeholders.

For Bitcoin Users

Bitcoin users can now use the best features of programmable money and payments, including reduced transaction costs and confirmation times. RSK implements a network of 15–30 block propagation rates, enabling fast payments with low-latency transactions.

For Bitcoin Miners

Bitcoin miners can participate in the Smart Contract market adding utilization and value to their industry while enabling higher scalability. RSK is also based on Proof of Work by supporting SHA-256D merged mining with bitcoin, using its same consensus protocol and mining network. Merge mining allows Bitcoin miners to mine RSK simultaneously with minimal additional cost while rewarding them with additional transaction fees.

For Ethereum Users

Ethereum users have a compatible platform to deploy their applications using Bitcoin’s currency, security, and user base. RSK implements a Turing-complete Virtual Machine (RVM) that is compatible with Ethereum’s VM (EVM) at the op-code level, allowing Ethereum contracts, compilers, tools, and DApps to run on RSK.

How does Rootstock run with BTC?

As a sidechain, RSK is an independent blockchain, but its currency is automatically pegged to the value of Bitcoin via a two-way peg mechanism called PoWpeg. BTC is transferred into the RSK blockchain, becoming RBTC, and can be transferred back into BTC at any time at no additional cost.

This process is done through a smart contract in the RSK blockchain called the Bridge Contract. As a smart contract is just an ‘if then’ contract if a specific amount of BTC is received by the contact, the same amount of RBTC is sent to an RSKs address corresponding to the original bitcoin address. If you wish to convert your RBTC back to BTC, you just need to send the RBTC to a special bridge contract address and the conversion is again handled through PowPeg which gets its security from HSM (Hardware Security Module), a mechanism for protecting private keys.

Can you trust Rootstock?

Complete trustless and decentralized two-way pegs require both platforms to have Turing-complete smart contracts, but Bitcoin does not currently support them. Therefore, a group of semi-trusted third-party (STTP), called the Federation, controls the PoWpeg mechanism. An open smart contract controls the composition of the Federation, and in case of a modification, it is applied after a one-week delay. This way, users that do not trust the new Federation have time to transfer the BTC back to the Bitcoin blockchain.

Each STTP has a key to control the locked BTC, and their release is determined only by a majority of the STTP, according to commands coming from the RSK blockchain and with no human intervention. In a future version of RSK, Bitcoin miners will also directly participate in the PoWpeg, making it even less federated and more coupled with Bitcoin Proof of Work.

DeFi on Bitcoin

Sovryn is a decentralized application built on RSK. Powered by smart contracts, the application allows for Bitcoin lending, borrowing, and margin trading.

Sovryn’s decentralized capability is built around smart contracts that allow users to deposit BTC into a noncustodial wallet. The user retains control of their private key and cannot be subject to KYC requirements, transaction censorship, or account bans.

Being a decentralized application, Sovryn uses an oracle and an aggregate of multiple exchanges to receive the most accurate price when trading on the application. Oracles allow data from outside the application to be brought in and generate a more accurate price of bitcoin in this case. Exchanges can have slightly different prices for bitcoin based on inefficiencies in recording all transactions on the exchange. Therefore, Sovryn combines multiple exchange prices to find the most accurate price and provide it to the user.

Sovryn attempts to reduce the amount of arbitrage that occurs and prevent traders from making small profits on price discrepancies on exchanges. Sovryn allows up to 5x leverage for margin trading, procuring these funds from lenders on the Sovryn platform who receive interest from users trading on margin. This core focus of margin trading and lending through peer-to-peer communication allows users to maintain control of their wallets and offer lending directly to other users without the regulation of a centralized exchange.

Sovryn allows peer-to-peer transactions and choices with lending to specific users for margin trading and farming or providing liquidity to various trading pairs. The decentralized application gives control to the user. Backed by smart contracts to follow the designs of peer-to-peer lending and accurate pricing of bitcoin, Sovryn leads decentralized finance via the development of its coded and automated implementation of oracles.

How to get started with DeFi on Bitcoin

To use Sovryn users must first convert their Bitcoin to Smart Bitcoin (RBTC), to be compatible with Sovryn.

To make these conversions, you need to access a wallet that supports RSK. Here are some wallets that you can check out — Liquality, Defiant, Portis, Ledger, Beexo, Metamask, and more. Once you download and set up the wallet, you need to connect it to the RSK blockchain.

Note- Keep your seed phrase i.e. the 12 or 24 words you receive from the wallet safe and do not share it with anyone under any circumstances.

Screenshot from Sovryn Website

For this example, I am going to use the Metamask wallet. To connect the wallet to the RSK blockchain, you can just go to the Sovryn app and click on Get started.

Screenshot from Sovryn Website

Now just click on connect wallet and select Metamask. It will ask you to add the RSK network to Metamask, sign the page to approve. Now you need to buy some RBTC. Click on Top op wallet and send BTC to the FastBTC address.

(FastBTC is currently centralized, so only do this if you trust Sovryn platform)

The minimum swap size is around $200 (changes based on the price of the asset at the moment) so make sure you transfer more than that to cover for fees. You shall receive RBTC in your wallet (it can take 60 minutes) Once you have RBTC in your wallet, you can buy SOV tokens to use all sorts of DeFi services provided by Sovryn.

Written by

, , , , , and .

References and Resources

Oracles and Blockchain: DeFi Oracles Examined | Gemini

DeFi on Bitcoin Explained | Edan Yago | Pomp Podcast #575

RSK white-paper

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also Read

--

--

Coinmonks
Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

NEU Blockchain Organization
NEU Blockchain Organization

A student-led organization dedicated to advancing blockchain education, development, and research.

No responses yet