Pact OpenAPI
Pact REST API (1.3.7)
Transactional API for a runtime offering Pact smart contracts.
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 |
hash required | string <base64url> Unpadded Base64URL of Blake2s-256 hash of the |
required | Array of objects >= 0 items List of signatures corresponding one-to-one with |
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
- Payload
{- "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
- "sigs": [
- {
- "sig": "8d452109cc0439234c093b5e204a7428bc0a54f22704402492e027aaa9375a34c910d8a468a12746d0d29e9353f4a3fbebe920d63bcc7963853995db015d060f"
}
], - "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
- 200
- 400
{- "gas": 123,
- "result": {
- "status": "success",
- "data": 3
}, - "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
- "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
- "metaData": null,
- "continuation": null,
- "txId": "456",
- "events": [
- {
- "name": "TRANSFER",
- "params": [
- "Alice",
- "Bob",
- 10
], - "module": "coin",
- "moduleHash": "ut_J_ZNkoyaPUEJhiwVeWnkSQn9JT9sQCWKdjjVVrWo"
}
]
}
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 |
Request samples
- Payload
{- "cmds": [
- {
- "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
- "sigs": [
- {
- "sig": "8d452109cc0439234c093b5e204a7428bc0a54f22704402492e027aaa9375a34c910d8a468a12746d0d29e9353f4a3fbebe920d63bcc7963853995db015d060f"
}
], - "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
- 200
- 400
{- "requestKeys": [
- "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw"
]
}
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
- Payload
{- "requestKeys": [
- "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw"
]
}
Response samples
- 200
{- "property1": {
- "gas": 123,
- "result": {
- "status": "success",
- "data": 3
}, - "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
- "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
- "metaData": null,
- "continuation": null,
- "txId": "456",
- "events": [
- {
- "name": "TRANSFER",
- "params": [
- "Alice",
- "Bob",
- 10
], - "module": "coin",
- "moduleHash": "ut_J_ZNkoyaPUEJhiwVeWnkSQn9JT9sQCWKdjjVVrWo"
}
]
}, - "property2": {
- "gas": 123,
- "result": {
- "status": "success",
- "data": 3
}, - "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
- "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
- "metaData": null,
- "continuation": null,
- "txId": "456",
- "events": [
- {
- "name": "TRANSFER",
- "params": [
- "Alice",
- "Bob",
- 10
], - "module": "coin",
- "moduleHash": "ut_J_ZNkoyaPUEJhiwVeWnkSQn9JT9sQCWKdjjVVrWo"
}
]
}
}
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
- Payload
{- "listen": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw"
}
Response samples
- 200
{- "gas": 123,
- "result": {
- "status": "success",
- "data": 3
}, - "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
- "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
- "metaData": null,
- "continuation": null,
- "txId": "456",
- "events": [
- {
- "name": "TRANSFER",
- "params": [
- "Alice",
- "Bob",
- 10
], - "module": "coin",
- "moduleHash": "ut_J_ZNkoyaPUEJhiwVeWnkSQn9JT9sQCWKdjjVVrWo"
}
]
}
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 |
hash required | string <base64url> Unpadded Base64URL of Blake2s-256 hash of the |
required | Array of objects >= 0 items List of signatures corresponding one-to-one with |
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 |
Request samples
- Payload
{- "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
- "sigs": [
- {
- "sig": "8d452109cc0439234c093b5e204a7428bc0a54f22704402492e027aaa9375a34c910d8a468a12746d0d29e9353f4a3fbebe920d63bcc7963853995db015d060f"
}
], - "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
- 200
{- "requestKeys": [
- "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw"
]
}
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
Backend-specific data for continuing a cross-chain proof.
Request samples
- Payload
{- "requestKey": "7af34f24d55d2fcf5de6fccfeeb837698ebff4598303237c64348a47806c8646",
- "targetChainId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VmxRRW9EQWVoT1JPeFdBckJidXpldnZLTUdQZTB1RlVfUE8yejM3VC0tY0thdDZ1d3pBVm9DbFVrU1lXaXRDODF0TERVd2JYYVFWRTdnZFp1ckN6d0RiZUlBdlpBcUFKVThWZHZkMS1nYmo2UEtIVXdWQm00UWRvNl9YUkpYdHdKTGE4a0N3OWJhQWQtbXRubnlsUkczOC1WcTZzZmlZWm0xd2tKejhZcU5ZT2gwbVZCTktFR1VBTkdQWlB4NGFhMWFDdTJ1Ty1VRkJXLWxLbFdFeFU0a2JjMkszOFZCT21ZeEFDakxpdjMwazdBaGdwVXBCWUIxcEYwWFRqTmU4d3k4aHQta2FveFFKbTZpQVlXSkFYZlpXZERNdkQ3Z1UydUItWFdTVUh3bVpvM3NzV0stRzh1OTIxempBTzllbVBkOFJRVk5jOWZWZWJHN0lMb2lqVDlYMm9Db1p2Q00xQ29yR3laUUFTLVVZd3c4dkJ1bEVVYXlxaHZEQUFreUthbHk1TXk1bzJYVXZpZlZsNkg5QUM5ZXZsczVxMXh2bGhQbE9UWnJZNVB2SDNFbDd3dTBZTTJQYmZzaE1lUGFBUFpZRFJoWncyXzBVM1hIZllQbmJ6QlQ4bkc3a2gtR09kRTBTcFFCNEVOQ0FVWGEzcGVoMnhVd2dCVHd5WFVvc3RDRjNqQ21Scm9ZRGlEUTVGTGhYNkVQQUdlMUF2cFhJazZFM2tpdnUxY1N4aVFYV0hUcW1pdEUwLTVYaVpjNU4zQ3ZBS1dMNmM1RDdQSV84aW0zbG04cWhtZl84UXp3d2ZFcVpXQXZoQ0dWc1VVdCIsImNoYWluIjoxfQ\"\n"
cmd required | string Stringified JSON |
hash required | string <base64url> Unpadded Base64URL of Blake2s-256 hash of the |
required | Array of objects >= 0 items List of signatures corresponding one-to-one with |
{- "hash": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI",
- "sigs": [
- {
- "sig": "8d452109cc0439234c093b5e204a7428bc0a54f22704402492e027aaa9375a34c910d8a468a12746d0d29e9353f4a3fbebe920d63bcc7963853995db015d060f"
}
], - "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\"}"
}
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": {
- "status": "success",
- "data": 3
}, - "reqKey": "cQ-guhschk0wTvMBtrqc92M7iYm4S2MYhipQ2vNKxoI",
- "logs": "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
- "metaData": null,
- "continuation": null,
- "txId": "456",
- "events": [
- {
- "name": "TRANSFER",
- "params": [
- "Alice",
- "Bob",
- 10
], - "module": "coin",
- "moduleHash": "ut_J_ZNkoyaPUEJhiwVeWnkSQn9JT9sQCWKdjjVVrWo"
}
]
}
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": {
- "exec": {
- "data": null,
- "code": "(coin.transfer \"Alice\" \"Bob\" 10.0)"
}
}, - "signers": [
- {
- "pubKey": "368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca",
- "clist": [
- {
- "name": "coin.TRANSFER",
- "args": [
- "Alice",
- "Bob",
- 10
]
}
]
}
], - "meta": {
- "gasLimit": 1000,
- "chainId": "0",
- "gasPrice": 0.01,
- "sender": "368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca"
}, - "nonce": "nonce-value"
}