EvolveArt / starknet-state-verifier

Home Page:https://ccip-helper.nethermind.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve ENS names on l1 via starknet

Verify Starknet state/storage proofs in solidity.

This projects implements the verification of state/storage proofs for starknet on L1. We have built our custom contract(SNStateProofVerifier.sol) which verifies the state/storage proofs exported by starknet_getProof API. This repo utilizes a third party library/contract to calculate pedersen hashes(mentioned below) but implements custom verification and CCIP logic to enable ENS name resolution. Frontend app demonstrates the proof verification and ens resolution via starknet. Full details of this request flow can be found in EIP 3668.

Build and run UI Tool

cd frontend
yarn install
yarn build
yarn dev

Deploy contracts

From the root folder run the following

cd contracts
yarn install
cp .env.example .env
npx hardhat run <--network yournetwork > scripts/deploy.ts

SNL1ResolverStub.sol inherits from SNStateProofVerifier.sol and has been deployed to Goerli at 0xF1979Ec7Fc554e83cF722978Cf73AE94381fBD92

On goerli Pedersen hash contract is already deployed at 0x1a1eB562D2caB99959352E40a03B52C00ba7a5b1

Poseidon3(starkewares version) contracts EVM code has ben generated from the following repo and deployed on Goerli at 0x84d43a8cbEbF4F43863f399c34c06fC109c957a4.

https://github.com/NethermindEth/circomlibjs/

Run contract tests

From the root folder run the following

cd contracts
npx hardhat test --network hardhat

Run tests with gas statistics report:

REPORT_GAS=true npx hardhat test 

Build and deploy the gateway

From the root folder run the following. L2/Starknet resolver is already deployed on goerli at 0x7412b9155cdb517c5d24e1c80f4af96f31f221151aab9a9a1b67f380a349ea

cd gateway
yarn install
yarn build
yarn start --l1_provider_url XXXXX --l2_provider_url XXXX  --l2_resolver_address 0x7412b9155cdb517c5d24e1c80f4af96f31f221151aab9a9a1b67f380a349ea

To deploy to google cloud.

gcloud app deploy goeril.app.yml
gcloud app logs tail -s default

Current implementation is already deployed for goerli at https://starknetens.ue.r.appspot.com

L2 Resolver

This has been upgraded to cairo1 and deployed to 0x7412b9155cdb517c5d24e1c80f4af96f31f221151aab9a9a1b67f380a349ea on goerli

Acknowledgements

Pedersen Hash implementation has been borrowed from https://github.com/Kelvyne/starknet-storage-proof-solidity. Many Thanks!

Help taken from existing implementaion of optimism related solution at https://github.com/ensdomains/op-resolver.

Disclaimer

None of the contracts have been audited and should not be used in production.

About

https://ccip-helper.nethermind.io

License:BSD 2-Clause "Simplified" License


Languages

Language:TypeScript 74.3%Language:Solidity 22.9%Language:Python 1.1%Language:CSS 0.9%Language:Cairo 0.3%Language:JavaScript 0.3%Language:HTML 0.2%Language:Dockerfile 0.1%