How to Scale Ethereum Dapps
Latest posts by Aran Davies (see all)
- How to Build Hyperautomation Tools? - 5 Aug, 2022
- How Many People Does It Take to Form An iOS App Development Team? - 1 Aug, 2022
- How Many People Does It Take to form An Android Development Team? - 29 Jul, 2022
Interested in knowing how to scale Ethereum Dapps? This is a great question which we will answer here.
Scaling your Ethereum Dapp is a great way to reach more customers and increase your profits. So, let’s see in detail how to scale ethereum DApps.
Decentralization and security overshadow scaling Ethereum DApp
Blockchain and crypto startups prefer the Ethereum platform. It’s a peer-to-peer (P2P) network. It helps them to set up a decentralized business. The Ethereum public blockchain network doesn’t have centralized servers. Buyers and sellers can communicate directly without intermediaries.
A brief note about decentralization on the Ethereum public blockchain network
Check out how Storj.io has opened up the cloud storage market to anyone who wants to make money from their unused storage.
You can put your excess storage up for rent on Storj. You can earn the crypto token STORJ. This is possible because the Ethereum blockchain offers decentralization. Read more about it in our guide on how to build decentralized cloud storage solutions.
Such decentralization makes a network immutable. Hackers might be able to take over one server, however, the data is spread over a number of other servers in pieces.
Since it requires every node on the Ethereum blockchain to store all the blocks, hackers can only access a small part of the complete data package.
A brief note about the consensus algorithm on Ethereum
Ethereum currently uses the “Proof of Work” (POW) consensus algorithm for transaction validation though it is planning to change over soon.
The POW algorithm requires miners to solve a computing-intensive cryptographic puzzle to create new blocks. Miners run up massive electricity bills to do this.
The Ethereum community increases the complexity of the puzzle periodically. Therefore, miners will need to use even more computing power.
Here too, every node must validate transactions and that a miner has indeed solved a block. Every miner must validate the creation of every new block. Maintaining the decentralized security on Ethereum depends on this.
Read about it in our POW-vs-PoS comparison.
However, the more the network grows, the harder it is for hackers to stage a “51% attack” by capturing the majority of the network’s computing power. The Ethereum network has never been hacked in this way.
Note: Many observers talk about the Ethereum DAO hack in 2016. They wonder whether Ethereum is secure enough. Hackers did exploit the vulnerabilities of a smart contract run on the Ethereum network. However, they didn’t exploit any vulnerability in the actual Ethereum network.
The impact of decentralization and security on the scalability of Ethereum
The combination of decentralization and security makes it hard to scale the Ethereum network. Each node stores even more data as the network grows.
More and more nodes participate in the transaction validation process due to this growth. As a result, the Ethereum network can’t scale well and is often overloaded.
This phenomenon is known as the “Blockchain Trilemma”. Read why it’s hard to solve the blockchain trilemma.
There is good news, however! There is research underway to determine how Ethereum can be scaled better, and I will cover a few key approaches.
Ethereum sidechain: #1 of Ethereum blockchain scaling tips
1. Scale Ethereum decentralized applications (DApps) by using a sidechain (AVAILABLE)
In this guide on how to scale Ethereum DApps, I will first explain the use of a sidechain blockchain. This strategy to scale Ethereum decentralized applications works on the premise that not all DApps require the same level of security.
1a. Differentiating between different types of DApps
Consider a DApp where you will allow the transfer of thousands of Ethers. Hackers have more incentives to attack such a DApp.
Compare that with DApps for social networks. Users will likely spend a small number of crypto tokens when using it. Hackers will not find it a lucrative target due to lesser values being transacted.
First, determine the economic value of the DApp. Subsequently, you can determine the level of security required.
You can now set customized rules for the DApp. Read more about this differentiation in “DAppChains: Scaling Ethereum DApps Through Sidechains”.
E.g., use the POW consensus algorithm for a high-value DApp. Implement the PoS algorithm for a DApp with lower economic or transaction values. You can run the 2nd DApp on a different blockchain.
Use a “Sidechain” to run this 2nd DApp. A sidechain is just another blockchain that‘s attached to the main blockchain. A mechanism called the “two-way peg” establishes a connection between the two blockchains.
1b. A brief note about the “two-way peg” process
The ’two-way peg‘ process works as follows:
- Send your Ether (ETH) on the mainnet to a predetermined address. You can’t use this cryptocurrency fund since it’s locked.
- There’s a confirmation message after the above transaction. Subsequently, there’s a “cool-off” period.
- Your DApp will use a different crypto token and a different blockchain. You set up an exchange rate between Ether and your crypto token.
- You get crypto tokens from the mainnet based on this exchange rate.
- Execute transactions on your DApp. Return the remaining tokens to the mainnet.
- You get a confirmation message for this transaction.
- Since your DApp runs on a different chain, you can create customized rules. E.g., use the PoS algorithm instead of POW.
- Computations for your DApp happen on the sidechain. This doesn’t cause congestion on the mainnet.
Read “What are sidechains?” for more information.
1c. How can you use sidechains to scale an Ethereum DApp?
Loom Network, a company providing blockchain solutions offers a solution called the “Basechain”. It’s a blockchain network that’s interoperable with Ethereum. Basechain is interoperable with Bitcoin and a few other blockchain networks too.
It uses the DPoS (Delegated Proof of Stake) consensus algorithm. You can build a DApp and deploy it on the Basechain. Subsequently, your DApps can interact with the Ethereum network.
What if you already have a DApp on the Ethereum network? You can port it to Basechain easily.
Summary: You can use sidechains to scale your Ethereum DApps.
2. Scale an Ethereum DApp using “Plasma” (FUTURISTIC)
You can think of the “Plasma” as a separate blockchain on top of the Ethereum mainnet. These separate blockchain networks are also called the “Child” chains.
“Plasma” chains are copies of the Ethereum mainnet, however, they are smaller. Technology solutions like “Merkle trees” help one to create many of these chains.
You can offload computational workload to these chains. The Ethereum project team has come up with security mechanisms like the “fraud proofs” for these chains. You can have different block validation mechanisms on these “Plasma” chains.
2a. The working of a “Plasma” chain
While you can run your DApps on a Plasma child chain and execute your transactions, you don‘t broadcast every transaction in the mainnet. You only periodically broadcast a transaction in the mainnet. This can provide a snapshot of the child blockchain transactions in that period.
Hire expert developers for your next project
1,200 top developers
us since 2016
A “Plasma” chain decongests the mainnet. You can set up customized rules for these chains. E.g., you can use the PoS algorithm instead of POW.
2b. The advantages of the “Plasma” chain
Plasma can offer the following advantages:
- The mainnet acts as the “Root” blockchain. It provides the security of a fully decentralized blockchain.
- One Plasma chain can have its’ own “child” chain. This can give a tree structure to the network. This can decongest the network.
- The mainnet needs to broadcast the summary transaction. You need the mainnet if there’s a dispute among different child chains. The mainnet doesn’t need to take up other workloads.
- Each Plasma child chain sets its‘s own customized rules.
- Users of a Plasma child chain can use the “Plasma Exit” mechanism. If they suspect foul play in a Plasma child chain, they can withdraw their funds. They can return to the mainnet with those funds. They need to submit “Exit” transactions to the mainnet to do this.
- Since each Plasma child chain can do its own complex calculations, it will allow significant scalability.
2c. A disadvantage of the “Plasma” chain
Plasma has a potential disadvantage. Suppose a lot of foul play is going on in the child chains, and many users want to simultaneously exit those chains. Such a sudden spike of transactions can impact the Ethereum mainnet.
However, the “Plasma Exit” mechanism also has a “Challenge” period, allowing another user to dispute a claim. In case of a sudden spike in “Exit” transactions, the community can decide to extend the challenge period to handle the load on the mainnet better.
2d. What’s in the future for “Plasma”?
Plasma release was delayed for years which raised questions about its credibility. It is now considered as a noble attempt to find a robust solution to ethereum scalability. Some research groups are now focused on Optimistic Rollups as the scalability solution for the ethereum network.
Summary: The plasma chain is considered ‘dead’ now. Rollups have taken their place now as DApps scalability solutions on the ethereum network.
3. Scale a DApps using the technology offered by the Ethereum “Casper protocol” (FUTURISTIC)
The Ethereum project team plans to transition to the “Casper protocol”. The team has planned it for a while, and it’s working on this transition. This transition will address many aspects. These include the question of scalability.
3a. A brief note about the “Casper protocol”
The transition to the Casper protocol involves plenty of work. The Casper protocol will use a variant of the PoS (Proof of Stake) consensus algorithm.
Therefore, the Ethereum project will transition from the POW consensus algorithm to the PoS algorithm.
Read more about their comparison in “Proof of Work vs Proof of Stake Comparison”.
The PoS algorithm involves “Stakers”. They stake their Ethers for transaction validation. Any manipulation will result in stakers losing their money. That acts as a deterrence against manipulation.
This is unlike POW, where miners may not own any Ether at all. The amount of stake and the duration of it determines the priority a Stakeholder gets.
The PoS algorithm has its share of drawbacks though. Assume a malicious stakeholder stakes plenty of Ether for a long period. The stakeholder gets the job of transaction validation and manipulates transactions of very high value. Despite the initial investments, the stakeholder will make a significant profit.
As we can see, both POW and PoS have different kinds of drawbacks. The Ethereum project team plans to address them using the Casper protocol.
3b. The advantages of the Casper protocol
The Casper protocol sets the following rules to prevent the misuse of the PoS algorithm. These rules are as follows:
- Stakers will need to stake their Ether for a considerable period as a “security deposit”. These Ethers will be locked for this period.
- The Ethereum project will confiscate the Ethers of the malicious stakers. It will also bar them from staking in the future.
That’s an improvement from the PoS algorithm. The transition to the Casper protocol will improve the scalability of the Ethereum network.
3c. What’s in the future for the Casper protocol?
The Ethereum project is working on the transition to the Casper protocol. This work has been ongoing for a while now. However, plenty of work remains to be done. The Ethereum project team hasn’t officially announced any official target date for this transition.
Summary: You can’t yet use the technology solutions offered by the Casper protocol to scale your DApps. You need to wait for the transition to complete.
4. Use the “Raiden Network” to scale an Ethereum DApp (AVAILABLE)
“Raiden Network” is an off-chain solution to scale an Ethereum DApp. Nodes participating in this network can open a “state channel” and communicate with each other using it. This is designed for payment transactions.
Brainbot Labs Est. has developed the Raiden Network. The objective of this project is to provide an off-chain scaling solution. Ethereum users can use it since it has already been released.
The Raiden Network intends to offer near-instant payment transactions. Users should have to pay fewer fees. You can use any ERC-20 tokens on the Raiden Network.
The “root blockchain” doesn’t record all the transactions executed through the Raiden Network. It records only a periodical summary.
Users initiating regular and small payment transactions might find the Raiden Network useful. An example includes subscriptions to services, etc.
You can consider the transactions on the Raiden Network as off-chain transactions. These transactions require smaller “gas” fees. The Raiden Network makes such transactions cheaper for users.
The transactions on the Raiden Network don’t congest the mainnet. That improves the scalability of the Ethereum network.
Summary: You can use the Raiden Network as a scaling solution since it’s already tried and tested in the marketplace.
5. Use “Sharding” for scaling the Ethereum blockchain network (FUTURISTIC)
“Sharding” is originally a database management concept. Horizontal portions of the database are stored in separate server instances. The database management system uses an appropriate indexing solution.
At the time the query is made, indexing helps with loading data from the appropriate partition. You get your query outputs quicker.
This makes the database more efficient. Read more about database sharding in “Database sharding explained in plain English”.
Let’s see how sharding can be used in a blockchain network.
5a. What does “sharding” mean in blockchain?
In the case of a blockchain network, sharding will mean the following:
- A group of nodes will only store data of one horizontal portion of the blockchain database, i.e. one shard.
- Different groups of nodes will store different shards.
- Transactions and transaction validation will be confined to one shard.
- Since nodes don‘t load the entire blockchain data and don‘t participate in all transaction validation, as such, it improves power efficiency and scalability.
Read more about blockchain sharding in “Blockchain FAQ #3: What is Sharding in the Blockchain?”.
5b. The prerequisites for implementing sharding in a blockchain network
Sharding can‘t work with the POW algorithm. Nodes in one shard can‘t even see all transactions, hence they can‘t participate in every transaction validation.
Therefore, a blockchain network needs to use the PoS algorithm for sharding. Each shard on such a blockchain will have separate stakeholders. These stakeholders will validate transactions in that shard.
5c. The challenges in implementing sharding in a blockchain network
Sharding could help to make a blockchain network more scalable. However, it has the following limitations:
- You will find it hard to design and implement sharding. The concept isn’t new in the world of databases, however, its implementation with blockchain technologies is very complex.
- Users can only request transactions that involve data within one shard.
5d. What’s in the future for sharding on Ethereum?
The Ethereum blockchain network currently uses the POW consensus algorithm. It can use the PoS algorithm only after the transition to the Casper protocol is complete. The Ethereum project team can implement sharding only after that.
Summary: You can’t currently use sharding for scaling your Ethereum DApp.
A brief note about the Ethereum development tools
The Ethereum ecosystem offers useful developer tools for building Ethereum DApps. Look for programmers with good knowledge of the following for DApps development:
- Solidity: Ethereum developers use this popular programming language to code smart contracts.
- Remix: It’s an IDE to code a Solidity smart contract.
- Ganache: It’s a well-known Ethereum client.
- Truffle: It’s a tool to organize, compile, test, and deploy Ethereum smart contracts.
- Ropsten: It’s a test network for testing Ethereum smart contracts.
- MetaMask: It’s a browser extension as well as an Ethereum wallet. You can use it to buy real as well as dummy Ether. You need real Ether to deploy your DApps on Ethereum, and you test it using dummy Ether.
Depending on your use case, you might need to use technologies like IPFS (Inter-Planetary File System). Note that Ethereum is still a new technology. Conduct appropriate background and expertise checks with due diligence before hiring developers.
Read our article for more information on DApps development.
If you find yourself lacking the required skills or experience to create your own blockchain product then why not take a moment to describe your project to us at DevTeam.Space via this link so that we can get in touch to answer any questions you might have.
Should you require a developer or dev team then our community of field expert software designers and engineers have all the expertise and skillsets you will need to ensure your project is a success.
Frequently Asked Questions
The Ethereum blockchain.
DApp stands for Decentralized Application. It is an app that runs off a decentralized network and as such, has no single centralized server or authority. The backend code of a DApp comprises of smart contracts whereas the frontend user interface can be in any programming language. Any user with an internet connection and a bit of know-how can use DApps.
DeFi apps using DeFi tokens and a crypto index fund, non-fungible tokens (NFTs) tokenizing digital artwork, decentralized autonomous organizations (DAOs), etc. are a few examples of decentralized applications.