paint-brush
DeFi on Bitcoin Part 2: How to Deploy DApps on Bitcoin Using the Rootstock Sidechainby@rootstock_io
6,984 reads
6,984 reads

DeFi on Bitcoin Part 2: How to Deploy DApps on Bitcoin Using the Rootstock Sidechain

by RootstockNovember 28th, 2023
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

While Ethereum, Solana, and other blockchains have been at the forefront of building dApps, developers are now considering the untapped potential of building on Bitcoin with Rootstock.
featured image - DeFi on Bitcoin Part 2: How to Deploy DApps on Bitcoin Using the Rootstock Sidechain
Rootstock HackerNoon profile picture

While Ethereum, Solana, and other blockchains have been at the forefront of building dApps, developers are now considering the untapped potential of building on Bitcoin with Rootstock.

Explore a paradigm shift that could redefine your dApp development experience and open doors to unparalleled innovation.

How does Rootstock enable building on Bitcoin?

Rootstock is a smart contract, EVM-compatible sidechain on Bitcoin that enables developers to build decentralized applications (dApps) on top of Bitcoin.


It is a layer 2 solution that provides smart contract functionality and scalability without sacrificing the security of the Bitcoin blockchain. Its native cryptocurrency is called RBTC used as gas for all transactions happening on the Rootstock chain.


Read this comprehensive guide to get introduced to Smart Contract development and deployment, getting RBTC, tooling and developer resources and how to get help when building on the Rootstock Blockchain.


If you want to get an in-depth view of the Rootstock Blockchain and why developers choose to build on Rootstock including EVM-compatibility, scalability, security of Bitcoin, and lower fees, read part one in the hackernoon series: DeFi on Bitcoin Part 1: A Guide To Building dApps on Rootstock.

Prerequisites for Smart Contract Development on Rootstock

Smart contracts are self-executing code that are stored on a blockchain. They can be used to automate a wide range of transactions and agreements, without the need for intermediaries. It is essential for building dApps, as they provide the foundation for decentralized applications.


For a quick intro, read the quick-start guide to get a quick introduction to Rootstock, learn how to interact with Rootstock in your web browser, and how to view Rootstock transactions.

Rootstock Smart Contract Capabilities:

Rootstock offers a variety of smart contract capabilities, including:


  • Support for Solidity: the most popular smart contract programming language.


Developing on Rootstock: DeFi on Bitcoin Porting dApps and benefits over Ethereum


  • EVM-compatibility: Rootstock’s virtual machine (RVM) is Rootstock’s high-performance virtual machine that can execute smart contracts quickly and efficiently and is EVM-compatible.


  • Security: A secure and reliable environment for deploying and executing smart contracts. Since Rootstock (Layer 2) is built on Bitcoin (Layer 1), it benefits from Bitcoin's high security.


Watch video on Merged Mining and Why it matters

Rootstock’s Programming Languages

Programming Languages use to develop dApp on Rootstock includes:


  • Solidity
  • Javascript


To level up your knowledge of smart contracts, enroll for the Rootstock Blockchain Developer Course. Learn how to write, test, compile, deploy, secure, and verify smart contracts using Solidity.


Additional resources include:


Want to integrate with Rootstock? Get in touch with us or visit the Developer Portal to get started.

Developer Tooling

If you’ve already developed any dApps on Ethereum, you should be ready to hop on Rootstock and start building on Bitcoin.


Here are some developer tooling to enable smart contract deployment on Rootstock including explorers, frameworks, libraries, demo code snippets, blockchain oracles, node infrastructure, and smart contract monitoring:


  1. Explorers (Rootstock Explorer)


The Rootstock blockchain explorer provides an in-depth visualization of all the transactions, blocks, addresses and tokens in the blockchain. It also supports contract verifications / interactions.


Rootstock explorer


  1. Frameworks


Frameworks enable Rootstock developers to participate in the Rootstock ecosystem at different levels, such as  running full nodes, trading tokens, mining cryptocurrency, and more.


