Introduction
The blockchain trend continues to gain momentum, and more and more experts in the tech community forecast its universal adoption in the near future. So far, there have been a few challenges preventing that from happening.
First of all, today’s blockchain systems are poorly scalable. For example, Ethereum’s capacity is just 20 tx/s and, notwithstanding its many advantages, it does not suit large businesses. However, Ethereum is valued for its advanced protection against hacking and network failures, so it should not be written off. It makes more sense to improve the shortcomings of Ethereum and turn them into benefits.
Many companies move in this direction today. In particular, the
Opporty development team has created Plasma Cash to ensure decentralization, security, and scalability in blockchain, thereby solving the Scalability Trilemma.
Plasma Cash is a child chain consisting of a smart contract and a private Node.js-based network that periodically commits its state to the Ethereum root chain.
Plasma Cash Testing in Mongo Atlas
Plasma Cash works successfully using MongoDB. Our team conducted tests in Mongo Atlas, and it provided the following advantages when working with Plasma:
- Resilience to data loss, since there are several synchronized replicas in a cluster.
- Fast access, since the cluster can be created on one of the three most popular cloud platforms: Amazon, Google, and Azure. As a result, the Plasma Cash node can be deployed in many data centers situated closely to Mongo Atlas. We have ensured that even when Plasma nodes are deployed in other data centers, their access remains fast.
- Plasma nodes used only in read mode can be located in different parts of the world and still be connected to a single Mongo cluster. This improves geo scalability, allowing nodes to be placed closer to users.
- It is easy to deploy a new node, since there is no need to synchronize everything multiple times. You can simply connect to the existing Mongo cluster or quickly make a copy and configure the connection to it.
- It is easy to scale the database. The data volume grows over time, and the size of cluster nodes can be increased as needed.
Servers were used for testing
- Three virtual Azure servers Standard E4s v3 (4 vcpus, 32 GiB memory). Three nodes were raised on each server. One of them was able to submit blocks to the root chain.
- Each node was connected to an individual Mongo Atlas cluster M50 containing three nodes in replica mode.
Test 1
Three nodes received 100k transactions each. In total, there should be 300k transactions and tokens in all nine nodes.
Initial state: the last block is # 213, 0 transactions and tokens are available in the database.
00:00 - three scripts are launched that generate and send 100k transactions
00:29 - the transfer of 100k transactions to nodes # 1 and # 2 began
00:32 - the transfer of 100k transactions to node # 3 began
00:32 - node # 1 took 11703 transactions from the pool and formed block # 214 (9fb)
00:34 - node # 2 took 27088 transactions from the pool and formed block # 214 (ef4)
00:34 - block # 214 (9fb) was signed and sent to other nodes for validation
00:36 - node # 3 took 11900 transactions from the pool and forms block # 214 (983)
00:37 - block # 214 (9fb) was validated and sent to the root chain
00:38 - block # 214 (983) was signed and sent to other nodes for validation
00:38 - block # 214 (ef4) was 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 the application of 11703 transactions has begun
00:45 - all nodes received information from the root chain that block # 215 (983) has been added and the application of 11900 transactions has begun
00:51 - block # 214 (ef4) was validated and sent to the root chain
00:52 - node # 1 took 51469 transactions from the pool and formed block # 216 (ea0)
00:56 - node # 3 took 55102 transactions from the pool and formed block # 216 (f75)
00:58 - demo script finished its work for node # 2
00:58 - block # 216 (ea0) was 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 the application of 27088 transactions has begun
01:04 - block # 216 (f75) was signed and sent to other nodes for validation
01:14 - node # 2 took 72912 transactions from pool and formed block # 217 (f85)
01:15 - demo script finished its work for nodes # 1 and # 2
01:17 - blocks # 216 (f75) and # 216 (ea0) were validated and sent to the root chain
01:21 - block # 217 (f85) was signed and sent to other nodes for validation
01:26 - blocks # 217 (f75) and # 218 (ea0) were added to the root chain, and the nodes began to apply 51469 and 55102 transactions, respectively
01:27 - block # 217 (a85) was validated and sent to the root chain
01:41 - node # 1 took 36828 transactions from the pool and formed block # 219 (46f)
01:41 - node # 3 took 32998 transactions from the pool and formed block # 219 (bb3)
01:43 - all nodes received information from the root chain that block # 219 (a85) has been added and the application of 72912 transactions has begun
01:46 - block # 219 (46f) was signed and sent to other nodes for validation
01:46 - block # 219 (bb3) was signed and sent to other nodes for validation
01:53 - node # 2 processed all 100k transactions available in the pool
02:37 - block # 219 (bb3) was validated and sent to the root chain
02:41 - block # 219 (46f) was validated and sent to the root chain
02:48 - blocks # 220 (bb3) and # 221 (46f) were added to the root chain, and the nodes began to apply 32998 and 36828 transactions, respectively
02:54 - node # 1 processed all 100k transactions available in the pool
02:55 - node # 3 processed all 100k transactions available in the pool
04:12 - all nodes contain 300k transactions and tokens; the last block is # 221
Test 2:
Three nodes received 1kk transactions each. In total, there should be 3kk transactions and tokens in all nine nodes.
Initial state: last block # 213, 0 transactions and tokens are available in the database.
00:00 - three scripts are launched that generate and send 1kk transactions
02:29 - the transfer of 1kk transactions to nodes # 1 and # 2 began
02:33 - node # 1 took 11668 transactions from the pool and formed block # 222 (510)
02:35 - block # 222 (510) was signed and sent to other nodes for validation
02:37 - block # 222 (510) was validated and sent to root chain
02:38 - node # 2 took 46378 transactions from the pool and formed block # 222 (a9d)
02:38 - the transfer of 1kk transactions to node # 3 began
02:41 - node # 3 took 5504 transactions from the pool and formed block # 222 (387)
02:42 - block # 222 (387) was signed and sent to other nodes for validation
02:44 - block # 222 (a9d) was signed and sent to other nodes for validation
02:44 - block # 222 (387) was validated and sent to the root chain
02:49 - block # 222 (a9d) was validated and sent to the root chain
02:56 - blocks # 222 (510), # 223 (387), and # 224 (a9d) were added to the root chain, and the nodes began to apply 11668, 5504, and 46378 transactions, respectively
03:09 - node # 1 took 177170 transactions from the pool and formed block # 225 (e50)
03:09 - node # 3 took 119327 transactions from the pool and formed block # 225 (ccc)
03:10 - node # 2 took 149772 transactions from the pool and formed block # 225 (404)
03:26 - block # 225 (ccc) was signed and sent to other nodes for validation
03:32 - block # 225 (404) was signed and sent to other nodes for validation
03:33 - block # 225 (e50) was signed and sent to other nodes for validation
03:53 - block # 225 (ccc) was validated and sent to the root chain
04:03 - block # 225 (e50) was validated and sent to the root chain
04:04 - block # 225 (404) was validated and sent to the root chain
04:06 - all nodes received information from the root chain hat block # 225 (ccc) has been added and the application of 119327 transactions has started
04:14 - all nodes received information from the root chain that block # 226 (404) has been added and the application of 149772 transactions has started
04:16 - all nodes received information from the root chain that block # 227 (e50) has been added and the application of 177170 transactions has started
04:32 - node # 3 took 209436 transactions from the pool and formed block # 228 (1e9)
04:40 - node # 2 took 212669 transactions from the pool and formed block # 228 (e38)
04:40 - node # 1 took 190144 transactions from the pool and formed block # 228 (861)
05:02 - block # 228 (1e9) was signed and sent to other nodes for validation
05:08 - block # 228 (861) was signed and sent to other nodes for validation
05:10 - block # 228 (e38) was signed and sent to other nodes for validation
06:13 - block # 228 (1e9) was 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) were added to the root chain, and the nodes began to apply 190144, 209436, and 212669 transactions, respectively
07:07 - node # 1 took 199770 transactions from the pool and formed block # 231 (e04)
07:09 - node # 2 took 190473 transactions from the pool and formed block # 231 (36e)
07:09 - node # 3 took 178807 transactions from the pool and formed block # 231 (f43)
07:34 - block # 231 (e04) was signed and sent to other nodes for validation
07:37 - block # 231 (36e) was signed and sent to other nodes for validation
07:37 - block # 231 (f43) was signed and sent to other nodes for validation
08:49 - block # 231 (e04) was validated and sent to the root chain
08:51 - block # 231 (f43) was validated and sent to the root chain
08:52 - block # 231 (36e) was validated and sent to the root chain
09:47 - blocks # 231 (e04), # 232 (f43), and # 233 (36e) were added to the root chain, and the nodes started using 199770, 178807, and 190473 transactions, respectively
10:16 - node # 1 took 153075 transactions from the pool and formed block # 234 (e04)
10:16 - node # 2 took 168035 transactions from the pool and formed block # 234 (36e)
10:16 - node # 3 took 166685 transactions from the pool and formed block # 234 (f43)
10:42 - block # 234 (56d) was signed and sent to other nodes for validation
11:59 - block # 234 (1bb) was validated and sent to the root chain
12:02 - block # 234 (58a)was validated and sent to the root chain
12:02 - block # 234 (56d) was validated and sent to the root chain
12:48 - blocks # 234 (1bb), # 235 (58a), and # 236 (56d) were added to the root chain, and the nodes began to apply 153075, 168035, and 166685 transactions, respectively
13:14 - node # 1 took 112226 transactions from the pool and formed block # 237 (5c0)
13:16 - node # 2 took 87550 transactions from the pool and formed block # 234 (58a)
13:16 - node # 3 took 99594 transactions from the pool and formed block # 234 (56d)
13:30 - block # 237 (5c0) was signed and sent to other nodes for validation
13:32 - block # 237 (58a) was signed and sent to other nodes for validation
13:34 - block # 237 (56d) was signed and sent to other nodes for validation
14:47 - block # 237 (58a) was validated and sent to the root chain
14:53 - block # 237 (5c0) was not validated by the specified time
14:53 - all nodes received information from the root chain that block # 237 (58a) has been added and the application of 87550 transactions has started
14:54 - block # 237 (56d) was validated and sent to the root chain
15:02 - node # 1 took 181206 transactions from the pool and formed block # 238 (c5f)
15:06 - all nodes received information from the root chain that block # 238 (56d) has been added and the application of 99594 transactions has started
15:12 - node # 2 took 51990 transactions from the pool and formed block # 239 (ad8)
15:20 - block # 239 (ad8) was signed and sent to other nodes for validation
15:25 - node # 3 took 46685 transactions from the pool and formed block # 239 (857)
15:30 - block # 238 (c5f) was signed and sent to other nodes for validation
15:34 - block # 239 (857) was signed and sent to other nodes for validation
16:32 - block # 239 (857) was 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 the application of 46685 transactions has started
16:42 - block # 238 (c5f) was validated and sent to the root chain
16:42 - block # 239 (ad8) was not validated by the specified time
16:54 - node # 2 took 96882 transactions from the pool and formed block # 240 (e6e)
16:56 - node # 3 took 39704 transactions from the pool and formed block # 240 (a47)
17:02 - block # 240 (a47) was signed and sent to other nodes for validation
17:02 - block # 240 (e6e) was 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 the application of 181206 transactions has started
17:45 - block # 240 (a47) was validated and sent to the root chain
17:47 - node # 1 took 54956 transactions from the pool and formed block # 241 (170)
17:59 - block # 241 (170) was 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 the application of 181206 transactions has started
18:20 - node # 3 took 39104 transactions from the pool and formed block # 242 (955)
18:24 - block # 240 (e6e) was validated and sent to the root chain
18:28 - block # 242 (955) was 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 the application of 96882 transactions has started
19:06 - demo script finished its work for node # 1
19:08 - demo script finished its work for node # 2
19:08 - node # 2 took 48241 transactions from the pool and formed block # 243 (fde)
19:14 - block # 243 (fde) was signed and sent to other nodes for validation
19:18 - block # 241 (170) was not validated by the specified time
19:28 - node # 1 took 86967 transactions from the pool and formed block # 243 (37c)
19:35 - block # 242 (955) was validated and sent to the root chain
19:40 - block # 243 (37c) was 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 the application of 39104 transactions has started
20:15 - block # 243 (fde) was validated and sent to the root chain
20:19 - node # 3 took 42981 transactions from the pool and formed block # 244 (9b5)
20:26 - block # 244 (9b5) was signed and sent to other nodes for validation
20:28 - all nodes received information from the root chain that block # 244 (fde) has been added and the application of 48241 transactions has started
20:32 - node # 2 processed all 1kk transactions available in the pool
21:05 - block # 243 (37c) was not validated by the specified time
21:15 - node # 1 took 86967 transactions from the pool and formed block # 245 (37c)
21:32 - block # 245 (37c) was signed and sent to other nodes for validation
21:42 - block # 244 (9b5) was validated and sent to the root chain
21:50 - all nodes received information from the root chain the that block # 245 (9b5) has been added and the application of 42981 transactions has started
22:04 - node # 3 took 45361 transactions from the pool and formed block # 246 (3f9)
22:11 - block # 246 (3f9) was signed and sent to other nodes for validation
22:51 - block # 245 (37c) was not validated by the specified time
23:01 - node # 1 took 86967 transactions from the pool and formed block # 246 (37c)
23:08 - demo script finished its work for node # 3
23:15 - block # 246 (37c) was signed and sent to other nodes for validation
23:32 - block # 246 (3f9) was not validated by the specified time
23:42 - node # 3 took 52173 transactions from the pool and formed block # 246 (71d)
23:51 - block # 246 (71d) was signed and sent to other nodes for validation
24:38 - block # 246 (37c) was not validated by the specified time
25:01 - node # 1 took 86967 transactions from the pool and formed block # 246 (37c)
25:06 - block # 246 (71d) was validated and sent to the root chain
25:12 - block # 246 (37c) was signed and sent to other nodes for validation
25:14 - all nodes received information from the root chain that block # 246 (71d) was added and the application of 52173 has started
25:29 - node # 3 processed all 1kk transactions available in the pool
26:40 - block # 247 (37c) was not validated by the specified time
26:47 - node # 1 took 86967 transactions from the pool and formed block # 247 (37c)
27:03 - block # 247 (37c) was signed and sent to other nodes for validation
28:29 - block # 247 (37c) was not validated by the specified time
28:35 - node # 1 took 86967 transactions from the pool and formed block # 247 (37c)
28:49 - block # 247 (37c) was signed and sent to other nodes for validation
30:13 - block # 247 (37c) was not validated by the specified time
30:23 - node # 1 took 86967 transactions from the pool and formed block # 247 (37c)
30:38 - block # 247 (37c) was signed and sent to other nodes for validation
32:00 - block # 247 (37c) was not validated by the specified time
32:11 - node # 1 took 86967 transactions from the pool and formed block # 247 (37c)
32:26 - block # 247 (37c) was signed and sent to other nodes for validation
33:49 - block # 247 (37c) was not validated by the specified time
33:59 - node # 1 took 86967 transactions from the pool and formed block # 247 (37c)
34:12 - block # 247 (37c) was signed and sent to other nodes for validation
35:34 - block # 247 (37c) was 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 the application of 86967 transactions has started
36:11 - node # 1 processed all 1kk transactions available in the pool
55:12 - the first node processed all 3kk transactions
Conclusion
Processor power provided by Azure virtual servers has proven insufficient for conducting a large number of transactions. However, the system coped well with the main task of our tests: studying the work of Plasma Cash with MongoDB.
The article was written in co-authorship with
Oleksandr Nashyvan, a Senior Developer at
Clever Solution Inc.
| | | | | | | | | |
Звуковая функция ограничена 200 символами