1.0.0 • Published 5 months ago

@hyperoracle/zkgraph-cli v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

zkGraph CLI

CLI

Note: Only full image will be processed by zkOracle node. local (generated by commands ending with --local option) means the zkGraph is compiled locally and only contains partial computation (so that proving and executing will be faster).

The workflow of local zkGraph development must follow: Develop (code in /src) -> Compile (get compiled wasm image) -> Execute (get expected output) -> Prove (generate input and pre-test for actual proving in zkOracle) -> Deploy (deploy verification contract) -> Verify (verify proof on-chain).

To upload and publish your zkGraph, you should Upload (upload code to IPFS), and then Publish (register zkGraph on onchain zkGraph Registry).

Compile

Compile for Full Image (Link Compiled with Compiler Server).

Usage

zkgraph compile [root]

Options

OptionsDescription
--localCompile for Local Image

Execute

Execute Full Image.

Please save the ZKGRAPH_STATE_OUTPUT string for following prove steps.

Usage

zkgraph exec <block id> [root]

Arguments

ArgumentsDescription
<block id>Block number (or block hash) as runtime context

Options

OptionsDescription
--localExecute Local Image

Set Up

Set Up Full Image

  • circuit-size: Specify the circuit size of image instead of the default recommended. eg. zkgraph setup -- --circuit-size <size> (eg. 22).

Usage

zkgraph setup [root]

Options

OptionsDescription
--localSet Up Local Image
-k, --circuit-size <size>Circuit size (k in 2^k) of image

Prove

Prove Full Image

Usage

zkgraph prove <block id> <expected state> [root]

Arguments

ArgumentsDescription
<block id>Block number (or block hash) as runtime context
<expected state>State output of the zkGraph execution

Options

OptionsDescription
--localProve Local Image
-i, --inputgenRun in input generation Mode
-t, --testRun in test Mode
-p, --proveRun in prove Mode

Deploy

Deploy Verification Contract for Full Image.

Please save the verifer_contract_address from the output dialog for following publish steps.

  • network_name: Specify the network name of deployed verification smart contract, instead of loading dataDestinations.network from zkgraph.yaml. eg. zkgraph deploy --network-name <network (eg. goerli)>.

Usage

zkgraph deploy -n [network_name (sepolia / goerli)] [root]

Options

OptionsDescription
--localDeploy Verification Contract for Local Image
-n, --network-name <name>Name of deployed network for verification contract ( sepolia / goerli )

Upload

Upload zkGraph (Code and Full Image).

Please save the ipfs_hash from the output dialog for following publish steps.

Usage

zkgraph upload [root]

Options

OptionsDescription
--localUpload Local zkGraph (Code and Local Image)

Verify

Verify Proof Onchain.

Usage

zkgraph verify <prove task id>

Arguments

ArgumentsDescription
<prove task id>Task id of prove task

Publish

Publish and Register zkGraph Onchain.

See also: Verifier Contract Interface.

Usage

zkgraph publish <deployed contract address> <ipfs_hash> <bounty_reward_per_trigger>

Arguments

ArgumentsDescription
<deployed contract address>Contract address of deployed verification contract address
<ipfs hash>IPFS hash of uploaded zkGraph
<bounty reward per trigger>Bounty reward per trigger in ETH

Config

Configuring zkGraph

When running zkGraph from the command line, the tool will automatically attempt to locate a configuration file named zkgraph.config.js in the project’s root directory. It also supports other file extensions such as JS and TS.

The most basic config file looks like this:

// zkgraph.config.js
export default {
  // config options
}

You can also explicitly specify a config file to use with the --config CLI option (resolved relative to cwd):

zkgraph --config my-config.js

Config Intellisense

Since zkGraph ships with TypeScript typings, you can leverage your IDE's intellisense with jsdoc type hints:

/** @type {import('@hyperoracle/zkgraph-cli').UserConfig} */
export default {
  // ...
}

Alternatively, you can use the defineConfig helper which should provide intellisense without the need for jsdoc annotations:

import { defineConfig } from '@hyperoracle/zkgraph-cli'

export default defineConfig({
  // ...
})

ZkGraph also directly supports TS config files. You can use zkgraph.config.ts with the defineConfig helper as well.

Config Options

JsonRpcProviderUrl

  • Type: object
  • Default: { mainet: "", sepolia: "", goerli: ""}

Update your Etherum JSON RPC provider URL here. It is recommended to use providers that support debug_getRawReceipts RPC method.

UserPrivateKey

  • Type: string

Update your private key here to sign zkwasm messages. Please note that (during testnet phrase) your address balance (in zkwasm server) should > 0.

ZkwasmProviderUrl

  • Type: string
  • Default: https://zkwasm-explorer.delphinuslab.com:8090

CompilerServerEndpoint

  • Type: string
  • Default: http://compiler.hyperoracle.io/compile

PinataEndpoint

  • Type: string
  • Default: https://api.pinata.cloud/pinning/pinFileToIPFS

PinataJWT

  • Type: string

WasmBinPath

  • Type: string
  • Default: build/zkgraph_full.wasm

LocalWasmBinPath

  • Type: string
  • Default: build/zkgraph_local.wasm
1.0.0-alpha.0

5 months ago

1.0.0

5 months ago

0.0.2-alpha.4

5 months ago

0.0.2-alpha.6

5 months ago

0.0.2-alpha.5

5 months ago

0.0.2-alpha.3

5 months ago

0.0.2-alpha.2

6 months ago

0.0.2-alpha.1

6 months ago

0.0.1

6 months ago

0.0.1-alpha.25

6 months ago

0.0.1-alpha.24

6 months ago

0.0.1-alpha.23

6 months ago

0.0.1-alpha.22

6 months ago

0.0.1-alpha.21

6 months ago

0.0.1-alpha.20

6 months ago

0.0.1-alpha.19

6 months ago

0.0.1-alpha.18

6 months ago

0.0.1-alpha.17

6 months ago

0.0.1-alpha.16

6 months ago

0.0.1-alpha.15

6 months ago

0.0.1-alpha.14

6 months ago

0.0.1-alpha.13

6 months ago

0.0.1-alpha.12

6 months ago

0.0.1-alpha.11

6 months ago

0.0.1-alpha.10

6 months ago

0.0.1-alpha.9

6 months ago

0.0.1-alpha.8

7 months ago

0.0.1-alpha.7

7 months ago

0.0.1-alpha.6

7 months ago

0.0.1-alpha.5

7 months ago

0.0.1-alpha.4

7 months ago

0.0.1-alpha.3

7 months ago

0.0.1-alpha.2

7 months ago

0.0.1-alpha.1

7 months ago

0.0.1-alpha.0

7 months ago