The zkwasm-service-cli is a command-line interface application that provides functionalities to interact with the zkwasm cloud service. This application can be executed using the node command.
Install dependencies:
npm installThen the application can be executed using the following command:
node dist/index.js <command> <options>To view the available options, execute the following:
node dist/index.js --helpTo view the available options for each command, execute the following:
node dist/index.js <command> --helpAll example usages of the cli are available in the scripts folder.
Add a new wasm image.
node dist/index.js addimage \
-r <resturl> \
-u <address> \
-x <priv> \
-p <path> \
[-d <description>] \
[-c <circuit_size>] \
[--creator_paid_proof <true|false>] \
[--creator_only_add_prove_task <true|false>] \
[--auto_submit_network_ids x y z] \
[--import_data_image <image_md5>]
Use the following to display options:
node dist/index.js addimage --help
The following options are available for the addimage command:
-r, --resturl The rest url of zkwasm cloud serivce.
[string] [required]
-u, --address User address which is adding the image
[string] [required]
-x, --priv The private key of user address.
[string] [required]
-p, --path Wasm image path [string] [required]
-n, --name The name of the image (legacy and not used)
[deprecated] [string] [default: ""]
-c, --circuit_size The circuit size of the image. If not
specified, the default size is 22
[number] [default: 22]
-d, --description The description of the image. If not
specified, the name will be used [string]
--creator_paid_proof Specify if proofs for this image will be
charged to the creator of the image
[boolean] [default: false]
--creator_only_add_prove_task Specify if proofs for this image are
restricted to only be added by the creator
of the image [boolean] [default: false]
--auto_submit_network_ids List of network ids to automatically submit
proofs to. If not specified, proofs will
not be automatically submitted.
[array] [default: []]
--import_data_image The MD5 in which to inherit merkle data
from [string]
Add reset image task with the given parameters.
node dist/index.js resetimage \
-r <resturl> \
-u <address> \
-x <priv> \
-i <image_md5> \
[-c <circuit_size>] \
[--creator_paid_proof <true|false>] \
[--creator_only_add_prove_task <true|false>] \
[--auto_submit_network_ids x y z]
Use the following to display options:
node dist/index.js resetimage --help
The following options are available for the resetimage command:
-r, --resturl The rest url of zkwasm cloud serivce.
[string] [required]
-u, --address User address which is adding the image
[string] [required]
-x, --priv The private key of user address.
[string] [required]
-i, --image The MD5 of the wasm image
[string] [required]
-c, --circuit_size The circuit size of the image. If not
specified, the default size is 22
[number] [default: 22]
--creator_paid_proof Specify if proofs for this image will be
charged to the creator of the image
[boolean] [default: false]
--creator_only_add_prove_task Specify if proofs for this image are
restricted to only be added by the creator
of the image [boolean] [default: false]
--auto_submit_network_ids List of network ids to automatically submit
proofs to. If not specified, proofs will
not be automatically submitted.
[array] [default: []]
Add proving task.
node dist/index.js addprovingtask \
-r <resturl> \
-u <address> \
-x <priv> \
-i <image> \
[--public_input <public_input>] \
[--private_input <private_input>] \
[--submit_mode <Manual|Auto>]
Use the following to display options:
node dist/index.js addprovingtask --help
The following options are available for the addprovingtask command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
-u, --address User address which is adding the image[string] [required]
-x, --priv The private key of user address. [string] [required]
-i, --image The MD5 of the wasm image [string] [required]
--public_input public input of the proof, inputs must have format
(0x)[0-f]*:(i64|bytes|bytes-packed) and been separated by
spaces (eg: 0x12:i64 44:i64 32:i64). [string]
--private_input The private input of the proof. Currently not supported.
[string]
--submit_mode The submit mode of the proving task. Specify 'Auto' or
'Manual'. If not specified, the default is 'Manual'
[string] [default: "Manual"]
Add payment either by creating an new transaction or using a exiting one.
node dist/index.js addpayment \
-r <resturl> \
[-t <tx>] \
[-p <provider>] \
[-x <priv>] \
[-a <amount>]
Use the following to display options:
node dist/index.js addpayment --help
The following options are available for the addpayment command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
-x, --priv The private key of user address, required only when creating a
new transaction [string]
-p, --provider The provider to connect to a network, required only when
creating a new transaction [string]
-a, --amount The amount of payment, required only when creating a new
transaction [string]
-t, --tx The transaction hash. If provided, will use existing
transaction hash to add the payment, no other options are
required [string]
This command will fetch the node statistics from the server and save it to a local node_statistics_{timestamp}.json file. If the --compare-with option is specified, the command will compare the current node statistics with the specified file and output the differences to the specified --report-out file.
We do not require any user information as this is purely querying the server for statistics and optionally comparing them.
If you want to add tasks to force value updates, you can use addProvingTask or pressuretest commands.
node dist/index.js prover-profile \
-r <resturl> \
--compare-with <file> \
--report-out <file>
node dist/index.js prover-profile \
-r "http://localhost:8108" \
--compare-with "compare.json" \
--report-out "report.json"
Use the following to display options:
node dist/index.js prover-profile --help
The following options are available for the prover-profile command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
--compare-with The file to compare the current node statistics with, this
option is required if `--report-out` is specified [string]
--report-out The file to output the node statistics to, this can be a
.json or .csv file, this option is required if
`--compare-with` is specified [string]
Query Task with given parameters.
node dist/index.js querytask \
-r <resturl> \
[--task_id <task_id>] \
[--user_address <user_address>] \
[--md5 <md5>] \
[--tasktype <Setup|Prove|Verify|Batch|Deploy|Reset>] \
[--taskstatus <Pending|DryRunSuccess|Processing|DryRunFailed|Done|Fail|Unprovable|Stale>] \
[--start <start_n>] \
[--total <total_n>] \
[--concise <true|false>] \
[--verbose <true|false>]
- Query with all parameters specified
- Find most recent 10 finished proof associate with D2144252F3C9DDCA5CA86C23D2EE97E9 image
Use the following to display options:
node dist/index.js querytask --help
The following options are available for the querytask command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
--task_id Id of the task to query [string]
--user_address User address of the task to query [string]
--md5 Image MD5 of the task to query [string]
--tasktype Type of the task to query, options:
Setup|Prove|Verify|Batch|Deploy|Reset [string]
--taskstatus Status of the task to query, options: Pending|DryRunSucces
s|Processing|DryRunFailed|Done|Fail|Unprovable|Stale
[string]
--start Number of tasks to skip before counting total number of
tasks to output, default is 0 [number] [default: 0]
--total Total number of tasks to output, max is 100 and default is
1 [number] [default: 1]
--concise Print concise output or regular, default is false
[boolean] [default: false]
--verbose Enable task to be printed to stdout, default is true
[boolean] [default: true]
Query Image with given parameters.
node dist/index.js queryimage \
-r <resturl> \
--md5 <Image MD5>
Use the following to display options:
node dist/index.js queryimage --help
The following options are available for the queryimage command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
--md5 MD5 of the image to query [string] [required]
Query user with given parameters.
node dist/index.js querytask \
-r <resturl> \
--user_address <user_address>
Use the following to display options:
node dist/index.js queryuser --help
The following options are available for the queryuser command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
--user_address Address of the user to query [string] [required]
Get task's external host table file.
node dist/index.js gettaskexternalhosttable \
-r <resturl> \
--task_id <task_id>
Use the following to display options:
node dist/index.js gettaskexternalhosttable --help
The following options are available for the gettaskexternalhosttable command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
--task_id Id of the task to query [string]
Force an Unprovable task into a Fail state to allow it's proof to be retried.
node dist/index.js forceunprovabletoreprocess \
-r <resturl> \
-x <priv> \
--task_ids <task_id_0> <task_id_1> <task_id_1>
Use the following to display options:
node dist/index.js forceunprovabletoreprocess --help
The following options are available for the forceunprovabletoreprocess command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
-x, --priv The private key of user address. [string] [required]
--task_ids Id of the task to reprocess [string] [required]
Force an DryRunFailed task into a Pending state to allow it's dry run to be retried.
node dist/index.js forcedryrunfailstoreprocess \
-r <resturl> \
-x <priv> \
--task_ids <task_id_0> <task_id_1> <task_id_1>
Use the following to display options:
node dist/index.js forcedryrunfailstoreprocess --help
The following options are available for the forcedryrunfailstoreprocess command:
-r, --resturl The rest url of zkwasm cloud serivce. [string] [required]
-x, --priv The private key of user address. [string] [required]
--task_ids Id of the tasks to reprocess [array] [required] [default: []]
npm install
bash scripts/query_nodes_tasks_time_range_stat.sh
First, update the tests/config.json with your specific details.
Note: Server must be up and running with some valid data.
Test the query commands:
npm run test queriesTest the task commands:
npm run test tasks