RSK, the first smart contract platform for Bitcoin

Community sourced content

The two biggest and most well-known blockchain networks in recent years are Bitcoin and Ethereum. Ethereum offers the smart contract execution platform with the most robust application ecosystem, while Bitcoin offers the most secure digital asset. In this article, we introduce RSK, a sidechain that adds stateful smart contracts and compatibility with Ethereum to Bitcoin.

What is RSK?

RSK is the first general purpose smart contract platform secured by the Bitcoin Network. The objective of the project is to bring Ethereum's benefits to Bitcoin, enabling users of Bitcoin to fully take advantage of decentralised finance without having to trade their Bitcoin for other assets or give up Bitcoin's consensus security.

We have mentioned a key word here, smart contract. What then is a smart contract. Smart contracts are agreements whose provisions are encoded in computer language as opposed to formal ‘legalese’.

A computer network like RSK may execute smart contracts such that the contract's conditions are automatically enforced through a protocol that all of the network's nodes adhere to.

Is a smart contract autonomous? Yes, smart contracts are expected to be autonomous. If all these mentioned things (such as money, payments, obligations, property titles, assets, and licences) have a digital representation in the platform, the smart contract can function completely autonomously. A smart contract can also refer to itself and respond to changes in its state using specialised gateway nodes called oracles that feed outside data to the blockchain when an item does not have a similar digital representation.

RSK: the architecture

RSK does not designate itself as a sidechain, hence it does not compete with Bitcoin as a store of value. RSK, on the other hand, adds new features to Bitcoin without depleting its network's resources. Along with other features, RSK implements a merged mining algorithm that gives Bitcoin miners more fees without significantly increasing overhead. It also offers a way to move bitcoins from the Bitcoin network and back.

Just like Pontem, RSK can support any language that compiles to the EVM since it presently supports all of Ethereum's opcodes and precompiled contracts. This covers novel or experimental programming languages like Vyper, Julia, and Solidity.

To bridge itself to the Bitcoin protocol, RSK uses a mechanism called PowPeg. What then is PowPeg? Powpeg is a verified two-way peg - and the first Bitcoin peg to give security guarantees based on Bitcoin's verification, making it the most secure and stateless peg already accessible. A federation of nodes controlling a Bitcoin multi-signature was used to bootstrap this 2-way peg. RSK, however, switched their federation over to a PowPeg.

The PowPeg is an additional layer of security protection above the preceding federation. The attack surface for the most common security vulnerabilities is drastically decreased because of its uniqueness in the crypto ecosystem.

The routers of users do not directly access or manipulate private keys in a PowPeg. Rather, the keys are handled by Tamper-proof HSMs (hardware security models). Fundamentally, these HSMs run RSK nodes that enact commands from the bridge.

RSK advantages and ecosystem

The main reasons why developers may consider choosing the RSK smart contract network over other networks are security and scalability.

From the security standpoint, the RSK network uses the same hashing algorithm as Bitcoin, which is protected by more than 40% of the computer power of the Bitcoin Network. Even though other security models have been in existence, such as DPoS on EOS or PoW on Ethereum and could have certain advantages, none of those networks hold as much value in custody as the Bitcoin Network has. With the above said, RSK combines the best of Bitcoin and Ethereum under a single platform.

From the standpoint of programming and scalability, RSK Network and Ethereum both natively support Solidity smart contracts and the same APIs, making them comparable from the standpoint of development capabilities. Developers may easily convert their dApps to the RSK Network using these degrees of compatibility and take advantage of their newly gained skills and expertise.

So far RSK has far less onchain activity than Ethereum does. But its ecosystem is growing: DappRadar already lists 7 apps built on RSK with a total value locked of over $50 million. The dApps include Sovryn, Babelfish, and Money on Chain.

Tokens of RSK

RSK has two unique tokens called RIF & RBTC, but each has a different function. One is the native token while the other is for access and payment basically for developers.

RIF token

A collection of open and decentralised infrastructure protocols known as RSK Infrastructure Framework Open Standard (RIF OS) enables the rapid, simple, and scalable creation of distributed applications (dApps) in a single setting.

Decentralised, third-party, off-chain payment network support, a collection of APIs for safe, smooth communication across decentralised apps, and user-friendly interfaces for developers are all features of RIF OS. Access and payment for RIF OS services are based on the RIF Token, which enables developers to access the range of services built on top of RIF protocols, including Identity, Payments, Gateways, Storage, and Communications, as well as third-party developed infrastructure services, and any other apps that may be deployed on RIF's framework that agree to accept RIF Tokens as a means of accessing / consuming the service.

RBTC token

