Category Archives: Solidity

Programming for RSK

I have been working as a software developer at RSK for almost four years now. I entered without knowing much about blockchain programming, but in these years, thanks to this experience, I was able to learn many interesting topics.

If a programmer wants to collaborate with the RSK code but, like me at the beginning, does not know about blockchain, some recommendations are in this post. Some of them I already wrote in the 2017 Spanish post serie Learning Ethereum / RSK. The following are comments and personal recommendations, which I found interesting and important to learn.

Although the RSK base project, its node (see https://github.com/rsksmart/rskj) is written in Java, there are several projects to collaborate, applying from JavaScript to Go, and we will also see applying Solidity (a language of smart contracts).

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.

While it is not essential to program for RSK (either in hackathons, collaborating in open source, or working within the company), it is important to know how Bitcoin works. For that I can recommend the resource of Andreas Antonopolous (personal site) (twitter) (wikipedia)

Mastering Bitcoin 2nd Edition

I read there:

This book is mostly intended for coders. If you can use a programming language, this book will teach you how cryptographic currencies work, how to use them, and how to develop software that works with them. The first few chapters are also suitable as an in-depth introduction to bitcoin for noncoders—those trying to understand the inner workings of bitcoin and cryptocurrencies.

It has chapters such as: How Bitcoin Works, Bitcoin Core, Keys and Addresses, Wallets, Transactions, Advanced Transactions and Scripting, Blockchain, Bitcoin Network, Mining and Consensus, Bitcoin Security, Blockchain Applications.

Although it is not completely necessary to understand much of RSK, it is interesting to read about the Lightning Network, what is called a Bitcoin Layer 2 (RSK will also have its Layer 2). You can start with:

A Deep Dive into LND: Overview and Channel Funding Process

It is a very interesting topic, see everything that is appearing, even in Ethereum (and you will see that in RSK):

Layer 2’s Cambrian Explosion by Ben Jones of Plasma Group

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.

There are countless tutorials, but I can mention some:

A Hitchhiker’s Guide to the Blockchain Universe
Best Resources for Learning Blockchain Development in 2019
Understanding Blockchain Fundamentals, Part 1: Byzantine Fault Tolerance
Understanding Blockchain Fundamentals, Part 2: Proof of Work & Proof of Stake
Understanding Blockchain Fundamentals, Part 3: Delegated Proof of Stake

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.)

To understand RSK then yes: it is necessary to understand Ethereum (and then, the differences with RSK). Again, Antonopolous with Gavin Wood (one of the creators of Ethereum):

Mastering Ethereum

Then read the Ethereum Yellow Paper where the internal functioning of Ethereum is explained.

Some additional topics you can see are:

What is Ethereum?
Learn Ethereum
Getting started with Ethereum as a developer
What is Ethereum? Everything you need to know!
A Guide to Gas
Understanding the ethereum trie
Data structure in Ethereum | Episode 1: Recursive Length Prefix (RLP) Encoding/Decoding
Data structure in Ethereum | Episode 1+: Compact (Hex-prefix) encoding
Data structure in Ethereum | Episode 2: Radix trie and Merkle trie
Data structure in Ethereum | Episode 3: Patricia trie
Data structure in Ethereum | Episode 4: Diving into examples
CryptoZombies is a free, interactive code school that teaches you to build games on Ethereum
A curated list of awesome Ethereum Resources
Ethereum Virtual Machine Awesome List
The Hitchhiker’s Guide to Smart Contracts in Ethereum
Ethereum Explained: Merkle Trees, World State, Transactions, and More
Ethereum Under the Hood: Part-1 (ver 0.1)
Ethereum Under the Hood- Part 2 (RLP Encoding)
Ethereum Under The Hood Part 3 (RLP Decoding)
EVM Evolution Roadmap
Ethereum Yellow Paper Walkthrough: Merkle Trees
A guide to Ethereum’s ERC standards
Diving into Ethereum’s world state
Mastering The Fundamentals of Ethereum (For New Blockchain Devs) Part III — Wallets, Keys, And Accounts

I would recommend studying mainly, from the links above, the topics:

  • 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

On the topic cryptography of elliptic curves, see my references in the personal project (WIP)  about elliptic curves.

RSK

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

The main use cases covered by both an Ethereum node and the RSK node (although they are implemented differently) are:

  • 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

I hope in the next post to write a little more in detail about these implementations.

As entities, it handles the same as Ethereum: block, account, transaction, transaction receipt, but with some differences, mainly in the block fields. The transaction is practically the same as those of Ethereum, which makes it possible to reuse the wallet ecosystem (external client programs) to send them to a node in the RSK network.

Other topics to study (and I hope to cover in future posts, I will leave here the links as they appear): RSK networks testnet and mainnet, explorer, status, merge mining, two-way peg, distributed storage, layer 2 a raiden, etc.

