Socket
Book a DemoInstallSign in
Socket

@hyperoracle/zkgraph-cli

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperoracle/zkgraph-cli

## CLI

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
4
Created
Source

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) -> 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
--yaml-path <path>Path to yaml file
--mapping-path <path>Path to mapping file

Execute

Execute Full Image.

Please save the ZKGRAPH_STATE_OUTPUT string for following prove steps.

Usage

zkgraph exec [...params] [root]

Usage cases

zkgraph exec <blockId> [root]
zkgraph exec <blockId> <offchainData> [root]

Arguments

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

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 [...params] [root]

Usage cases

zkgraph prove <blockId> <expectedStateStr> [root]
zkgraph prove <blockId> <offchainData> <expectedStateStr> [root]

Arguments

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

Options

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

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

Deposit

Publish and register zkGraph Onchain.

Usage

zkgraph deposit <deployed contract address> <deposit amount>

Arguments

ArgumentsDescription
<deployed contract address>Contract address of deployed verification contract address
<deposit amount>Deposit amount 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: [root]/build/zkgraph_full.wasm

zkGraph CLI Build-In a tag name is root.
The root is user project root path.
Of course, you can also place this tag at any position within the string.
LocalWasmBinPath is the same.

LocalWasmBinPath

  • Type: string
  • Default: [root]/build/zkgraph_local.wasm

FAQs

Package last updated on 07 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.