The native token of the RSK Live Mainnet is called RBTC, and it is tied 1:1 to Bitcoin. As ETH is utilised as gas for Ethereum, RBTC is used as gas to pay for the execution of Smart Contracts. The bridge between the Bitcoin and RSK protocols allows technical users to convert in and out of BTC in a decentralised manner. Less technical users may buy RBTC from compatible exchanges like Huobi and Bitfinex, among others, in order to get started. It is needed to use the RSK and all of the RSK and RIF OS-based programmes.

RSK is a decentralised autonomous organisation. It is not controlled by anyone but its affairs are managed by a team of developers called IOV. IOV Labs operates as a purpose driven organisation focused on promoting and developing the next generation of open blockchain-based infrastructure that will enable worldwide financial inclusion and bridge the gap between this nascent technology and mass adoption and is the organisation behind RSK and RIF platforms. They don’t control RSK or RIF. Even if they stop working RSK will still be running smoothly.

How RSK uses merge mining

Merged mining is the process that allows RSK blockchain to be mined simultaneously with Bitcoin blockchain. This can be done because both chains use the same proof-of-work (PoW) algorithm, double SHA-256.

Every mining job that Bitcoin mining pools provide to miners has a reference to RSK's block. When miners discover a solution, it is compared against the challenges of both networks (Bitcoin and RSK), yielding one of three results:

  • Bitcoin network difficulty is satisfied by the solution. A block is therefore put together and delivered to the network. The Bitcoin network will contain and disregard RSK's merged mining reference. This approach will also work for RSK and may be uploaded to the network because RSK's network difficulty is lower than Bitcoin's.
  • The solution satisfies the RSK network difficulty but not the Bitcoin network difficulty. Therefore, the RSK network will receive the solution but not the Bitcoin network.
  • The solution is not uploaded to any network; rather, it just fulfils the pool difficulty, which is significantly lower than the Bitcoin or RSK network difficulty.

The node can create an SPV proof by submitting a solution to the network. The block that will be transmitted to the network contains the proof if it is legitimate. Miners earn a high percentage of transaction fees from the RSK block they mine. This mining process is done with the same hashing power used in Bitcoin mining, and has no additional cost or impact.

For each RSK block they mine, miners receive 80% of the transaction fees. As the RSK platform promotes adoption and the volume of transactions in the network rises, these incentives will get increasingly alluring. RSK offers a second source of income for Bitcoin miners utilising the same equipment and power because merging RSK with mining Bitcoin does not incur any additional costs.

How secure is RSK mining?

As long as there is an honest majority of miners, Nakamoto consensus may be demonstrated to be safe. Malicious miners may view cheating as a sensible or irrational tactic in the event of a dishonest majority based on assumptions about how the market and society would respond to a 51 percent attack. Theoretically, RSK is identical to Bitcoin; however, as not all Bitcoin miners engage in merge-mining in actuality, a greater honest hash-rate is needed.

By alerting nodes if more than 50% of the miners turn hostile, an ad hoc monitoring system known as Armadillo lowers the requirement before rogue miners may do harm. RSK merge-mining makes use of SHA256 and Keccak for blockchain security. RSK is considered very secure as Bitcoin mining because there are no known real-world attacks on these hashing methods.In particular, RSK takes SHA256's stronger assumption that it must not permit a "free-start collision" with a cost of less than 280 operations. This is so that the size of the SPV proof may be compressed via the RSK network, which makes use of a Merkle-Damgard construction characteristic.

How RSK guards against selfish mining

RSK employs the consensus protocol DECOR+. When the rate of honest uncle blocks created by the network is minimal, DECOR+ is incentive-compatible and guards against selfish mining. According to Camacho-Lerner, if the uncle rate is large, a selfish motivation could develop. Several changes have been suggested to make it better, such as the "sticky" rule, postponing the weight of uncles in GHOST, or allowing mentioning uncle-children in the same way as uncles.

If transaction costs remain steady and there are no off-chain payments or bribes to miners, any of these improvements will make the RSK consensus system incentive-compatible.

Summary

RSK is the first purpose smart contract platform secured by the Bitcoin network. It supports all the opcodes of Ethereum, combining the best of Ethereum and Bitcoin. RSK’s ecosystem is still small, but with around $50 million in total value locked, it is a project to keep on your radar.

About Pontem

Pontem is a product studio working toward global financial inclusion powered by blockchains - primarily Aptos, the most scalable and safest L1 network. We are partnered with Aptos to build foundational dApps, development tools, AMMs, and more. The first dApp, LiquidSwap - the first-ever AMM for Aptos - is already available as a test version.  

To stay updated on our work, be sure to follow Pontem on Twitter, subscribe on Medium, and connect with us on Telegram.

Install our wallet and try DEX