Skip to main content

Public inputs only

Generators who participate in Markets that only support public inputs don't need to run enclaves. They just have to listen for proof requests and then pass the requests to the prover-gateway.

note

Recollect that prover-gateway is a server that converts the format of proof requests (for eg. any encoding/decoding of arguments etc.) posted on-chain and then forwards them to the component running the software that produces proofs.

Starting the Generator

  1. kalypso-listener: Download the listener binary required for the Generator.

    wget -O kalypso-listener http://link_to_prover_bin_is_not_hosted_yet
  2. Create config files: Create the necessary configuration files for the Generator.

    mkdir generator_config
    cd generator_config
    touch runtime_config.json
  3. Add relevant config data: Add the following configuration parameters to runtime_config.json.

    ./generator_config/runtime_config.json
    {
    "runtime_config": {
    "ws_url": "wss://arb-sepolia.g.alchemy.com/v2/apikey",
    "http_url": "https://arb-sepolia.g.alchemy.com/v2/apikey",
    "private_key": "private key for paying gas",
    "proof_market_place": "0xBD3700b9e4292C4842e6CB87205192Fa96e8Ed05",
    "generator_registry": "0xCf30295AfC4F12FfAC6EE96Da3607e7749881BA7",
    "start_block": 50800000,
    "chain_id": 421614,
    "payment_token": "0x01d84D33CC8636F83d2bb771e184cE57d8356863",
    "staking_token": "0xdb69299dDE4A00c99b885D9f8748B2AeD1Fe4Ed4",
    "attestation_verifier": "0x63EEf1576b477Aa60Bfd7300B2C85b887639Ac1b",
    "entity_registry": "0xFFf22f221B9dB47a43cA5c8f48f7915c7957539c",
    "markets": { "6": { "port": "3030", "ivs_url": "http://unavailable" } }
    }
    }
    • ws_url: WebSocket URL for connecting to the blockchain network.
    • http_url: HTTP URL for blockchain network API access.
    • private_key: Private key for the account used to pay for gas fees.
    • proof_market_place: Address of the proof marketplace contract.
    • generator_registry: Address of the generator registry contract.
    • start_block: The block number from which to start listening for events.
    • chain_id: The ID of the blockchain network.
    • payment_token: Address of the token used for payments.
    • staking_token: Address of the token used for staking.
    • attestation_verifier: Address of the attestation verifier contract.
    • entity_registry: Address of the entity registry contract.
    • markets: Configuration for specific markets, including port and IVS URL.
  4. Create another Generator-specific config file: Create the generator configuration file.

    touch generator_config.json
  5. Add relevant config data: Add the following configuration parameters to generator_config.json.

    ./generator_config/generator_config.json
    {
    "generator_config": [
    {
    "address": "0x4576B7d01Ff1AAB4442aEAea92fE93928463960C",
    "supported_markets": ["18"]
    }
    ]
    }
    • address: Address of the generator.
    • supported_markets: List of market IDs that the generator supports.
  6. Start the kalypso-listener

    ./kalypso-listener

Successful launch of the kalypso-listener should show logs as below:

[2024-06-16T17:29:29Z INFO  listener] Gas payers address : 0xae58e9187d21923cbbf8ce05e3d05354cd90fc7a
[2024-06-16T17:29:30Z INFO listener] Wallet nonce : 137
[2024-06-16T17:29:30Z INFO listener] Total number of generators 1
[2024-06-16T17:29:30Z INFO listener] Searching for TASKs from Block 50800000 to 50809999...
[2024-06-16T17:29:31Z INFO listener] Searching for TASKs from Block 50810000 to 50819999...
[2024-06-16T17:29:32Z INFO listener] Searching for TASKs from Block 50820000 to 50829999...
[2024-06-16T17:29:32Z INFO listener] Searching for TASKs from Block 50830000 to 50839999...
[2024-06-16T17:29:33Z INFO listener] Searching for TASKs from Block 50840000 to 50849999...

Registering with the Proof Marketplace

This section walks you through registering your Generator with the Marketplace.

Staking

Before joining a Market, it is advised that Generators check the minimum stake set by the Market Creator for that Market. Otherwise, no Tasks in the Market will be assigned to the Generator. Generators can always increase or reduce the amount of stake to have multiple Tasks assigned to them concurrently.

Ensure that you have setup the kalypso-sdk before proceeding.

/kalypso-tutorial/index.ts
// Ensure that the SDK setup has been completed

let tx: ContractTransactionResponse;
let receipt: ContractTransactionReceipt | null;
let currentStake = await kalypso.Generator().getStake();

const stakeFor = await wallet.getAddress();
if (new BigNumber(currentStake.toString()).lt(amountToStake)) {
tx = await kalypso.Generator().stake(stakeFor, amountToStake);
receipt = await tx.wait();
console.log("Stake Transaction: ", receipt?.hash);
}

return "Done";
  • stakeFor: The address from which you want to stake.
  • amountToStake: Amount to stake.

Joining the Marketplace

Once the staking step has been completed, you can join the marketplace using the function below.

Ensure that you have setup the kalypso-sdk before proceeding.

/kalypso-tutorial/index.ts
// Ensure that the SDK setup has been completed

let tx: ContractTransactionResponse;
let receipt: ContractTransactionReceipt | null;

tx = await kalypso
.Generator()
.joinMarketPlace(
marketId,
computeAllocatedPerRequest,
proofGenerationCost,
proposedTimeInBlocks,
"0x", // not required for markets for public inputs so leave it blank
"0x" // not required for markets for public inputs so leave it blank
);

receipt = await tx.wait();
console.log("Joined Market Place Transaction: ", receipt?.hash);
  • marketId: The ID of the market to join.
  • computeAllocatedPerRequest: The compute power allocated per request.
  • proofGenerationCost: The cost for generating a proof.
  • proposedTimeInBlocks: The proposed time in blocks for proof generation.