From Ethereum to Bitcoin: Smart Contract Development on Rootstock – hackernoon.com

Are you a smart contract developer on Ethereum? If yes, you can now develop a smart contract on Bitcoin with the tools you already know using Rootstock. In this tutorial, we will be using Ethereum-related tools to create and deploy smart contracts on Rootstock.

Prerequisites

Rootstockis an EVM-compatible chain, merging the benefits of Bitcoin with the benefits of Ethereum. The beautiful part is Rootstock has a token called RBTC which is equal to BTC. Being an EVM-compatible chain, it lowers development barriers because tools used in an EVM-compatible chain can also be used at Rootstock.

Since it is an EVM chain, we will be using ChainList to add Rootstock to Metamask

Visit ChainList EVM Filtered link where Rootstock has been searched in networks.

Make sure Include Testnets is checked.

Click on the connect wallet button; this will pop up a Metamask modal to connect to ChainList.

Clicking on Connect Wallet changed the Connect Wallet to Add to Metamask

Click Add to Metamask for Rootstock Mainnet.

Click Add to Metamask for Rootstock Testnet; this popup is a modal by Metamask to approve and later switch the network.

Getting Rootstock Testnet Native Token (tRBTC)

Visit Rootstock faucet, and copy and paste your Metamask wallet address.

Check the I'm not a robot,

Click the Get test RBTC button. After a few seconds, check your wallet, and you will see the balance.

Visit Rootstock Testnet Explorer at explorer.testnet.rootstock.io, enter your wallet address, and press enter key to search. The Testnet faucet transaction is shown in the screenshot below.

We will be using the Remix IDE to write our first smart contract.

Visit https://remix.ethereum.org/

Create a new file called SimpleStorage.sol.

Copy and paste the code below in the newly created SimpleStorage.sol file.

Compile SimpleStorage.sol on Remix

Click on the Solidity logo Icon by the left menu.

Check the Auto compile.

Click the Compile SimpleStorage button.

Deploying the Smart Contract on Rootstock

In your MetaMask switch your MetaMask network to Rootstock Testnet.

Click the deploy & run transaction button.

Select Inject Provider - MetaMask.

Make sure the account you select the account with balance.

Select the smart contract in this example SimpleStorage.

Click the Deploy button.

Visit explorer.testnet.rootstock.io

Copy your smart contract address, and paste the address into the search input; press enter to search

All the tools and languages used on Ethereum are compatible with Bitcoin thanks to Rootstock, you can now port your favorite Ethereum protocol to Bitcoin. Take your learning to the next level at https://dev.rootstock.io/

See the original post here:

From Ethereum to Bitcoin: Smart Contract Development on Rootstock - hackernoon.com

Related Posts

Comments are closed.