Skip to main content

Pact OpenAPI

Pact REST API (1.3.7)

Transactional API for a runtime offering Pact smart contracts.

Non-transactional execution

local

Blocking/sync call to submit a command for non-transactional execution. In a blockchain environment this would be a node-local “dirty read”, which can either serve as a node-local repl execution, or fully gassed transaction simulation and transaction validation. Any database writes or changes to the environment are rolled back.

query Parameters
preflight
boolean

Trigger fully-gassed mainnet transaction execution simulation and transaction metadata validations.

rewindDepth
integer >= 0

Rewind transaction execution environment by a number of block heights.

signatureValidation
boolean

Require user signature validation when validating transaction metadata.

Request Body schema: application/json
cmd
required
string

Stringified JSON payload object. Canonic non-malleable signed transaction data.

hash
required
string <base64url>

Unpadded Base64URL of Blake2s-256 hash of the cmd field value. Serves as a command requestKey since each transaction must be unique.

required
Array of objects >= 0 items

List of signatures corresponding one-to-one with signers array in the payload.

Responses

Response Schema: application/json
One of
reqKey
required
string <base64url> (Request Key) = 43 characters ^[a-zA-Z0-9_-]{43}$

Unique ID of a pact transaction consisting of its hash.

required
Success (object) or Failure (object)
txId
number

Database-internal transaction tracking ID.

logs
required
string

Backend-specific value providing image of database logs.

required
object
Array of objects (event)
object

Describes result of a defpact execution.

gas
required
number

Request samples

Content type
application/json
{
  • "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
  • "sigs": [
    ],
  • "cmd": "{\"payload\":{\"exec\":{\"data\":null,\"code\":\"(+ 1 2)\"}},\"signers\":[{\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"gasLimit\":1000,\"chainId\":\"0\",\"gasPrice\":1.0e-2,\"sender\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"},\"nonce\":\"nonce-value\"}"
}

Response samples

Content type
application/json
Example
{
  • "gas": 123,
  • "result": {
    },
  • "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
  • "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
  • "metaData": null,
  • "continuation": null,
  • "txId": "456",
  • "events": [
    ]
}

Transactional batch execution

send

Asynchronous submission of one or more public (unencrypted) commands to the blockchain for execution.

Request Body schema: application/json
required
Array of objects (Pact Command) non-empty

Responses

Response Schema: application/json
requestKeys
required
Array of strings (Request Key) non-empty [ items = 43 characters ^[a-zA-Z0-9_-]{43}$ ]

Request keys for use with poll or listen to retrieve results.

Request samples

Content type
application/json
{
  • "cmds": [
    ]
}

Response samples

Content type
application/json
{
  • "requestKeys": [
    ]
}

Batch polling for results

poll

Allows polling for one or more command results by request key.

Request Body schema: application/json
requestKeys
required
Array of strings (Request Key) non-empty [ items = 43 characters ^[a-zA-Z0-9_-]{43}$ ]

Responses

Response Schema: application/json
additional property
object (Command Result)

The result of attempting to execute a single well-formed Pact command.

Request samples

Content type
application/json
{
  • "requestKeys": [
    ]
}

Response samples

Content type
application/json
{
  • "property1": {
    },
  • "property2": {
    }
}

Blocking listen for single transaction result

listen

Blocking request for single command result.

Request Body schema: application/json
listen
required
string <base64url> (Request Key) = 43 characters ^[a-zA-Z0-9_-]{43}$

Unique ID of a pact transaction consisting of its hash.

Responses

Response Schema: application/json
reqKey
required
string <base64url> (Request Key) = 43 characters ^[a-zA-Z0-9_-]{43}$

Unique ID of a pact transaction consisting of its hash.

required
Success (object) or Failure (object)
txId
number

Database-internal transaction tracking ID.

logs
required
string

Backend-specific value providing image of database logs.

required
object
Array of objects (event)
object

Describes result of a defpact execution.

gas
required
number

Request samples

Content type
application/json
{
  • "listen": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw"
}

Response samples

Content type
application/json
{
  • "gas": 123,
  • "result": {
    },
  • "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
  • "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
  • "metaData": null,
  • "continuation": null,
  • "txId": "456",
  • "events": [
    ]
}

Private transaction execution

private

Asynchronous submission of a single addressed command which will be transmitted with end-to-end encryption only between addressed entity nodes. Private payload metadata required.

Request Body schema: application/json
cmd
required
string

Stringified JSON payload object. Canonic non-malleable signed transaction data.

hash
required
string <base64url>

Unpadded Base64URL of Blake2s-256 hash of the cmd field value. Serves as a command requestKey since each transaction must be unique.

required
Array of objects >= 0 items

List of signatures corresponding one-to-one with signers array in the payload.

Responses

Response Schema: application/json
requestKeys
Array of strings (Request Key) = 1 items [ items = 43 characters ^[a-zA-Z0-9_-]{43}$ ]

Request keys for use with poll or listen to retrieve results.

Request samples

