For ZK Collective Hackathon, we created a proof of concept for this idea from @mkoeppelmann.
‘L1StateOracle - A trustless and affordable framework for storing L1 historical states on L2 using zkp and block headers’
Given a reliable L1 block header hash for a certain block number with Hashi on L2, this PoC proves that you can store a L1 state value on L2 trustlessly by using block headers as a source of truth.
How it works
- We used Axiom.xyz to create a ZK proof of a storage slot value associated with the block header at a desired block number.
- On L2, we call
AxiomStorageProofwith the ZK storage proof that includes(storageSlot, slotValue, blockNumber, associatedBlockHeaderHash). - On L2,
AxiomStorageProofcalls Hashi to get the reliable block hash for L1 at a desired block number. - We compare the hash returned from Hashi and the one from the proof.
- If same,
AxiomStorageProofcalls the prover contract to verify the proof. The prover verifies the storage value with the associated block header. AxiomStorageProofretrieves the state value associated with the block header. This retrieved state value can be stored, and be used for any other contracts on L2.
Terminology: For simplicity, we used L1 as a term for the source chain, and L2 as a term for the target chain. L1 and L2 here do not imply any association like rollup between the two. L1 and L2 can be any EVM compatible chain supported by Gnosis Hashi.
Limitation: This currently can only check the state value of a contract stored on a EVM storage slot, not the returned value from a contract method.
p.s. I’m looking for an engineering job in web3. Hire me! resume.sjlee.me
More Info
