The Term Structure Evacuation Kit is a tool designed for managing term structure data and generating zero-knowledge proofs for data evacuation. Below are the instructions to build, install, and use the kit.
To build the project and install the tool:
cargo build --release
cargo install --path term-structure-evacuation-kit
After installation, you can use the ts-evacu
command with various subcommands to manage and process your data. First, copy the example configuration file and replace it with your own API key:
cp config.json.example config.json
To update the state based on the provided configuration file and end block ID, use the update_state
command. If the end block ID (-e
) is not specified, the state will be updated to the latest block:
ts-evacu update_state -c config.json -e 19968461
To query the balance of a specific account for a specified asset, use the query
command with the account ID and token ID:
ts-evacu query -c config.json -a 2 -t 2
To export the input files required for the evacuation zk proof, use the export
command with the account ID and token ID:
ts-evacu export -c config.json -a 2 -t 2 > ./input.json
To export the data required to consume L1 requests in the smart contract, use the consume
command with the configuration file:
ts-evacu consume -c config.json
Download the zkTrue-up Evacuation Witness Calculator and the zkTrue-up Evacuation Zkey.
Generate the witness:
node zkTrueUp-Evacuation_js/generate_witness.js zkTrueUp-Evacuation_js/zkTrueUp-Evacuation.wasm ./input.json ./witness.wtns
Prove the circuit using snarkjs
:
npx snarkjs groth16 prove evacu_finalized.zkey ./witness.wtns ./proof.json ./public.json
Export the Solidity calldata:
npx snarkjs zkey export soliditycalldata ./public.json ./proof.json
For more detailed usage and options, please refer to the help command ts-evacu --help
.