ethereum client

Case Study: Delivering an Ethereum client to the market in 7 months

ethereum client

Ethereum is frequently referred to as the second most famous cryptocurrency, after Bitcoin. Though unlike Bitcoin—and most cryptocurrencies—Ethereum is to be much more than just a medium of exchange or a store of value. Instead, Ethereum aims to present itself as a decentralized computing network built on blockchain technology. Here you can read more about the differences between Ethereum and Bitcoin. There is no doubt about the adoption of cryptocurrencies as legal tender in national economies. They can bring solutions to many industries, for example, the art industry.

One of our clients asked us to help them with the development of an Ethereum client because they needed a highly-skilled team, ready to swiftly deliver the Ethereum client to the market. The client was a technology company that builds cryptocurrencies and blockchains for a variety of businesses. Above all, they valued scientific research and formal methods in their work.

What is an Ethereum client?

Ethereum client is a piece of software that enables users to interact with the Ethereum p2p network.  This means:

  • Downloading the whole blockchain state from other clients in the network
  • Sending and receiving Ethereum transactions
  • Processing and validating transactions locally, to recreate a blockchain state
  • Integrating with various external tools in the Ethereum ecosystem such as Miner or External wallets via a standard set of JSON RPC endpoints.

The most comprehensive overview of the inner workings of Ethereum can be found in the so-called yellow paper

This is a highly technical document that describes all of the data structures and operations that a fully functioning Ethereum client needs to support. 

For anyone interested  in just the gist of things, there exists a whitepaper intended for the broader public; https://ethereum.org/en/whitepaper/

Steps in building the Ethereum client

Assembling the team 

Our agile team of developers has started the project with two experienced Scala engineers, working in a close partnership with the client’s developers. After successfully reaching the first project goals together as an accelerated team, the team scaled up to four experienced engineers on the Scalac side. 

Scala programming language for secure Etherium client

One of the reasons for creating another Ethereum client was the need to diversify the landscape of Ethereum classic clients. Users of Ethereum Classic currency have much less choice than users of its sister currency, called just Ethereum. 

Another reason was the choice of the Scala programming language. According to our client;

Scala offers security guarantees that other languages do not.

So, the company decided to develop the Ethereum client functionally.  The choice of Scala was a natural consequence of that approach. Furthermore, as Scala works on JVM, it was an easy way to use a significant number of libraries, all ready to use, which would also help to shorten the time to market.

Key features of the Ethereum client

Ethereum Virtual Machine

One of the key features of Ethereum are the so-called “Smart Contracts”, which are pieces of code and state, living on the Ethereum blockchain. These programs make the Ethereum blockchain really flexible and suitable for different sets of applications.

Every Ethereum client must have the ability to execute smart contracts to correctly process transactions. All smart contract executions happen on the Ethereum Virtual Machine, a stack-based virtual machine, with over 140 opcodes (operations)

Merkle Patricia Tree 

One of the requirements for a fully functional Ethereum client is the ability to execute transactions contained in blocks, and then validate the resulting world state against the block header. 

To make this possible, as with all other Ethereum nodes, we implemented a data structure called the Merkle Patricia Tree. The Merkle Patricia Tree is a cryptographically authenticated data structure used to hold key-value bindings.

It is also fully deterministic, which means that two trees with the same key-value binding will always have the same root hash. 

This property is key to Ethereum state validation. It means that each node in the network can execute a set of transactions and be sure to end up in the same state as other nodes.

Ethereum network stack

The node created by Scalc implements all of the necessary features required for successful network communication. The main features are:

  • RLP encoding, serialization format used by all of the clients over the network
  • A full set of messages supported by all of the clients
  • An RLPx transport protocol, an encrypted protocol working over TCP required to communicate between clients. A full specification can be found at; https://github.com/ethereum/devp2p/blob/master/rlpx.md
  • A node discovery protocol.  As for now, the node does not implement a fully working Kademlia protocol, but rather a simplified protocol minimal enough to discover peers. There are plans to upgrade it to full Kademlia

JSON RPC API

JSON RPC API is a standard way for users to interact with their Ethereum clients. Our node implements a whole set of endpoints defined by Ethereum standards;  

Security

Taking into account that every Ethereum client works in a highly adversarial setting in which every vulnerability could be used by malicious actors to steal user funds, each of the components needed to be implemented with great attention to detail. 

The initial release of our Ethereum node underwent a security audit by external auditors. The audit didn’t find any critical vulnerabilities, but only 3 medium ones that were quickly resolved or discussed with the auditors. 

Results

By using Scala to implement the Ethereum node, the Client was able to deliver a fully working Ethereum client with all its necessary features, in only 7 months, with a small team of developers. This was possible due to the rich JVM ecosystem of libraries that Scala can take advantage of,  as well as the general brevity of the language.

After the successful implementation of the Ethereum client, our engineers have since been involved in the development of further blockchain endeavors.

Blockchain by Scalac 

Web Dapp Catalog Based on Ethereum Blockchain Tokens

Tezos Blockchain Data Management Solution

Download e-book:

Scalac Case Study Book

Download now

Authors

Daria Karasek
Daria Karasek

Marketing Hero at Scalac. I strongly believe in creating opportunities rather than waiting for them to come. As befits Scalac team member I'm a hard worker, I always try to do the right thing and have a lot of fun! I'm an awesome friend and content writer, in that order. When I'm out of the office, I love to cook delicious Italian food and play board games with my friends. #boardgamegeek

Latest Blogposts

23.04.2024 / By  Bartosz Budnik

Kalix tutorial: Building invoice application

Kalix app building.

Scala is well-known for its great functional scala libraries which enable the building of complex applications designed for streaming data or providing reliable solutions with effect systems. However, there are not that many solutions which we could call frameworks to provide every necessary tool and out-of-the box integrations with databases, message brokers, etc. In 2022, Kalix was […]

17.04.2024 / By  Michał Szajkowski

Mocking Libraries can be your doom

Test Automations

Test automation is great. Nowadays, it’s become a crucial part of basically any software development process. And at the unit test level it is often a necessity to mimic a foreign service or other dependencies you want to isolate from. So in such a case, using a mock library should be an obvious choice that […]

04.04.2024 / By  Aleksander Rainko

Scala 3 Data Transformation Library: ducktape 0.2.0.

Scala 3 Data Transformation Library: Ducktape 2.0

Introduction: Is ducktape still all duct tape under the hood? Or, why are macros so cool that I’m basically rewriting it for the third time? Before I go off talking about the insides of the library, let’s first touch base on what ducktape actually is, its Github page describes it as this: Automatic and customizable […]

software product development

Need a successful project?

Estimate project