First of all, modern blockchain systems do not scale well. For example, the bandwidth of Ethereum is only 20 transactions per second, and despite its many advantages, it is not suitable for large businesses.
At the same time, Ethereum is valued for its powerful protection against hacking and network outages. So you should not write it off. It is much more advisable to correct the disadvantages of Ethereum and turn them into advantages.
Plasma Cash as a solution for privacy and scalability in Ethereum
Plasma is a technology introduced by Vitalik Buterin, co-founder of the Ethereum project, at the EthCC conference in Paris in 2018. It was developed jointly with Joseph Pune, co-founder of the Lightning Network, and announced as a solution that increases the computing power of the Ethereum blockchain. The first Plasma news leaked to the media in 2017.
This platform is an external level of smart contracts that can interact with the main blockchain, thereby offloading the root chain, reducing transaction fees for smart contracts and decentralized applications (DApps).
Detailed information on the development was presented in the document “ Plasma: Scalable Autonomous Smart Contracts ”, dated August 2017.
Buterin acknowledged that Plasma has scalability issues: every user must download and authenticate each Plasma block, which prevents exponential scaling.
To correct this shortcoming, Plasma Cash was developed - a subsidiary chain consisting of a smart contract and a private network based on Node.js, periodically transferring its state to the root chain (Ethereum). It provides decentralization, security and scalability on the blockchain, thereby solving the Scalability Trilemma.
An important advantage of Plasma Cash compared to Plasma is that it attracts the attention of users only to those blocks that contain the coins of interest to them:
“Now users need to check the availability and correctness of the Plasma chain only for a special index related to the coins that they want to spend, own and that interest them,” Buterin said.
According to the developers, Plasma Cash is an effective cure for hacking in Ethereum. Each Plasma coin has an owner and is unique. No one can take possession of another user's coins without his knowledge. The holder of the coin can prevent a potential fraudulent withdrawal of funds through the “complaints” system by presenting his “evidence” in the history of his coin.
Testing Plasma Cash at Mongo Atlas
Due to its novelty, Plasma Cash is still little studied. Blockchain experts are actively testing its interaction with various cloud services and databases, fix shortcomings and find ways to fix them. In particular, tests in Mongo Atlas revealed the following advantages when working with Plasma:
- Reliable protection against data loss , as several replicas are synchronized among themselves in a cluster.
- Quick access , since the cluster can be created on the three most popular cloud platforms: Amazon, Google, Azure. As a result, the Plasma Cash node can be deployed in many data centers located close to Mongo Atlas. We have proved that the speed does not drop much, even if Plasma nodes are deployed in more remote data centers.
- Plasma nodes used only in read mode can be connected to one Mongo cluster and located in different parts of the world, which improves geo-scalability (nodes are closer to users).
- Deploying a new node is easy , as you don’t need to re-sync everything. You can simply connect to an existing Mongo cluster or quickly make a copy and configure the connection to it.
- Scaling a database is easy . Over time, there is more data, and you can increase the size of the nodes in the cluster as needed.
We used the following servers for testing:
- 3 virtual Azure servers Standard E4s v3 (4 vcpus, 32 GiB memory). On each server 3 nodes are lifted. One of them can submit blocks to the root chain.
- Each node is connected to its Mongo Atlas cluster M50, which contains 3 nodes in replica mode.
Test 1
3 nodes receive 100k transactions each. In total, all 9 nodes contain 300k transactions and tokens.
Initial state: last block # 213; 0 transactions and tokens are stored in the database.
00:00 - 3 scripts are launched that generate and send 100k transactions
00:29 - Sending of 100k transactions to nodes # 1 and # 2 began
00:32 - Sending of 100k transactions to node # 3 has begun
00:32 - Node # 1 took 11703 transactions from the pool and forms block # 214 (9fb)
00:34 - Noda # 2 took 27088 transactions from the pool and forms block # 214 (ef4)
00:34 - Block # 214 (9fb) is signed and sent to other nodes for validation
00:36 - Noda # 3 took 11900 transactions from the pool and forms block # 214 (983)
00:37 - Block # 214 (9fb) is validated and sent to the root chain
00:38 - Block # 214 (983) is signed and sent to other nodes for validation
00:38 - Block # 214 (ef4) is signed and sent to other nodes for validation
00:40 - Block # 214 (983) was validated and sent to the root chain
00:41 - All nodes received information from the root chain that block # 214 (9fb) has been added and 11703 transactions are beginning to be applied
00:45 - All nodes received information from the root chain that block # 215 (983) has been added and 11900 transactions are starting to apply
00:51 - Block # 214 (ef4) is validated and sent to the root chain
00:52 - Node # 1 took 51,469 transactions from the pool and forms block # 216 (ea0)
00:56 - Noda # 3 took 55102 transactions from the pool and forms block # 216 (f75)
00:58 - Demo script finished its work for node # 2
00:58 - Block # 216 (ea0) is signed and sent to other nodes for validation
00:58 - All nodes received information from the root chain that block # 216 (ef4) has been added and 27088 transactions are starting to apply
01:04 - Block # 216 (f75) is signed and sent to other nodes for validation
01:14 - Noda # 2 took 72912 transactions from the pool and forms block # 217 (f85)
01:15 - Demo script finished its work for nodes # 1 and # 2
01:17 - Blocks # 216 (f75) and # 216 (ea0) are validated and sent to the root chain
01:21 - Block # 217 (f85) is signed and sent to other nodes for validation
01:26 - Blocks # 217 (f75) and # 218 (ea0) are added to the root chain and the nodes begin to apply 51469 and 55102 transactions, respectively
01:27 - Block # 217 (a85) is validated and sent to the root chain
01:41 - Noda # 1 took 36828 transactions from the pool and forms block # 219 (46f)
01:41 - Noda # 3 took 32998 transactions from the pool and forms block # 219 (bb3)
01:43 - All nodes received information from the root chain that block # 219 (a85) has been added and 72912 transactions are starting to be applied
01:46 - Block # 219 (46f) is signed and sent to other nodes for validation
01:46 - Block # 219 (bb3) is signed and sent to other nodes for validation
01:53 - Noda # 2 processed all 100k transactions that were in the pool
02:37 - Block # 219 (bb3) is validated and sent to the root chain
02:41 - Block # 219 (46f) is validated and sent to the root chain
02:48 - Blocks # 220 (bb3) and # 221 (46f) are added to the root chain and the nodes begin to apply 32998 and 36828 transactions, respectively
02:54 - Node # 1 processed all 100k transactions that were in the pool
02:55 - Noda # 3 processed all 100k transactions that were in the pool
04:12 - All nodes contain 300k transactions and tokens last block # 221
Test 2
3 nodes receive 1kk of transactions. In total, all 9 nodes contain 3kk transactions and tokens.
Initial state: last block # 213; 0 transactions and tokens are stored in the database.
00:00 - 3 scripts are launched that generate and send 1kk transactions
02:29 - Started sending 1kk transactions to nodes # 1 and # 2
02:33 - Noda # 1 took 11668 transactions from the pool and forms block # 222 (510)
02:35 - Block # 222 (510) is signed and sent to other nodes for validation
02:37 - Block # 222 (510) is validated and sent to the root chain
02:38 - Noda # 2 took 46378 transactions from the pool and forms block # 222 (a9d)
02:38 - Started sending 1kk transactions to node # 3
02:41 - Noda # 3 took 5504 transactions from the pool and forms block # 222 (387)
02:42 - Block # 222 (387) is signed and sent to other nodes for validation
02:44 - Block # 222 (a9d) is signed and sent to other nodes for validation
02:44 - Block # 222 (387) is validated and sent to the root chain
02:49 - Block # 222 (a9d) is validated and sent to the root chain
02:56 - Blocks # 222 (510) # 223 (387) and # 224 (a9d) are added to the root chain and the nodes begin to apply 11668, 5504 and 46378 transactions, respectively
03:09 - Noda # 1 took 177170 transactions from the pool and forms block # 225 (e50)
03:09 - Node # 3 took 119327 transactions from the pool and forms block # 225 (ccc)
03:10 - Noda # 2 took 149772 transactions from the pool and forms block # 225 (404)
03:26 - Block # 225 (ccc) is signed and sent to other nodes for validation
03:32 - Block # 225 (404) is signed and sent to other nodes for validation
03:33 - Block # 225 (e50) is signed and sent to other nodes for validation
03:53 - Block # 225 (ccc) is validated and sent to the root chain
04:03 - Block # 225 (e50) is validated and sent to the root chain
04:04 - Block # 225 (404) is validated and sent to the root chain
04:06 - All nodes received information from the root chain that block # 225 (ccc) has been added and 119327 transactions are starting to be applied
04:14 - All nodes received information from the root chain that block # 226 (404) has been added and 149772 transactions are starting to apply
04:16 - All nodes received information from the root chain that block # 227 (e50) has been added and 177170 transactions are starting to be applied
04:32 - Node # 3 took 209436 transactions from the pool and forms block # 228 (1e9)
04:40 - Noda # 2 took 212669 transactions from the pool and forms block # 228 (e38)
04:40 - Noda # 1 took 190144 transactions from the pool and forms block # 228 (861)
05:02 - Block # 228 (1e9) is signed and sent to other nodes for validation
05:08 - Block # 228 (861) is signed and sent to other nodes for validation
05:10 - Block # 228 (e38) is signed and sent to other nodes for validation
06:13 - Block # 228 (1e9) is validated and sent to the root chain
06:13 - Block # 228 (861) was validated and sent to the root chain
06:13 - Block # 228 (e38) was validated and sent to the root chain
06:39 - Blocks # 228 (861) # 229 (1e9) and # 230 (e38) are added to the root chain and the nodes begin to apply 190144, 209436 and 212669 transactions, respectively
07:07 - Noda # 1 took from the pool 199770 transactions and forms block # 231 (e04)
07:09 - Noda # 2 took 190473 transactions from the pool and forms block # 231 (36e)
07:09 - Noda # 3 took 178807 transactions from the pool and forms block # 231 (f43)
07:34 - Block # 231 (e04) is signed and sent to other nodes for validation
07:37 - Block # 231 (36e) is signed and sent to other nodes for validation
07:37 - Block # 231 (f43) is signed and sent to other nodes for validation
08:49 - Block # 231 (e04) is validated and sent to the root chain
08:51 - Block # 231 (f43) is validated and sent to the root chain
08:52 - Block # 231 (36e) is validated and sent to the root chain
09:47 - Blocks # 231 (e04) # 232 (f43) and # 233 (36e) are added to the root chain and the nodes start applying 199770, 178807 and 190473 transactions, respectively
10:16 - Noda # 1 took 153075 transactions from the pool and forms block # 234 (e04)
10:16 - Noda # 2 took 168035 transactions from the pool and forms block # 234 (36e)
10:16 - Noda # 3 took 166685 transactions from the pool and forms block # 234 (f43)
10:42 - Block # 234 (56d) is signed and sent to other nodes for validation
11:59 - Block # 234 (1bb) is validated and sent to the root chain
12:02 - Block # 234 (58a) is validated and sent to the root chain
12:02 - Block # 234 (56d) is validated and sent to the root chain
12:48 - Blocks # 234 (1bb) # 235 (58a) and # 236 (56d) are added to the root chain and the nodes begin to apply 153075, 168035 and 166685 transactions, respectively
13:14 - Node # 1 took 112226 transactions from the pool and forms block # 237 (5c0)
13:16 - Node # 2 took 87550 transactions from the pool and forms block # 234 (58a)
13:16 - Node # 3 took 99594 transactions from the pool and forms block # 234 (56d)
13:30 - Block # 237 (5c0) is signed and sent to other nodes for validation
13:32 - Block # 237 (58a) is signed and sent to other nodes for validation
13:34 - Block # 237 (56d) is signed and sent to other nodes for validation
14:47 - Block # 237 (58a) is validated and sent to the root chain
14:53 - Block # 237 (5c0) was not validated for the specified time
14:53 - All nodes received information from the root chain that block # 237 (58a) has been added and 87550 transactions are starting to apply
14:54 - Block # 237 (56d) is validated and sent to the root chain
15:02 - Noda # 1 took 181206 transactions from the pool and forms block # 238 (c5f)
15:06 - All nodes received information from the root chain that block # 238 (56d) has been added and they are starting to apply 99594 transactions
15:12 - Noda # 2 took 51990 transactions from the pool and forms block # 239 (ad8)
15:20 - Block # 239 (ad8) is signed and sent to other nodes for validation
15:25 - Noda # 3 took 46685 transactions from the pool and forms block # 239 (857)
15:30 - Block # 238 (c5f) is signed and sent to other nodes for validation
15:34 - Block # 239 (857) is signed and sent to other nodes for validation
16:32 - Block # 239 (857) is validated and sent to the root chain
16:42 - All nodes received information from the root chain that block # 239 (857) has been added and 46685 transactions are starting to be applied
16:42 - Block # 238 (c5f) is validated and sent to the root chain
16:42 - Block # 239 (ad8) was not valid for the specified time
16:54 - Noda # 2 took 96882 transactions from the pool and forms block # 240 (e6e)
16:56 - Noda # 3 took 39704 transactions from the pool and forms block # 240 (a47)
17:02 - Block # 240 (a47) is signed and sent to other nodes for validation
17:02 - Block # 240 (e6e) is signed and sent to other nodes for validation
17:18 - All nodes received information from the root chain that block # 240 (c5f) has been added and 181206 transactions are beginning to be applied
17:45 - Block # 240 (a47) is validated and sent to the root chain
17:47 - Noda # 1 took 54956 transactions from the pool and forms block # 241 (170)
17:59 - Block # 241 (170) is signed and sent to other nodes for validation
18:09 - All nodes received information from the root chain that block # 241 (a47) has been added and 181206 transactions are beginning to be applied
18:20 - Noda # 3 took 39104 transactions from the pool and forms block # 242 (955)
18:24 - Block # 240 (e6e) is validated and sent to the root chain
18:28 - Block # 242 (955) is signed and sent to other nodes for validation
18:09 - All nodes received information from the root chain that block # 242 (e6e) has been added and 96882 transactions are starting to apply
19:06 - Demo script finished its work for node # 1
19:08 - Demo script finished its work for node # 2
19:08 - Noda # 2 took 48241 transactions from the pool and forms block # 243 (fde)
19:14 - Block # 243 (fde) is signed and sent to other nodes for validation
19:18 - Block # 241 (170) was not valid for the specified time
19:28 - Node # 1 took 86967 transactions from the pool and forms block # 243 (37c)
19:35 - Block # 242 (955) is validated and sent to the root chain
19:40 - Block # 243 (37c) is signed and sent to other nodes for validation
20:05 - All nodes received information from the root chain that block # 243 (955) has been added and 39104 transactions are starting to apply
20:15 - Block # 243 (fde) is validated and sent to the root chain
20:19 - Noda # 3 took 42981 transactions from the pool and forms block # 244 (9b5)
20:26 - Block # 244 (9b5) is signed and sent to other nodes for validation
20:28 - all nodes received information from the root chain that block # 244 (fde) was added and 48241 transactions were starting to apply
20:32 - Node # 2 processed all 1kk transactions that were in the pool
21:05 - Block # 243 (37c) was not validated for the specified time
21:15 - Node # 1 took 86967 transactions from the pool and forms block # 245 (37c)
21:32 - Block # 245 (37c) is signed and sent to other nodes for validation
21:42 - Block # 244 (9b5) is validated and sent to the root chain
21:50 - All nodes received information from the root chain that block # 245 (9b5) has been added and 42981 transactions are starting to apply
22:04 - Noda # 3 took 45361 transactions from the pool and forms block # 246 (3f9)
22:11 - Block # 246 (3f9) is signed and sent to other nodes for validation
22:51 - Block # 245 (37c) was not validated for the specified time
23:01 - Node # 1 took 86967 transactions from the pool and forms block # 246 (37c)
23:08 - Demo script finished its work for node # 3
23:15 - Block # 246 (37c) is signed and sent to other nodes for validation
23:32 - Block # 246 (3f9) was not valid for the specified time
23:42 - Noda # 3 took 52173 transactions from the pool and forms block # 246 (71d)
23:51 - Block # 246 (71d) is signed and sent to other nodes for validation
24:38 - Block # 246 (37c) was not validated for the specified time
25:01 - Node # 1 took 86967 transactions from the pool and forms block # 246 (37c)
25:06 - Block # 246 (71d) is validated and sent to the root chain
25:12 - Block # 246 (37c) is signed and sent to other nodes for validation
25:14 - All nodes received information from the root chain that block # 246 (71d) has been added and 52173 transactions are starting to apply
25:29 - Node # 3 processed all 1kk transactions that were in the pool
26:40 - Block # 247 (37c) was not validated for the specified time
26:47 - Noda # 1 took 86967 transactions from the pool and forms block # 247 (37c)
27:03 - Block # 247 (37c) is signed and sent to other nodes for validation
28:29 - Block # 247 (37c) was not validated for the specified time
28:35 - Noda # 1 took 86967 transactions from the pool and forms block # 247 (37c)
28:49 - Block # 247 (37c) is signed and sent to other nodes for validation
30:13 - Block # 247 (37c) was not validated for the specified time
30:23 - Noda # 1 took 86967 transactions from the pool and forms block # 247 (37c)
30:38 - Block # 247 (37c) is signed and sent to other nodes for validation
32:00 - Block # 247 (37c) was not validated for the specified time
32:11 - Node # 1 took 86967 transactions from the pool and forms block # 247 (37c)
32:26 - Block # 247 (37c) is signed and sent to other nodes for validation
33:49 - Block # 247 (37c) was not validated for the specified time
33:59 - Noda # 1 took 86967 transactions from the pool and forms block # 247 (37c)
34:12 - Block # 247 (37c) is signed and sent to other nodes for validation
35:34 - Block # 247 (37c) is validated and sent to the root chain
35:54 - All nodes received information from the root chain that block # 247 (37c) has been added and 86967 transactions are starting to be applied
36:11 - Node # 1 processed all 1kk transactions that were in the pool
55:12 - the first node processed all 3kk transactions
Summary
It was revealed that Azure virtual servers did not have enough processing power to handle such a large number of transactions. But with the main task of the tests, namely, to demonstrate how Plasma Cash works with MongoDB, the system coped well.
We invite you to visit the GitHub project: https://github.com/opporty-com/Plasma-Cash/tree/new-version
The article was co-written by Alexander Nashivan , senior developer of Clever Solution Inc.
Previously, the Opporty development team has already tested the speed of Plasma Cash. The results are presented in this article .