Programming for RSK

Bitcoin

It is the blockchain par excellence (wikipedia). The main RSK product is a sidechain connected to Bitcoin: BTC (bitcoins) can be transferred from the main Bitcoin network to RSK and vice versa. Below I comment on the basic idea of that RSK sidechain.

Blockchain

It may seem strange that this item appears in second place, after Bitcoin, but I think it is a suitable path: first to see a particular implementation (Bitcoin) and then to see the panorama that since then was opened for all, and for us the programmers.

Ethereum

It is the second best known blockchain. See site. Started by programmers who collaborated with the Bitcoin project, its novelty is the support of smart contracts. The RSK node is born as a modified fork of the Ethereum node implemented in Java in the EthereumJ project (now deprecated) (there are nodes implemented in other languages such as Go, Rust, Python, etc.)

  • Ethereum main entities: blocks, transactions, accounts
  • State of the world, the Trie and Merkle Trees
  • Encryption of information using RLP
  • Signing transactions using elliptical curves

RSK

The current node code can be studied at https://github.com/rsksmart/rskj.

  • Communicate with external customers via JSON RPC see TBD
  • Communicate with other nodes using TCP based on a Peer to Peer protocol (P2P)
  • Send messages to other nodes informing
  • The current state of the node
  • New transactions
  • New blocks or notices of new blocks
  • Other request / response messages to talk node to node, for example, when a node is late (it does not have all the blocks of the current blockchain) it asks for blocks from another one
  • Receive transactions from external customers
  • Given a transaction received from an external client or another node, validate it and distribute it to other friendly nodes
  • Given a block received from a friend node, validate it, see if it belongs to a chain, and if all is well, forward it to friendly nodes
  • Initially connect to nodes called bootstrap, to get an initial list of nodes to connect to

My Personal Experience

As you know, I like to program to really understand a topic. You can see some of my first steps in Building a Blockchain posts serie.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store