Language

Choose a language

/build/rpc / assets / zk_compliance

generatezkproof

generatezkproof "asset_id" "public_inputs" "witness" ( {"mode":"str","pk_file":"str","vk_file":"str","api_url":"str","api_key":"str","timeout":n} ) Generate a zero-knowledge proof for asset transfers. Supports both local and remote proving modes. Arguments: 1. asset_id (string, required) Asset ID requiring ZK proof 2. public_inputs (string, required) Public inputs as JSON string 3. witness (string, required) Private witness data as JSON string 4. options (json object, optional) Proof generation options { "mode": "str", (string, optional, default="local") Proof mode: 'local' or 'remote' "pk_file": "str", (string, optional) Path to proving key file (local mode) "vk_file": "str", (string, optional) Path to verification key file (local mode, optional verification) "api_url": "str", (string, optional) HTTPS API endpoint (remote mode) "api_key": "str", (string, optional) API authentication key (remote mode) "timeout": n, (numeric, optional, default=30) Timeout in seconds for remote requests } Result: { (json object) "proof" : "hex", (string) Generated proof data (hex-encoded, 192 bytes for Groth16) "public_inputs" : "hex", (string) Serialized public inputs (hex-encoded, 128 bytes legacy / 192 bytes HDv1) "public_inputs_hash" : "hex", (string) Hash of public inputs for verification "mode" : "str", (string) Proof generation mode used "proof_size" : n (numeric) Size of proof in bytes } Examples: > bitcoin-cli generatezkproof "asset_id" '{"merkle_root":"..."}' '{"commitment":"..."}' '{"mode":"local","pk_file":"/path/to/pk.bin"}' > bitcoin-cli generatezkproof "asset_id" '{"merkle_root":"..."}' '{"commitment":"..."}' '{"mode":"remote","api_url":"https://prover.example.com","api_key":"..."}'

Signature

generatezkproof(asset_id: string, public_inputs: string, witness: string, options?: object) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"generatezkproof","params":["\"<asset_id>\"","\"<public_inputs>\"","\"<witness>\"",{}]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
asset_idstringyesAsset ID requiring ZK proof
public_inputsstringyesPublic inputs as JSON string
witnessstringyesPrivate witness data as JSON string
optionsobjectProof generation options { "mode": "str", (string, optional, default="local") Proof mode: 'local' or 'remote' "pk_file": "str", (string, optional) Path to proving key file (local mode) "vk_file": "str", (string, optional) Path to verification key file (local mode, optional verification) "api_url": "str", (string, optional) HTTPS API endpoint (remote mode) "api_key": "str", (string, optional) API authentication key (remote mode) "timeout": n, (numeric, optional, default=30) Timeout in seconds for remote requests }

Result

Type:  any

{ (json object) "proof" : "hex", (string) Generated proof data (hex-encoded, 192 bytes for Groth16) "public_inputs" : "hex", (string) Serialized public inputs (hex-encoded, 128 bytes legacy / 192 bytes HDv1) "public_inputs_hash" : "hex", (string) Hash of public inputs for verification "mode" : "str", (string) Proof generation mode used "proof_size" : n (numeric) Size of proof in bytes }

Source: services/core-node/bcore/src/wallet/rpc/assets.cpp:5528

C++ symbol: generatezkproof