Content type
application/json
{
  • "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
  • "sigs": [
    ],
  • "cmd": "{\"payload\":{\"exec\":{\"data\":null,\"code\":\"(+ 1 2)\"}},\"signers\":[{\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"gasLimit\":1000,\"chainId\":\"0\",\"gasPrice\":1.0e-2,\"sender\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"},\"nonce\":\"nonce-value\"}"
}

Response samples

Content type
application/json
{
  • "requestKeys": [
    ]
}

SPV proof creation for cross chain transaction

spv

Blocking request to fetch spv proof of a cross chain transaction. Request must be sent to the chain where the transaction is initiated.

Request Body schema: application/json
requestKey
required
string

Request Key of an initiated cross chain transaction at the source chain.

targetChainId
required
string

Target chain id of the cross chain transaction.

Responses

Response Schema: application/json
string (SPV Proof)

Backend-specific data for continuing a cross-chain proof.

Request samples

Content type
application/json
{
  • "requestKey": "7af34f24d55d2fcf5de6fccfeeb837698ebff4598303237c64348a47806c8646",
  • "targetChainId": "1"
}

Response samples

Content type
application/json
"\"eyJzdWJqZWN0Ijp7ImlucHV0IjoiQUJSN0ltZGhjeUk2TlRRMExDSnlaWE4xYkhRaU9uc2ljM1JoZEhWeklqb2ljM1ZqWTJWemN5SXNJbVJoZEdFaU9pSlhjbW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dWQm00UWRvNl9YUkpYdHdKTGE4a0N3OWJhQWQtbXRubnlsUkczOC1WcTZzZmlZWm0xd2tKejhZcU5ZT2gwbVZCTktFR1VBTkdQWlB4NGFhMWFDdTJ1Ty1VRkJXLWxLbFdFeFU0a2JjMkszOFZCT21ZeEFDakxpdjMwazdBaGdwVXBCWUIxcEYwWFRqTmU4d3k4aHQta2FveFFKbTZpQVlXSkFYZlpXZERNdkQ3Z1UydUItWFdTVUh3bVpvM3NzV0stRzh1OTIxempBTzllbVBkOFJRVk5jOWZWZWJHN0lMb2lqVDlYMm9Db1p2Q00xQ29yR3laUUFTLVVZd3c4dkJ1bEVVYXlxaHZEQUFreUthbHk1TXk1bzJYVXZpZlZsNkg5QUM5ZXZsczVxMXh2bGhQbE9UWnJZNVB2SDNFbDd3dTBZTTJQYmZzaE1lUGFBUFpZRFJoWncyXzBVM1hIZllQbmJ6QlQ4bkc3a2gtR09kRTBTcFFCNEVOQ0FVWGEzcGVoMnhVd2dCVHd5WFVvc3RDRjNqQ21Scm9ZRGlEUTVGTGhYNkVQQUdlMUF2cFhJazZFM2tpdnUxY1N4aVFYV0hUcW1pdEUwLTVYaVpjNU4zQ3ZBS1dMNmM1RDdQSV84aW0zbG04cWhtZl84UXp3d2ZFcVpXQXZoQ0dWc1VVdCIsImNoYWluIjoxfQ\"\n"

Pact Commands

cmd
required
string

Stringified JSON payload object. Canonic non-malleable signed transaction data.

hash
required
string <base64url>

Unpadded Base64URL of Blake2s-256 hash of the cmd field value. Serves as a command requestKey since each transaction must be unique.

required
Array of objects >= 0 items

List of signatures corresponding one-to-one with signers array in the payload.

{
  • "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
  • "sigs": [
    ],
  • "cmd": "{\"payload\":{\"exec\":{\"data\":null,\"code\":\"(+ 1 2)\"}},\"signers\":[{\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"gasLimit\":1000,\"chainId\":\"0\",\"gasPrice\":1.0e-2,\"sender\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"},\"nonce\":\"nonce-value\"}"
}

Pact Command Results

reqKey
required
string <base64url> (Request Key) = 43 characters ^[a-zA-Z0-9_-]{43}$

Unique ID of a pact transaction consisting of its hash.

required
Success (object) or Failure (object)
txId
number

Database-internal transaction tracking ID.

logs
required
string

Backend-specific value providing image of database logs.

required
object
Array of objects (event)
object

Describes result of a defpact execution.

gas
required
number
{
  • "gas": 123,
  • "result": {
    },
  • "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
  • "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
  • "metaData": null,
  • "continuation": null,
  • "txId": "456",
  • "events": [
    ]
}

Pact Command Payloads

required
Exec Message (object) or Continuation Message (object)
required
Public metadata (Chainweb) (object) or Private metadata (Kuro) (object)
required
Array of objects (Signer)

List of signers, corresponding with list of signatures in outer command.

networkId
required
string
Enum: "mainnet01" "testnet04"

Backend-specific identifier of target network.

nonce
required
string

Arbitrary user-supplied value.

{
  • "payload": {
    },
  • "signers": [
    ],
  • "meta": {
    },
  • "nonce": "nonce-value"
}

Pact Values

Any of
string (String)

Pact strings encode directly to JSON strings.

Example
"string"
;

Was this page helpful?

Receive important developer updates

Cookie consent

We are using cookies on this website!