Vitalik Butterin, the co-founder and inventor of Ethereum has published a report, documenting how they plan on increasing the number of transactions process on the network to a minimum of ~500 tx/sec. This is expected to be done using mass tx validation.
He said that without the use of layer 2’s that shows liveness assumptions such as channels and plasma, asset transfer transactions can be scaled by a huge amount using ZK-SNARKs to validate the transactions on a large scale, or mass validation.
How It Is Done
The transactor, and the relayer are two classes of users. A set of operations is taken by the relayer from transactors, and then it is combined into transactions and a ZK-SNARK is made to prove the validity. Once the validity is proven the ZK-SNARK is published in a highly compressed form together with the transaction data, to the blockchain. A reward is given to the relayer for this through the transaction fees from transactors.
A contract with a state consisting only of two bytes32, and values representing Merkle roots, is used to manage the system. The two bytes32 values representing Merkle roots are the address book (A) and balances+nonces (B). It begins as a Merkle root of 2 24 zero entries, and also, B as a Merkle tree of 2 24 (0, 0) tuples.
The registration, deposit/withdraw and sending, are the three types of operations for the transactors. For registration, a Merkle branch must be provided by the user, showing some index i. The A[i] will equal the msg sender’s address, when the Merkle tree is updated, after which, the Merkle branch is logged in order to provide all the data needed to clients reading logs, and they will be able to create their own Merkle branches.
Users are required to provide certain information, in order to deposit or withdraw. The information required is a Merkle branch, that shows some index i, at the location where A[i] equals the msg sender’s address. It also requires the corresponding branch for B[i] , along with the amount to be deposited or withdrawn, to be shown. The contract checks all the information provided, it then updates the Merkle root.
What Does This Mean For The Ethereum Network
It costs ~60000 gas, for a ZK-SNARK verification through the latest protocols, and ~50000 gas can be added for overhead, this includes, log cost, base tx cost, storage slot modifications and so on. The cost of every transaction included costs for every byte, is 68 gas, unless it is a zero byte where it goes down to 4 gas. Therefore, the marginal cost for a regular transfer is expected to be 892 gas. A relay transaction, in the best case, would consume 8 million gas of a block, making the marginal costs take up about ~91% of the total costs, which would be < 1000 gas for every transaction. A gain of ~50x for ERC20 transfers, and ~24x for ETH transactions is made.
Allowing a relayer, with ZK-SNARKs proving the operation to rebalance the tree, can optimise it further, by a moving more frequent users into lower indices. Also, changing the encoding for the value will make common values, like round numbers of ETH, to be represented, detailing in the signature change of every 100 blocks, therefore, the nonce can reset every 100 blocks.