Optimal and Seamless ZkRollups on Polkadot

Kogarashi Network
Coinmonks
3 min readAug 16, 2023

--

We recompose the blockchain architecture through the Polkadot pallet system and achieve high-performance and usable ZkRollups. In a previous post, we proposed crypto-friendly blockchain architecture. We describe what’s ZkRollups and how we recompose to improve more.

Photo by UX Indonesia on UnSplash

Background

ZkRollups are innovative in terms of replacing sidechain governance with a cryptographic protocol and safely outsourcing transaction processes without trust to the operator. However, there are still some problems to be addressed. We recompose runtime and structure overall for crypto-friendly and, improve both usability and gas cost.

ZkRollups Nutshell

ZkRollups put a lot of transactions together off-chain and reflect changes at once on the on-chain. ZkRollups reduce the gas cost of

  1. Init Transaction
  2. Storage
  3. Computation

Init Transaction

As well as we need initial fares when we ride taxis, and blockchain transactions need initial gas costs. On Ethereum, we need to pay 21,000 gas for the initial gas cost. However, ZkRollups can reflect a thousand transaction changes at once. We can save the initial gas cost happens for each transaction.

Storage

Blockchain account is key-value mapping of address and balance. If we manage a million accounts, a million key-value mapping storage costs would be necessary. With ZkRollups, the account is managed by Merkle tree and the state can be expressed as only one hashed value even if we manage a million accounts. Reflecting a thousand transactions updates only this hash value instead of updating every relevant account balance.

Merkle Tree

Computation

Transfer transaction needs to calculate the sender and recipient balance from the transfer amount. It’s necessary to check every value is in a valid range and that arithmetic is performed correctly. ZkRollups check the transaction requirement with zero knowledge proof thus, the blockchain doesn’t have to recompute to check transactions again.

ZkRollups Bottleneck

ZkRollups are great scaling solutions but there are some bottlenecks for a billion users to use.

  1. Proof Generation Cost
  2. Data Availability Cost
  3. Usability

Proof Generation Cost

Most proof generation cost comes from signature verification because it includes elliptic curve operation and hash function. We improve ZkRollups bottlenecks with the following technologies.

  1. Signature Batch Validation
  2. Zero Knowledge-Friendly Hash

Firstly, we change the signature validation scheme. We use signature batch validation¹ and validate them once instead of each transaction.

Secondly, we replace the hash function in the signing algorithm with a zero-knowledge-friendly hash function². Hash function as SHA256 works byte blocks. This is inefficient to be proved by zero-knowledge proof.

Data Availability Cost

Storage costs to manage users’ balances and verification costs are constant even if it deals with a million accounts. Whereas, the data size necessary for data availability increases linearly for a number of accounts. Traditional ZkRollups post this data to an area called calldata but it’s still costly.

We prepare temporary storage³ for this data and after some period, we remove it. We reduce storage and memory gas costs.

Usability

The wallets used for mainchain and rollup chains are different. Traditional blockchains use the ECDSA algorithm however, the rollup chain often uses the EdDSA algorithm because of efficiency. Users need to recreate the wallet for the rollup chain before they use the rollup functionality.

In our architecture, users can use the same wallets and don’t need to recreate wallets.

Summary

We replace ZkRollups components with the latest cryptographic best practice and improve the bottlenecks of existing solutions. Scaling is an essential part of blockchain thus feature is required to be used simply and with high performance. Realizing advanced functionalities with simple architecture is the key to unlocking blockchain potential.

What’s Kogarashi?

We integrate cryptography best practice and achieves advanced functionalities with simple usage and high performance. We connect applied cryptography with social issues as solutions.

Follow Us

Website | Twitter | Discord | Github

Reference

[1]: RedDSA batch validation
[2]: POSEIDON: A New Hash Function for Zero-Knowledge Proof Systems
[3]: EIP-4844: Shard Blob Transactions

--

--

Kogarashi Network
Coinmonks

Kogarashi is a Real Wold Hybrid Smart Contract on Crypto-Centric Scalable and Private Blockchain