If you have any technical questions you can write at https://gitter.im/rsksmart/rskj.

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.

From time to time I give blockchain programming talks for developers, you can see some of my presentations and some videos (Spanish).

I am also writing a blockchain from scratch (the node of a blockchain) based on Ethereum’s ideas (and therefore, similar to RSK) in Java, see my personal project BlockchainJ (there is another one that I am not updating for now, in C# BlockchainSharp)

More blockchain, programming, ethereum and solidity resources in the README of my repositories:

https://github.com/ajlopez/aprendiendoblockchain
https://github.com/ajlopez/aprendiendoSolidity
https://github.com/ajlopez/SoliditySamples

Some personal projects, more oriented to smart contracts (there are resources on each subject, in the README of each project):

Solidity Compiler
Ethereum Virtual Machine Compiler (from AST (Abstract Syntax Tree) to bytecodes)
Ethereum Virtual Machine to Code
Decentralized Exchange for ERC20 Tokens
Simple Ethereum/RSK Bridge
Metatransactions in Ethereum RSK

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
https://twitter.com/ajlopez

Blockchain: Links And Resources (517)

Previous Post
Next Post

Creating a Non-Collateralized Stablecoin
https://levelup.gitconnected.com/creating-a-non-collateralized-stablecoin-82fb1258647e

Filecoin Project Specification
https://filecoin-project.github.io/specs/

Bad Actors Rent Hashing Power to Hit Bitcoin Gold With New 51% Attacks
https://www.coindesk.com/attackers-rent-hashing-power-to-hit-bitcoin-gold-with-new-51-attacks

Year in Ethereum 2019
https://weekinethereum.substack.com/p/year-in-ethereum-2019

How the BCH developer tax affects BTC miners
https://blog.deribit.com/insights/how-the-bch-developer-tax-affects-btc-miners/

Better Solidity debugging: console.log is finally here
https://medium.com/nomic-labs-blog/better-solidity-debugging-console-log-is-finally-here-fc66c54f2c4a

Week in Ethereum News, Jan 26, 2020
https://weekinethereum.substack.com/p/week-in-ethereum-news-jan-26-2020

Taproot Is Coming: What It Is, and How It Will Benefit Bitcoin
https://bitcoinmagazine.com/articles/taproot-coming-what-it-and-how-it-will-benefit-bitcoin

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
https://twitter.com/ajlopez

New Month’s Resolutions: September 2019

The end of year is coming. It’s time to write down my monthly resolutions, but first, review of the last month’s ones:

– Continue RLie [complete] see repo
– Continue Erlie [partial] see repo
– Continue Walang [pending]
– Continue SimpleNeuron [pending]
– Continue SimpleTalk [pending]
– Continue BlockchainJ [complete] see repo
– Continue Dexert [pending]
– Continue EthBridge [pending]
– Improve my Genetic Algorithms repo [complete] see repo
– Give a talk Building a Blockchain in Java, using TDD [complete]
– Continue evmcompiler [pending]
– Continue selang [pending]
– Continue solcom [pending]
– Continue EthRlp [complete] see repo
– Continue SimpleTensor [pending]
– Continue HuskyJS [pending]
– Continue Monki [complete] see repo
– Start Learning Elliptic Curves [complete]
– Start Learning Rust [complete]
– Start Learning Golang [complete]

I also was working on:

– Start EthMeta metatransactions in Ethereum and RSK [complete] see repo
– Adding commands to RskApi [complete] see repo
– Improving SimpleAbi [complete] see repo
– Start EthMMR, Merkle Mountain Range in Solidity [complete] see repo
– Start EthProof, Merkle proof in Solidity [complete] see repo

My new month’s resolutions:

– Continue RLie
– Continue Erlie
– Continue Walang
– Continue SimpleNeuron
– Continue SimpleTalk
– Continue BlockchainJ
– Prepare a talk about Deep Learning and the Game of Go
– Continue evmcompiler
– Continue selang
– Continue solcom
– Continue EthRlp
– Continue EthMeta
– Continue Monki
– Continue Learning Elliptic Curves
– Continue Learning Rust
– Continue Learning Golang

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
http://twitter.com/ajlopez

 

 

Blockchain: Links And Resources (438)

Previous Post
Next Post

Why is Proof of Work Required in Bitcoin
https://bitcoin.stackexchange.com/questions/89972/why-is-proof-of-work-required-in-bitcoin

Another random #Ethereum state stat
https://twitter.com/peter_szilagyi/status/1166633058348556288

Ethereum Smart Contracts in L2: Optimistic Rollup
https://medium.com/plasma-group/ethereum-smart-contracts-in-l2-optimistic-rollup-2c1cef2ec537

Zero Knowledge 92: Jorge Izquierdo talks Aragon and DAOs
https://www.zeroknowledge.fm/92

Solhint: linting utility for Solidity code
https://github.com/protofire/solhint

HookPad
https://hookpad.io
Blockchain event processing solution for dapp developers

Smart Contracts on Substrate – Shawn Tabrizi
https://www.youtube.com/watch?v=EjBTOBrdLrw

While Blockchain Platforms Struggle With Consensus, MATRIX AI Perfects It
https://blog.usejournal.com/while-blockchain-platforms-struggle-with-consensus-matrix-ai-perfects-it-6a417976386c

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
https://twitter.com/ajlopez

Blockchain: Links And Resources (395)

Previous Post
Next Post

The Cutting Edge of Sidechains: Liquid and RSK
https://www.rsk.co/noticia/the-cutting-edge-of-sidechains-liquid-and-rsk/

What is Ethereum?
https://medium.com/on-the-block/what-is-ethereum-fb6b7c33e21d

Getting the most out of CREATE2
https://blog.zeppelinos.org/getting-the-most-out-of-create2/

Public Blockchains Will be a Productivity Revolution Says EY on Launching Zk-Snarks For Ethereum
https://www.trustnodes.com/2019/06/01/public-blockchains-will-be-a-productivity-revolution-says-ey-on-launching-zk-snarks-for-ethereum

StarkDEX: Bringing STARKs to Ethereum
https://blog.0xproject.com/starkdex-bringing-starks-to-ethereum-6a03fffc0eb7

Justin Sun won the bid to have lunch with Warren Buffett, paying $4.57 million
https://www.theblockcrypto.com/tiny/justin-sun-won-the-bid-to-have-lunch-with-warren-buffett-paying-4-57-million/

Build on EOSIO
https://eos.io/build-on-eosio/

Scaling of Ethereum; Sharding Explained
https://medium.com/altcoin-magazine/scaling-of-ethereum-4cb76a3485c9

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
https://twitter.com/ajlopez

 

Blockchain: Links And Resources (338)

Previous Post
Next Post

Venezuela comercia más de 8000 BTC en LocalBitcoins por Tercer Mes Consecutivo
https://www.criptonoticias.com/mercados/venezuela-comercia-btc-localbitcoins-tercer-mes/

Bitcoin Timestamp Security
https://medium.com/@lopp/bitcoin-timestamp-security-8dcfc3914da6

Mainframe Developers
https://mainframe.com/developers/

Mainframe OS Developer Edition Now Available — Bounties Offered to Dapp Developers
https://blog.mainframe.com/mainframe-os-launch-2019-71689d0c5ec

The Best Intermediate-ish Crypto Resources
https://medium.com/@ctaylormpearson/the-best-intermediate-ish-crypto-resources-c385f1cba4c

What are the different types of Digital Ledger Technologies & how they work?
https://medium.com/datadriveninvestor/what-are-the-different-types-of-dlts-how-they-work-8ddeeda2d3a1

The business of sending transactions on Ethereum
https://medium.com/coinmonks/the-business-of-sending-transactions-on-ethereum-e79fd9a2b88

Blockchain’s Killer App: Crypto-Powered Web Browser Brave Hits 20 Million Downloads
https://www.ccn.com/blockchains-killer-app-crypto-powered-web-browser-brave-hits-20-million-downloads

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Blockchain: Links And Resources (302)

Previous Post
Next Post

Decentraland September Land Market Analysis – Effects of Over $1M in Land Sales This Month!
https://dclblogger.com/decentraland-september-land-market-analysis-effects-of-over-1m-in-land-sales-this-month/

IBM Helps Kenyan Agriculture Flourish On Twiga Blockchain
https://cryptobriefing.com/ibm-kenya-agriculture-twiga-blockchain/

Debugging EVM bytecode with radare2
https://blog.positive.com/debugging-evm-bytecode-with-radare2-9e0e13cbd936

Sesocio.com migra a la Blockchain y lanza su criptomoneda la Inve Coin
https://www.ambito.com/sesociocom-migra-la-blockchain-y-lanza-su-criptomoneda-la-inve-coin-n5005239

Request for public feedback: how well organized / useful / understandable are our sharding and Casper educational materials?
https://www.reddit.com/r/ethereum/comments/a6e0au/request_for_public_feedback_how_well_organized/

Debugging solidity contract with the go-ethereum evm cmd
https://ethereum.stackexchange.com/questions/23362/debugging-solidity-contract-with-the-go-ethereum-evm-cmd

EVM.Debugger
https://hexdocs.pm/evm/EVM.Debugger.html

Ethereum Chat Startup Status Lays Off 25% of Staff
https://www.coindesk.com/ethereum-chat-startup-status-lays-off-25-of-staff

Angel “Java” Lopez
https://github.com/ajlopez
http://www.ajlopez.com
http://twitter.com/ajlopez