Shardeum: an EVM-based autoscaling blockchain platform

Shardeum is an innovative EVM-compliant blockchain platform that leverages dynamic state sharding to achieve unprecedented scalability. By implementing a sharding model, Shardeum ensures faster processing times and lower transaction costs without compromising security or decentralization.

Background

The meteoric rise of Bitcoin and Ethereum has brought about a revolutionary change in how society exchanges, stores, and organizes digital assets, representing a profound transformation of the digital economy and societal infrastructure. In 2015, the Ethereum network made it possible for the first time to create fully programmable smart contracts on a decentralized network, setting off a revolution. The demand for decentralized applications has since exploded with use cases like AMMs, DeFi, NFTs and gaming bringing new users into the space who otherwise were not interested in just cryptocurrency. As the popularity of Ethereum has grown over the years, the demand for transactions on the network has reached the maximum capacity of 20 transactions per second (TPS). This has led to the transaction fees rising from under 1 cent in 2015 to about $50 in 2022. Many applications which were feasible on Ethereum are no longer feasible due to the high transaction fees. There is a growing need for a smart contract platform that can keep transaction fees low not just when the network is new, but even years later as the number of transactions continue to grow.

In order to keep transaction fees low in a sustainable way, a network must be able to scale to accommodate an ever-increasing number of transactions. Of course scalability is not the only important factor. A network must also maintain a high level of decentralization and security. The scalability trilemma says that as a blockchain tries to achieve scalability, decentralization and security, it will only be able to attain any two of these. With security being an essential requirement, this means that there will be a trade-off between scalability and decentralization. A lack of scalability leads to slow processing of transactions and higher transaction fees resulting in a bad user experience. A lack of decentralization is not immediately felt as a bad experience, but puts all the users at risk of losing assets should the lack of decentralization be exploited. Sharding of state data across the many nodes available in a large network can increase parallel processing and also provide a solution to the scalability trilemma.

As Vitalik Buterin, the founder of Ethereum pointed out, sharding is the solution to the scalability trilemma. The most general form of sharding referred to as state sharding divides the nodes in the network into smaller groups which store a subset of the state data and process different sets of transactions to achieve parallel processing. The transaction throughput of the network increases directly proportional to the number of shards in the network. State sharding provides a way to achieve both scalability and decentralization while maintaining security. However, many of the current platforms that employ state sharding do so in limited ways and the grouping of transactions into blocks adds complexity to the sharding protocol. No decentralized network has yet demonstrated linear scaling or auto-scaling.

Although sharding increases throughput, it introduces additional complexity. Most implementations of sharding break atomic composability which allows multiple smart contracts to be chained together in one transaction. Furthermore, sharding can potentially reduce the network’s security if naively implemented. Adversaries only need to compromise the byzantine fault tolerance limits of a single shard instead of the entirety of the network to halt the shard or engage in arbitrary state changes. Adversaries can also launch other attacks, such as cross-shard takeover attacks, new data availability attacks, sharding-specific replay attacks and other forms of attacks against sharded networks. Therefore, the sharded networks’ architecture must be secure, robust and mitigate existing attack vectors to retain security. 

Features

  • Scalability: Horizontal scalability through sharding
  • High Performance: Low latency and high throughput
  • Security: Advanced cryptographic techniques and robust consensus protocols
  • Decentralization: Truly decentralized network with no single point of failure
  • Interoperability: EVM compatibility for existing DApps and smart contracts

Getting Started

Prerequisites

  • Node.js (v18.19.1)
  • npm (v10.2.4)
  • Rust (v1.74.1)
  • Docker (optional, for containerized deployment)

Setting Up Your Environment

Shardeum requires specific versions of Nodejs, Rust and other build tools to run.

We have detailed setup instructions in this page

Installation

Clone the repository:

git clone https://github.com/shardeum/shardeum.git
cd shardeum

Install dependencies:

npm ci

Network Configuration:

git apply debug-10-nodes.patch

Learn more about the different config options here

Compile project

npm run prepare

Install the Shardus CLI:

npm install -g shardus
npm update @shardus/archiver

Running the Network Locally

To start a local Shardeum network with 10 nodes, run:

shardus start 10

Running the JSON-RPC Server

Clone the JSON-RPC server repository:

git clone https://github.com/shardeum/json-rpc-server.git
cd json-rpc-server
npm install

Start the server:

npm run start

The default RPC URL is http://localhost:8080.

Testing with MetaMask

To test your local Shardeum network using MetaMask:

Install the MetaMask extension.

Add the Shardeum network to MetaMask:

Obtaining Test Tokens and Configuring the Genesis File: To receive SHM tokens for testing on your local Shardeum network, you need to add your wallet address to the src/config/genesis.json file. Open this file in a text editor and add an entry for your wallet address with the desired SHM balance like this:

"YOUR-WALLET-ADDRESS": {
    "wei": "200000000000000000000000000"
},

Stopping and Cleaning Up

To stop the network and clean up resources:

shardus stop && shardus clean && rm -rf instances

Health Checks

Diagnostic endpoints to check the health of the node

  • GET /is-alive this endpoint returns 200 if the server is running.
  • GET /is-healthy currently the same as /is-alive but will be expanded.