CLI Tutorial
In this tutorial, you will learn how to use the fiammad command line tool to send requests related to zkpverify.
Preparations
Before you can use cli, you need to prepare the proof for testing, and a simple way to do this is to use the fiamma git repository provides some sample prover code for generating test proof files, which can be used to easily generate test proof public_input and vk.
Note! Fimma currently supports zkp authentication with a variety of proofs, the list of supported proofs is shown in Support ProofSystem. For the bitvm proof system , there is currently no open source specific prover, we give a sample generated by our test, soon we will open source bitvm proof system
1. Clone Fiamma Git repository.
2. Generate Proof
The following shows an example of how to generate groth16_bn254 in the root directory of a fiamma repository
After executing the above commands, you will see the proof public_input and vk files in the example directory.
1. Send your proof to Fiamma network
Groth16 proof
The Groth16 proof need the proof file, public input file and verifying key file. You may set gas and fees.
The current Fiamma network chain-id is fiamma-testnet-1
, the proof system is GROTH16_BN254
and the node is https://testnet-rpc.fiammachain.io.
Example submit proof:
Plonk proof
The fiammd command for submit plonk proof is essentially similar to the one above for submit groth16 proof. The differences are proof system with GROTH16_BN254 or PLONK_BN254 and the proof files at gnark_plonk
direction.
Example First regenerate different proof files:
Then send Plonk proof:
Proof system use PLONK_BN254.
Or proof system use PLONK_BLS12_381.
BitVM proof
The fiammd command for submit BitVM proof is essentially similar to the one above for submit groth16 proof. The differences are proof system with GROTH16_BN254_BITVM
and the proof files at bitvm direction.
Example Proof system use GROTH16_BN254_BITVM.
Send BitVM proof:
2. Get Proof id
When you have finished submitting your proof you have two ways to get the proof id of the proof you have submitted
Get Proof Id by tx event
When you submit a proof, you will receive a transaction hash. Typically, if the transaction is successful, by querying the transaction details using the hash, you can retrieve an event list where you can filter out the proofId.
Get Proof Id by Manual/Code Calculation
The proof id can be calculated from sha256sum
of proof inputs using shell. It Concatenate the proof system, proof, public input,and vk.
3. Submit community verification to Fiamma network
The community verification need an proof id and verification result.
submit community verification:
Example You may use the above shell to calculate a proof id, and use fiammad command to sumbit community verification with a verification result.
In addition, we provide shell scripts to make it easier to send these commands. The three parameters accepted by the script are account, proof id and result with bool value.
5. Get proof data by proof id from Fiamma network
You can query proof data stored in the fiamma network by proof id.
Example
6. Get bitvm witness by proof id from Fiamma network
You can query bitVM witness stored in the fiamma network by proof id.
Example
7. Get verify result from Fiamma network
You can query proof verify status stored in the fiamma network by proof id.
Example
8. Get pending proofs from Fiamma network
You can queries a list of pending proof verification items in teh fiamma network.
Example
Last updated