RSK Quick Start Guide | Overview
What is RSK?
RSK’s full technology stack is built on top of Bitcoin: From RSK smart contracts to the RSK Infrastructure Framework. The stack is designed to create a more fair and inclusive financial system.
Bitcoin, is a store and transfer of value. The blockchain is secure because miners with high infrastructure and energy costs create new blocks to be added to the blockchain every 10 minutes. The more hashing power they provide, the more secure the network is. RSK is the first open source smart contract platform that is powered by the bitcoin network. RSK’s goal is to add value and functionality to the bitcoin ecosystem by enabling smart-contracts, near instant payments, and higher-scalability. RIF is an all-in-one suite of open and decentralized infrastructure applications and services that enable faster, easier and scalable development of distributed applications (dApps) within a unified blockchain environment.
RSK is connected to Bitcoin in terms of how its blocks are mined, and also in terms of a common currency. RSK is also compatible with Ethereum in terms of its virtual machine (which executes smart contracts), as well as the RPC (external API) that it exposes. Let’s briefly look at each of these areas.
Merged Mining: Layer 2 to Bitcoin layer 1
The bitcoin miners do what is known as merged mining, securing both networks with the same infrastructure and energy consumption.
They create blocks on the bitcoin network every 10 minutes, including transfer of bitcoin from different addresses, and in the process they create new bitcoins. On RSK, blocks are created every 30 seconds, to secure the execution of smart contracts. This does not mint any new coins in the process, but does earn a reward from the merged mining. Check out mining.rsk.co to learn more about mining.
NOTE: The time between blocks on each network listed above are approximate values.
PowPeg: 1-to-1 peg between BTC and RBTC
The second point of contact is the Powpeg. This component connects both networks to allow the transfer of bitcoins to RSK, thereby allowing developers to interact with smart contracts. They pay gas using the same bitcoin, the smart bitcoin.
To do so, you send bitcoin to a special address, where they are locked in the bitcoin network. Next, in the same address over in the RSK network, that same bitcoin is released to the user for use in the RSK network. This is called peg-in. You can do the reverse operation called peg-out, by sending your bitcoin to a special address in the RSK network, and receiving your bitcoin back in the bitcoin network.
EVM Compatible Smart Contracts
If you are familiar with smart contract development or dApp development using solidity, web3, and other compatible technologies; you might be excited to know that the RSK Virtual Machine (RVM) is compatible with the Ethereum Virtual machine (EVM). So you can use the same code, tools, and libraries when developing with RSK too. Thus, the smart contract/dApp development skills that you’re used to will transfer across quite nicely too!
- Truffle is a development, testing, and deployment framework for smart contracts,
and is an essential tool among blockchain developers. Truffle works well with RSK. In fact, we have our own Truffle Boxes, which are templates or starter projects that are already configured to connect to RSK.
- Ganache is your personal (localhost-only) simulated blockchain that has been optimised for smart contract development.
You can use this to run tests, execute commands, and inspect state during development. We recommend using a combination of Ganache and RSKj in Regtest mode for local development.
- Metamask is a browser extension cryptocurrency wallet or mobile app,
enabling users to interact with the RSK blockchain, including sending RBTC, sending RSK-based tokens such as RIF, and interacting with smart contracts deployed to the RSK network. See how to configure MetaMask to connect to RSK.
- Solidity is the most popular programming language for implementing smart contracts.
The bytecode and ABI that the Solidity compiler,
solc, outputs can be used to deploy and interact with smart contracts on RSK,
thanks to the compatibility between RVM and EVM.
See The Complete Full Stack Guide on RSK which will guide you through the process of developing and deploying a Solidity smart contract on RSK.
Ethereum compatible JSON RPC
The set of remote procedure calls (RPCs) that RSK supports is largely the same as the RPCs supported by Ethereum. This is another layer of compatibility, in addition to the virtual machine implementation, which allows the same tools and libraries to be used.
Differences with Ethereum: Checksums, derivation paths, gas prices
RSK is not 100% compatible with Ethereum: It has differences in the way checksums are calculated, the derivation path it uses, and how gas is calculated.
- Different Ethereum-compatible networks differentiate themselves using “chain IDs”.
- Each blockchain network has its own unique chain ID.
- RSK uses the chain ID when calculating checksums for its addresses,
whereas Ethereum does not take this into account.
- Checksums in both networks are represented using capitalisation (uppercase and lowercase letters),
so the “same” address will not pass checksum validations on both RSK and Ethereum.
Derivation path differences
Remembering or storing private keys for your crypto wallets can be super challenging, even for technical people. This is because these keys are essentially extremely large numbers. So to make things easier, the crypto community has come up with a technique called “HD wallets”, where using a seed phrase (a set of randomly chosen dictionary words), plus a “derivation path”. RSK and Ethereum have different derivation paths, therefore, the same seed phrase results in a different set of keys and addresses between RSK and Ethereum.
The EVM and RVM are compatible in that they support the same op-codes, and therefore can run the same smart contracts. However, the price of each op-code (measured in units known as gas) is different between EVM and RVM, thus the total gas consumed in various transactions is different. Further to that, gas units are multiplied by gas price to calculate the transaction cost. Since RSK’s gas price is denominated in RBTC and Ethereum’s gas price is denominated in Ether, there is another difference between gas prices on RSK and Ethereum.
- About additional security and alerting systems for the merged mining process between RSK and Bitcoin,
check out the Armadillo guide.
- About merged mining
- About PowPeg
- About gas, and gas calculations
- About derivation path, checksum, and chain ID
- About Turing completeness
- About RSK Improvement Proposals, many of which involve EVM compatibility
- About the RPCs that are available, including documentation with sample requests and responses
- About RSK public nodes, which expose RPC endpoints