Following are some frameworks used to build Rootstock dApps:


  • Hardhat: Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment. Check out this step-by-step tutorial on How to set up a Hardhat project to connect to the Rootstock Testnet.


  • useDApp: useDApp is a framework for Rapid DApp Development. Learn how to build on Rootstock using useDApp React Library.


  1. Libraries


  • Ethers.js: Ethers.js is a JavaScript library that allows developers to interact with the blockchain. The library includes utility functions in JavaScript and TypeScript, and can also support wallets.


  • OpenZeppelin: OpenZeppelin is a library for secure smart contract development to help developers build on a solid foundation of community-vetted code.


  1. Demo Code Snippets


    The demo code snippets is a github repo full of code snippets demonstrating dev tasks on Rootstock. Each folder within this repo contains a separate demo, and has its own dependencies to install.


  2. Blockchain Oracles


    Blockchain oracles are entities that connect blockchains to external systems, allowing smart contracts to execute depending on real-world inputs and outputs.


Here are some oracles integrated with Rootstock:


  • API3's mission is to connect Web2 APIs with Web3 to unlock the tremendous potential of trustless applications that interact with real-world businesses, and truly decentralized off-chain data feeds.


  1. Node Infrastructure


  • GetBlock is a service that provides a fast and easy connection to Rootstock nodes, and a continuously growing list of over 40 cryptocurrency nodes.


  • NOWNodes is a blockchain-as-a-service enterprise solution that lets users get access to full Nodes and blockbook Explorers via an API. The service provides a high-quality infrastructure that is quick, cost-effective, and reliable.


  1. Blockchain Data Analytics, Asset Monitoring and Management


  • Tenderly helps developers build, monitor, and improve smart contracts by providing a set of tools to boost productivity, save time, and ensure smart contracts are working as expected.
  • Covalent is a hosted blockchain data solution providing access to historical and current on-chain data for 100+ supported blockchains, including Rootstock.
  • Coinfirm is an industry leading analytics and compliance platform. Its AML solutions are trusted to best analyze and manage risk.
  • Fireblocks is an enterprise-grade platform delivering a secure infrastructure for moving, storing, and issuing digital assets aimed at institutional use cases.


  1. No-Code Infrastructure


    Forward Protocol enables creation of Blockchains, Subnets, and dApps with a No-Code interface.


Want to integrate with Rootstock? Get in touch with us or visit the Developer Portal to get started.

Getting RBTC

RBTC, or Smart Bitcoin, is the native token of the Rootstock blockchain and it is pegged 1:1 to BTC. It plays a crucial role in the functioning and security of the Rootstock ecosystem and is the token to be used for transaction fees, smart contract execution, Bitcoin peg maintenance, and as a store of value as it has the same value of BTC.


To start building on Rootstock, you will need to acquire RBTC. For a detailed guide on Exchanges, Cryptocurrencies and the various ways to get crypto on Rootstock. See 3 Easy Ways to Get RBTC or  Get Crypto on Rootstock.


Here are some other methods;

Faucets

A crypto faucet is an app or a website that distributes small amounts of cryptocurrencies as a reward for completing easy tasks. The Rootstock Testnet Faucet is used to get test tokens for building and deployments on Testnet.

Decentralized Exchanges

Decentralized exchanges or “DEX”, is a peer-to-peer marketplace where users can trade cryptocurrencies without the need for a central authority. Instead, DEXs use smart contracts to facilitate trades and ensure that they are executed fairly and securely.


Let’s take a look at DEXes that support Rootstock tokens:


  • Money on Chain
  • Sovryn is a non-custodial and permissionless smart contract based system for Bitcoin lending, borrowing and margin trading. Users can buy SOV with RBTC, swap and trade: DOC, BPRO, rUSDT, xUSD, and MOC tokens on Sovryn.
  • Tex is a Decentralized Exchange from Money on Chain, which uses periodic ticks in an order book to match operations at an emerging price, avoiding front-running and allowing fair price discovery even with low volume.
  • Liquality Wallet is a browser extension for accessing Bitcoin, Rootstock, and Ethereum applications. This MetaMask alternative supports multiple blockchains and provides the easiest way to flip between BTC, ETH/ERC20s, and RSK tokens with built-in one-click atomic swaps.

Centralized Exchanges

Centralized exchanges are managed by a centralized organization such as a bank that is otherwise involved in financial services looking to make a profit.


