bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 5쪽 중 2쪽
ss or utilize data from any other blockchains in a trust-free way .
To make a Sci-Fi analogy, we can think of on-chain smart contracts as three-
dimensional beings, such as humans living on Earth. A human always lives in the
present time and cannot travel back in the past. Furthermore, a person cannot get
information about another person without having the other person agree to share the
information. Finally, a person cannot see the events happening in another parallel
universe. Comparatively, off-chain programs are like higher-dimensional beings that
have visibility back to the past, into every fact, and to other alternative universes.
However, they are separated from the on-chain world and can not drive the core logic
of dApps today.
One might argue that there are several possible paths to solve these challenges.
For the same blockchain, it is theoretically possible for a smart contract to parse data
query semantics, access state roots directly, and compute the necessary query results by
expanding the state tree on-chain. However, in practice, this is prohibitively expensive
due to the extremely high on-chain computation costs. Similarly, it is theoretically
possible to build a trust-free light client that validates if block headers from a different
blockchain are generated via the proper consensus rules. However, in practice, this is
impossible due to the same cost concerns.
So, how can we allow smart contracts to access and compute data from
any blockchains over an arbitrary period of time?
2.3. Computation Migration Using Zero-Knowledge Succinct Proof
Zero-knowledge succinct proof technology (ZKP) is a rapidly evolving area of cryp-
tography research with the potential to revolutionize our interactions with digital
information. With ZKP, one party can prove to another party that they have cor-
rectly generated a computation result based on an input value, without revealing any
information about that value. Moreover, the other party only needs to run a computa-
tionally inexpensive program, called a verifier, to be convinced that the computation
is done correctly.
Apart from the privacy benefits implied in the “zero knowledge” part of ZKP, this
technology can also be used to migrate computation from a high unit cost
10
location to a low unit cost location.
The idea is that zero-knowledge succinct proofs allow the prover to perform a com-
putationally expensive operation not only to complete the computation but also to
generate a cryptographic proof, while the verifier can perform a computationally cheap
operation to verify the proof. This effectively enables the location of computation to be
shifted from the verifier to the prover. Although the total computation cost increases
when using ZKP due to the added proof generation computation, the tradeoff is still
worthwhile if the prover’s unit computational costs are sufficiently lower than those of
the verifier.
ZKP’s computation migration property is the driving force behind many ZK rollups
(e.g., [7, 19, 22, 23, 30]). In this paper, we leverage this property to design Brevis, which
enables access and computation of arbitrary blockchain data across the entire history.
3. Overview of Brevis by An Example
Before we delve into the details of each component, we present a concrete application
example to provide an overview of Brevis. Note that this overview abstracts some key
details for simplicity and leaves a more detailed design in the following sections.
Application’s Blockchain
zkAggregatorRollup
DEX
State Root
Agent1
6
7
zkQueryNet
zkFabric
Query Result
Store zk Verifier
Block Header
Store
4
2
3
45
Figure 2. An Example Walk Through
Multi-blockchain decentralized exchanges (DEXes), such as PancakeSwap, often
need to dynamically adjust farming rewards for incentivized pools based on trad-
ing pair quality scores such as average daily volume, 14-day volume, price volatility,
11
number of active traders, and liquidity providers across all supported blockchains.
Currently, such adjustments must be made through governance proposals, which
entail significant human overhead and can only be done when the setting deviates
severely from optimal. This lag behind market trends often leads to a decline in user
engagement, revenue loss, and waste of treasury funds due to sub-optimal reward
configurations.
Brevis can address these challenges by enabling DEXes to adjust the liquidity farm-
ing schedule programmatically and trust-freely based on omnichain market trends. For
simplicity, let us assume that volume is all we care about. Let us also assume that
there is a ZK Query Engine Q in zkQueryNet that provides a set of highly optimized
circuits for DEX volume data with an API that looks like the following:
uint_64 get_trading_volume(uint_64 chain_id,
uint_64 start_block,
uint_64 end_block,
address pair)
Figure 2 shows the step-by-step process of how this use case works. To use this
data compute API, DEX smart contract first needs to make a function call to the
Agent Smart Contract (denoted as A) of zkQueryNet with the above query parameters
specified. Note that this function is asynchronous and only immediately returns a
query id so the DEX’s smart contract needs to remember this ID and has a handler
to process the return value later.
This function call is then picked up by Q’s prover, denoted by Pq. Using the block
headers for chain id (which has already been verified and stored in zkAggregator-
Rollup), Pq will generate a ZK proof π proving that on chain id during the time
period from start block to end block the DEX’s trading pair indeed has volume.
Q’s proof verifier in zkAggregatorRollup verifies π, and the result volume, as well
as the corresponding query parameters, are stored in zkAggregatorRollup. This state
is later included in a state root S of zkAggregatorRollup and committed to the chain
on which the DEX is deployed.
Now, A can retrieve and verify the query result by using a state inclusion proof
against S. This retrieved query result will then be returned back to the DEX’s smart
contract’s handler function. The handler function will be able to match the stored
12
query id with the returned query result and adjust the liquidity farming schedule
based on the volume data accordingly.
With this example as a high-level walkthrough, we will now dive into the detailed
design of each component in the following sections.
4. Brevis zkFabric
In Brevis, zkFabric serves as the trust-free interoperability layer that enables any
blockchain to access attested states of every other blockchain. zkFabric’s zero-
knowledge proof (ZKP) based light clients makes it fully trust-free without
relying on any external validation entity, because its security is solely derived from
the underlying blockchains and mathematically sound proofs.
In the following sections, we will briefly survey existing interoperability solutions and
their limitations in Section 4.1, provide an overview of the architecture and technology
used in zkFabric in Section 4.2, and discuss implementation details of building zkFabric
in Section 4.3 with a few consensus protocols as examples.
4.1. Existing Interoperability Solutions
Blockchain interoperability has emerged as a prominent area of research in recent
years, leading to the development of several classes of architectures in production. In
this section, we briefly discuss various multi-blockchain interoperability solutions and
their limitations. Please note that the list in each class is not meant to be exhaustive.
• External V alidation Bridge achieves interoperability among blockchains by
using an external entity sitting in between different blockchains. This external
entity undertakes the role of validating and relaying messages from one chain to
another. Therefore, the security of cross-chain communications solely depends on
the external entity’s designs, such as multi-signature validation (e.g., Wormhole
[28], Ronin Bridge [21]), multi-party computation threshold signature (e.g., Mul-
tichain [15], Thorchain [26]), relay and oracle co-validation (e.g., LayerZero [lay-
erzero]), and Proof-of-Stake (PoS) based middle chains (e.g., Axelar [1], Celer’s
default security model [2]). External validation bridges are often decentralized
but not trust-free because the external entity can still modify the cross-chain
13
messages when acting maliciously.
• Optimistic-like Bridge is a variation of the external validation model’s de-
sign by incorporating a two-phase commit with a delay and optionally source-
chain slashing functionality (e.g. Nomad [17] and Celer’s optimistic model [2]).
Specifically, an optimistic bridge system requires the external validation layer
to deposit collateral and relies on a watchdog service to continuously monitor
the bridge state and penalize malicious actors by slashing their collateral upon
detection. However, an optimistic bridge introduces a considerable delay due to
the challenging period between commitment and confirmation. Moreover, its se-
curity still depends on the deposited collateral: if the value in transit exceeds
the collateral, there are still incentives for the external validation layer to cheat.
Note that Optimistic-like bridges are very different from Rollup bridges, because
malicious messages can still be delivered even if a challenge is successful.
• Light-Client Bridge implements the entire light client logic in a smart contract
on the destination chain for the source chain. Compared to the aforementioned
models, the light-bridge bridge model eliminates the need for a trusted third
party and is trust-free. Examples include Cosmos IBC [9] and NEAR-Ethereum
Rainbow bridge [16]. However, directly implementing generalized light clients
as a smart contract is prohibitively expensive. For example, verifying NEAR
light client involves many Ed25519 signature verifications but a single Ed25519
signature would require 500k gas to verify in EVM. Thus, light-client bridges
such as NEAR-Ethereum Rainbow bridge use an optimistic model that skips the
Ed25519 signature verification and relies on a watchdog to monitor (similar to
the previously-mentioned Optimistic bridge), resulting long delay (4 hours) and
a weakened security model.
4.2. zkF abric: Interoperability via ZKP-based Light Client
zkFabric achieves trust-free interoperability, the same as the light-client bridge model,
and overcomes its implementation challenges and long delay issues by implementing
light-client protocols in polynomial arithmetic circuits. Using these circuits, zkFabric
can generate ZK Consensus Proofs which prove block headers are indeed generated
through the corresponding chains consensus protocols. These Consensus Proofs can
then be verified efficiently and recursively through zkAggregatorRollup, on all con-
14
nected blockchains.
Figure 3 shows the architecture of zkFabric which consists of two components:
• Block Header Relay Network: This network synchronizes block headers from
various blockchains, forwarding them to the zkFabric prover network to generate
validity proofs. Subsequently, it submits the block headers and associated proofs
to zkAggregatorRollup (refer to Section 6 for further details on zkAggregator-
Rollup).
• zkF abric Prover Network implements circuits for each blockchain’s light-
client protocol, this network generates validity proofs for block headers. Provers
can leverage accelerators, such as GPUs, FPGAs, and ASICs, to minimize prov-
ing time and cost.
Block Header Relay Network
send block headers submit block headers
and proofgenerate validity proof
sync block headers
Blockchains
......
zkFabric Prover Network
Prover 1
Ethereum Light Client Circuit
SSZ Sync
Committee update
BLS Signature
Verification
Cosmos Light Client Circuit
Ed25519 signature verification
......
Prover 2
......
zkAggregateRollup
Figure 3. Brevis zkFabric Architecture
The zkFabric workflow comprises the following steps:
(1) The block header relayer network periodically synchronizes block headers from
various blockchains. To avoid fork choices, the network only selects a block header
after a safe block confirmation delay has passed. Additionally, external triggers
(e.g., on-chain events or user requests) can initiate block header synchronization.
(2) The block header relayer network submits block headers to the zkFabric prover
network.
(3) The prover network generates a validity proof π for the block headers, utilizing
15
a chain-specific ZKP circuit that implements the light-client protocol. Section
4.3 will provide some example implementations.
(4) The prover network returns the validity proof π to the relayer network.
(5) Upon receiving the proof, the relayer network sends it and the corresponding
block headers to zkAggregatorRollup using the InsertBlockHeaders interface.
Section 6 will specify details about this interface.
T rust Assumption. zkFabric relies on the security assumptions of blockchains and
underlying cryptographic protocols, without requiring additional assumptions on any
external parties. However, ensuring zkFabric’s liveness necessitates at least one honest
relayer to synchronize the correct fork. Therefore, we propose employing a decentral-
ized relayer network, rather than a single relayer, to optimize zkFabric’s liveness. This
relayer network can utilize existing constructs such as the State Guardian Network in
Celer Network. However, it is critical to note that in this case, the State Guardian
Network has no way to generate malicious cross-chain messages.
Prover Assignment. The prover network, a decentralized network of ZKP provers,
requires the selection of a prover for each proof generation task and the payments to
these provers. This is out of the scope of this paper and separate economics specifica-
tions will be published on this and other related subjects in the future.
4.3. Example Light Client Implementations
In this subsection, we outline our current implementations of light client protocols for
various blockchains, including Ethereum PoS, Cosmos Tendermint, and BNB Chain,
as examples and proof of concepts.
4.3.1. Ethereum PoS
Circuit. The ZK circuit for the Ethereum PoS light client primarily comprises two
components:
• SSZ Sync Committee Commitment. This circuit computes the SSZ commitment
for the 512 validators in the sync committee, requiring 1025 SHA-256 compu-
tations over a 64-byte public key. It is worth noting that SHA-256 is not ZK-
friendly due to bitwise operations, leading to a large number of constraints in
our implementation. Fortunately, since the Ethereum sync committee updates
16
#Constraints Prove+Witness Gen. Time
BLS12-381 Sig Verification
(over BN254) 8.7m 25s
SSZ Sync Committee Update 88m 72s
T able 2.Benchmark results for Ethereum PoS Light-client Circuit implementation in gnark.
The machine is a Linux server with 384GB memory and 20 cores@2.3GHz.
every 27 hours, this circuit is invoked only occasionally. However, the per-block
aggregate BLS signature verification, which also necessitates calculating the sync
committee commitment, is impractical at such a large number of constraints for
a per-block frequency. To address this issue, we employ a technique by Succinct
Labs [24], allowing the circuit to compute two commitments: one using the orig-
inal SHA-256 hash function and the other utilizing a ZK-friendly hash function,
such as Poseidon or Rescue hash. An on-chain mapping from the original SSZ
commitment to the new ZK-friendly commitment is then stored for later use in
per-block BLS signature verification.
• BLS Signature Verification. This circuit first calculates the ZK-friendly com-
mitment and compares it to the on-chain commitment mapping. Subsequently,
it verifies the BLS12-381 signature, involving hash-to-curve calculations and
BLS12-381 pairing over the BN254 scalar field (since the initial implementa-
tion requires light client verification in EVM, where BN254 pairing is supported
as a pre-compile).
We implement the circuits in gnark [6] with Groth16 instantiated with BN254. The
gnark framework has proven to be highly optimized in performance, as demonstrated
in industrial benchmarks [32]. F urthermore, gnark provides an efficient imple-
mentation for range checks which we leverage to significantly reduce the
number of constraints in non-native field operations for BLS signature ver-
ification. A similar optimization for the bitwise operations in SSZ Sync Committee
Commitment circuit is in progress.
Table 2 presents the benchmark results for the aforementioned circuits on a Linux
server with 384GB memory and 20 cores@2.3GHz.
Light Client. Our system utilizes the latest beacon chain light client APIs, which
provide both sync committee updates and finalized blocks. Proofs are submitted to on-
chain light client contracts for sync committee and block signature verification. Sync
17
#Constraints Prove+Witness Gen. Time
Batch of 8 Ed25519 Sig Verifications
(Over BN254) 7.4m 15s
T able 3.Benchmark results for verifying a batch of 8 Ed25519 signatures (over BN254 scalar
field) implementation in gnark. The machine is a Linux server with 384GB memory and 20
cores@2.3GHz.
committee updates must be submitted every 27 hours to establish a chain of trust.
Blocks, on the other hand, can be updated on-demand as long as they are finalized
by the current committee. To support use cases like generic message passing, we also
generate a Merkle proof for the execution state root in the beacon state and submit
it to the light client to persist the latest execution state root on-chain. Consequently,
other applications can easily call the Ethereum API eth getProof to obtain Merkle
proofs for any state of interest, and the on-chain contract ensures that the state root
matches the persisted root.
4.3.2. Cosmos Tendermint
Ed25519 Signature V erification Circuit.One of the most computationally expen-
sive aspects of Cosmos Tendermint consensus is the verification of a batch of Ed25519
signatures (for example, in Ethereum, verifying a single Ed25519 signature on-chain
costs approximately 500k gas). To leverage the computation migration property of
ZKP, we incorporate the Ed25519 signature verification into a ZK circuit.
However, Ed25519 signature verification necessitates elliptic curve operations on
Curve25519, whose scalar field is larger than BN254. As a result, the Ed25519 signa-
ture verification circuit requires non-native field arithmetic operations (it is theoret-
ically impossible to avoid such non-native arithmetic operations if we need to verify
Ed25519 signatures in EVM [33]). We implement the Ed25519 signature verification
(over BN254 scalar field) circuit in gnark, where each Curve25519 element is divided
into 5 limbs with 51 bits each. Additionally, we employ the efficient range check gad-
gets in gnark to significantly reduce the number of constraints in non-native field
operations. Table 3 displays the benchmark results for our implementation on a Linux
server with 384GB memory and 20 cores@2.3GHz. We anticipate further improve-
ments in proving time for a batch of signatures through parallelization and hardware
acceleration.
Light Client. We have integrated the Ed25519 verification circuit into an on-chain
18
Tendermint light client contract based on Tendermint-sol [25]. The light client first
verifies a protobuf-serialized Tendermint block header by performing basic checks that
are not particularly computationally intensive. It then delegates the validation of val-
idator signatures to the Ed25519 verification contract. In our current simplified im-
plementation, the circuit validates signatures from 2/3 of the validators in a single
proof with a constant estimated proof verification cost of 300k gas. This cost saving
is significant compared to the estimated 500k gas per signature if we were to use an
Ed25519 implementation in EVM, where validating 10 signatures would have cost 5M
gas instead.
Once a Tendermint block header is verified, the light client stores the Merkle root
of the Tendermint state t프로젝트로 돌아가기