Utilizing NEBRA as proof aggregator
Galxe Identity Protocol SDK is capable to utilize NEBRA’s proof aggregation tech to drastically reduce the costly onchain proof verifications. To learn more on NEBRA, click here.
This tutorial guides you through the process of using Nebra UPA to aggregate and verify credentials on Sepolia.
Note that:
To run this tutorial, you need to have an funded address on Sepolia as Nebra signer. This address is used to submit proofs to the Nebra Upa receiver. Example proof submission transaction can be found here.
.env
file using .env.example
as a template. Update NEBRA_SIGNER_PK
with your private key.In your Node.js repo, run:
Note that the dummy issuer used in this tutorial has been registered on Sepolia testnet. Check out the registration transaction here.
This issuer is registered with the following parameters:
parameter | type | input |
---|---|---|
name | string | demo-issuer (don’t trust me) |
verificationStackId | uint8 | 1 |
publicKeyId | uint256 | 18776893102620642575656716525121755312642649464684953450234247405793284298744 |
publicKeyRaw | bytes | 0x0435be315dd7c00c9ba151f7c811bde6598c2e1b1f30552a3fb07a34b6c91416a99883f708f3389842c8f43c1c272bb8210a68d25f09201887354d85e8e58beff0 |
verificationStackId = 1
means that this issuer is registered for babyzk stackSince this tutorial uses the Unit
primitive type, you can skip this step and use the pre-registered circuit ID instead - 535783125321978663259414080602879573584328345995263811920911450103380255481
.
This circuit is registed with this transaction.
To register your own circuit, follow the tutorial here.
Code used in this tutorial is also available here.
While this looks similar to the previous tutorial, the main differences here is the proof verification process. Let’s take a look at the main function. Instead of verifying the proof on-chain with our stateful verifier like in the previous tutorial, we submit the proof to Nebra UPA instead and once submission is verified, we verify the proof using the public signals only.
Proof is submitted to Nebra UPA using the submitProofs
function. This function returns a submission handle which can be used to wait for the submission to be verified using the waitForSubmissionVerified
function. waitForSubmissionVerified
will run for a while since it takes time for the proof to be aggregated by NEBRA and verified on-chain.
And note that in verifyByCallingAggregatedStatefulVerifier
, we can now verify the proof using the public signals only with aggregatedStatefulVerifier.verifyProofFull
.
Congratulations! You’ve successfully issued a credential, generated a zero-knowledge proof, submit the proof to be aggregated by NEBRA, and verified it on-chain. This tutorial demonstrates how NEBRA can be utilized to aggregate and verify proofs off-chain, reducing the costly on-chain proof verifications.
The code used in this tutorial is available here
Utilizing NEBRA as proof aggregator
Galxe Identity Protocol SDK is capable to utilize NEBRA’s proof aggregation tech to drastically reduce the costly onchain proof verifications. To learn more on NEBRA, click here.
This tutorial guides you through the process of using Nebra UPA to aggregate and verify credentials on Sepolia.
Note that:
To run this tutorial, you need to have an funded address on Sepolia as Nebra signer. This address is used to submit proofs to the Nebra Upa receiver. Example proof submission transaction can be found here.
.env
file using .env.example
as a template. Update NEBRA_SIGNER_PK
with your private key.In your Node.js repo, run:
Note that the dummy issuer used in this tutorial has been registered on Sepolia testnet. Check out the registration transaction here.
This issuer is registered with the following parameters:
parameter | type | input |
---|---|---|
name | string | demo-issuer (don’t trust me) |
verificationStackId | uint8 | 1 |
publicKeyId | uint256 | 18776893102620642575656716525121755312642649464684953450234247405793284298744 |
publicKeyRaw | bytes | 0x0435be315dd7c00c9ba151f7c811bde6598c2e1b1f30552a3fb07a34b6c91416a99883f708f3389842c8f43c1c272bb8210a68d25f09201887354d85e8e58beff0 |
verificationStackId = 1
means that this issuer is registered for babyzk stackSince this tutorial uses the Unit
primitive type, you can skip this step and use the pre-registered circuit ID instead - 535783125321978663259414080602879573584328345995263811920911450103380255481
.
This circuit is registed with this transaction.
To register your own circuit, follow the tutorial here.
Code used in this tutorial is also available here.
While this looks similar to the previous tutorial, the main differences here is the proof verification process. Let’s take a look at the main function. Instead of verifying the proof on-chain with our stateful verifier like in the previous tutorial, we submit the proof to Nebra UPA instead and once submission is verified, we verify the proof using the public signals only.
Proof is submitted to Nebra UPA using the submitProofs
function. This function returns a submission handle which can be used to wait for the submission to be verified using the waitForSubmissionVerified
function. waitForSubmissionVerified
will run for a while since it takes time for the proof to be aggregated by NEBRA and verified on-chain.
And note that in verifyByCallingAggregatedStatefulVerifier
, we can now verify the proof using the public signals only with aggregatedStatefulVerifier.verifyProofFull
.
Congratulations! You’ve successfully issued a credential, generated a zero-knowledge proof, submit the proof to be aggregated by NEBRA, and verified it on-chain. This tutorial demonstrates how NEBRA can be utilized to aggregate and verify proofs off-chain, reducing the costly on-chain proof verifications.
The code used in this tutorial is available here