Joining Kalypso as a hardware operator
Hardware operators generate proofs and in turn receive USDC as fees. They are free to generate proofs for any circuit(s) of their choice by joining the corresponding markets. This involves the following steps:
- Registering with Kalypso
- Deploying the prover enclave corresponding to a chosen market
- Benchmarking performance
- Starting the enclave
- Subscribing to that particular market
- Staking
- Verifying the enclave key
- Updating the enclave
Pre-requisite
You will be using the kalypso-sdk to perform all operations.
-
Clone the kalypso-sdk examples repository.
git clone https://github.com/marlinprotocol/kalypso-sdk-examples
git checkout noir_examples -
Install all the required node modules. This step will also install kalypso-sdk itself.
npm install --include-dev
-
To run a specific script, use the below command.
npm run ts-node ./path_to/script_file.ts`
Registering with Kalypso
To register with Kalypso, you can invoke the registration script. The registration steps requires following information:
rewardAddress
: This address receives all the rewards that accrue to you across KalypsodeclaredCompute
: Number of CPUs/vCPUs that you are allocating to KalypsogeneratorMetaData
: Adhoc information about the hardware operator
If you have already registered with the same address, the script with throw an error.
- It is recommended to chose a different
rewardAddress
during registration. - Start with a small value of
declareCompute
like 8 or 10. You can always increase/decrease it latter. - Add some nice utf-8 bytes in
generatorMetaData
to have a nice view in dashboard.
Deploying the enclave
- Fetch the IPFS link/S3 link where the enclave file i.e.
nitro-enclave.eif
is hosted for the given market. It should be on the corresponding market's page on the Kalypso Portal. - With the available link, visit the Oyster Portal to deploy the enclave.
- Once the enclave is successfully deployed, you will receive the IP of the enclave. Update the IP in the kalypso-config.json. Ensure that both
url
andutilityUrl
are replaced in both generator and ivs section. Example
"generatorEnclave": {
"url": "http://your_enclave_ip_here:5000",
"utilityUrl": "http://your_enclave_ip_here:1500"
},
"ivsEnclave": {
"url": "http://your_enclave_ip_here:5000",
"utilityUrl": "http://your_enclave_ip_here:1500"
}
Benchmarking an enclave
Once the enclave is deployed, you can benchmark the enclave using
curl http://your_enclave_ip:port/benchmark
This should show the benchmarkTime in milliseconds. The response may vary based on the proving scheme, software and hardware configuration used underneath
{
benchmarkTime: "12300"
}
If the benchmarkTime
is in your acceptable range you can proceed to the next step, otherwise you can revisit the previous step and redeploy the enclave with lower/higher vCPUs.
An upcoming version of kalypso-sdk will provide a programmatic way to benchmark multiple enclaves together and provided comparisons between each.
Starting the enclave
- Start the enclave by invoking this script.
- Once done, your enclave can start receiving requests.
This steps only starts the enclave/machine. It will be sent requests once it is matched against specific jobs after completing the steps ahead.
Subscribing to the market
Joining the market required couple of arguments
computeAllocatedPerProof
: Number of vCPUs that you wish to allocate from your enclave per proof. Example: Provided you have 100 vCPUs registered in kalypso, and you decide to allocate 25 vCPUs per proof, your enclave can receive 4 parallel request at a time, provided you haven't participated in any other market. This number should be ideally inferred from the benchmarking stepproofGenerationCost
: Cost for generate a single proofproposedTimeInBlocks
: Maximum time on blocks, which your prover will generate the proof for.
- Ensure you have started the enclave before this step.
proposedTimeInBlocks
: If you fail to generate proof in declaredTime, you can be subjected to slashing.- Even though you have subscribed to marketplace, you may not receive requests if sufficient stake is not locked, visit Staking to update stake.
If you have already joined the market, this step will throw error
Staking
This step can be performed after registration (or) even after subscribing to a market. You can invoke this script to stake. The minimum stake required for you to receive requests varies from market to market.
Ensure that wallet through which your are staking has enough tokens available.
Verifying the enclave key
- This steps verifies the enclave and its signing key on the TeeVerifier smart contract.
- This also needed to be performed again if the enclave is being re-deployed/restarted.
Updating the enclave
- This step updates the enclave encryption public key in the smart contract.
- This is needed to be performed if the enclave is being re-deployed/restarted