Some of these exchanges include:


Bridges

Bridges are software protocols that enable communication and interaction between different blockchains.


2 way peg


The 2 way peg is a protocol that converts BTC to RBTC and vice versa. It is secured by the powpeg, which is a unique 2-way peg system that secures the locked bitcoins with the same Bitcoin hashrate that establishes consensus. See the 2 way peg app to get started.


Tokenbridge


The Ethereum/Rootstock Bridge allows the move of ERC20 tokens between one chain and the other.


Sovryn Cross-chain bridge


The Sovryn Cross-chain Bridge allows easy and permissionless transfers of your tokens from one blockchain to another. There are currently three blockchains included in the bridge: Rootstock, Ethereum, and Binance Smart Chain.

Supported Wallets

Wallets that support RBTC include:


Supported Token Standards

  • ERC20

  • ERC677


To understand the differences, read Fungible Token standards.

Asset Types

Fungible Tokens

  • USDRIF: RIF US Dollar is a fully crypto collateralized stablecoin. 1:1 pegged to US Dollar guaranteed by the smart contract that creates it.

  • RIF: This Token allows any token holder to consume the services that are compatible with the RIF architecture.

  • DOC: Dollar on Chain is the ideal stablecoin for daily transactions and users seeking to hold current value without leaving the benefits of bitcoin.


Non-token financial assets

  • BPRO: This token allows hodlers passive income combined with free leverage that makes the price of the token rise even more when bitcoin price goes up.

  • RIF Pro: Holders get additional leverage on their RIF and are also eligible to earn a share of fees generated by the RIF on Chain protocol.


Visit the RIF On Chain decentralized protocol to get started.

Rootstock Community and Support

The Rootstock blockchain is supported by its community of developers and blockchain enthusiasts that together provide a significant knowledge base for newcomers to the community. You can find these communities and support channels on:


Stackoverflow


Get your questions answered on Stackoverflow. Tag #RSK or #Rootstock to get support.


Rootstock Global Discord Community


Join the Rootstock Global Discord Community to get the needed resources and support as you start your journey to build on Bitcoin and Ethereum.


Want to integrate with Rootstock? Get in touch with us or visit the Developer Portal to get started.


Free Education Sources

Take these courses on Rootstock to level up your knowledge of Rootstock Sidechain  and Writing Smart contracts.


Rootstock Blockchain Developer Course

The developer course teaches you how to develop on the Rootstock blockchain, with a major focus on smart contract development. In this course, you will learn how to write, test, compile, deploy, secure, and verify smart contracts using Solidity and it is completely FREE!


Rootstock User Course

The User course aims to teach you how to use and interact with the Rootstock blockchain network. This course is for a technical user, but does not require or involve any programming knowledge and it is completely FREE!

Contribute

Here are the various ways you can contribute to the Rootstock Ecosystem!

Join the Ambassador Program

Become a Rootstock Ambassador, support the Rootstock ecosystem and earn exclusive rewards.


  • Earn Rewards
  • Collaborate
  • Network
  • Increase network
  • Get merchandise
  • Get invited and participate in exclusive events with top thought leaders in the space.

Submit an Issue

Contribute to the Rootstock Developer Portal.


Submit an issue

Participate in a hackathon or grant

Wave three of Rootstock's grants program closes on November 17th — and if you've got a project or an idea that could supercharge our ecosystem, we want to hear from you.


Meet the winners of the first waves of Rootstock Grants Program.

Future Prospects and Potential Impact of Rootstock on the Blockchain Industry

Rootstock is revolutionizing the way decentralized applications are being built and deployed. By providing smart contract functionality and scalability on Bitcoin, Rootstock is enabling developers and businesses to build dApps that are more secure, reliable, and efficient.


Rootstock also has a significant impact on the adoption of Bitcoin, by making it possible to build dApps on Bitcoin, Rootstock has opened up new possibilities for the use of Bitcoin. For example, Rootstock can be used to build decentralized financial applications (DeFi) and other innovative dApps on Bitcoin.


In this article, we covered how to deploy dApps on Bitcoin using Rootstock EVM-compatible sidechain, we looked at developer tooling and resources needed to get started on Rootstock.

Useful Resources