The steps below assume that you have Node.js and Typescript installed on your machine.
- Install dependencies
npm i
andforge install
- Create a .env file and copy + paste the contents of .env.example into it. Fill this with your information.
- Deploy the contract
DummyToken1
.forge create --rpc-url <ALCHEMY_ENDPOINT> --private-key <SEPOLIA_PRIVATE_KEY> src/DummyToken1.sol:DummyToken1
- Verify the contract
DummyToken1
.forge verify-contract --etherscan-api-key <ETHERSCAN_API_KEY> --chain-id 11155111 <DummyToken1Addr> DummyToken1
- Deploy the contract
DummyToken2
.forge create --rpc-url <ALCHEMY_ENDPOINT> --private-key <SEPOLIA_PRIVATE_KEY> src/DummyToken2.sol:DummyToken2
- Verify the contract
DummyToken2
.forge verify-contract --etherscan-api-key <ETHERSCAN_API_KEY> --chain-id 11155111 <DummyToken2Addr> DummyToken2
- Deploy the Axiom callback contract
ChangeColorClient
.forge create --rpc-url <ALCHEMY_ENDPOINT> --private-key <SEPOLIA_PRIVATE_KEY> src/ChangeColorClient.sol:ChangeColorClient --constructor-args 0x83c8c0B395850bA55c830451Cfaca4F2A667a983 11155111
- Verify the contract
ChangeColorClient
.forge verify-contract --etherscan-api-key <ETHERSCAN_API_KEY> --chain-id 11155111 --constructor-args $(cast abi-encode "constructor(address,uint64)" 0x83c8c0B395850bA55c830451Cfaca4F2A667a983 11155111) <ChangeColorClientAddr> ChangeColorClient
- Deploy the NFT contract
ZKColors
.forge create --rpc-url <ALCHEMY_ENDPOINT> --private-key <SEPOLIA_PRIVATE_KEY> src/ZKColors.sol:ZKColors --constructor-args <ChangeColorClientAddr>
- Verify the NFT contract
ZKColors
. forge verify-contract --etherscan-api-key <ETHERSCAN_API_KEY> --chain-id 11155111 --constructor-args $(cast abi-encode "constructor(address)" <ChangeColorClientAddr>) <ZKColorsAddr> ZKColors
- Call the
updateNFTAddr
function inChangeColorClientAddr
to point it to theZKColors
address.cast send --private-key <SEPOLIA_PRIVATE_KEY> <ChangeColorClientAddr> "updateNFTAddr(address)" <ZKColorsAddr> --rpc-url <ALCHEMY_ENDPOINT>
- Mint N DummyToken1s to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> <DummyToken1Address> "mint(uint256)" <N> --rpc-url <ALCHEMY_ENDPOINT>
- Mint M DummyToken2s to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> <DummyToken2Address> "mint(uint256)" <M> --rpc-url <ALCHEMY_ENDPOINT>
- Mint an NFT to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> <ZKColorsAddr> "mint()" --rpc-url <ALCHEMY_ENDPOINT>
- Compile circuit and generate
compiled.json
.npx axiom circuit compile app/axiom/balance.circuit.ts --provider <ALCHEMY_ENDPOINT>
- Generate proof.
npx axiom circuit prove app/axiom/data/compiled.json app/axiom/data/inputs.json --provider <ALCHEMY_ENDPOINT>
- Generate query parameters used to call
AxiomV2Query
.npx axiom circuit query-params <ChangeColorClientAddr> --sourceChainId 11155111 --refundAddress <Your EOA Address> --provider <ALCHEMY_ENDPOINT>
- Send the query on-chain
cast send --rpc-url <ALCHEMY_ENDPOINT> --private-key <SEPOLIA_PRIVATE_KEY> --value <payment value> 0x83c8c0B395850bA55c830451Cfaca4F2A667a983 <sendQueryCalldata>
wheresendQueryCalldata
is the value in the calldata field from the json output filesendQuery.json
that was generated from the previous step.
- DummyToken1: 0xd04D6724Fb95BAda8ef799Ff3E2Cb4728c9f145D
- DummyToken2: 0x8B17E3629C1253805dbDBAFee6C7382aB5F1Bf75
- ChangeColorClient: 0xf4bE653537F157Ea1139d4405203C17e7F7445d0
- ZKColors: 0xa98Da97faE6234b515415fF8BD9496F53E0cBa3b
- Fill out /axiom-zk-nfts/.env.example, save as .env.
- Fill out /axiom-zk-nfts/app/.env.local.example, save as .env.local.
- Create a Sepolia address, accessible by browser (metamask, walletconnect)
- Mint N DummyToken1s to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> 0xd04D6724Fb95BAda8ef799Ff3E2Cb4728c9f145D "mint(uint256)" <N> --rpc-url <ALCHEMY_ENDPOINT>
- Mint M DummyToken2s to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> 0x8B17E3629C1253805dbDBAFee6C7382aB5F1Bf75 "mint(uint256)" <M> --rpc-url <ALCHEMY_ENDPOINT>
- Mint an NFT to your address.
cast send --private-key <SEPOLIA_PRIVATE_KEY> 0xa98Da97faE6234b515415fF8BD9496F53E0cBa3b "mint()" --rpc-url <ALCHEMY_ENDPOINT>
- Update axiom/data/inputs.json with the latest Sepolia block number, dummy token addresses, your address, and your NFT token ID.
- Navigate to the '/app' directory in the terminal.
- Enter 'npm run dev'.
- Open your browser and navigate to 'localhost:3000'.
- Follow the app instructions to generate a proof and send a query.