W3bstream Outputs

A W3bstream proof can be directed to various destinations, referred to as "Outputs." Each configuration in the W3bstream project file must have an output specified. Below is an example configuration structure:

{
  "defaultVersion": "0.1",
  "versions": [
    {
      "vmType": "halo2",
      "output": {
        "type": "..."
      },
      "version": "0.2",
      "code": "789cecb3bc5acda85509c609e9..."
    },
    {
      "vmType": "risc0",
      "output": {
        "type": "..."
      },
      "version": "0.1",
      "code": "789cecb3bc5acda85509c609e9..."
    }
  ]
}

Each output type has its own settings and parameters. Below are the supported output types and their respective configurations:

Standard Output

stdout is the default output for a configuration and is ideal during the development phase. It allows developers to retrieve the proof from the W3bstream node log for local verification without writing it to an actual destination. This simplifies debugging and testing:

"output": {
  "type": "stdout"
}

Explanation of Settings

  • type: Specifies the output type. For standard output, this should be set to stdout.

By using the stdout output type, you can focus on ensuring that your proofs are generated correctly and efficiently before moving on to more complex output configurations.

Ethereum Contract

When you need the W3bstream proof to be written to your Dapp contract (e.g., to trigger your DePIN token economy), you should use the ethereumContract output type. This output currently supports the IoTeX blockchain and requires some additional settings:

"output": {
  "type": "ethereumContract",
  "ethereum": {
    "chainEndpoint": "https://babel-api.testnet.iotex.io",
    "contractAddress": "0xDea7f9b692cb90a2DF1860189BcAc428500c44f1",
    "receiverContract": "0x22D5B41b28E7f9739a3D0C984737174cC7e554dF",
    "contractMethod": "submitProof",
    "contractAbiJSON": "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"seal\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"imageId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateDigest\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"journal\",\"type\":\"bytes\"}],\"name\":\"submitProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
  }
}

Explanation of Settings

  • type: Specifies the output type. For Ethereum contracts, this should be set to ethereumContract.

  • chainEndpoint: The endpoint of the IoTeX blockchain where your Dapp operates.

  • contractAddress: The address of the W3bstream router contract on the IoTeX blockchain.

  • receiverContract: The address of your DePIN Dapp contract that is supposed to receive the W3bstream proofs.

  • contractMethod: The method in the receiver contract that will handle the proof.

  • contractAbiJSON: The ABI of the method in the receiver contract that will handle the proof.

By configuring the output as shown, you ensure that the proofs generated by W3bstream are correctly sent to your Dapp contract on the IoTeX blockchain, enabling your DePIN token economy to function as intended.

Last updated

Logo

This documentation portal is currently undergoing updates to align with the IoTeX 2.0 Whitepaper release. Information provided here may be incomplete, or out-of-date. Please use this portal for preliminary reference only, and check out the official IoTeX 2.0 Whitepaper for updated information.

.

2024 | IoTeX