diff --git a/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-17.json b/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-17.json new file mode 100644 index 0000000000..4d7142db23 --- /dev/null +++ b/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-17.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@kadena/chainweb-node-client", + "comment": "update ISignature to non-null ", + "type": "patch" + } + ], + "packageName": "@kadena/chainweb-node-client" +} \ No newline at end of file diff --git a/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-21.json b/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-21.json new file mode 100644 index 0000000000..c7ff869291 --- /dev/null +++ b/common/changes/@kadena/chainweb-node-client/fix-update-quicksign_2023-02-24-10-21.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@kadena/chainweb-node-client", + "comment": "", + "type": "none" + } + ], + "packageName": "@kadena/chainweb-node-client" +} \ No newline at end of file diff --git a/common/changes/@kadena/client/fix-update-quicksign_2023-02-02-06-46.json b/common/changes/@kadena/client/fix-update-quicksign_2023-02-02-06-46.json new file mode 100644 index 0000000000..e6d3e43f2f --- /dev/null +++ b/common/changes/@kadena/client/fix-update-quicksign_2023-02-02-06-46.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@kadena/client", + "comment": "update /quickSign to /quicksign in client/signWithChainweaver", + "type": "patch" + } + ], + "packageName": "@kadena/client" +} \ No newline at end of file diff --git a/common/changes/@kadena/client/fix-update-quicksign_2023-02-17-13-56.json b/common/changes/@kadena/client/fix-update-quicksign_2023-02-17-13-56.json new file mode 100644 index 0000000000..78f24c1f17 --- /dev/null +++ b/common/changes/@kadena/client/fix-update-quicksign_2023-02-17-13-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@kadena/client", + "comment": "Update with KIP 0015 signing api standard", + "type": "patch" + } + ], + "packageName": "@kadena/client" +} \ No newline at end of file diff --git a/common/changes/@kadena/types/fix-update-quicksign_2023-02-17-13-56.json b/common/changes/@kadena/types/fix-update-quicksign_2023-02-17-13-56.json new file mode 100644 index 0000000000..69a4286523 --- /dev/null +++ b/common/changes/@kadena/types/fix-update-quicksign_2023-02-17-13-56.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@kadena/types", + "comment": "add null type to IUnsignedTransaction sig", + "type": "minor" + } + ], + "packageName": "@kadena/types" +} \ No newline at end of file diff --git a/packages/libs/chainweb-node-client/.eslintignore b/packages/libs/chainweb-node-client/.eslintignore new file mode 100644 index 0000000000..93cad5cf0f --- /dev/null +++ b/packages/libs/chainweb-node-client/.eslintignore @@ -0,0 +1 @@ +/src/openapi/ diff --git a/packages/libs/chainweb-node-client/openapi/chainweb.json b/packages/libs/chainweb-node-client/openapi/chainweb.json new file mode 100644 index 0000000000..7a08cd0362 --- /dev/null +++ b/packages/libs/chainweb-node-client/openapi/chainweb.json @@ -0,0 +1,5194 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Kadena Chainweb Node API", + "description": "API of [chainweb-node](https://github.com/kadena-io/chainweb-node)\n\nChainweb is a scalable Proof-Of-Work (PoW) consensus algorithm. It is an\nconservative extension of Bitcoin's Nakamoto consensus that extends\nBitcoin's single chain algorithm to multiple chains. This allows for\nunlimited transaction throughput by horizontally scaling the number of chains.\n\nFeedback and bug reports for the content of this site are welcome. Please\nopen an issue at [this github repository](https://github.com/kadena-io/chainweb-openapi/issues).\n", + "version": "0.0", + "x-logo": { + "url": "https://i.imgur.com/bAZFAGF.png", + "alttext": "Kadena Chainweb Logo" + } + }, + "servers": [ + { + "url": "https://api.chainweb.com/chainweb/{apiVersion}/mainnet01", + "description": "Chainweb mainnet service API. It also serves some endpoints of the P2P API.\n", + "variables": { + "apiVersion": { + "default": "0.0" + } + } + }, + { + "url": "https://api.testnet.chainweb.com/chainweb/{apiVersion}/testnet04", + "description": "Chainweb testnet service API. It also serves some endpoints of the P2P API.\n", + "variables": { + "apiVersion": { + "default": "0.0" + } + } + }, + { + "url": "{schema}://{domain}:{port}/chainweb/{apiVersion}/{chainwebVersion}", + "description": "An generic chainweb-node. It may serve only a subset of the endpoints.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "api.chainweb.com" + }, + "port": { + "default": "1848" + }, + "chainwebVersion": { + "default": "mainnet01", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + }, + { + "url": "https://{location}.chainweb.com/chainweb/{apiVersion}/mainnet01", + "description": "Chainweb mainnet P2P bootstrap node. Only P2P API endpoints are served.", + "variables": { + "location": { + "default": "us-e1", + "enum": [ + "us-e1", + "us-e2", + "us-e3", + "us-w1", + "us-w2", + "us-w3", + "fr1", + "fr2", + "fr3", + "jp1", + "jp2", + "jp3" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + }, + { + "url": "https://{location}.testnet.chainweb.com/chainweb/{apiVersion}/testnet04", + "description": "Chainweb testnet P2P bootstrap node. Only P2P API endpoints are served.", + "variables": { + "location": { + "default": "us-e1", + "enum": [ + "us1", + "us2", + "eu1", + "eu2", + "ap1", + "ap2" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + } + ], + "tags": [ + { + "name": "p2p_api", + "x-displayName": "P2P API", + "description": "The P2P API is used for inter-node communication in order to establish block\nchain consensus. Each chainweb-node serves these endpoints via HTTPS on a\nnetwork interface and port that is available directly on the public\ninternet.\n\nAdditionally, endpoints of the P2P API can be made available for other\nclients. For this purpose it is possible to expose the endpoints via reverse\nproxies, load balancers, or authentication frameworks, and similar web\ntechnologies.\n" + }, + { + "name": "service_api", + "x-displayName": "Service API", + "description": "The Service API includes endpoints that expose functionality of\nchainweb-node to clients other than chainweb-nodes, such as mining pools,\nDAPPs, web applications, exchanges, wallets, etc.\n\nThe endpoints of the service API are optional and can be enabled via\nrespective configuration settings. They are served on a separate port via\nplain HTTP. Node operators are free to expose those endpoints only locally,\nor via reverse proxies, load balancers, authentication frameworks, and\nsimilar web technologies.\n\nSome of the endpoints of the service API can require considerable resources\non the server side and administrators should be careful when exposing those\npublicly. Generally, endpoints of the service API are more vulnerable to DOS\nattacks.\n" + }, + { + "name": "cut", + "x-displayName": "Cut Endpoints", + "description": "A cut represents a distributed state of a chainweb. It references one\nblock header for each chain, such that those blocks are pairwise\nconcurrent.\n\nTwo blocks from two different chains are said to be concurrent if either\none of them is an adjacent parent (is a direct dependency) of the other or\nif the blocks do not depend at all on each other.\n" + }, + { + "name": "peer", + "x-displayName": "Peer Endpoints", + "description": "The P2P communication between chainweb-nodes is sharded into several independent\nP2P network. The `cut` network is exchanging consensus state. There is also one\nmempool P2P network for each chain.\n" + }, + { + "name": "mempool", + "x-displayName": "Mempool P2P Endpoints", + "description": "Mempool P2P endpoints for communication between mempools. Endusers are not\nsupposed to use these endpoints directly. Instead, the respective Pact\nendpoints should be used for submitting transactions into the network.\n" + }, + { + "name": "payload", + "x-displayName": "Block Payload Endpoints", + "description": "Raw literal Block Payloads in the form in which they are stored on the chain.\nBy default only the payload data is returned which is sufficient for validating\nthe blockchain Merkle Tree. It is also sufficient as input to Pact for\nexecuting the Pact transactions of the block and recomputing the outputs.\n\nIt is also possible to query the transaction outputs along with the payload data.\n" + }, + { + "name": "blockhash", + "x-displayName": "Block Hashes Endpoints", + "description": "These endpoints return block hashes from the chain database.\n\nGenerally, block hashes are returned in ascending order and include hashes\nfrom orphaned blocks.\n\nFor only querying blocks that are included in the winning branch of the\nchain the `branch` endpoint can be used, which returns blocks in descending\norder starting from the leafs of branches of the block chain.\n" + }, + { + "name": "header", + "x-displayName": "Block Header Endpoints", + "description": "These endpoints return block headers from the chain database.\n\nGenerally, block headers are returned in ascending order and include headers\nof orphaned blocks.\n\nFor only querying blocks that are included in the winning branch of the\nchain the `branch` endpoints can be used, which return blocks in descending\norder starting from the leafs of branches of the block chain.\n\nBlock headers are returned in three different formats specified in the `accept` header of the request:\n* `application/json`, returns block headers in base64Url (without padding)\n encoded binary.\n* `application/json;blockheader-encoding=object`, returns block headers in\n JSON encoding.\n* `application/octet-stream`, when supported by the endpoint, returns block\n headers as binary.\n" + }, + { + "name": "config", + "x-displayName": "Config Endpoint" + }, + { + "name": "misc", + "x-displayName": "Miscellaneous Endpoints" + }, + { + "name": "pact", + "x-displayName": "Pact Endpoints", + "description": "The [Pact](https://pactlang.org) endpoints are documented in the [Pact API\nSpecification](./pact.html).\n\nThe Pact endpoints for chain `{chainId}` use the route prefix\n`/chain/{chainId}/pact/` in addition to the base URL.\n\nFuther details can also be found in [this section of the Pact Language\nReference](https://pact-language.readthedocs.io/en/stable/pact-reference.html#endpoints).\n" + }, + { + "name": "rosetta", + "x-displayName": "Rosetta Endpoints", + "description": "Chainweb node includes an implementation of the\n[Rosetta API](https://www.rosetta-api.org). The API is disabled by default\nand can be enabled in the configuration file of a node.\n\nThe following endpoints are supported, which are documented\nin the [Rosetta Specification](https://www.rosetta-api.org/docs/welcome.html):\n\n* `POST rosetta/account/balance`\n* `POST rosetta/block/transaction`\n* `POST rosetta/block`\n* `POST rosetta/construction/metadata`\n* `POST rosetta/construction/submit`\n* `POST rosetta/mempool/transaction`\n* `POST rosetta/mempool`\n* `POST rosetta/network/list`\n* `POST rosetta/network/options`\n* `POST rosetta/network/status`\n" + }, + { + "name": "mining", + "x-displayName": "Mining Endpoints", + "description": "The Mining API of Chainweb node is disabled by default. It can be enabled\nand configured in the configuration file.\n\n\nThe mining API consists of the following endpoints that\nare described in detail on the\n[Chainweb mining wiki page](https://github.com/kadena-io/chainweb-node/wiki/Mining-API)\n\n* `GET mining/work`\n* `POST mining/solved`\n* `GET mining/updates`\n" + }, + { + "name": "binaryHeader", + "x-displayName": "Block Header Binary Encoding", + "description": "## Binary Format For Chain Graphs of Degree Three\n\ndefined in `Chainweb.BlockHeader`\n\n| Size | Bytes | Value |\n| ---- | ------- | ----------- |\n| 8 | 0-7 | flags |\n| 8 | 8-15 | time |\n| 32 | 16-47 | parent |\n| 110 | 48-157 | adjacents |\n| 32 | 158-189 | target |\n| 32 | 190-221 | payload |\n| 4 | 222-225 | chain |\n| 32 | 226-257 | weight |\n| 8 | 258-265 | height |\n| 4 | 266-269 | version |\n| 8 | 270-277 | epoch start |\n| 8 | 278-285 | nonce |\n| 32 | 286-317 | hash |\n\ntotal: 318 bytes\n\nAdjacent Parents Record (length 3):\n\n| Bytes | Value |\n| ----- | --------- |\n| 0-1 | length |\n| 2-109 | adjacents |\n\ntotal: 110 bytes\n\nAdjacent Parent:\n\n| Bytes | Value |\n| ----- | ----- |\n| 0-3 | chain |\n| 4-35 | hash |\n\ntotal: 36 bytes\n\n## Fields\n\n**POW related values**:\n\nArithmetic operations and comparisons on `parent`, `target`, `weight`, and `hash`\ninterpret the value as unsigned 256 bit integral numbers in little endian encoding.\nAll operations are performed using rational arithmetic of unlimited precision and the final result is rounded.\nPlease consult the code for details of how the result is rounded.\n\n**Time Stamps**:\n\n`time` and `epoch start` are a little endian twoth complement encoded integral numbers that count SI microseconds since POSIX epoch (leap seconds are ignored). These numbers are always positive (highest bit is 0).\n\n**Numbers**:\n\n* `height` is a little endian encoded unsigned integral 64 bit number.\n* `length` is a little endian encoded unsigned integral 16 bit number.\n\n**Version**:\n\n`version` identifies the chainweb version. It is a 32 bit value in little endian encoding.\nValues up to 0x0000FFFF are reserved for production versions (which includes `development` and testnets).\n\n| value | version |\n| ---------- | ----------- |\n| 0x00000005 | mainnet01 |\n| 0x00000001 | development |\n| 0x00000007 | testnet04 |\n\n**Other**:\n\n* `nonce` is any sequence of 8 bytes that is only compared for equality.\n* `chain` is any sequence of 4 bytes that identifies a chain and can be compared for equality.\n* `payload` is any sequence of 32 bytes that is a cryptographic hash of the payload associated with the block and can be compared for equality.\n* `flags` are eight bytes of value 0x0 that are reserved for future use.\n" + }, + { + "name": "binaryWorkHeader", + "x-displayName": "Work Header Binary Encoding", + "description": "The work bytes received from the `/miner/work` endpoint is slightly different than the above header format. These headers do not include the block hash, instead prefixing the header above (without hash) with chain id and hash target bytes.\n\nThe first 36 bytes are informational. Only the bytes from position 36 to the end are subject of the POW hash computation.\n\nThe final 8 bytes are the nonce. The creation time is encoded in bytes 44-52 (see above for details of the encoding). Miners are allowed, but not required, to update the time to reflect the solve time for the block more closely.\nA larger value for the creation time increases the accuracy of difficulty adjustment which is in the interest of miners -- the high difficulty guarantees that the outcome of the race of winning blocks is determined by actual hash power. However, blocks that are predated (i.e. have a creation time that is in the future) are rejected during block header validation. Leaving the time unchanged is a valid choice.\n\nMiners must not change or make any assumptions about the content of the \"reserved\" bytes.\n\nDefined in `Chainweb.Miner.Core`\n\n| Size | Bytes | Work Bytes | Value |\n| ---- | ------- | -----------| ----------- |\n| 4 | 0-3 | NA | chain |\n| 32 | 4-35 | NA | hash-target |\n| | | | |\n| 8 | 36-43 | 0-7 | reserved |\n| 8 | 44-51 | 8-15 | **time** |\n| 298 | 52-313 | 16-277 | reserved |\n| 8 | 314-321 | 278-285 | **nonce** |\n\ntotal: 322 bytes\n\n\nFor arithmetic comparisons the `hash-target` is interpreted as unsigned 256 bit integral number in little endian encoding.\n\n`time` is a little endian twoth complement encoded integral number that counts SI microseconds since POSIX epoch (leap seconds are ignored). The value is always positive (highest bit is 0).\n" + }, + { + "name": "cut_model", + "x-displayName": "Cut Model", + "description": "The `origin` property is required for use with the `PUT /cut` endpoint.\n\n" + }, + { + "name": "payload_model", + "x-displayName": "Payload Model", + "description": "\n" + }, + { + "name": "payloadWithOutputs_model", + "x-displayName": "Payload With Outputs Model", + "description": "\n" + }, + { + "name": "header_model", + "x-displayName": "Block Header Model", + "description": "\n" + }, + { + "name": "peer_model", + "x-displayName": "Peer Info Model", + "description": "\n\n## Compute PeerInfo\n\nGenerally, it is easier to query the peer info of a peer using a GET query for a peer database.\nOtherwise the peer info can be computed as follows.\n\nFor peers that use domain names with valid CA signed SSL certificates the peer id is `null`.\n\nFor peers with self-signed certificates the peer id is the base64Url (without padding) encoded\nSHA256 fingerprint of the certificate. For a chainweb-node `NODE` it can be computed as follows:\n\n```sh\necho |\nopenssl s_client -showcerts -servername ${NODE} -connect ${NODE}:443 2>/dev/null |\nopenssl x509 -fingerprint -noout -sha256 |\nsed 's/://g' |\ntail -c 65 |\nxxd -r -p |\nbase64 |\ntr -d '=' |\ntr '/+' '_-'\n```\n" + }, + { + "name": "nodeInfo_model", + "x-displayName": "Chainweb Node Info Model", + "description": "\n" + }, + { + "name": "page_model", + "x-displayName": "Collection Page Model", + "description": "\n" + }, + { + "name": "minerInfo_model", + "x-displayName": "Miner Info Model", + "description": "\n" + }, + { + "name": "miningUpdateEventStream_model", + "x-displayName": "Mining Update Event Stream Model", + "description": "A server-sent event sources that notifies miners when new mining work\nbecomes available. The stream is terminated by the server in regular\nintervals and it is up to the client to request a new stream.\n\nEach event consists of a single line: `event:New Cut`.\nEvents are separated by empty lines.\n\n\n" + }, + { + "name": "commonResponseHeaders", + "x-displayName": "Response Headers", + "description": "\n## Server Timestamp\n\n`x-server-timestamp`: The time of the clock of the remote node\n\n\n\n## Chainweb Node Version\n\n`x-chainweb-node-version`: The version of the remote chainweb node\n\n\n\n## Client Peer Address\n\n`x-peer-addr`: Host and port of the client as observed by the remote node\n\n\n" + } + ], + "x-tagGroups": [ + { + "name": "chainweb_p2p", + "x-displayName": "Chainweb P2P API", + "tags": [ + "p2p_api", + "cut", + "blockhash", + "header", + "payload", + "mempool", + "peer", + "config" + ] + }, + { + "name": "chainweb_service", + "x-displayName": "Chainweb Service API", + "tags": [ + "service_api", + "misc", + "mining", + "pact", + "rosetta" + ] + }, + { + "name": "Common HTTP Headers", + "tags": [ + "commonResponseHeaders" + ] + }, + { + "name": "Data Models", + "tags": [ + "cut_model", + "header_model", + "payload_model", + "payloadWithOutputs_model", + "peer_model", + "nodeInfo_model", + "page_model", + "minerInfo_model", + "miningUpdateEventStream_model" + ] + }, + { + "name": "Binary Encodings", + "tags": [ + "binaryHeader", + "binaryWorkHeader" + ] + } + ], + "components": { + "schemas": { + "posixTimestamp": { + "title": "POSIX Timestamp", + "type": "integer", + "description": "Seconds since POSIX epoch", + "example": 1619108524, + "minimum": 0 + }, + "posixTimestampMicro": { + "title": "POSIX Timestamp in Microseconds", + "type": "integer", + "description": "Microseconds since POSIX epoch", + "example": 1602382624629329, + "minimum": 0 + }, + "chainwebVersion": { + "title": "Chainweb Version", + "description": "The version of the Chainweb network", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ] + }, + "chainId": { + "title": "Chain ID", + "description": "A Chainweb chain ID. In Kadena Chainweb chains are named by numbers\nstarting form 0. Valid values depend on the current graph at the\nrespective block height of the chainweb version.\n", + "type": "integer", + "minimum": 0, + "example": 0 + }, + "hostAddress": { + "title": "Host Address", + "description": "Host address containing IPv4 and port", + "type": "string", + "pattern": "^\\d{4}.\\d{4}.\\d{4}.\\d{4}:\\d+$", + "example": "10.36.1.3:42988" + }, + "signedTxText": { + "title": "Signed Transaction Text", + "type": "string", + "description": "Text of a JSON encoded signed Pact transaction", + "example": { + "value": { + "hash": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw", + "sigs": [ + { + "sig": "8ddc06b37c496f2cadc4f7412405a80faf3ab07482ff5553b9b5fcc73d1b4121275ad5948d9b4078e553b71f8b42eaf6b24135bf2fb4d5840c16bcdde0e35e0f" + } + ], + "cmd": "{\"networkId\":\"mainnet01\",\"payload\":{\"exec\":{\"data\":{\"account-keyset\":{\"pred\":\"keys-all\",\"keys\":[\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\"]}},\"code\":\"(coin.transfer-create \\\"60241f51ea34e05c61fbea9d\\\" \\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\" (read-keyset \\\"account-keyset\\\") 5007.0000)\"}},\"signers\":[{\"pubKey\":\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\",\"clist\":[{\"args\":[\"60241f51ea34e05c61fbea9d\",\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\",5007],\"name\":\"coin.TRANSFER\"},{\"args\":[],\"name\":\"coin.GAS\"}]}],\"meta\":{\"creationTime\":1618949714,\"ttl\":300,\"gasLimit\":600,\"chainId\":\"0\",\"gasPrice\":1.0e-7,\"sender\":\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\"},\"nonce\":\"\\\"2021-04-20T20:16:13.645Z\\\"\"}" + } + } + }, + "requestKey": { + "title": "Request Key", + "type": "string", + "description": "Base64Url-encoded, request key of a Pact transaction", + "pattern": "^[a-zA-Z0-9_-]{43}$", + "minLength": 43, + "maxLength": 43, + "example": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw" + }, + "sha256Hash": { + "title": "SHA256 Hash", + "type": "string", + "description": "Base64Url (without padding) encoded SHA256 hash", + "pattern": "^[a-zA-Z0-9_-]{43}$", + "minLength": 43, + "maxLength": 43, + "example": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw" + }, + "blockHash": { + "title": "Block Hash", + "description": "Base64Url (without padding) encoded block hash", + "example": "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH7", + "allOf": [ + { + "$ref": "#/components/schemas/sha256Hash" + } + ] + }, + "payloadHash": { + "title": "Block Payload Hash", + "description": "Base64Url (without padding) encoded block payload hash", + "example": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "allOf": [ + { + "$ref": "#/components/schemas/sha256Hash" + } + ] + }, + "blockHeight": { + "title": "Block Height", + "description": "The height of a block is the number of its predecessors in the block chain\n", + "type": "integer", + "minimum": 0, + "example": 1000000 + }, + "blockWeight": { + "title": "Block Weight", + "description": "The POW weight of a block is the sum of the difficulties of the block\nand of all of its ancestors. The difficulty of a block is the maximum\ndifficulty divided by the target.\n\nIt represented as the base64Url (without padding) 256 bit little endian\nencoding of the numerical value.\n", + "type": "string", + "pattern": "^[a-zA-Z0-9_-]{43}$", + "minLength": 43, + "maxLength": 43, + "example": "iil_D0t2MGqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + "target": { + "title": "PoW Target", + "description": "The PoW target of a block represented as the base64Url (without\npadding) 256 bit little endian encoding of the numerical value.\n", + "type": "string", + "pattern": "^[a-zA-Z0-9_-]{43}$", + "minLength": 43, + "maxLength": 43, + "example": "2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA" + }, + "nonce": { + "title": "PoW Nonce", + "description": "PoW nonce of the block. This is computed by the miner such that the\nblock hash is smaller than the target.\n", + "type": "string", + "pattern": "[0-9]+", + "minLength": 1 + }, + "base64Header": { + "title": "Base64Url Block Header", + "description": "Base64Url (without padding) encoded binary block header", + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "example": { + "value": { + "$ref": "#/components/examples/base64HeaderPage/value/items/0" + } + } + }, + "backupStatus": { + "title": "Backup job status", + "type": "string", + "pattern": "backup-done|backup-in-progress|backup-failed" + }, + "backupId": { + "title": "Backup job identifier", + "description": "Textual backup job identifier", + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "example": 1648665437000 + }, + "binaryHeader": { + "title": "Binary Block Header", + "description": "Binary representation of a block header", + "type": "string", + "minLength": 318, + "maxLength": 318 + }, + "blockHeader": { + "title": "Block Header", + "description": "JSON Encoded Block Header", + "required": [ + "creationTime", + "parent", + "height", + "hash", + "chainId", + "weight", + "featureFlags", + "epochStart", + "adjacents", + "payloadHash", + "chainwebVersion", + "target", + "nonce" + ], + "example": { + "value": { + "$ref": "#/components/examples/blockHeaderPage/value/items/0" + } + }, + "properties": { + "creationTime": { + "$ref": "#/components/schemas/posixTimestampMicro" + }, + "parent": { + "$ref": "#/components/schemas/blockHash" + }, + "height": { + "$ref": "#/components/schemas/blockHeight" + }, + "hash": { + "$ref": "#/components/schemas/blockHash" + }, + "chainId": { + "$ref": "#/components/schemas/chainId" + }, + "weight": { + "$ref": "#/components/schemas/blockWeight" + }, + "featureFlags": { + "type": "integer", + "description": "A reserved value that must be 0." + }, + "epochStart": { + "$ref": "#/components/schemas/posixTimestampMicro" + }, + "adjacents": { + "description": "The block hashes of the adjacent parents of the block. This is\nrepresented as an associative array that maps the adjancent chain\nids to the respective block hash.\n", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/blockHash" + } + }, + "payloadHash": { + "$ref": "#/components/schemas/payloadHash" + }, + "chainwebVersion": { + "$ref": "#/components/schemas/chainwebVersion" + }, + "target": { + "$ref": "#/components/schemas/target" + }, + "nonce": { + "$ref": "#/components/schemas/nonce" + } + } + }, + "payload": { + "title": "Block Payload", + "description": "Payload of a Block including the Merkle roots for transactions and\ntransaction outputs.\n", + "required": [ + "transactions", + "minerData", + "transactionsHash", + "outputsHash", + "payloadHash" + ], + "example": { + "value": { + "$ref": "#/components/examples/payloads/value/1" + } + }, + "properties": { + "transactions": { + "type": "array", + "description": "Array of base64Url (without padding) encoded JSON texts of signed Pact transactions", + "items": { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of a signed Pact transaction" + } + }, + "minerData": { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of the miner data of the payload" + }, + "transactionsHash": { + "$ref": "#/components/schemas/sha256Hash" + }, + "outputsHash": { + "$ref": "#/components/schemas/sha256Hash" + }, + "payloadHash": { + "$ref": "#/components/schemas/payloadHash" + } + } + }, + "payloadWithOutputs": { + "title": "Block Payload With Outputs", + "description": "Payload with outputs of a Block including the Merkle roots for\ntransactions and transaction outputs\n", + "required": [ + "transactions", + "minerData", + "transactionsHash", + "outputsHash", + "payloadHash", + "coinbase" + ], + "example": { + "value": { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "coinbase": "eyJnYXMiOjAsInJlc3VsdCI6eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YSI6IldyaXRlIHN1Y2NlZWRlZCJ9LCJyZXFLZXkiOiJJa2hoV0VGQ2NURlFTMU5MYkdodVkwcHJNRjlOZERjMVgyeE1OMDVUTTNkSk5qSTNVV1pZV2w4NE5Xc2kiLCJsb2dzIjoiZ3Noak1kWFJrVGxKYmIxalZkQWJ6SVVDcGpQb1JBQ2pEbExzRzBXNkJEMCIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNTB9" + } + }, + "properties": { + "transactions": { + "type": "array", + "description": "Array of pairs of transactions and their outputs.\nSigned Pact transactions and outputs are base64Url-encoded without padding.\n", + "items": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "anyOf": [ + { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of a signed Pact transaction" + }, + { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of a transaction output" + } + ] + } + } + }, + "minerData": { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of the miner data of the payload" + }, + "transactionsHash": { + "$ref": "#/components/schemas/sha256Hash" + }, + "outputsHash": { + "$ref": "#/components/schemas/sha256Hash" + }, + "payloadHash": { + "$ref": "#/components/schemas/payloadHash" + }, + "coinbase": { + "type": "string", + "pattern": "[a-zA-Z0-9_-]+", + "description": "Base64Url (without padding) encoded JSON text of coinbase output of the block" + } + } + }, + "peer": { + "title": "Peer", + "description": "Peer info object", + "required": [ + "id", + "address" + ], + "example": { + "address": { + "hostname": "85.238.99.91", + "port": 30004 + }, + "id": "PRLmVUcc9AH3fyfMYiWeC4nV2i1iHwc0-aM7iAO8h18" + }, + "properties": { + "id": { + "description": "The base64Url (without padding) encoded SHA256 fingerprint of the\nSSL certificate of the node. This can be null only if the node uses\nan official CA signed certificate\n", + "type": "string", + "nullable": true, + "pattern": "[a-zA-Z0-9_-]{43}" + }, + "address": { + "required": [ + "hostname", + "port" + ], + "properties": { + "hostname": { + "description": "A domain name or IP address. This must be a domain name only if\nthe respective node is using a valid CA signed SSL certificate.\n", + "type": "string", + "oneOf": [ + { + "format": "hostname" + }, + { + "format": "ipv4" + }, + { + "format": "ipv6" + } + ] + }, + "port": { + "description": "Port number", + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + } + } + } + }, + "cut": { + "title": "Cut", + "description": "Cut datastruction of the chainweb API", + "required": [ + "height", + "weight", + "hashes" + ], + "example": { + "value": { + "origin": null, + "height": 30798466, + "weight": "b0wYplmNiTBXCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "hashes": { + "0": { + "height": 1539923, + "hash": "qEaSmWt_tDcJC9AGbgWY9x12LW5VED7hGgfyz9x_S3w" + }, + "1": { + "height": 1539923, + "hash": "TJuC6nfhamfD517gspAZmqD9umR71nAgttDOi1JbBHw" + }, + "2": { + "height": 1539924, + "hash": "4ineCWfnO1rneWuBMLPzqTl2HF_sZpypT_3TEzf3VLc" + }, + "3": { + "height": 1539924, + "hash": "ZEOMXB2ByqzL2HfYVKIZKAnoe4wIeJ2SaltnXDir59k" + }, + "4": { + "height": 1539923, + "hash": "0g0rOoSznVW2BJDBmK0Lbxz22F-sxTZUNIrUs_Q8Ye4" + }, + "5": { + "height": 1539923, + "hash": "5y_TL-clnF_wELMBKyJk0Sz8RVShw_bGQETJdrMkADA" + }, + "6": { + "height": 1539923, + "hash": "YkQKv6P4_C4jRM3RqKK9FWPxIneeLzlkKQS9ATAQYRk" + }, + "7": { + "height": 1539923, + "hash": "j_hJ9iiH_ATyeQeeRN3auGXjbBWiFgnTU0dYPIz8cKM" + }, + "8": { + "height": 1539924, + "hash": "s7c3B55VbDsS6EJ-nc9S5k2kNbPOBGI8xxF3vUg4d4Q" + }, + "9": { + "height": 1539922, + "hash": "bowQf63xSY9owHKhK1yGee2Q0Fn8yL_oCLaEUn-CGoA" + }, + "10": { + "height": 1539924, + "hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4" + }, + "11": { + "height": 1539924, + "hash": "TIhegjZ0GEC73T4m0BVuFtfLNGuS56IUWEuf93AJ5UU" + }, + "12": { + "height": 1539923, + "hash": "-j1qcAS9Fs-WQmc3WEhzZ96VojxnlIA2TFpfyIv31Zs" + }, + "13": { + "height": 1539923, + "hash": "S-4TqMgWGlK1k33XRlU9w0Lfwr0RvkO5Jn78Au1OglM" + }, + "14": { + "height": 1539923, + "hash": "xSuULf--S4TrgYNz82deaGhnPLWrg3pXkynGeUPUGwA" + }, + "15": { + "height": 1539923, + "hash": "jsc9rugvcHXDiBAuoO9_j8R_b_jchtJJ8b5596i8wVg" + }, + "16": { + "height": 1539923, + "hash": "qs1aEY8kSxfUBb_JRVswv5dYINRXBjGJteC-6RC1hjc" + }, + "17": { + "height": 1539924, + "hash": "xzVBXaQxzlUfUrakDgppUubQBRXGh-Uy0HBdMNwCq_Y" + }, + "18": { + "height": 1539924, + "hash": "4VOHPAqwioySYRycdl5MxfscQHwtlwwCAt7AySYQT98" + }, + "19": { + "height": 1539923, + "hash": "1PrRg20XyQ_2cfgGOgNK9K-cqIJ1vO8-A-RJlfN5m00" + } + }, + "id": "BBz7KeurYTeQ0hMGbwUbQC84cRbVcacoDQTye-3qkXI", + "instance": "mainnet01" + } + }, + "properties": { + "origin": { + "$ref": "#/components/schemas/peer" + }, + "height": { + "description": "The cut height is the sum of the height of all blocks of the cut.\nUsage of this value should be avoided, because its semantics may\nchange in the future\n", + "type": "integer", + "minimum": 0 + }, + "weight": { + "description": "The sum of the weights of all blocks in the cut", + "type": "string", + "pattern": "[a-zA-Z0-9_-]{43}" + }, + "hashes": { + "type": "object", + "required": [ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10" + ], + "description": "An object that maps chain Ids to their respective block hash and\nblock height\n", + "additionalProperties": { + "$ref": "#/components/schemas/hashWithBlockHeight" + } + }, + "instance": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, + "hashWithBlockHeight": { + "title": "Hash with block height", + "description": "A block hash and the height of that block", + "required": [ + "hash", + "height" + ], + "example": { + "height": 1539924, + "hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4" + }, + "type": "object", + "properties": { + "hash": { + "type": "string", + "pattern": "[a-zA-Z0-9_-]{43}" + }, + "height": { + "type": "integer", + "minimum": 0 + } + } + }, + "nodeInfo": { + "title": "Chainweb Node Info", + "description": "General information about a chainweb node", + "required": [ + "nodeNumberOfChains", + "nodeApiVersion", + "nodeChains", + "nodeVersion", + "nodeGraphHistory" + ], + "example": { + "value": { + "nodeNumberOfChains": 20, + "nodeApiVersion": "0.0", + "nodeChains": [ + "12", + "13", + "14", + "15", + "8", + "9", + "10", + "11", + "4", + "5", + "6", + "7", + "0", + "16", + "1", + "17", + "2", + "18", + "3", + "19" + ], + "nodeVersion": "mainnet01", + "nodeGraphHistory": [ + [ + 0, + [ + [ + 0, + [ + 5, + 2, + 3 + ] + ], + [ + 1, + [ + 4, + 6, + 3 + ] + ], + [ + 2, + [ + 4, + 7, + 0 + ] + ], + [ + 3, + [ + 8, + 0, + 1 + ] + ], + [ + 4, + [ + 9, + 1, + 2 + ] + ], + [ + 5, + [ + 9, + 6, + 0 + ] + ], + [ + 6, + [ + 5, + 7, + 1 + ] + ], + [ + 7, + [ + 8, + 6, + 2 + ] + ], + [ + 8, + [ + 9, + 7, + 3 + ] + ], + [ + 9, + [ + 8, + 4, + 5 + ] + ] + ] + ], + [ + 852054, + [ + [ + 0, + [ + 15, + 10, + 5 + ] + ], + [ + 1, + [ + 11, + 6, + 16 + ] + ], + [ + 2, + [ + 12, + 7, + 17 + ] + ], + [ + 3, + [ + 13, + 8, + 18 + ] + ], + [ + 4, + [ + 14, + 9, + 19 + ] + ], + [ + 5, + [ + 8, + 7, + 0 + ] + ], + [ + 6, + [ + 8, + 9, + 1 + ] + ], + [ + 7, + [ + 9, + 5, + 2 + ] + ], + [ + 8, + [ + 5, + 6, + 3 + ] + ], + [ + 9, + [ + 4, + 6, + 7 + ] + ], + [ + 10, + [ + 11, + 0, + 19 + ] + ], + [ + 11, + [ + 12, + 10, + 1 + ] + ], + [ + 12, + [ + 13, + 11, + 2 + ] + ], + [ + 13, + [ + 12, + 14, + 3 + ] + ], + [ + 14, + [ + 13, + 15, + 4 + ] + ], + [ + 15, + [ + 14, + 0, + 16 + ] + ], + [ + 16, + [ + 15, + 1, + 17 + ] + ], + [ + 17, + [ + 16, + 2, + 18 + ] + ], + [ + 18, + [ + 17, + 3, + 19 + ] + ], + [ + 19, + [ + 10, + 4, + 18 + ] + ] + ] + ] + ] + } + }, + "properties": { + "nodeNumberOfChains": { + "type": "integer", + "minimum": 10, + "example": 20 + }, + "nodeApiVersion": { + "type": "string", + "example": "0.0" + }, + "nodeChains": { + "type": "array", + "items": { + "description": "Chain identifiers", + "type": "string" + }, + "minItems": 0, + "example": [ + "0" + ] + }, + "nodeVersion": { + "type": "string", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ], + "example": "mainnet01" + }, + "nodeGraphHistory": { + "description": "Array of all chain graphs indexed by the height of the first block with the repective\ngraph. Graphs are encoded as adjacency lists.\n", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "description": "A pair consisting of the height of the first block of a chain graph and the adjacency list of the graph.", + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "oneOf": [ + { + "description": "height of the first block of the graph", + "type": "integer", + "minimum": 0 + }, + { + "description": "adjacency list encoding of the chain graph.", + "type": "array", + "items": { + "description": "A pair of the chain identifier and the list of chains adjacent to it.", + "minItems": 2, + "maxItems": 2, + "type": "array", + "items": { + "oneOf": [ + { + "description": "a chain identifier", + "type": "integer", + "minimum": 0 + }, + { + "description": "an adjacency list for that chain", + "type": "array", + "minItems": 0, + "items": { + "type": "integer", + "minimum": 0 + } + } + ] + } + } + } + ] + } + } + } + } + }, + "page": { + "title": "Page", + "description": "Page of a collection of items", + "required": [ + "next", + "limit", + "items" + ], + "example": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "AAAAAAAAAABRoiLHW7EFAB2lwAatTykipYZ3CZNPzLe-f5S-zUt8COtu0H12f_OZAwAFAAAAMpic85rur2MYf3zli8s8bHxTFjriFoMPTr6ZPs8sjxMKAAAAVBKuhU_hQmuvKlx88A5o-FH0rzNo59NsdxmOGNBQ-ycPAAAAMItdqgHZxf7j6l0oE8X-G9-VyMbnQmZrtSniuRe_EJ9CtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAABqWlmx5B6wo0YWPIShNKmdVrAQWht2P85BS1drGLpkAAAAAADUJ-ARn7blgHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEIPAAAAAAAFAAAA-na5gFuxBQAFL-3CY4YuAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5", + "AAAAAAAAAAA0slHKW7EFAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5AwAFAAAAALcxv1ZiwwQ_QX9eOBZMbzIop6n7XtveS1FqOFwyvGMKAAAAC76ElC60qXSJQCHePpzzJxsCYvvrqvmkoHPyZnex-4QPAAAAKv0sz_rTANjoiJwMrdZFCJNFwdH0U_M5ouwMr3BXBfpCtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAALJlIg1vY3w_9L63bePn1yk_5agvdEbIBBjm3adxc5xWAAAAAGzpBzdiVL9gHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQUIPAAAAAAAFAAAA-na5gFuxBQALiBhXgqaHAb4VWug3oddEVy0X9y_jEkE2Kmi_vyGP5ovr-fDIz_Uf" + ], + "limit": 2 + } + }, + "properties": { + "limit": { + "description": "The number of items in the page. This number can be smaller but\nnever be larger than the number of requested items.\n", + "type": "integer", + "minimum": 0, + "items": { + "description": "Items of the returned collection", + "type": "array" + } + }, + "next": { + "description": "A cursor that can be used to query the next page. It should be used\nliterally as value for the `next` parameter in a follow-up request.\n", + "oneOf": [ + { + "type": "null" + }, + { + "type": "string" + } + ], + "nullable": true, + "pattern": "^(inclusive|exclusive):.*$" + }, + "items": { + "description": "The items in the page.\n" + } + } + }, + "miningUpdateEventStream": { + "title": "Mining Update Events", + "description": "A stream of server-sent events. **This is not an JSON array**.\nEvents are separated by empty lines (`\\n\\n`). Each event\nconsists of a single line:\n\n event:New Cut\n", + "type": "array", + "items": { + "title": "New Cut Event", + "description": "A `New Cut` event. **This is not an JSON object**.\nEach event consists of a single `event` propert.\n", + "properties": { + "event": { + "type": "string", + "enum": [ + "New Cut" + ] + } + } + }, + "example": "event:New Cut\n\nevent:New Cut\n\nevent:New Cut" + }, + "minerInfo": { + "title": "Miner Info", + "properties": { + "account": { + "title": "Account Name", + "description": "Miner account name. Usually this is the same as the public key.", + "type": "string", + "example": "f880a433d6e2a13a32b6169030f56245efdd8c1b8a5027e9ce98a88e886bef27" + }, + "predicate": { + "title": "Key Predicate", + "enum": [ + "keys-all", + "keys-any" + ], + "example": "keys-all", + "description": "key predicate. For a single key this is usually `keys-all`." + }, + "public-keys": { + "type": "array", + "items": { + "title": "Miner Public Key", + "type": "string", + "example": "f880a433d6e2a13a32b6169030f56245efdd8c1b8a5027e9ce98a88e886bef27" + } + } + }, + "example": { + "account": "miner", + "predicate": "keys-all", + "public-keys": [ + "f880a433d6e2a13a32b6169030f56245efdd8c1b8a5027e9ce98a88e886bef27" + ] + } + }, + "nodeConfig": { + "title": "Node Configuration", + "description": "The configuration of a node. Private information regarding certificates\nand local networks are removed. The schema is subject to change and not\npart of the stable API.\n", + "example": { + "value": { + "allowReadsInLocal": false, + "rosetta": true, + "throttling": { + "local": 1, + "mining": 2, + "global": 200, + "putPeer": 21 + }, + "serviceApi": { + "interface": "invalid", + "port": 0 + }, + "validateHashesOnReplay": false, + "chainwebVersion": "mainnet01", + "pactQueueSize": 2000, + "mining": { + "coordination": { + "enabled": false, + "updateStreamTimeout": 240, + "limit": 1200, + "updateStreamLimit": 2000, + "miners": [] + }, + "nodeMining": { + "miner": { + "account": "", + "predicate": "keys-all", + "public-keys": [] + }, + "enabled": false + } + }, + "p2p": { + "peer": { + "certificateChainFile": null, + "key": null, + "interface": "*", + "certificateChain": null, + "hostaddress": { + "hostname": "34.70.108.163", + "port": 1789 + }, + "keyFile": null + }, + "maxPeerCount": 100, + "private": false, + "ignoreBootstrapNodes": false, + "maxSessionCount": 8, + "bootstrapReachability": 0.5, + "sessionTimeout": 300, + "peers": [ + { + "address": { + "hostname": "us-e1.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "us-w1.chainweb.com", + "port": 443 + }, + "id": null + } + ] + }, + "transactionIndex": { + "enabled": true, + "configuration": {} + }, + "gasLimitOfBlock": 150000, + "reorgLimit": 480, + "headerStream": true, + "mempoolP2p": { + "enabled": true, + "configuration": { + "pollInterval": 30, + "maxSessionCount": 6, + "sessionTimeout": 240 + } + }, + "reintroTxs": true, + "cuts": { + "pruneChainDatabase": "none", + "fetchTimeout": 3000000, + "initialCutHeightLimit": null + } + } + } + } + }, + "responses": {}, + "parameters": { + "limit": { + "name": "limit", + "in": "query", + "description": "Maximum number of records that may be returned. The actual number may be\nlower.\n", + "required": false, + "schema": { + "type": "integer", + "minimum": 0 + } + }, + "next": { + "name": "next", + "in": "query", + "description": "The cursor for the next page. This value can be found as value of the\n`next` property of the previous page.\n", + "required": false, + "schema": { + "type": "string" + } + }, + "chain": { + "name": "chain", + "in": "path", + "description": "the id of the chain to which the request is sent", + "required": true, + "schema": { + "type": "integer", + "minimum": 0, + "example": 0 + } + }, + "backupId": { + "name": "backupId", + "in": "path", + "description": "The identifier of the backup being checked", + "required": true, + "schema": { + "$ref": "#/components/schemas/backupId" + } + }, + "backupPact": { + "name": "backupPact", + "in": "query", + "description": "Flag, if present back up the Pact databases too. Extra disk space and time required\n", + "required": false, + "allowEmptyValue": true + }, + "minheight": { + "name": "minheight", + "in": "query", + "description": "Minimum block height of the returned headers", + "required": false, + "schema": { + "type": "integer", + "minimum": 0 + }, + "example": 500000 + }, + "maxheight": { + "name": "maxheight", + "in": "query", + "description": "Maximum block height of the returned headers", + "required": false, + "schema": { + "type": "integer", + "minimum": 0 + }, + "example": 500000 + }, + "payloadHash": { + "name": "payloadHash", + "in": "path", + "required": true, + "description": "Payload hash of a block", + "schema": { + "$ref": "#/components/schemas/payloadHash" + }, + "example": { + "value": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA" + } + }, + "blockHash": { + "name": "blockHash", + "in": "path", + "description": "Block hash of a block", + "required": true, + "schema": { + "$ref": "#/components/schemas/blockHash" + }, + "example": { + "value": [ + "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k" + ] + } + } + }, + "requestBodies": { + "requestKeyArray": { + "description": "Array of request keys", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/requestKey" + } + }, + "examples": { + "empty request body": { + "value": [] + }, + "singleton request body": { + "value": [ + "qx346ILpakzgbNZbE8oHqF5TZQghp-HPcV-0Ptc_n2s" + ] + } + } + } + } + }, + "payloadHashArray": { + "description": "An array of block payload hashes", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/payloadHash" + } + }, + "examples": { + "two": { + "value": { + "value": [ + "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM" + ] + }, + "summary": "Query two payloads" + }, + "empty": { + "value": [], + "summary": "Query nothing" + } + } + } + } + } + }, + "headers": { + "x-server-timestamp": { + "description": "The time of the clock of the remote node", + "schema": { + "$ref": "#/components/schemas/posixTimestamp" + }, + "example": 1618597601 + }, + "x-chainweb-node-version": { + "description": "The version of the remote chainweb node", + "schema": { + "type": "string" + }, + "example": "2.6" + }, + "x-peer-addr": { + "description": "Host and port of the client as observed by the remote node", + "schema": { + "$ref": "#/components/schemas/hostAddress" + }, + "example": "10.36.1.3:42988" + } + }, + "securitySchemes": {}, + "links": {}, + "callbacks": {}, + "examples": { + "blockHashes": { + "value": [ + "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k" + ] + }, + "requestKeys": { + "value": [ + "qx346ILpakzgbNZbE8oHqF5TZQghp-HPcV-0Ptc_n2s" + ] + }, + "signedTxText": { + "value": { + "hash": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw", + "sigs": [ + { + "sig": "8ddc06b37c496f2cadc4f7412405a80faf3ab07482ff5553b9b5fcc73d1b4121275ad5948d9b4078e553b71f8b42eaf6b24135bf2fb4d5840c16bcdde0e35e0f" + } + ], + "cmd": "{\"networkId\":\"mainnet01\",\"payload\":{\"exec\":{\"data\":{\"account-keyset\":{\"pred\":\"keys-all\",\"keys\":[\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\"]}},\"code\":\"(coin.transfer-create \\\"60241f51ea34e05c61fbea9d\\\" \\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\" (read-keyset \\\"account-keyset\\\") 5007.0000)\"}},\"signers\":[{\"pubKey\":\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\",\"clist\":[{\"args\":[\"60241f51ea34e05c61fbea9d\",\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\",5007],\"name\":\"coin.TRANSFER\"},{\"args\":[],\"name\":\"coin.GAS\"}]}],\"meta\":{\"creationTime\":1618949714,\"ttl\":300,\"gasLimit\":600,\"chainId\":\"0\",\"gasPrice\":1.0e-7,\"sender\":\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\"},\"nonce\":\"\\\"2021-04-20T20:16:13.645Z\\\"\"}" + } + }, + "peers": { + "value": { + "next": "inclusive:3", + "items": [ + { + "address": { + "hostname": "85.238.99.91", + "port": 30004 + }, + "id": "PRLmVUcc9AH3fyfMYiWeC4nV2i1iHwc0-aM7iAO8h18" + }, + { + "address": { + "hostname": "us-w3.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "95.111.232.151", + "port": 30004 + }, + "id": "DguFKLFMxp12vfl1z3cQIJQlh8xOpeZuBkpJU9Y-VLo" + } + ], + "limit": 3 + } + }, + "blockHashPage": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "vhVa6Deh10RXLRf3L-MSQTYqaL-_IY_mi-v58MjP9R8" + ], + "limit": 2 + } + }, + "blockHashBranchPage": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74", + "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM" + ], + "limit": 2 + } + }, + "base64HeaderBranchPage": { + "value": { + "next": "inclusive:u9Va7MRkDSOCm0yWpsC2w-4Z0oyEMv-BjofkHeIln6g", + "items": [ + "AAAAAAAAAADX5AyHgcAFAEQpcrsmQGnMLz6Zi1ym08KyEV1nlEo4jYSVT9nrB_CjAwAFAAAA4BMlW68KbggSREOGDeH_oFFoUrpZ0zX0hM0TTdYrEAYKAAAARoxLy8ECsIIWebtW8zZsH1xfRGu4NOuSlgH4cAJLFcwPAAAAsHRn1laXo2DK2_85nOH7apQyC6Vr_gEctSElqdrCC03a4wKcHiVawSuP3DULW8CnWwdh36wAF_eSBwAAAAAAAA3PRGZVm8h4aY9cMgXAQf3QbYSNDUnFxjZnr8FwcknXAAAAAIopfw9LdjBqowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3LgXAAAAAAAFAAAAavQWLYHABQAOBvq0L1PrvEMRggM-QGNWONZ4dclrYKoSoWfaT4j0WoBXSCjagR--", + "AAAAAAAAAAC46tSFgcAFANxrUMH15DY-83DeKwlvDWsj4DY4Sphc5I82jCVSpSuCAwAFAAAAwdorGxUmrIkWyssvz3oHm3uqurfNd5ywiD6NHsZQEr8KAAAA750C1IKC9doZZKtqCckOF8JmIaHMhDfopNobHeJvmXMPAAAA4pgr0U_1kQxou-NIc42nICYqOgLM1Vawamal-HuhLvfa4wKcHiVawSuP3DULW8CnWwdh36wAF_eSBwAAAAAAANdqRLGXd6y6OGwShrFC7vBrIWf_TLCfaYpLnu-q7A7AAAAAAI5IadugqQ5qowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA27gXAAAAAAAFAAAAavQWLYHABQBFGVPEmhORyEQpcrsmQGnMLz6Zi1ym08KyEV1nlEo4jYSVT9nrB_Cj" + ], + "limit": 2 + } + }, + "blockHeaderBranchPage": { + "value": { + "next": "inclusive:3GtQwfXkNj7zcN4rCW8NayPgNjhKmFzkjzaMJVKlK4I", + "items": [ + { + "creationTime": 1619037432636631, + "parent": "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM", + "height": 1554652, + "hash": "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74", + "chainId": 0, + "weight": "iil_D0t2MGqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1619035923346538, + "adjacents": { + "5": "4BMlW68KbggSREOGDeH_oFFoUrpZ0zX0hM0TTdYrEAY", + "10": "RoxLy8ECsIIWebtW8zZsH1xfRGu4NOuSlgH4cAJLFcw", + "15": "sHRn1laXo2DK2_85nOH7apQyC6Vr_gEctSElqdrCC00" + }, + "payloadHash": "Dc9EZlWbyHhpj1wyBcBB_dBthI0NScXGNmevwXBySdc", + "chainwebVersion": "mainnet01", + "target": "2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA", + "nonce": "13613065763022308878" + }, + { + "creationTime": 1619037412190904, + "parent": "3GtQwfXkNj7zcN4rCW8NayPgNjhKmFzkjzaMJVKlK4I", + "height": 1554651, + "hash": "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM", + "chainId": 0, + "weight": "jkhp26CpDmqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1619035923346538, + "adjacents": { + "5": "wdorGxUmrIkWyssvz3oHm3uqurfNd5ywiD6NHsZQEr8", + "10": "750C1IKC9doZZKtqCckOF8JmIaHMhDfopNobHeJvmXM", + "15": "4pgr0U_1kQxou-NIc42nICYqOgLM1Vawamal-HuhLvc" + }, + "payloadHash": "12pEsZd3rLo4bBKGsULu8GshZ_9MsJ9pikue76rsDsA", + "chainwebVersion": "mainnet01", + "target": "2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA", + "nonce": "14452354234648303941" + } + ], + "limit": 2 + } + }, + "blockHeaderPage": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + { + "creationTime": 1602382624629329, + "parent": "HaXABq1PKSKlhncJk0_Mt75_lL7NS3wI627QfXZ_85k", + "height": 1000000, + "hash": "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "chainId": 0, + "weight": "NQn4BGftuWAeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1602381443331834, + "adjacents": { + "5": "Mpic85rur2MYf3zli8s8bHxTFjriFoMPTr6ZPs8sjxM", + "10": "VBKuhU_hQmuvKlx88A5o-FH0rzNo59NsdxmOGNBQ-yc", + "15": "MItdqgHZxf7j6l0oE8X-G9-VyMbnQmZrtSniuRe_EJ8" + }, + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "chainwebVersion": "mainnet01", + "target": "QrcsbEm-3WjyCGAGlzIEhLEN3ZMWORoyYy8AAAAAAAA", + "nonce": "13095611958898437" + }, + { + "creationTime": 1602382678045236, + "parent": "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "height": 1000001, + "hash": "vhVa6Deh10RXLRf3L-MSQTYqaL-_IY_mi-v58MjP9R8", + "chainId": 0, + "weight": "bOkHN2JUv2AeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1602381443331834, + "adjacents": { + "5": "ALcxv1ZiwwQ_QX9eOBZMbzIop6n7XtveS1FqOFwyvGM", + "10": "C76ElC60qXSJQCHePpzzJxsCYvvrqvmkoHPyZnex-4Q", + "15": "Kv0sz_rTANjoiJwMrdZFCJNFwdH0U_M5ouwMr3BXBfo" + }, + "payloadHash": "smUiDW9jfD_0vrdt4-fXKT_lqC90RsgEGObdp3FznFY", + "chainwebVersion": "mainnet01", + "target": "QrcsbEm-3WjyCGAGlzIEhLEN3ZMWORoyYy8AAAAAAAA", + "nonce": "110239794631051275" + } + ], + "limit": 2 + } + }, + "base64HeaderPage": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "AAAAAAAAAABRoiLHW7EFAB2lwAatTykipYZ3CZNPzLe-f5S-zUt8COtu0H12f_OZAwAFAAAAMpic85rur2MYf3zli8s8bHxTFjriFoMPTr6ZPs8sjxMKAAAAVBKuhU_hQmuvKlx88A5o-FH0rzNo59NsdxmOGNBQ-ycPAAAAMItdqgHZxf7j6l0oE8X-G9-VyMbnQmZrtSniuRe_EJ9CtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAABqWlmx5B6wo0YWPIShNKmdVrAQWht2P85BS1drGLpkAAAAAADUJ-ARn7blgHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEIPAAAAAAAFAAAA-na5gFuxBQAFL-3CY4YuAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5", + "AAAAAAAAAAA0slHKW7EFAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5AwAFAAAAALcxv1ZiwwQ_QX9eOBZMbzIop6n7XtveS1FqOFwyvGMKAAAAC76ElC60qXSJQCHePpzzJxsCYvvrqvmkoHPyZnex-4QPAAAAKv0sz_rTANjoiJwMrdZFCJNFwdH0U_M5ouwMr3BXBfpCtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAALJlIg1vY3w_9L63bePn1yk_5agvdEbIBBjm3adxc5xWAAAAAGzpBzdiVL9gHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQUIPAAAAAAAFAAAA-na5gFuxBQALiBhXgqaHAb4VWug3oddEVy0X9y_jEkE2Kmi_vyGP5ovr-fDIz_Uf" + ], + "limit": 2 + } + }, + "info": { + "value": { + "nodeNumberOfChains": 20, + "nodeApiVersion": "0.0", + "nodeChains": [ + "12", + "13", + "14", + "15", + "8", + "9", + "10", + "11", + "4", + "5", + "6", + "7", + "0", + "16", + "1", + "17", + "2", + "18", + "3", + "19" + ], + "nodeVersion": "mainnet01", + "nodeGraphHistory": [ + [ + 0, + [ + [ + 0, + [ + 5, + 2, + 3 + ] + ], + [ + 1, + [ + 4, + 6, + 3 + ] + ], + [ + 2, + [ + 4, + 7, + 0 + ] + ], + [ + 3, + [ + 8, + 0, + 1 + ] + ], + [ + 4, + [ + 9, + 1, + 2 + ] + ], + [ + 5, + [ + 9, + 6, + 0 + ] + ], + [ + 6, + [ + 5, + 7, + 1 + ] + ], + [ + 7, + [ + 8, + 6, + 2 + ] + ], + [ + 8, + [ + 9, + 7, + 3 + ] + ], + [ + 9, + [ + 8, + 4, + 5 + ] + ] + ] + ], + [ + 852054, + [ + [ + 0, + [ + 15, + 10, + 5 + ] + ], + [ + 1, + [ + 11, + 6, + 16 + ] + ], + [ + 2, + [ + 12, + 7, + 17 + ] + ], + [ + 3, + [ + 13, + 8, + 18 + ] + ], + [ + 4, + [ + 14, + 9, + 19 + ] + ], + [ + 5, + [ + 8, + 7, + 0 + ] + ], + [ + 6, + [ + 8, + 9, + 1 + ] + ], + [ + 7, + [ + 9, + 5, + 2 + ] + ], + [ + 8, + [ + 5, + 6, + 3 + ] + ], + [ + 9, + [ + 4, + 6, + 7 + ] + ], + [ + 10, + [ + 11, + 0, + 19 + ] + ], + [ + 11, + [ + 12, + 10, + 1 + ] + ], + [ + 12, + [ + 13, + 11, + 2 + ] + ], + [ + 13, + [ + 12, + 14, + 3 + ] + ], + [ + 14, + [ + 13, + 15, + 4 + ] + ], + [ + 15, + [ + 14, + 0, + 16 + ] + ], + [ + 16, + [ + 15, + 1, + 17 + ] + ], + [ + 17, + [ + 16, + 2, + 18 + ] + ], + [ + 18, + [ + 17, + 3, + 19 + ] + ], + [ + 19, + [ + 10, + 4, + 18 + ] + ] + ] + ] + ] + } + }, + "cut": { + "value": { + "origin": null, + "height": 30798466, + "weight": "b0wYplmNiTBXCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "hashes": { + "0": { + "height": 1539923, + "hash": "qEaSmWt_tDcJC9AGbgWY9x12LW5VED7hGgfyz9x_S3w" + }, + "1": { + "height": 1539923, + "hash": "TJuC6nfhamfD517gspAZmqD9umR71nAgttDOi1JbBHw" + }, + "2": { + "height": 1539924, + "hash": "4ineCWfnO1rneWuBMLPzqTl2HF_sZpypT_3TEzf3VLc" + }, + "3": { + "height": 1539924, + "hash": "ZEOMXB2ByqzL2HfYVKIZKAnoe4wIeJ2SaltnXDir59k" + }, + "4": { + "height": 1539923, + "hash": "0g0rOoSznVW2BJDBmK0Lbxz22F-sxTZUNIrUs_Q8Ye4" + }, + "5": { + "height": 1539923, + "hash": "5y_TL-clnF_wELMBKyJk0Sz8RVShw_bGQETJdrMkADA" + }, + "6": { + "height": 1539923, + "hash": "YkQKv6P4_C4jRM3RqKK9FWPxIneeLzlkKQS9ATAQYRk" + }, + "7": { + "height": 1539923, + "hash": "j_hJ9iiH_ATyeQeeRN3auGXjbBWiFgnTU0dYPIz8cKM" + }, + "8": { + "height": 1539924, + "hash": "s7c3B55VbDsS6EJ-nc9S5k2kNbPOBGI8xxF3vUg4d4Q" + }, + "9": { + "height": 1539922, + "hash": "bowQf63xSY9owHKhK1yGee2Q0Fn8yL_oCLaEUn-CGoA" + }, + "10": { + "height": 1539924, + "hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4" + }, + "11": { + "height": 1539924, + "hash": "TIhegjZ0GEC73T4m0BVuFtfLNGuS56IUWEuf93AJ5UU" + }, + "12": { + "height": 1539923, + "hash": "-j1qcAS9Fs-WQmc3WEhzZ96VojxnlIA2TFpfyIv31Zs" + }, + "13": { + "height": 1539923, + "hash": "S-4TqMgWGlK1k33XRlU9w0Lfwr0RvkO5Jn78Au1OglM" + }, + "14": { + "height": 1539923, + "hash": "xSuULf--S4TrgYNz82deaGhnPLWrg3pXkynGeUPUGwA" + }, + "15": { + "height": 1539923, + "hash": "jsc9rugvcHXDiBAuoO9_j8R_b_jchtJJ8b5596i8wVg" + }, + "16": { + "height": 1539923, + "hash": "qs1aEY8kSxfUBb_JRVswv5dYINRXBjGJteC-6RC1hjc" + }, + "17": { + "height": 1539924, + "hash": "xzVBXaQxzlUfUrakDgppUubQBRXGh-Uy0HBdMNwCq_Y" + }, + "18": { + "height": 1539924, + "hash": "4VOHPAqwioySYRycdl5MxfscQHwtlwwCAt7AySYQT98" + }, + "19": { + "height": 1539923, + "hash": "1PrRg20XyQ_2cfgGOgNK9K-cqIJ1vO8-A-RJlfN5m00" + } + }, + "id": "BBz7KeurYTeQ0hMGbwUbQC84cRbVcacoDQTye-3qkXI", + "instance": "mainnet01" + } + }, + "payloadHash": { + "value": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA" + }, + "payloadHashes": { + "value": [ + "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM" + ] + }, + "payloads": { + "value": [ + { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA" + }, + { + "transactions": [ + "eyJoYXNoIjoiMi16Q3dmRFZZR010WHljd2pTLXRlNzh5U3l3T3JXcjNSdUhiQlJnNDdhRSIsInNpZ3MiOlt7InNpZyI6ImZiMTVkNzkyYTNkNDM1MDI5ODJmOGQ1MGUyMzA1NTI5OWEwZjdhMWRmMWE4YjUyMmE5NTMxNWUyZDljY2MyNmE1MzI4M2I5YTNhNDM5ZWE0ZGY4MGM1ZTIwMjg4NDhjNjFhMWY0MGM5OWIyOTYzOWM0NGNkYTgwMzBmYmViYjBjIn1dLCJjbWQiOiJ7XCJuZXR3b3JrSWRcIjpcIm1haW5uZXQwMVwiLFwicGF5bG9hZFwiOntcImV4ZWNcIjp7XCJkYXRhXCI6e30sXCJjb2RlXCI6XCIoY29pbi50cmFuc2ZlciBcXFwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlxcXCIgXFxcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcXFwiIDMuNzc2KVwifX0sXCJzaWduZXJzXCI6W3tcInB1YktleVwiOlwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlwiLFwiY2xpc3RcIjpbe1wiYXJnc1wiOltdLFwibmFtZVwiOlwiY29pbi5HQVNcIn0se1wiYXJnc1wiOltcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIixcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcIiwzLjc3Nl0sXCJuYW1lXCI6XCJjb2luLlRSQU5TRkVSXCJ9XX1dLFwibWV0YVwiOntcImNyZWF0aW9uVGltZVwiOjE2MDIzODI4MTQsXCJ0dGxcIjoyODgwMCxcImdhc0xpbWl0XCI6NjAwLFwiY2hhaW5JZFwiOlwiMFwiLFwiZ2FzUHJpY2VcIjoxLjBlLTUsXCJzZW5kZXJcIjpcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIn0sXCJub25jZVwiOlwiXFxcIjIwMjAtMTAtMTFUMDI6MjE6MTQuMTk0WlxcXCJcIn0ifQ" + ], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "lWcQRlj3MV7FSem8P4G-8GMRf1-O7zQqi_AwmWnk-N0", + "outputsHash": "9BzXZbhjSSevp4K0bYFqi1GdLjeX_DB-4u1T5Em8abs", + "payloadHash": "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM" + } + ] + }, + "emptyPayload": { + "value": { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "coinbase": "eyJnYXMiOjAsInJlc3VsdCI6eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YSI6IldyaXRlIHN1Y2NlZWRlZCJ9LCJyZXFLZXkiOiJJa2hoV0VGQ2NURlFTMU5MYkdodVkwcHJNRjlOZERjMVgyeE1OMDVUTTNkSk5qSTNVV1pZV2w4NE5Xc2kiLCJsb2dzIjoiZ3Noak1kWFJrVGxKYmIxalZkQWJ6SVVDcGpQb1JBQ2pEbExzRzBXNkJEMCIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNTB9" + } + }, + "payloadWithTransactions": { + "value": { + "transactions": [ + [ + "eyJoYXNoIjoiMi16Q3dmRFZZR010WHljd2pTLXRlNzh5U3l3T3JXcjNSdUhiQlJnNDdhRSIsInNpZ3MiOlt7InNpZyI6ImZiMTVkNzkyYTNkNDM1MDI5ODJmOGQ1MGUyMzA1NTI5OWEwZjdhMWRmMWE4YjUyMmE5NTMxNWUyZDljY2MyNmE1MzI4M2I5YTNhNDM5ZWE0ZGY4MGM1ZTIwMjg4NDhjNjFhMWY0MGM5OWIyOTYzOWM0NGNkYTgwMzBmYmViYjBjIn1dLCJjbWQiOiJ7XCJuZXR3b3JrSWRcIjpcIm1haW5uZXQwMVwiLFwicGF5bG9hZFwiOntcImV4ZWNcIjp7XCJkYXRhXCI6e30sXCJjb2RlXCI6XCIoY29pbi50cmFuc2ZlciBcXFwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlxcXCIgXFxcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcXFwiIDMuNzc2KVwifX0sXCJzaWduZXJzXCI6W3tcInB1YktleVwiOlwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlwiLFwiY2xpc3RcIjpbe1wiYXJnc1wiOltdLFwibmFtZVwiOlwiY29pbi5HQVNcIn0se1wiYXJnc1wiOltcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIixcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcIiwzLjc3Nl0sXCJuYW1lXCI6XCJjb2luLlRSQU5TRkVSXCJ9XX1dLFwibWV0YVwiOntcImNyZWF0aW9uVGltZVwiOjE2MDIzODI4MTQsXCJ0dGxcIjoyODgwMCxcImdhc0xpbWl0XCI6NjAwLFwiY2hhaW5JZFwiOlwiMFwiLFwiZ2FzUHJpY2VcIjoxLjBlLTUsXCJzZW5kZXJcIjpcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIn0sXCJub25jZVwiOlwiXFxcIjIwMjAtMTAtMTFUMDI6MjE6MTQuMTk0WlxcXCJcIn0ifQ", + "eyJnYXMiOjU3MiwicmVzdWx0Ijp7InN0YXR1cyI6InN1Y2Nlc3MiLCJkYXRhIjoiV3JpdGUgc3VjY2VlZGVkIn0sInJlcUtleSI6IjItekN3ZkRWWUdNdFh5Y3dqUy10ZTc4eVN5d09yV3IzUnVIYkJSZzQ3YUUiLCJsb2dzIjoiSU1ra1VFZmVGak45bFQxZ0gtX2ZNT1dDRklrU1d6aVNTZHF2eEo4dS16RSIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNzJ9" + ] + ], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "lWcQRlj3MV7FSem8P4G-8GMRf1-O7zQqi_AwmWnk-N0", + "outputsHash": "9BzXZbhjSSevp4K0bYFqi1GdLjeX_DB-4u1T5Em8abs", + "payloadHash": "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM", + "coinbase": "eyJnYXMiOjAsInJlc3VsdCI6eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YSI6IldyaXRlIHN1Y2NlZWRlZCJ9LCJyZXFLZXkiOiJJbkV4WDFkUk16SnliRmhCWW1KcU9WTnZkMXB2YmtabmNHRXdlRnBXUWtKdmNUWTJiRk0xY0RSQ1ZVVWkiLCJsb2dzIjoiSVc0N0QxTXFMVW9mRnNKbWpoWGdDZnhnb2Fzb0xTc05YZUFiOFRPb2NCNCIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNzB9" + } + }, + "payloadsWithOutputs": { + "value": [ + { + "$ref": "#/components/examples/emptyPayload" + }, + { + "$ref": "#/components/examples/payloadWithTransactions" + } + ] + }, + "nodeConfig": { + "value": { + "allowReadsInLocal": false, + "rosetta": true, + "throttling": { + "local": 1, + "mining": 2, + "global": 200, + "putPeer": 21 + }, + "serviceApi": { + "interface": "invalid", + "port": 0 + }, + "validateHashesOnReplay": false, + "chainwebVersion": "mainnet01", + "pactQueueSize": 2000, + "mining": { + "coordination": { + "enabled": false, + "updateStreamTimeout": 240, + "limit": 1200, + "updateStreamLimit": 2000, + "miners": [] + }, + "nodeMining": { + "miner": { + "account": "", + "predicate": "keys-all", + "public-keys": [] + }, + "enabled": false + } + }, + "p2p": { + "peer": { + "certificateChainFile": null, + "key": null, + "interface": "*", + "certificateChain": null, + "hostaddress": { + "hostname": "34.70.108.163", + "port": 1789 + }, + "keyFile": null + }, + "maxPeerCount": 100, + "private": false, + "ignoreBootstrapNodes": false, + "maxSessionCount": 8, + "bootstrapReachability": 0.5, + "sessionTimeout": 300, + "peers": [ + { + "address": { + "hostname": "us-e1.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "us-w1.chainweb.com", + "port": 443 + }, + "id": null + } + ] + }, + "transactionIndex": { + "enabled": true, + "configuration": {} + }, + "gasLimitOfBlock": 150000, + "reorgLimit": 480, + "headerStream": true, + "mempoolP2p": { + "enabled": true, + "configuration": { + "pollInterval": 30, + "maxSessionCount": 6, + "sessionTimeout": 240 + } + }, + "reintroTxs": true, + "cuts": { + "pruneChainDatabase": "none", + "fetchTimeout": 3000000, + "initialCutHeightLimit": null + } + } + } + } + }, + "paths": { + "/cut": { + "summary": "Cut Endpoints", + "description": "A cut represents a distributed state of a chainweb. It references one\nblock header for each chain, such that those blocks are pairwise\nconcurrent.\n\nTwo blocks from two different chains are said to be concurrent if either\none of them is an adjacent parent (is a direct dependency) of the other or\nif the blocks do not depend at all on each other.\n", + "get": { + "tags": [ + "cut" + ], + "summary": "Query the current cut", + "parameters": [ + { + "name": "maxheight", + "in": "query", + "description": "Maximum cut height of the returned cut", + "required": false, + "schema": { + "type": "integer", + "minimum": 0 + } + } + ], + "responses": { + "200": { + "description": "The current cut", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/cut" + }, + "example": { + "value": { + "origin": null, + "height": 30798466, + "weight": "b0wYplmNiTBXCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "hashes": { + "0": { + "height": 1539923, + "hash": "qEaSmWt_tDcJC9AGbgWY9x12LW5VED7hGgfyz9x_S3w" + }, + "1": { + "height": 1539923, + "hash": "TJuC6nfhamfD517gspAZmqD9umR71nAgttDOi1JbBHw" + }, + "2": { + "height": 1539924, + "hash": "4ineCWfnO1rneWuBMLPzqTl2HF_sZpypT_3TEzf3VLc" + }, + "3": { + "height": 1539924, + "hash": "ZEOMXB2ByqzL2HfYVKIZKAnoe4wIeJ2SaltnXDir59k" + }, + "4": { + "height": 1539923, + "hash": "0g0rOoSznVW2BJDBmK0Lbxz22F-sxTZUNIrUs_Q8Ye4" + }, + "5": { + "height": 1539923, + "hash": "5y_TL-clnF_wELMBKyJk0Sz8RVShw_bGQETJdrMkADA" + }, + "6": { + "height": 1539923, + "hash": "YkQKv6P4_C4jRM3RqKK9FWPxIneeLzlkKQS9ATAQYRk" + }, + "7": { + "height": 1539923, + "hash": "j_hJ9iiH_ATyeQeeRN3auGXjbBWiFgnTU0dYPIz8cKM" + }, + "8": { + "height": 1539924, + "hash": "s7c3B55VbDsS6EJ-nc9S5k2kNbPOBGI8xxF3vUg4d4Q" + }, + "9": { + "height": 1539922, + "hash": "bowQf63xSY9owHKhK1yGee2Q0Fn8yL_oCLaEUn-CGoA" + }, + "10": { + "height": 1539924, + "hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4" + }, + "11": { + "height": 1539924, + "hash": "TIhegjZ0GEC73T4m0BVuFtfLNGuS56IUWEuf93AJ5UU" + }, + "12": { + "height": 1539923, + "hash": "-j1qcAS9Fs-WQmc3WEhzZ96VojxnlIA2TFpfyIv31Zs" + }, + "13": { + "height": 1539923, + "hash": "S-4TqMgWGlK1k33XRlU9w0Lfwr0RvkO5Jn78Au1OglM" + }, + "14": { + "height": 1539923, + "hash": "xSuULf--S4TrgYNz82deaGhnPLWrg3pXkynGeUPUGwA" + }, + "15": { + "height": 1539923, + "hash": "jsc9rugvcHXDiBAuoO9_j8R_b_jchtJJ8b5596i8wVg" + }, + "16": { + "height": 1539923, + "hash": "qs1aEY8kSxfUBb_JRVswv5dYINRXBjGJteC-6RC1hjc" + }, + "17": { + "height": 1539924, + "hash": "xzVBXaQxzlUfUrakDgppUubQBRXGh-Uy0HBdMNwCq_Y" + }, + "18": { + "height": 1539924, + "hash": "4VOHPAqwioySYRycdl5MxfscQHwtlwwCAt7AySYQT98" + }, + "19": { + "height": 1539923, + "hash": "1PrRg20XyQ_2cfgGOgNK9K-cqIJ1vO8-A-RJlfN5m00" + } + }, + "id": "BBz7KeurYTeQ0hMGbwUbQC84cRbVcacoDQTye-3qkXI", + "instance": "mainnet01" + } + } + } + } + } + } + }, + "put": { + "summary": "Publish a cut", + "description": "Publish a cut to a Chainweb node.\n\nThe cut must contain an origin property that is not `null`. The receiving node\nwill first try to obtain all missing dependencies from the node that is\nindicated in by the origin property before searching for the dependencies in the\nP2P network.\n", + "tags": [ + "cut" + ], + "requestBody": { + "description": "A cut with an origin property that is not `null`.", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/cut" + }, + { + "required": [ + "origin" + ] + } + ] + }, + "example": { + "value": { + "origin": null, + "height": 30798466, + "weight": "b0wYplmNiTBXCwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "hashes": { + "0": { + "height": 1539923, + "hash": "qEaSmWt_tDcJC9AGbgWY9x12LW5VED7hGgfyz9x_S3w" + }, + "1": { + "height": 1539923, + "hash": "TJuC6nfhamfD517gspAZmqD9umR71nAgttDOi1JbBHw" + }, + "2": { + "height": 1539924, + "hash": "4ineCWfnO1rneWuBMLPzqTl2HF_sZpypT_3TEzf3VLc" + }, + "3": { + "height": 1539924, + "hash": "ZEOMXB2ByqzL2HfYVKIZKAnoe4wIeJ2SaltnXDir59k" + }, + "4": { + "height": 1539923, + "hash": "0g0rOoSznVW2BJDBmK0Lbxz22F-sxTZUNIrUs_Q8Ye4" + }, + "5": { + "height": 1539923, + "hash": "5y_TL-clnF_wELMBKyJk0Sz8RVShw_bGQETJdrMkADA" + }, + "6": { + "height": 1539923, + "hash": "YkQKv6P4_C4jRM3RqKK9FWPxIneeLzlkKQS9ATAQYRk" + }, + "7": { + "height": 1539923, + "hash": "j_hJ9iiH_ATyeQeeRN3auGXjbBWiFgnTU0dYPIz8cKM" + }, + "8": { + "height": 1539924, + "hash": "s7c3B55VbDsS6EJ-nc9S5k2kNbPOBGI8xxF3vUg4d4Q" + }, + "9": { + "height": 1539922, + "hash": "bowQf63xSY9owHKhK1yGee2Q0Fn8yL_oCLaEUn-CGoA" + }, + "10": { + "height": 1539924, + "hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4" + }, + "11": { + "height": 1539924, + "hash": "TIhegjZ0GEC73T4m0BVuFtfLNGuS56IUWEuf93AJ5UU" + }, + "12": { + "height": 1539923, + "hash": "-j1qcAS9Fs-WQmc3WEhzZ96VojxnlIA2TFpfyIv31Zs" + }, + "13": { + "height": 1539923, + "hash": "S-4TqMgWGlK1k33XRlU9w0Lfwr0RvkO5Jn78Au1OglM" + }, + "14": { + "height": 1539923, + "hash": "xSuULf--S4TrgYNz82deaGhnPLWrg3pXkynGeUPUGwA" + }, + "15": { + "height": 1539923, + "hash": "jsc9rugvcHXDiBAuoO9_j8R_b_jchtJJ8b5596i8wVg" + }, + "16": { + "height": 1539923, + "hash": "qs1aEY8kSxfUBb_JRVswv5dYINRXBjGJteC-6RC1hjc" + }, + "17": { + "height": 1539924, + "hash": "xzVBXaQxzlUfUrakDgppUubQBRXGh-Uy0HBdMNwCq_Y" + }, + "18": { + "height": 1539924, + "hash": "4VOHPAqwioySYRycdl5MxfscQHwtlwwCAt7AySYQT98" + }, + "19": { + "height": 1539923, + "hash": "1PrRg20XyQ_2cfgGOgNK9K-cqIJ1vO8-A-RJlfN5m00" + } + }, + "id": "BBz7KeurYTeQ0hMGbwUbQC84cRbVcacoDQTye-3qkXI", + "instance": "mainnet01" + } + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "The cut was added to the cut processing pipeline of the remote node", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + }, + "401": { + "description": "The requester is not a peer of this node, and thus not allowed to send it cuts", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + } + } + } + }, + "/cut/peer": { + "get": { + "summary": "Get Cut-Network Peer Info", + "tags": [ + "peer" + ], + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + } + ], + "responses": { + "200": { + "description": "Peers from the peer database of the remote node", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of peers", + "items": { + "$ref": "#/components/schemas/peer" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:3", + "items": [ + { + "address": { + "hostname": "85.238.99.91", + "port": 30004 + }, + "id": "PRLmVUcc9AH3fyfMYiWeC4nV2i1iHwc0-aM7iAO8h18" + }, + { + "address": { + "hostname": "us-w3.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "95.111.232.151", + "port": 30004 + }, + "id": "DguFKLFMxp12vfl1z3cQIJQlh8xOpeZuBkpJU9Y-VLo" + } + ], + "limit": 3 + } + } + } + } + } + } + }, + "put": { + "summary": "Put Cut-Network Peer Info", + "tags": [ + "peer" + ], + "requestBody": { + "description": "The peer that is added to the peer database of the cut P2P network of\nthe remote host.\n", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/peer" + }, + { + "properties": { + "id": { + "nullable": true + } + } + } + ] + } + } + } + }, + "responses": { + "204": { + "description": "The peer got added to the peer database of the remote node.", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + }, + "400": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "The request is invalid. It is either malformed or the provided peer\nis not reachable.\n\nBefore the remote node adds a peer to its peer database it checks\nwhether the peer can be reached via the provided address. If this\ncheck fails an error is returned.\n", + "content": { + "text/plain": { + "description": "The reason for the failure.", + "example": "Invalid hostaddress: IsNotReachable (PeerInfo {_peerId = Nothing, _peerAddr = HostAddress {_hostAddressHost = us-w1.chainweb.com, _hostAddressPort = 444}}) \"\\\"HttpExceptionRequest Request {\\\\n host = \\\\\\\"us-w1.chainweb.com\\\\\\\"\\\\n port = 444\\\\n secure = True\\\\n requestHeaders = [(\\\\\\\"X-Chainweb-Node-Version\\\\\\\",\\\\\\\"2.6\\\\\\\")]\\\\n path = \\\\\\\"/chainweb/0.0/mainnet01/cut/peer\\\\\\\"\\\\n queryString = \\\\\\\"\\\\\\\"\\\\n method = \\\\\\\"GET\\\\\\\"\\\\n proxy = Nothing\\\\n rawBody = False\\\\n redirectCount = 10\\\\n responseTimeout = ResponseTimeoutMicro 2000000\\\\n requestVersion = HTTP/1.1\\\\n}\\\\n ConnectionTimeout\\\"\"" + } + } + } + } + } + }, + "/chain/{chain}/hash": { + "get": { + "summary": "Get Block Hashes", + "tags": [ + "blockhash" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + }, + { + "$ref": "#/components/parameters/minheight" + }, + { + "$ref": "#/components/parameters/maxheight" + } + ], + "responses": { + "200": { + "description": "A page of a collection of block hashes in **ascending** order\nthat satisfies query parameters. Any block hash from the chain\ndatabase is returned. **This includes hashes of orphaned blocks.**\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of block hashes", + "items": { + "$ref": "#/components/schemas/blockHash" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "vhVa6Deh10RXLRf3L-MSQTYqaL-_IY_mi-v58MjP9R8" + ], + "limit": 2 + } + } + } + } + }, + "404": { + "description": "A parameter indicated a nonexistent block height.\n", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + }, + "key": { + "$ref": "#/components/schemas/blockHash" + } + } + } + } + } + } + } + } + }, + "/chain/{chain}/hash/branch": { + "post": { + "summary": "Get Block Hash Branches", + "description": "A page of block hashes from branches of the block chain in\n**descending** order.\n\nOnly blocks are returned that are ancestors of the some block in the\nset of upper bounds and are not ancestors of any block in the set of\nlower bounds.\n", + "tags": [ + "blockhash" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + }, + { + "$ref": "#/components/parameters/minheight" + }, + { + "$ref": "#/components/parameters/maxheight" + } + ], + "requestBody": { + "description": "Upper and lower bounds of the queried branches", + "content": { + "application/json": { + "schema": { + "properties": { + "lower": { + "description": "No block hashes are returned that are predecessors of any\nblock with a hash from this array.\n", + "type": "array", + "items": { + "$ref": "#/components/schemas/blockHash" + } + }, + "upper": { + "description": "Returned block hashes are predecessors of a block with an\nhash from this array. This includes blocks with hashes from\nthis array.\n", + "type": "array", + "items": { + "$ref": "#/components/schemas/blockHash" + } + } + } + }, + "examples": { + "singletonLimited": { + "value": { + "lower": [ + "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM" + ], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Ancestors of block that are not acestors of another block" + }, + "singleton": { + "value": { + "lower": [], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Ancestors of one block" + }, + "empty": { + "value": { + "lower": [], + "upper": [] + }, + "summary": "Empty branch" + }, + "empty2": { + "value": { + "lower": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Another example that returns an empty page" + } + } + } + } + }, + "responses": { + "200": { + "description": "The requested block hashes", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of block hashes", + "items": { + "$ref": "#/components/schemas/blockHash" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74", + "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM" + ], + "limit": 2 + } + } + } + } + }, + "404": { + "description": "The requested block hashes could not be found", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + }, + "key": { + "$ref": "#/components/schemas/blockHash" + } + } + } + } + } + } + } + } + }, + "/chain/{chain}/header": { + "get": { + "summary": "Get Block Headers", + "description": "A page of a collection of block headers in **ascending** order\nthat satisfies query parameters. Any block header from the chain\ndatabase is returned. **This includes headers of orphaned blocks.**\n", + "tags": [ + "header" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + }, + { + "$ref": "#/components/parameters/minheight" + }, + { + "$ref": "#/components/parameters/maxheight" + } + ], + "responses": { + "200": { + "description": "The requested block headers", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of base64 encoded block headers", + "type": "array", + "items": { + "$ref": "#/components/schemas/base64Header" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + "AAAAAAAAAABRoiLHW7EFAB2lwAatTykipYZ3CZNPzLe-f5S-zUt8COtu0H12f_OZAwAFAAAAMpic85rur2MYf3zli8s8bHxTFjriFoMPTr6ZPs8sjxMKAAAAVBKuhU_hQmuvKlx88A5o-FH0rzNo59NsdxmOGNBQ-ycPAAAAMItdqgHZxf7j6l0oE8X-G9-VyMbnQmZrtSniuRe_EJ9CtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAABqWlmx5B6wo0YWPIShNKmdVrAQWht2P85BS1drGLpkAAAAAADUJ-ARn7blgHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEIPAAAAAAAFAAAA-na5gFuxBQAFL-3CY4YuAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5", + "AAAAAAAAAAA0slHKW7EFAJNGp9KhDkbrKkIPWYyq8WvtAaNPoUFWC16louSx8YN5AwAFAAAAALcxv1ZiwwQ_QX9eOBZMbzIop6n7XtveS1FqOFwyvGMKAAAAC76ElC60qXSJQCHePpzzJxsCYvvrqvmkoHPyZnex-4QPAAAAKv0sz_rTANjoiJwMrdZFCJNFwdH0U_M5ouwMr3BXBfpCtyxsSb7daPIIYAaXMgSEsQ3dkxY5GjJjLwAAAAAAALJlIg1vY3w_9L63bePn1yk_5agvdEbIBBjm3adxc5xWAAAAAGzpBzdiVL9gHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQUIPAAAAAAAFAAAA-na5gFuxBQALiBhXgqaHAb4VWug3oddEVy0X9y_jEkE2Kmi_vyGP5ovr-fDIz_Uf" + ], + "limit": 2 + } + } + }, + "application/json;blockheader-encoding=object": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of JSON encoded block headers", + "items": { + "$ref": "#/components/schemas/blockHeader" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + "items": [ + { + "creationTime": 1602382624629329, + "parent": "HaXABq1PKSKlhncJk0_Mt75_lL7NS3wI627QfXZ_85k", + "height": 1000000, + "hash": "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "chainId": 0, + "weight": "NQn4BGftuWAeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1602381443331834, + "adjacents": { + "5": "Mpic85rur2MYf3zli8s8bHxTFjriFoMPTr6ZPs8sjxM", + "10": "VBKuhU_hQmuvKlx88A5o-FH0rzNo59NsdxmOGNBQ-yc", + "15": "MItdqgHZxf7j6l0oE8X-G9-VyMbnQmZrtSniuRe_EJ8" + }, + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "chainwebVersion": "mainnet01", + "target": "QrcsbEm-3WjyCGAGlzIEhLEN3ZMWORoyYy8AAAAAAAA", + "nonce": "13095611958898437" + }, + { + "creationTime": 1602382678045236, + "parent": "k0an0qEORusqQg9ZjKrxa-0Bo0-hQVYLXqWi5LHxg3k", + "height": 1000001, + "hash": "vhVa6Deh10RXLRf3L-MSQTYqaL-_IY_mi-v58MjP9R8", + "chainId": 0, + "weight": "bOkHN2JUv2AeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1602381443331834, + "adjacents": { + "5": "ALcxv1ZiwwQ_QX9eOBZMbzIop6n7XtveS1FqOFwyvGM", + "10": "C76ElC60qXSJQCHePpzzJxsCYvvrqvmkoHPyZnex-4Q", + "15": "Kv0sz_rTANjoiJwMrdZFCJNFwdH0U_M5ouwMr3BXBfo" + }, + "payloadHash": "smUiDW9jfD_0vrdt4-fXKT_lqC90RsgEGObdp3FznFY", + "chainwebVersion": "mainnet01", + "target": "QrcsbEm-3WjyCGAGlzIEhLEN3ZMWORoyYy8AAAAAAAA", + "nonce": "110239794631051275" + } + ], + "limit": 2 + } + } + } + } + }, + "404": { + "description": "The `next` or `maxheight` parameter indicated a nonexistent block height.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + }, + "key": { + "$ref": "#/components/schemas/blockHash" + } + } + } + } + } + } + } + } + }, + "/chain/{chain}/header/{blockHash}": { + "get": { + "summary": "Get Block Header by Hash", + "description": "Query a block header by its hash", + "tags": [ + "header" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/blockHash" + } + ], + "responses": { + "200": { + "description": "The block header with that hash was found", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/base64Header" + }, + "example": { + "value": { + "$ref": "#/components/examples/base64HeaderPage/value/items/0" + } + } + }, + "application/json;blockheader-encoding=object": { + "schema": { + "$ref": "#/components/schemas/blockHeader" + }, + "example": { + "value": { + "$ref": "#/components/examples/blockHeaderPage/value/items/0" + } + } + }, + "application/octet-stream": { + "schema": { + "$ref": "#/components/schemas/binaryHeader" + } + } + } + }, + "404": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "A block header with that block hash was not found.", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + }, + "key": { + "$ref": "#/components/schemas/blockHash" + } + } + } + } + } + }, + "406": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "The value of the `Accept` header is not supported." + } + } + } + }, + "/chain/{chain}/header/branch": { + "post": { + "summary": "Get Block Header Branches", + "description": "A page of block headers from branches of the block chain in\n**descending** order.\n\nOnly blocks are returned that are ancestors of the some block in the\nset of upper bounds and are not ancestors of any block in the set of\nlower bounds.\n", + "tags": [ + "header" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + }, + { + "$ref": "#/components/parameters/minheight" + }, + { + "$ref": "#/components/parameters/maxheight" + } + ], + "requestBody": { + "description": "Upper and lower bounds of the queried branches", + "content": { + "application/json": { + "schema": { + "properties": { + "lower": { + "description": "No blocks are returned that are predecessors of any block with\nan hash from this array.\n", + "type": "array", + "items": { + "$ref": "#/components/schemas/blockHash" + } + }, + "upper": { + "description": "Returned block headers are predecessors of a block with an\nhash from this array. This includes blocks with hashes from\nthis array.\n", + "type": "array", + "items": { + "$ref": "#/components/schemas/blockHash" + } + } + } + }, + "examples": { + "singletonLimited": { + "value": { + "lower": [ + "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM" + ], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Ancestors of block that are not ancestors of another block" + }, + "singleton": { + "value": { + "lower": [], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Ancestors of one block" + }, + "empty": { + "value": { + "lower": [], + "upper": [] + }, + "summary": "Empty branch" + }, + "empty2": { + "value": { + "lower": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ], + "upper": [ + "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74" + ] + }, + "summary": "Another example that returns an empty page" + } + } + } + } + }, + "responses": { + "200": { + "description": "The block headers were found", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of base64 encoded block headers", + "items": { + "$ref": "#/components/schemas/base64Header" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:u9Va7MRkDSOCm0yWpsC2w-4Z0oyEMv-BjofkHeIln6g", + "items": [ + "AAAAAAAAAADX5AyHgcAFAEQpcrsmQGnMLz6Zi1ym08KyEV1nlEo4jYSVT9nrB_CjAwAFAAAA4BMlW68KbggSREOGDeH_oFFoUrpZ0zX0hM0TTdYrEAYKAAAARoxLy8ECsIIWebtW8zZsH1xfRGu4NOuSlgH4cAJLFcwPAAAAsHRn1laXo2DK2_85nOH7apQyC6Vr_gEctSElqdrCC03a4wKcHiVawSuP3DULW8CnWwdh36wAF_eSBwAAAAAAAA3PRGZVm8h4aY9cMgXAQf3QbYSNDUnFxjZnr8FwcknXAAAAAIopfw9LdjBqowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3LgXAAAAAAAFAAAAavQWLYHABQAOBvq0L1PrvEMRggM-QGNWONZ4dclrYKoSoWfaT4j0WoBXSCjagR--", + "AAAAAAAAAAC46tSFgcAFANxrUMH15DY-83DeKwlvDWsj4DY4Sphc5I82jCVSpSuCAwAFAAAAwdorGxUmrIkWyssvz3oHm3uqurfNd5ywiD6NHsZQEr8KAAAA750C1IKC9doZZKtqCckOF8JmIaHMhDfopNobHeJvmXMPAAAA4pgr0U_1kQxou-NIc42nICYqOgLM1Vawamal-HuhLvfa4wKcHiVawSuP3DULW8CnWwdh36wAF_eSBwAAAAAAANdqRLGXd6y6OGwShrFC7vBrIWf_TLCfaYpLnu-q7A7AAAAAAI5IadugqQ5qowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA27gXAAAAAAAFAAAAavQWLYHABQBFGVPEmhORyEQpcrsmQGnMLz6Zi1ym08KyEV1nlEo4jYSVT9nrB_Cj" + ], + "limit": 2 + } + } + }, + "application/json;blockheader-encoding=object": { + "schema": { + "allOf": [ + { + "properties": { + "items": { + "description": "Array of JSON encoded block headers", + "items": { + "$ref": "#/components/schemas/blockHeader" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:3GtQwfXkNj7zcN4rCW8NayPgNjhKmFzkjzaMJVKlK4I", + "items": [ + { + "creationTime": 1619037432636631, + "parent": "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM", + "height": 1554652, + "hash": "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74", + "chainId": 0, + "weight": "iil_D0t2MGqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1619035923346538, + "adjacents": { + "5": "4BMlW68KbggSREOGDeH_oFFoUrpZ0zX0hM0TTdYrEAY", + "10": "RoxLy8ECsIIWebtW8zZsH1xfRGu4NOuSlgH4cAJLFcw", + "15": "sHRn1laXo2DK2_85nOH7apQyC6Vr_gEctSElqdrCC00" + }, + "payloadHash": "Dc9EZlWbyHhpj1wyBcBB_dBthI0NScXGNmevwXBySdc", + "chainwebVersion": "mainnet01", + "target": "2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA", + "nonce": "13613065763022308878" + }, + { + "creationTime": 1619037412190904, + "parent": "3GtQwfXkNj7zcN4rCW8NayPgNjhKmFzkjzaMJVKlK4I", + "height": 1554651, + "hash": "RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM", + "chainId": 0, + "weight": "jkhp26CpDmqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "featureFlags": 0, + "epochStart": 1619035923346538, + "adjacents": { + "5": "wdorGxUmrIkWyssvz3oHm3uqurfNd5ywiD6NHsZQEr8", + "10": "750C1IKC9doZZKtqCckOF8JmIaHMhDfopNobHeJvmXM", + "15": "4pgr0U_1kQxou-NIc42nICYqOgLM1Vawamal-HuhLvc" + }, + "payloadHash": "12pEsZd3rLo4bBKGsULu8GshZ_9MsJ9pikue76rsDsA", + "chainwebVersion": "mainnet01", + "target": "2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA", + "nonce": "14452354234648303941" + } + ], + "limit": 2 + } + } + } + } + }, + "404": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "A block header indicated by a required parameter was not found.", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + }, + "key": { + "$ref": "#/components/schemas/blockHash" + } + } + } + } + } + }, + "406": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "The value of the `Accept` header is not supported." + } + } + } + }, + "/chain/{chain}/payload/{payloadHash}": { + "get": { + "summary": "Get Block Payload", + "tags": [ + "payload" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/payloadHash" + } + ], + "responses": { + "200": { + "description": "The payload data of for the given block payload hash", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/payload" + }, + "examples": { + "payload": { + "summary": "Payload with one transaction", + "value": { + "transactions": [ + "eyJoYXNoIjoiMi16Q3dmRFZZR010WHljd2pTLXRlNzh5U3l3T3JXcjNSdUhiQlJnNDdhRSIsInNpZ3MiOlt7InNpZyI6ImZiMTVkNzkyYTNkNDM1MDI5ODJmOGQ1MGUyMzA1NTI5OWEwZjdhMWRmMWE4YjUyMmE5NTMxNWUyZDljY2MyNmE1MzI4M2I5YTNhNDM5ZWE0ZGY4MGM1ZTIwMjg4NDhjNjFhMWY0MGM5OWIyOTYzOWM0NGNkYTgwMzBmYmViYjBjIn1dLCJjbWQiOiJ7XCJuZXR3b3JrSWRcIjpcIm1haW5uZXQwMVwiLFwicGF5bG9hZFwiOntcImV4ZWNcIjp7XCJkYXRhXCI6e30sXCJjb2RlXCI6XCIoY29pbi50cmFuc2ZlciBcXFwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlxcXCIgXFxcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcXFwiIDMuNzc2KVwifX0sXCJzaWduZXJzXCI6W3tcInB1YktleVwiOlwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlwiLFwiY2xpc3RcIjpbe1wiYXJnc1wiOltdLFwibmFtZVwiOlwiY29pbi5HQVNcIn0se1wiYXJnc1wiOltcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIixcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcIiwzLjc3Nl0sXCJuYW1lXCI6XCJjb2luLlRSQU5TRkVSXCJ9XX1dLFwibWV0YVwiOntcImNyZWF0aW9uVGltZVwiOjE2MDIzODI4MTQsXCJ0dGxcIjoyODgwMCxcImdhc0xpbWl0XCI6NjAwLFwiY2hhaW5JZFwiOlwiMFwiLFwiZ2FzUHJpY2VcIjoxLjBlLTUsXCJzZW5kZXJcIjpcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIn0sXCJub25jZVwiOlwiXFxcIjIwMjAtMTAtMTFUMDI6MjE6MTQuMTk0WlxcXCJcIn0ifQ" + ], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "lWcQRlj3MV7FSem8P4G-8GMRf1-O7zQqi_AwmWnk-N0", + "outputsHash": "9BzXZbhjSSevp4K0bYFqi1GdLjeX_DB-4u1T5Em8abs", + "payloadHash": "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM" + } + }, + "emptyPayload": { + "summary": "Empty block payload", + "value": { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA" + } + } + } + } + } + }, + "404": { + "description": "The block payload with that hash was not found", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string", + "description": "Failure message" + }, + "key": { + "$ref": "#/components/schemas/payloadHash" + } + } + }, + "example": { + "reason": "key not found", + "key": "k1H3DsInAPvJ0W_zPxnrpkeSNdPUT0S9U8bqDLG739w" + } + } + } + } + } + } + }, + "/chain/{chain}/payload/batch": { + "post": { + "summary": "Get Batch of Block Payload", + "tags": [ + "payload" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/payloadHashArray" + }, + "responses": { + "200": { + "description": "Array of the some or all of the requested block payloads. The\npayloads may be returned in any order.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/payload" + } + }, + "examples": { + "two": { + "value": { + "value": [ + { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA" + }, + { + "transactions": [ + "eyJoYXNoIjoiMi16Q3dmRFZZR010WHljd2pTLXRlNzh5U3l3T3JXcjNSdUhiQlJnNDdhRSIsInNpZ3MiOlt7InNpZyI6ImZiMTVkNzkyYTNkNDM1MDI5ODJmOGQ1MGUyMzA1NTI5OWEwZjdhMWRmMWE4YjUyMmE5NTMxNWUyZDljY2MyNmE1MzI4M2I5YTNhNDM5ZWE0ZGY4MGM1ZTIwMjg4NDhjNjFhMWY0MGM5OWIyOTYzOWM0NGNkYTgwMzBmYmViYjBjIn1dLCJjbWQiOiJ7XCJuZXR3b3JrSWRcIjpcIm1haW5uZXQwMVwiLFwicGF5bG9hZFwiOntcImV4ZWNcIjp7XCJkYXRhXCI6e30sXCJjb2RlXCI6XCIoY29pbi50cmFuc2ZlciBcXFwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlxcXCIgXFxcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcXFwiIDMuNzc2KVwifX0sXCJzaWduZXJzXCI6W3tcInB1YktleVwiOlwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlwiLFwiY2xpc3RcIjpbe1wiYXJnc1wiOltdLFwibmFtZVwiOlwiY29pbi5HQVNcIn0se1wiYXJnc1wiOltcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIixcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcIiwzLjc3Nl0sXCJuYW1lXCI6XCJjb2luLlRSQU5TRkVSXCJ9XX1dLFwibWV0YVwiOntcImNyZWF0aW9uVGltZVwiOjE2MDIzODI4MTQsXCJ0dGxcIjoyODgwMCxcImdhc0xpbWl0XCI6NjAwLFwiY2hhaW5JZFwiOlwiMFwiLFwiZ2FzUHJpY2VcIjoxLjBlLTUsXCJzZW5kZXJcIjpcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIn0sXCJub25jZVwiOlwiXFxcIjIwMjAtMTAtMTFUMDI6MjE6MTQuMTk0WlxcXCJcIn0ifQ" + ], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "lWcQRlj3MV7FSem8P4G-8GMRf1-O7zQqi_AwmWnk-N0", + "outputsHash": "9BzXZbhjSSevp4K0bYFqi1GdLjeX_DB-4u1T5Em8abs", + "payloadHash": "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM" + } + ] + }, + "summary": "Result with two payloads" + }, + "empty": { + "value": [], + "summary": "Empty result" + } + } + } + } + } + } + } + }, + "/chain/{chain}/payload/{payloadHash}/outputs": { + "get": { + "summary": "Get Block Payload With Outputs", + "tags": [ + "payload" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/payloadHash" + } + ], + "responses": { + "200": { + "description": "The payload with outputs for the given block payload hash", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/payloadWithOutputs" + }, + "examples": { + "payload": { + "summary": "Payload with outputs with one transaction", + "value": { + "value": { + "transactions": [ + [ + "eyJoYXNoIjoiMi16Q3dmRFZZR010WHljd2pTLXRlNzh5U3l3T3JXcjNSdUhiQlJnNDdhRSIsInNpZ3MiOlt7InNpZyI6ImZiMTVkNzkyYTNkNDM1MDI5ODJmOGQ1MGUyMzA1NTI5OWEwZjdhMWRmMWE4YjUyMmE5NTMxNWUyZDljY2MyNmE1MzI4M2I5YTNhNDM5ZWE0ZGY4MGM1ZTIwMjg4NDhjNjFhMWY0MGM5OWIyOTYzOWM0NGNkYTgwMzBmYmViYjBjIn1dLCJjbWQiOiJ7XCJuZXR3b3JrSWRcIjpcIm1haW5uZXQwMVwiLFwicGF5bG9hZFwiOntcImV4ZWNcIjp7XCJkYXRhXCI6e30sXCJjb2RlXCI6XCIoY29pbi50cmFuc2ZlciBcXFwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlxcXCIgXFxcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcXFwiIDMuNzc2KVwifX0sXCJzaWduZXJzXCI6W3tcInB1YktleVwiOlwiZTc1NzU4ZGQyYTFjNTk2NDRjMjJlMDQyYzZlYzA3NTI2ZWE0ZTU3MTU0ZjlkYmMyMDc2ZThhODRhYzE5NGYzMlwiLFwiY2xpc3RcIjpbe1wiYXJnc1wiOltdLFwibmFtZVwiOlwiY29pbi5HQVNcIn0se1wiYXJnc1wiOltcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIixcIjQ2NzdhMDllYTE2MDJlNGUwOWZlMDFlYjExOTZjZjQ3YzBmNDRhYTQ0YWFjOTAzZDVmNjFiZTdkYTM0MjUxMjhcIiwzLjc3Nl0sXCJuYW1lXCI6XCJjb2luLlRSQU5TRkVSXCJ9XX1dLFwibWV0YVwiOntcImNyZWF0aW9uVGltZVwiOjE2MDIzODI4MTQsXCJ0dGxcIjoyODgwMCxcImdhc0xpbWl0XCI6NjAwLFwiY2hhaW5JZFwiOlwiMFwiLFwiZ2FzUHJpY2VcIjoxLjBlLTUsXCJzZW5kZXJcIjpcImU3NTc1OGRkMmExYzU5NjQ0YzIyZTA0MmM2ZWMwNzUyNmVhNGU1NzE1NGY5ZGJjMjA3NmU4YTg0YWMxOTRmMzJcIn0sXCJub25jZVwiOlwiXFxcIjIwMjAtMTAtMTFUMDI6MjE6MTQuMTk0WlxcXCJcIn0ifQ", + "eyJnYXMiOjU3MiwicmVzdWx0Ijp7InN0YXR1cyI6InN1Y2Nlc3MiLCJkYXRhIjoiV3JpdGUgc3VjY2VlZGVkIn0sInJlcUtleSI6IjItekN3ZkRWWUdNdFh5Y3dqUy10ZTc4eVN5d09yV3IzUnVIYkJSZzQ3YUUiLCJsb2dzIjoiSU1ra1VFZmVGak45bFQxZ0gtX2ZNT1dDRklrU1d6aVNTZHF2eEo4dS16RSIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNzJ9" + ] + ], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "lWcQRlj3MV7FSem8P4G-8GMRf1-O7zQqi_AwmWnk-N0", + "outputsHash": "9BzXZbhjSSevp4K0bYFqi1GdLjeX_DB-4u1T5Em8abs", + "payloadHash": "jcQOWz7K9qKnkUv4Z883D2ZjkFFGgccoSroWGaoogLM", + "coinbase": "eyJnYXMiOjAsInJlc3VsdCI6eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YSI6IldyaXRlIHN1Y2NlZWRlZCJ9LCJyZXFLZXkiOiJJbkV4WDFkUk16SnliRmhCWW1KcU9WTnZkMXB2YmtabmNHRXdlRnBXUWtKdmNUWTJiRk0xY0RSQ1ZVVWkiLCJsb2dzIjoiSVc0N0QxTXFMVW9mRnNKbWpoWGdDZnhnb2Fzb0xTc05YZUFiOFRPb2NCNCIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNzB9" + } + } + }, + "emptyPayload": { + "summary": "Empty block payload", + "value": { + "value": { + "transactions": [], + "minerData": "eyJhY2NvdW50IjoiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCIsInByZWRpY2F0ZSI6ImtleXMtYWxsIiwicHVibGljLWtleXMiOlsiYTFiMzE0MGNiN2NjODk1YzBlMDkxNzAyZWQwNTU3OWZiZTA1YzZlNjc0NWY4MmNlNjAzNzQ2YjQwMGM4MTU0OCJdfQ", + "transactionsHash": "nT0j4xw2woMkdXXaopdurXIn24OG-jNMqQzUGfxV_MA", + "outputsHash": "4pXRrZ2K0_V0iGAxQCKrKdLjQTBZHBOQS7P-47kdnhY", + "payloadHash": "GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA", + "coinbase": "eyJnYXMiOjAsInJlc3VsdCI6eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YSI6IldyaXRlIHN1Y2NlZWRlZCJ9LCJyZXFLZXkiOiJJa2hoV0VGQ2NURlFTMU5MYkdodVkwcHJNRjlOZERjMVgyeE1OMDVUTTNkSk5qSTNVV1pZV2w4NE5Xc2kiLCJsb2dzIjoiZ3Noak1kWFJrVGxKYmIxalZkQWJ6SVVDcGpQb1JBQ2pEbExzRzBXNkJEMCIsIm1ldGFEYXRhIjpudWxsLCJjb250aW51YXRpb24iOm51bGwsInR4SWQiOjEyNzIzNTB9" + } + } + } + } + } + } + }, + "404": { + "description": "A block payload with that hash was not found", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string", + "description": "Failure message" + }, + "key": { + "$ref": "#/components/schemas/payloadHash" + } + } + }, + "example": { + "reason": "key not found", + "key": "k1H3DsInAPvJ0W_zPxnrpkeSNdPUT0S9U8bqDLG739w" + } + } + } + } + } + } + }, + "/chain/{chain}/payload/outputs/batch": { + "post": { + "summary": "Get Batch of Block Payload With Outputs", + "tags": [ + "payload" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/payloadHashArray" + }, + "responses": { + "200": { + "description": "Array of the some or all of the requested block payloads with\noutputs. Result items maybe returned in any order.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/payloadWithOutputs" + } + }, + "examples": { + "two": { + "value": { + "value": [ + { + "$ref": "#/components/examples/emptyPayload" + }, + { + "$ref": "#/components/examples/payloadWithTransactions" + } + ] + }, + "summary": "Result with two payloads" + }, + "empty": { + "value": [], + "summary": "Empty result" + } + } + } + } + } + } + } + }, + "/chain/{chain}/mempool/getPending": { + "post": { + "summary": "Get Pending Transactions from the Mempool", + "tags": [ + "mempool" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "name": "nonce", + "in": "query", + "description": "Server nonce value", + "schema": { + "type": "integer" + } + }, + { + "name": "since", + "in": "query", + "description": "Mempool tx id value", + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "recent state of pending transactions in the mempool", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "properties": { + "hashes": { + "type": "array", + "items": { + "type": "string" + } + }, + "highwaterMark": { + "type": "array", + "description": "two-element array: `[nonce (integer), since (int64)]`", + "items": { + "type": "integer" + } + } + } + }, + "examples": { + "singleton": { + "value": { + "hashes": [ + "qx346ILpakzgbNZbE8oHqF5TZQghp-HPcV-0Ptc_n2s" + ], + "highwaterMark": [ + 7530864100535969000, + 399 + ] + }, + "summary": "Result with one transaction" + }, + "empty": { + "value": { + "hashes": [], + "highwaterMark": [ + -4683248684880063000, + 436 + ] + }, + "summary": "Empty result" + } + } + } + } + } + } + } + }, + "/chain/{chain}/mempool/member": { + "post": { + "summary": "Check for Pending Transactions in the Mempool", + "tags": [ + "mempool" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/requestKeyArray" + }, + "responses": { + "200": { + "description": "Array of boolean values that indicate whether the respective\ntransaction is in the mempool.\n\nThe array has the same size as the request body.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "boolean" + } + }, + "examples": { + "hit": { + "value": [ + true + ], + "summary": "result for existing transaction" + }, + "miss": { + "value": [ + false + ], + "summary": "result for missing transaction" + }, + "empty": { + "value": [], + "summary": "result from empty request body" + } + } + } + } + } + } + } + }, + "/chain/{chain}/mempool/lookup": { + "post": { + "summary": "Lookup Pending Transactions in the Mempool", + "tags": [ + "mempool" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/requestKeyArray" + }, + "responses": { + "200": { + "description": "Array of lookup results for the respective transactions\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "tag": { + "type": "string", + "enum": [ + "Missing", + "Pending" + ] + }, + "contents": { + "$ref": "#/components/schemas/signedTxText" + } + } + } + }, + "examples": { + "hit": { + "value": [ + { + "tag": "Pending", + "contents": "{\"hash\":\"y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw\",\"sigs\":[{\"sig\":\"8ddc06b37c496f2cadc4f7412405a80faf3ab07482ff5553b9b5fcc73d1b4121275ad5948d9b4078e553b71f8b42eaf6b24135bf2fb4d5840c16bcdde0e35e0f\"}],\"cmd\":\"{\\\"networkId\\\":\\\"mainnet01\\\",\\\"payload\\\":{\\\"exec\\\":{\\\"data\\\":{\\\"account-keyset\\\":{\\\"pred\\\":\\\"keys-all\\\",\\\"keys\\\":[\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\"]}},\\\"code\\\":\\\"(coin.transfer-create \\\\\\\"60241f51ea34e05c61fbea9d\\\\\\\" \\\\\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\\\\\" (read-keyset \\\\\\\"account-keyset\\\\\\\") 5007.0000)\\\"}},\\\"signers\\\":[{\\\"pubKey\\\":\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\",\\\"clist\\\":[{\\\"args\\\":[\\\"60241f51ea34e05c61fbea9d\\\",\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\",5007],\\\"name\\\":\\\"coin.TRANSFER\\\"},{\\\"args\\\":[],\\\"name\\\":\\\"coin.GAS\\\"}]}],\\\"meta\\\":{\\\"creationTime\\\":1618949714,\\\"ttl\\\":300,\\\"gasLimit\\\":600,\\\"chainId\\\":\\\"0\\\",\\\"gasPrice\\\":1.0e-7,\\\"sender\\\":\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\"},\\\"nonce\\\":\\\"\\\\\\\"2021-04-20T20:16:13.645Z\\\\\\\"\\\"}\"}" + } + ], + "summary": "result for existing transaction" + }, + "miss": { + "value": [ + { + "tag": "Missing" + } + ], + "summary": "result for missing transaction" + }, + "empty": { + "value": [], + "summary": "result from empty request body" + } + } + } + } + } + } + } + }, + "/chain/{chain}/mempool/insert": { + "put": { + "summary": "Insert Transactions into the Mempool", + "tags": [ + "mempool" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "description": "Array of strings of JSON encoded signed transactions", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/signedTxText" + } + }, + "examples": { + "singleton": { + "summary": "Singleton request body", + "value": [ + "{\"hash\":\"y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw\",\"sigs\":[{\"sig\":\"8ddc06b37c496f2cadc4f7412405a80faf3ab07482ff5553b9b5fcc73d1b4121275ad5948d9b4078e553b71f8b42eaf6b24135bf2fb4d5840c16bcdde0e35e0f\"}],\"cmd\":\"{\\\"networkId\\\":\\\"mainnet01\\\",\\\"payload\\\":{\\\"exec\\\":{\\\"data\\\":{\\\"account-keyset\\\":{\\\"pred\\\":\\\"keys-all\\\",\\\"keys\\\":[\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\"]}},\\\"code\\\":\\\"(coin.transfer-create \\\\\\\"60241f51ea34e05c61fbea9d\\\\\\\" \\\\\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\\\\\" (read-keyset \\\\\\\"account-keyset\\\\\\\") 5007.0000)\\\"}},\\\"signers\\\":[{\\\"pubKey\\\":\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\",\\\"clist\\\":[{\\\"args\\\":[\\\"60241f51ea34e05c61fbea9d\\\",\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\",5007],\\\"name\\\":\\\"coin.TRANSFER\\\"},{\\\"args\\\":[],\\\"name\\\":\\\"coin.GAS\\\"}]}],\\\"meta\\\":{\\\"creationTime\\\":1618949714,\\\"ttl\\\":300,\\\"gasLimit\\\":600,\\\"chainId\\\":\\\"0\\\",\\\"gasPrice\\\":1.0e-7,\\\"sender\\\":\\\"acc28032a1bb725b7ba0a3593ab86f393894fa6659281f3dfdfee0afe48559a2\\\"},\\\"nonce\\\":\\\"\\\\\\\"2021-04-20T20:16:13.645Z\\\\\\\"\\\"}\"}" + ] + }, + "empty": { + "summary": "Empty request body", + "value": [] + } + } + } + } + }, + "responses": { + "200": { + "description": "Transactions were inserted", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + } + } + } + }, + "/chain/{chain}/mempool/peer": { + "get": { + "summary": "Get Chain Mempool-Network Peer Info", + "tags": [ + "peer" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/next" + } + ], + "responses": { + "200": { + "description": "Peer information", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "description": "Peers from the peer database of the remote node", + "allOf": [ + { + "properties": { + "items": { + "description": "Array of peers", + "items": { + "$ref": "#/components/schemas/peer" + } + } + } + }, + { + "$ref": "#/components/schemas/page" + } + ] + }, + "example": { + "value": { + "next": "inclusive:3", + "items": [ + { + "address": { + "hostname": "85.238.99.91", + "port": 30004 + }, + "id": "PRLmVUcc9AH3fyfMYiWeC4nV2i1iHwc0-aM7iAO8h18" + }, + { + "address": { + "hostname": "us-w3.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "95.111.232.151", + "port": 30004 + }, + "id": "DguFKLFMxp12vfl1z3cQIJQlh8xOpeZuBkpJU9Y-VLo" + } + ], + "limit": 3 + } + } + } + } + } + } + }, + "put": { + "summary": "Put Chain Mempool-Network Peer Info", + "tags": [ + "peer" + ], + "parameters": [ + { + "$ref": "#/components/parameters/chain" + } + ], + "requestBody": { + "description": "The peer that is added to the peer database of the mempoo P2P network of\nthe chain `{chain}` of remote host.\n", + "content": { + "application/json": { + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/peer" + }, + { + "properties": { + "id": { + "nullable": true + } + } + } + ] + } + } + } + }, + "responses": { + "204": { + "description": "The peer got added to the peer database of the remote node.", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + }, + "400": { + "description": "Bad Request.\nThe request is invalid. It is either malformed or the provided peer is not reachable.\n\nBefore the remote node addes a peer to its peer database it checks whether the peer can be reached\nvia the provided address. If this check fails an error is returned.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/plain": { + "description": "The reason for the failure.", + "example": "Invalid hostaddress: IsNotReachable (PeerInfo {_peerId = Nothing, _peerAddr = HostAddress {_hostAddressHost = us-w1.chainweb.com, _hostAddressPort = 444}}) \"\\\"HttpExceptionRequest Request {\\\\n host = \\\\\\\"us-w1.chainweb.com\\\\\\\"\\\\n port = 444\\\\n secure = True\\\\n requestHeaders = [(\\\\\\\"X-Chainweb-Node-Version\\\\\\\",\\\\\\\"2.6\\\\\\\")]\\\\n path = \\\\\\\"/chainweb/0.0/mainnet01/cut/peer\\\\\\\"\\\\n queryString = \\\\\\\"\\\\\\\"\\\\n method = \\\\\\\"GET\\\\\\\"\\\\n proxy = Nothing\\\\n rawBody = False\\\\n redirectCount = 10\\\\n responseTimeout = ResponseTimeoutMicro 2000000\\\\n requestVersion = HTTP/1.1\\\\n}\\\\n ConnectionTimeout\\\"\"" + } + } + } + } + } + }, + "/mining/work": { + "servers": [ + { + "url": "{schema}://{domain}:{port}/chainweb/{chainwebVersion}/{apiVersion}", + "description": "The service API port of a chainweb-node where the mining API is enabled\nand that is configured for mining.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "example.com" + }, + "port": { + "default": "1848" + }, + "chainwebVersion": { + "default": "mainnet01", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + } + ], + "get": { + "tags": [ + "mining" + ], + "summary": "Get Mining Work", + "description": "A new BlockHeader to mine on", + "requestBody": { + "description": "Miner Info", + "content": { + "application/json": { + "example": { + "account": "miner", + "predicate": "keys-all", + "public-keys": [ + "f880a433d6e2a13a32b6169030f56245efdd8c1b8a5027e9ce98a88e886bef27" + ] + }, + "schema": { + "$ref": "#/components/schemas/minerInfo" + } + } + } + }, + "responses": { + "200": { + "description": "A mining work item", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/octet-stream": { + "schema": { + "title": "322 Work Bytes", + "description": "The first 36 bytes are informational. Only the bytes from\nposition 36 to the end are subject of the POW hash\ncomputation.\n", + "properties": { + "chainBytes": { + "title": "4 Chain ID Bytes", + "description": "The chain selection made by the Node. This is\ninformational. Generally, miner should not care about the\nchain.\n", + "type": "string", + "format": "binary" + }, + "targetBytes": { + "title": "32 PoW Target Bytes", + "description": "The PoW target for the current block. The PoW hash of a\nvalid block must not be larger than this value.\n\nFor arithmetic comparisons the hash-target and the PoW\nhash are interpreted as unsigned 256 bit integral number\nin little endian encoding.\n", + "type": "string", + "format": "binary" + }, + "headerBytes": { + "title": "286 Work Header Bytes", + "description": "PoW Work Header Bytes. The last 8 bytes are the nonce. The\ncreation time is encoded in bytes 44-52. Miners must not\nchange or make any assumption about the other bytes.\n\nThe creation time is encoded as little endian twoth\ncomplement integral number that counts SI microseconds\nsince POSIX epoch (leap seconds are ignored). It always\npositive (highest bit is 0). Miners are free but not\nrequired to update the creation time. The value must be\nstrictly larger than the creation time of the parent block\nand must not be in the future.\n", + "type": "string", + "format": "binary" + } + } + } + } + } + } + } + } + }, + "/chainweb/0.0/mainnet01/mining/solved": { + "servers": [ + { + "url": "{schema}://{domain}:{port}/chainweb/{chainwebVersion}/{apiVersion}", + "description": "The service API port of a chainweb-node where the mining API is enabled\nand that is configured for mining.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "example.com" + }, + "port": { + "default": "1848" + }, + "chainwebVersion": { + "default": "mainnet01", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + } + ], + "post": { + "tags": [ + "mining" + ], + "summary": "Solved Mining Work", + "description": "Submit a solution for a new block", + "requestBody": { + "description": "The solved PoW work header bytes", + "content": { + "application/octet-stream": { + "schema": { + "title": "286 Solved PoW Work Header Bytes", + "description": "The original work received that was received from `/mining/work`\nwith updated nonce value such that it satisfies the\nProof-of-Work. The nonce are last 8 bytes of the work header\nbytes.\n\nThe PoW hash of a valid block is computed using `blake2s`. It\nmust not be larger than the PoW target for the current block.\nThe target was received along with the work header bytes from\nthe `/mining/work` endpoint. For arithmetic comparisons the\nhash-target and the PoW hash are interpreted as unsigned 256 bit\nintegral number in little endian encoding.\n\nMiners are free but not required to also update the creation time.\nThe value must be strictly larger than the creation time of the\nparent block and must not be in the future.\n", + "type": "string", + "format": "binary" + } + } + } + }, + "responses": { + "204": { + "description": "Solved mining work is valid", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + } + } + } + } + }, + "/mining/updates": { + "servers": [ + { + "url": "{schema}://{domain}:{port}/chainweb/{chainwebVersion}/{apiVersion}", + "description": "The service API port of a chainweb-node where the mining API is enabled\nand that is configured for mining.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "example.com" + }, + "port": { + "default": "1848" + }, + "chainwebVersion": { + "default": "mainnet01", + "enum": [ + "test-singleton", + "development", + "mainnet01", + "testnet04" + ] + }, + "apiVersion": { + "default": "0.0" + } + } + } + ], + "get": { + "tags": [ + "mining" + ], + "summary": "Notification of Updated Work", + "description": "An server-sent event sources that notifies miners when new mining\nwork becomes available.\n\nThe stream is terminated by the server in regular intervals and\nit is up to the client to request a new stream.\n", + "requestBody": { + "description": "The first 4 bytes received from a call to `/mining/work`. This tells the Node to only inform the Miner of a new Cut when the specific chain in question has updated.", + "content": { + "application/octet-stream": { + "schema": { + "title": "4 Chain ID bytes", + "type": "string", + "format": "binary" + } + } + } + }, + "responses": { + "200": { + "description": "Each events consists of a single line: `event:New Cut`.\nEvents are separated by empty lines.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/event-stream": { + "schema": { + "$ref": "#/components/schemas/miningUpdateEventStream" + }, + "example": "event:New Cut\n\nevent:New Cut\n\nevent:New Cut\n" + } + } + } + } + } + }, + "/config": { + "get": { + "tags": [ + "config", + "misc" + ], + "summary": "Configuration of Chainweb Node", + "description": "Returns the configuration of chainweb-node as a JSON structure.\nSensitive information is removed from the result. The JSON schema depends\non the chainweb node version and is not part of the stable chainweb-node\nAPI.\n", + "responses": { + "200": { + "description": "Configuration of the chainweb node", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "example": { + "value": { + "allowReadsInLocal": false, + "rosetta": true, + "throttling": { + "local": 1, + "mining": 2, + "global": 200, + "putPeer": 21 + }, + "serviceApi": { + "interface": "invalid", + "port": 0 + }, + "validateHashesOnReplay": false, + "chainwebVersion": "mainnet01", + "pactQueueSize": 2000, + "mining": { + "coordination": { + "enabled": false, + "updateStreamTimeout": 240, + "limit": 1200, + "updateStreamLimit": 2000, + "miners": [] + }, + "nodeMining": { + "miner": { + "account": "", + "predicate": "keys-all", + "public-keys": [] + }, + "enabled": false + } + }, + "p2p": { + "peer": { + "certificateChainFile": null, + "key": null, + "interface": "*", + "certificateChain": null, + "hostaddress": { + "hostname": "34.70.108.163", + "port": 1789 + }, + "keyFile": null + }, + "maxPeerCount": 100, + "private": false, + "ignoreBootstrapNodes": false, + "maxSessionCount": 8, + "bootstrapReachability": 0.5, + "sessionTimeout": 300, + "peers": [ + { + "address": { + "hostname": "us-e1.chainweb.com", + "port": 443 + }, + "id": null + }, + { + "address": { + "hostname": "us-w1.chainweb.com", + "port": 443 + }, + "id": null + } + ] + }, + "transactionIndex": { + "enabled": true, + "configuration": {} + }, + "gasLimitOfBlock": 150000, + "reorgLimit": 480, + "headerStream": true, + "mempoolP2p": { + "enabled": true, + "configuration": { + "pollInterval": 30, + "maxSessionCount": 6, + "sessionTimeout": 240 + } + }, + "reintroTxs": true, + "cuts": { + "pruneChainDatabase": "none", + "fetchTimeout": 3000000, + "initialCutHeightLimit": null + } + } + } + } + } + } + } + } + }, + "/make-backup": { + "post": { + "summary": "Start a backup job", + "description": "Backup jobs are identified by the Unix timestamp when they're begun.\n\nIf a backup job is already in progress, this endpoint will return its\nidentifier instead of starting a new one.\n\nThe RocksDB portion of the database is always backed up; if backupPact\nis set, the Sqlite (Pact) portion is backed up as well, taking much\nlonger.\n\nThere is no automatic backup retention policy - users need to delete old\nbackups.\n\nThis API is enabled by configuring the node thus:\n```yaml\nbackup:\n api:\n enabled: true\n directory: {some file path to put backups in}\n```\nThe backup directory ideally will be located in the same partition as the\nRocksDB portion of the node database.\n\nRocksDB backups to the same partition as holds the active RocksDB\ndatabase will have almost zero space overhead immediately, but over time\nas the active database diverges from the backup the space overhead will\nincrease. If the backup is to another partition, it will take longer\nand take as much disk space as the active RocksDB database.\n\nPact database backups always require about as much space as the active\nPact database does.\n", + "tags": [ + "misc" + ], + "parameters": [ + { + "$ref": "#/components/parameters/backupPact" + } + ], + "responses": { + "200": { + "description": "A backup job has been created", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/backupId" + } + } + } + } + } + } + }, + "/check-backup/{backupId}": { + "get": { + "summary": "Check the status of a backup job", + "tags": [ + "misc" + ], + "parameters": [ + { + "$ref": "#/components/parameters/backupId" + } + ], + "responses": { + "200": { + "description": "A backup job with that identifier exists, here is its status", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/backupStatus" + } + } + } + }, + "404": { + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "description": "There is no backup job with that identifier" + } + } + } + }, + "/health-check": { + "servers": [ + { + "url": "https://api.chainweb.com", + "description": "Chainweb service API for mainnet" + }, + { + "url": "https://api.testnet.chainweb.com", + "description": "Chainweb service API for testnet" + }, + { + "url": "{schema}://{domain}:{port}", + "description": "Service API endpoint of a chainweb-node. It may serve only a subset of\nthe endpoints.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "api.chainweb.com" + }, + "port": { + "default": "1848" + } + } + } + ], + "get": { + "tags": [ + "misc" + ], + "summary": "Health Check", + "description": "Checks whether the chainweb-node is up and running and responding to API\nrequests. In order to check the state of consensus the\n[/cut/get](#tag/cut/paths/~1cut/get) endpoint should be used instead.\n", + "responses": { + "200": { + "description": "The node is healthy", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/plain": { + "schema": { + "type": "string" + }, + "example": "Health check OK." + } + } + } + } + } + }, + "/info": { + "servers": [ + { + "url": "https://api.chainweb.com", + "description": "Chainweb service API for mainnet" + }, + { + "url": "https://api.testnet.chainweb.com", + "description": "Chainweb service API for testnet" + }, + { + "url": "{schema}://{domain}:{port}", + "description": "Service API endpoint of a chainweb-node. It may serve only a subset of\nthe endpoints.\n", + "variables": { + "schema": { + "default": "http", + "enum": [ + "http", + "https" + ] + }, + "domain": { + "default": "api.chainweb.com" + }, + "port": { + "default": "1848" + } + } + } + ], + "get": { + "tags": [ + "misc" + ], + "summary": "General Node Info", + "description": "Provides general information about the node and the chainweb version", + "responses": { + "200": { + "description": "General information about the node and the chainweb version", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/nodeInfo" + }, + "example": { + "value": { + "nodeNumberOfChains": 20, + "nodeApiVersion": "0.0", + "nodeChains": [ + "12", + "13", + "14", + "15", + "8", + "9", + "10", + "11", + "4", + "5", + "6", + "7", + "0", + "16", + "1", + "17", + "2", + "18", + "3", + "19" + ], + "nodeVersion": "mainnet01", + "nodeGraphHistory": [ + [ + 0, + [ + [ + 0, + [ + 5, + 2, + 3 + ] + ], + [ + 1, + [ + 4, + 6, + 3 + ] + ], + [ + 2, + [ + 4, + 7, + 0 + ] + ], + [ + 3, + [ + 8, + 0, + 1 + ] + ], + [ + 4, + [ + 9, + 1, + 2 + ] + ], + [ + 5, + [ + 9, + 6, + 0 + ] + ], + [ + 6, + [ + 5, + 7, + 1 + ] + ], + [ + 7, + [ + 8, + 6, + 2 + ] + ], + [ + 8, + [ + 9, + 7, + 3 + ] + ], + [ + 9, + [ + 8, + 4, + 5 + ] + ] + ] + ], + [ + 852054, + [ + [ + 0, + [ + 15, + 10, + 5 + ] + ], + [ + 1, + [ + 11, + 6, + 16 + ] + ], + [ + 2, + [ + 12, + 7, + 17 + ] + ], + [ + 3, + [ + 13, + 8, + 18 + ] + ], + [ + 4, + [ + 14, + 9, + 19 + ] + ], + [ + 5, + [ + 8, + 7, + 0 + ] + ], + [ + 6, + [ + 8, + 9, + 1 + ] + ], + [ + 7, + [ + 9, + 5, + 2 + ] + ], + [ + 8, + [ + 5, + 6, + 3 + ] + ], + [ + 9, + [ + 4, + 6, + 7 + ] + ], + [ + 10, + [ + 11, + 0, + 19 + ] + ], + [ + 11, + [ + 12, + 10, + 1 + ] + ], + [ + 12, + [ + 13, + 11, + 2 + ] + ], + [ + 13, + [ + 12, + 14, + 3 + ] + ], + [ + 14, + [ + 13, + 15, + 4 + ] + ], + [ + 15, + [ + 14, + 0, + 16 + ] + ], + [ + 16, + [ + 15, + 1, + 17 + ] + ], + [ + 17, + [ + 16, + 2, + 18 + ] + ], + [ + 18, + [ + 17, + 3, + 19 + ] + ], + [ + 19, + [ + 10, + 4, + 18 + ] + ] + ] + ] + ] + } + } + } + } + } + } + } + }, + "/header/updates": { + "get": { + "tags": [ + "misc" + ], + "summary": "Blocks Event Stream", + "description": "An source of server events that emits a `BlockHeader` event for each new\nblock header that is added to the chain database of the remote node.\n\nThe stream contains blocks that may later become orphaned. It is\ntherefor recommended to buffer events on the client side for the most\nrecent block heights until the desired confirmation depth is reached.\n\nThe server may terminate this stream from time to time and it is up to\nthe client to reinitiate the stream.\n", + "responses": { + "200": { + "description": "A stream of `BlockHeader` events. **This is not a JSON array**.\n\nEvents are separated by empty lines. Each event consists of an\n`event` property and a `data` property which are separated by\nnewlines.\n", + "headers": { + "x-peer-addr": { + "$ref": "#/components/headers/x-peer-addr" + }, + "x-server-timestamp": { + "$ref": "#/components/headers/x-server-timestamp" + }, + "x-chainweb-node-version": { + "$ref": "#/components/headers/x-chainweb-node-version" + } + }, + "content": { + "text/event-stream": { + "schema": { + "description": "A stream of `BlockHeader` events. **This is not an JSON array**.\n\nEvents are separated by empty lines (`\\n\\n`). Each event\nconsists of two newline (`\\n`) separated properties.\n", + "type": "array", + "items": { + "description": "A `BlockHeader` event. **This is not an JSON object**.\n\nEach event consists of an `event` property and a `data`\nproperty which are separated by newlines.\n", + "properties": { + "event": { + "type": "string", + "enum": [ + "BlockHeader" + ] + }, + "data": { + "properties": { + "txCount": { + "type": "integer", + "minimum": 0, + "description": "Number of transactions in the block" + }, + "powHash": { + "type": "string", + "description": "A custom representation of the POW hash for use in the block explorer UI" + }, + "header": { + "$ref": "#/components/schemas/blockHeader" + }, + "target": { + "type": "string", + "description": "A custom representation of the POW target for use in the block explorer UI" + } + } + } + } + } + }, + "example": "event:BlockHeader\ndata:{\"txCount\":0,\"powHash\":\"00000000000006e0b164858ee0fcbfd112f4242d5010ff33d3a43d2cc3c15177\",\"header\":{\"creationTime\":1619037443761924,\"parent\":\"qaUtvtXk75nXsWM9l6vkeGkQilZfE_YgzWkZm-7tLyE\",\"height\":1554652,\"hash\":\"okI4V9Pez5-UPw4nys2Nk9iIPz3-n30HCag5_NQptlo\",\"chainId\":6,\"weight\":\"d8mOCoZeFpajAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\"featureFlags\":0,\"epochStart\":1619035890499046,\"adjacents\":{\"1\":\"OTcNZsNMA-TZ9RTlfWqegFiE0ZkBYcy3JCzh23gmm9Y\",\"8\":\"nznrNdU8RWatTVlS8yTaVaxk8CT1ZjR4ZWta7GAaMDk\",\"9\":\"CanRK_wW8RjyA1X9xSEQCXymsnk3VERAJtAB2abrY_M\"},\"payloadHash\":\"cT86RaKJUyCZXKB3gYqX9A9SNway-lUBrHSvNr7_SaM\",\"chainwebVersion\":\"mainnet01\",\"target\":\"zklwTetkWv91YxYIRmXCt6kUHpEBpiN8gwcAAAAAAAA\",\"nonce\":\"3399765038640884059\"},\"target\":\"00000000000007837c23a601911e14a9b7c2654608166375ff5a64eb4d7049ce\"}\n\nevent:BlockHeader\ndata:{\"txCount\":0,\"powHash\":\"00000000000001c40ddfd6574f9962a443714f3817bbea773a55fec63c7d95c8\",\"header\":{\"creationTime\":1619037446256086,\"parent\":\"usmNftUR_mHpXOm8gCvtbZ50_9VaefaIVvcMdrKwc5A\",\"height\":1554652,\"hash\":\"SOfbK_kI_9BtgLemWmb3FWOgDCTxf1tPulKCq1ndmWA\",\"chainId\":18,\"weight\":\"i7XsQnkhY9yLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\"featureFlags\":0,\"epochStart\":1619035885828397,\"adjacents\":{\"19\":\"fQJ5JKQLdGEwZIoC5HrhJstk3Iibj_a2dfmJl9osG-o\",\"17\":\"L-GeIWZE4fMCICSpPptsfYpsLj3oO5eCiyJimclYJiY\",\"3\":\"V7m9ROQmJs2i1UI05t8J6rjkfg7m795esdsIjhqyqfc\"},\"payloadHash\":\"Ji7WisfH5IulPMcFglexGcVDnA59aS5k1YSE2_6L4t8\",\"chainwebVersion\":\"mainnet01\",\"target\":\"tvH4nBuGx3opw-50T8-i6ECi68IgpFLOjAcAAAAAAAA\",\"nonce\":\"9499180874660840183\"},\"target\":\"000000000000078cce52a420c2eba240e8a2cf4f74eec3297ac7861b9cf8f1b6\"}\n" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/libs/chainweb-node-client/openapi/pact.json b/packages/libs/chainweb-node-client/openapi/pact.json new file mode 100644 index 0000000000..45482f051c --- /dev/null +++ b/packages/libs/chainweb-node-client/openapi/pact.json @@ -0,0 +1,1316 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Pact REST API", + "description": "Transactional API for a runtime offering Pact smart contracts.\n", + "version": "1.3.7", + "x-logo": { + "url": "https://i.imgur.com/bAZFAGF.png", + "alttext": "Kadena Chainweb Logo" + } + }, + "servers": [ + { + "url": "https://api.chainweb.com/chainweb/{apiVersion}/mainnet01/chain/{chainId}/pact/api/v1", + "description": "Pact API for a chain on the Kadena mainnet.", + "variables": { + "apiVersion": { + "default": "0.0" + }, + "chainId": { + "default": "0" + } + } + }, + { + "url": "https://api.testnet.chainweb.com/chainweb/{apiVersion}/testnet04/chain/{chainId}/pact/api/v1", + "description": "Pact API for a chain on the Kadena testnet.", + "variables": { + "apiVersion": { + "default": "0.0" + }, + "chainId": { + "default": "0" + } + } + } + ], + "paths": { + "/local": { + "post": { + "description": "Blocking/sync call to submit a command for non-transactional execution. In a\nblockchain environment this would be a node-local “dirty read”, which can\neither serve as a node-local repl execution, or fully gassed transaction\nsimulation and transaction validation. Any database writes or changes to the\nenvironment are rolled back.\n", + "tags": [ + "endpoint-local" + ], + "summary": "local", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/command" + } + } + } + }, + "parameters": [ + { + "name": "preflight", + "in": "query", + "description": "Trigger fully-gassed mainnet transaction execution simulation and\ntransaction metadata validations.\n", + "required": false, + "schema": { + "type": "bool" + } + }, + { + "name": "signatureValidation", + "in": "query", + "description": "Require user signature validation when validating transaction\nmetadata.\n", + "required": false, + "schema": { + "type": "bool" + } + } + ], + "responses": { + "200": { + "description": "The command's result.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/command-result" + } + } + } + }, + "400": { + "description": "The command was invalid.", + "content": { + "text/plain": { + "type": "string", + "example": "Validation failed: Invalid command: Failed reading: empty", + "schema": { + "$ref": "#/components/schemas/validation-failure" + } + } + } + } + } + } + }, + "/send": { + "post": { + "description": "Asynchronous submission of one or more public (unencrypted) commands\nto the blockchain for execution.\n", + "tags": [ + "endpoint-send" + ], + "summary": "send", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "cmds" + ], + "properties": { + "cmds": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/command" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The commands were successfully submitted. The response contains their request keys.", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "requestKeys" + ], + "properties": { + "requestKeys": { + "description": "Request keys for use with `poll` or `listen` to retrieve results.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/request-key" + } + } + } + } + } + } + }, + "400": { + "description": "The command failed.", + "content": { + "text/plain": { + "type": "string", + "example": "Validation failed for hash \"j5f3mZaF9pVA7OmV4nTuw5-paG9LzLQJWAMuGGRRLeQ\": Attempt to buy gas failed with: (read coin-table sender): Failure: Tx Failed: read: row not found: 368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca", + "schema": { + "$ref": "#/components/schemas/validation-failure" + } + } + } + } + } + } + }, + "/poll": { + "post": { + "description": "Allows polling for one or more command results by request key.\n", + "summary": "poll", + "tags": [ + "endpoint-poll" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "requestKeys" + ], + "properties": { + "requestKeys": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/request-key" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The command results for some of the requested request keys.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/command-result" + } + } + } + } + } + } + } + }, + "/listen": { + "post": { + "description": "Blocking request for single command result.\n", + "summary": "listen", + "tags": [ + "endpoint-listen" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "listen" + ], + "properties": { + "listen": { + "$ref": "#/components/schemas/request-key" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The request key was found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/command-result" + } + } + } + } + } + } + }, + "/private": { + "post": { + "description": "Asynchronous submission of a single addressed command which\nwill be transmitted with end-to-end encryption only between addressed entity nodes.\nPrivate payload metadata required.\n", + "tags": [ + "endpoint-private" + ], + "summary": "private", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/command" + } + } + } + }, + "responses": { + "200": { + "description": "The command was accepted.", + "content": { + "application/json": { + "type": "object", + "schema": { + "properties": { + "requestKeys": { + "description": "Request keys for use with `poll` or `listen` to retrieve results.", + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "$ref": "#/components/schemas/request-key" + } + } + } + } + } + } + } + } + } + }, + "/spv": { + "servers": [ + { + "url": "https://api.chainweb.com/chainweb/{apiVersion}/mainnet01/chain/{chainId}/pact", + "description": "Pact API for a chain on the Kadena mainnet.", + "variables": { + "apiVersion": { + "default": "0.0" + }, + "chainId": { + "default": "0" + } + } + }, + { + "url": "https://api.testnet.chainweb.com/chainweb/{apiVersion}/testnet04/chain/{chainId}/pact", + "description": "Pact API for a chain on the Kadena testnet.", + "variables": { + "apiVersion": { + "default": "0.0" + }, + "chainId": { + "default": "0" + } + } + } + ], + "post": { + "description": "Blocking request to fetch spv proof of a cross chain transaction. Request must be sent to the chain where the transaction is initiated.\n", + "summary": "spv", + "tags": [ + "endpoint-spv" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/spv-object" + } + } + } + }, + "responses": { + "200": { + "description": "The requested spv proof.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/spv-proof" + } + } + } + }, + "400": { + "description": "The requested spv proof was not findable.", + "content": { + "text/plain": { + "example": "SPV target not reachable: target chain not reachable. Chainweb instance is too young", + "schema": { + "description": "Error message with the description of failed proof requests.", + "type": "string" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "command": { + "title": "Pact Command", + "tags": [ + "model-command" + ], + "description": "Represents a single blockchain Pact transaction.", + "type": "object", + "required": [ + "cmd", + "hash", + "sigs" + ], + "example": { + "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\"}" + }, + "properties": { + "cmd": { + "description": "Stringified JSON `payload` object. Canonic non-malleable signed transaction data.\n", + "type": "string" + }, + "hash": { + "description": "Unpadded Base64URL of Blake2s-256 hash of the `cmd` field value. Serves as a command\n`requestKey` since each transaction must be unique.\n", + "type": "string", + "contentEncoding": "base64url", + "example": "H6XjdPHzMai2HLa3_yVkXfkFYMgA0bGfsB0kOsHAMuI" + }, + "sigs": { + "description": "List of signatures corresponding one-to-one with `signers` array in the payload.\n", + "type": "array", + "minItems": 0, + "items": { + "properties": { + "sig": { + "type": "string", + "contentEncoding": "base16", + "description": "Base16-encoded cryptograhic signature of `cmd` field data\nfor corresponding signer in payload.\n", + "example": "8d452109cc0439234c093b5e204a7428bc0a54f22704402492e027aaa9375a34c910d8a468a12746d0d29e9353f4a3fbebe920d63bcc7963853995db015d060f" + } + } + } + } + } + }, + "payload": { + "description": "Pact Command Payloads are encoded as strings in Pact commands, and contain all\nnon-malleable data for a transaction.\n", + "tags": [ + "model-payload" + ], + "type": "object", + "required": [ + "payload", + "meta", + "signers", + "networkId", + "nonce" + ], + "example": { + "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" + }, + "properties": { + "payload": { + "oneOf": [ + { + "title": "Exec Message", + "description": "Standard pact execution.", + "properties": { + "code": { + "type": "string", + "description": "Executable pact code." + }, + "data": { + "description": "Arbitrary JSON to be accessed via `read-msg`, `read-integer` et al in Pact code." + } + } + }, + { + "title": "Continuation Message", + "description": "Continuation of a previous transaction defpact.", + "properties": { + "pactId": { + "type": "string", + "description": "ID of pact running previous step." + }, + "step": { + "type": "number", + "description": "Step in defpact to execute." + }, + "rollback": { + "type": "boolean", + "description": "Whether to execute a specified rollback on this step." + }, + "data": { + "description": "Arbitrary JSON to be accessed via `read-msg`, `read-integer` et al in Pact code." + }, + "proof": { + "type": "string", + "contentEncoding": "base64url", + "description": "Backend-specific data for continuing a cross-chain proof." + } + } + } + ] + }, + "meta": { + "oneOf": [ + { + "title": "Public metadata (Chainweb)", + "description": "Chainweb/public command metadata.", + "required": [ + "chainId", + "sender", + "gasLimit", + "gasPrice", + "ttl", + "creationTime" + ], + "properties": { + "chainId": { + "type": "string", + "description": "Platform-specific chain identifier. For chainweb this is the stringified chain number." + }, + "sender": { + "type": "string", + "description": "Indicates gas-paying account." + }, + "gasLimit": { + "type": "number", + "minimum": 1, + "description": "Limits total amount of gas to be consumed." + }, + "gasPrice": { + "type": "number", + "description": "Specifies price per gas unit to be charged." + }, + "ttl": { + "type": "number", + "minimum": 1, + "maximum": 180000, + "description": "Time in seconds after creation time that transaction can be executed." + }, + "creationTime": { + "type": "number", + "description": "POSIX epoch sending time for transaction." + } + } + }, + { + "title": "Private metadata (Kuro)", + "description": "Metadata for Kuro endpoints, including `private`.", + "properties": { + "address": { + "description": "Private message envelope address. Required only for private messages, otherwise null.", + "required": [ + "from", + "to" + ], + "properties": { + "from": { + "type": "string", + "description": "Sender entity name" + }, + "to": { + "description": "Recipient entity names", + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "description": "Recipient entity name" + } + } + } + } + } + } + ] + }, + "signers": { + "description": "List of signers, corresponding with list of signatures in outer command.", + "type": "array", + "items": { + "title": "Signer", + "required": [ + "pubKey" + ], + "properties": { + "pubKey": { + "type": "string", + "description": "Public key image. Pact default is base16 ED25519 encoding." + }, + "address": { + "type": "string", + "description": "Address, if any. Pact default expects this to match pubKey." + }, + "scheme": { + "type": "string", + "description": "Signer scheme. Default is ED25519.", + "enum": [ + "ED25519", + "ETH" + ] + }, + "clist": { + "description": "List of capabilities associated with/installed by this signer.", + "properties": { + "name": { + "type": "string", + "description": "Fully-qualified capability name." + }, + "args": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pact-value" + } + } + } + } + } + } + }, + "networkId": { + "description": "Backend-specific identifier of target network.", + "type": "string", + "enum": [ + "mainnet01", + "testnet04" + ] + }, + "nonce": { + "description": "Arbitrary user-supplied value.", + "type": "string" + } + } + }, + "spv-object": { + "description": "Object consisting of data required to fetch proof of a cross chain transaction\n", + "type": "object", + "required": [ + "requestKey", + "targetChainId" + ], + "properties": { + "requestKey": { + "type": "string", + "description": "Request Key of an initiated cross chain transaction at the source chain.", + "example": "7af34f24d55d2fcf5de6fccfeeb837698ebff4598303237c64348a47806c8646" + }, + "targetChainId": { + "type": "string", + "description": "Target chain id of the cross chain transaction.", + "example": "1" + } + } + }, + "command-result": { + "title": "Command Result", + "tags": [ + "model-command-result" + ], + "example": { + "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" + } + ] + }, + "description": "The result of attempting to execute a single well-formed Pact command.", + "type": "object", + "required": [ + "reqKey", + "result", + "logs", + "metaData", + "gas" + ], + "properties": { + "reqKey": { + "$ref": "#/components/schemas/request-key" + }, + "result": { + "oneOf": [ + { + "title": "Success", + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "success" + ] + }, + "data": { + "$ref": "#/components/schemas/pact-value" + } + } + }, + { + "title": "Failure", + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "failure" + ] + }, + "error": { + "$ref": "#/components/schemas/pact-error" + } + } + } + ] + }, + "txId": { + "type": "number", + "description": "Database-internal transaction tracking ID." + }, + "logs": { + "type": "string", + "description": "Backend-specific value providing image of database logs." + }, + "metaData": { + "properties": { + "blockTime": { + "type": "number", + "description": "POSIX time of block" + }, + "prevBlockHash": { + "type": "string", + "description": "Parent Block hash of containing block." + }, + "blockHash": { + "type": "string", + "description": "Block hash of containing block." + }, + "blockHeight": { + "type": "number", + "description": "Block height of containing block." + }, + "publicMeta": { + "type": "object", + "description": "Public metadata.", + "properties": { + "creationTime": { + "type": "number", + "description": "POSIX time the command was created" + }, + "ttl": { + "type": "number", + "description": "Transaction time to live" + }, + "gasLimit": { + "type": "number", + "description": "The transaction's gas limit" + }, + "chainId": { + "type": "string", + "description": "Chain identifier" + }, + "gasPrice": { + "type": "number", + "description": "The price of each unit of gas in KDA" + }, + "sender": { + "type": "string" + } + } + } + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/event" + } + }, + "continuation": { + "description": "Describes result of a defpact execution.", + "properties": { + "pactId": { + "type": "string", + "description": "Identifies this defpact execution. On first step generally matches request key." + }, + "step": { + "type": "number", + "description": "Identifies which step executed in defpact." + }, + "stepCount": { + "type": "number", + "description": "Total number of steps in pact." + }, + "executed": { + "type": "boolean", + "description": "optional value for private pacts, indicates if step was skipped." + }, + "stepHasRollback": { + "type": "boolean", + "description": "indicates if pact step has rollback." + }, + "continuation": { + "description": "Closure describing executed pact.", + "properties": { + "def": { + "type": "string", + "description": "Fully-qualified defpact name." + }, + "args": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pact-value" + } + } + } + }, + "yield": { + "description": "Value yielded during pact step, optionally indicating cross-chain execution.", + "properties": { + "data": { + "type": "object", + "description": "Pact value object containing yielded data.", + "additionalProperties": { + "$ref": "#/components/schemas/pact-value" + } + }, + "source": { + "type": "string", + "description": "Source chain ID." + }, + "provenance": { + "properties": { + "targetChainId": { + "type": "string", + "description": "Chain ID of target chain for next step." + }, + "moduleHash": { + "description": "Hash of module executing defpact.", + "type": "string" + } + } + } + } + } + } + }, + "gas": { + "type": "number" + } + } + }, + "pact-value": { + "description": "Pact value compound type.", + "tags": [ + "model-pact-value" + ], + "anyOf": [ + { + "title": "String", + "description": "Pact strings encode directly to JSON strings.", + "type": "string" + }, + { + "title": "Decimal", + "description": "There are two alternative JSON representations for Decimal.", + "oneOf": [ + { + "title": "Number", + "description": "JSON numbers can be used whenever the precision is adequate\n", + "type": "number" + }, + { + "title": "Object", + "description": "When JSON number precision is not enough, you can use an object with the number's decimal representation as a string\n", + "type": "object", + "required": [ + "decimal" + ], + "properties": { + "decimal": { + "type": "string", + "description": "String representation of number to avoid rounding error", + "example": "1.23498218000001" + } + } + } + ] + }, + { + "title": "Integer", + "description": "There are two alternative JSON representations for Integer.", + "type": "object", + "required": [ + "int" + ], + "properties": { + "int": { + "oneOf": [ + { + "title": "Number", + "description": "JSON numbers are rounded to integer values.\n", + "type": "number", + "example": 12345 + }, + { + "title": "String", + "description": "When JSON number precision is not enough, you can specify the integer as a string\n", + "type": "string", + "example": "123456789" + } + ] + } + } + }, + { + "title": "Boolean", + "description": "JSON booleans encode to Pact booleans.", + "type": "boolean" + }, + { + "title": "Object", + "type": "object", + "description": "JSON objects not matching other Pact Value schemas become Pact objects.", + "additionalProperties": { + "$ref": "#/components/schemas/pact-value" + } + }, + { + "title": "Time", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "string", + "description": "Literal time value using the UTC time format.", + "example": "1970-01-01T00:00:00Z" + } + } + }, + { + "title": "List", + "description": "JSON lists become Pact lists.", + "type": "array", + "items": { + "$ref": "#/components/schemas/pact-value" + } + }, + { + "title": "Module Reference", + "description": "Special pact value to directly reference a module or interface.", + "type": "object", + "properties": { + "refName": { + "type": "string", + "description": "Fully-qualified module or interface name." + } + } + }, + { + "title": "Guard", + "description": "Special pact value for guard types.", + "type": "object", + "oneOf": [ + { + "title": "Keyset", + "description": "A keyset forms a rule made from a set of key/address values and a predicate function.\nWhen enforced, transaction signer list is evaluated against keyset.\n", + "required": [ + "keys", + "pred" + ], + "properties": { + "keys": { + "type": "array", + "description": "Set of public key/address values. Native pact public keys are ED25519 in base16 encoding.", + "items": { + "type": "string" + } + }, + "pred": { + "type": "string", + "description": "A pact function name. Built-in values are `keys-all` (match all keys in set),\n`keys-any` (match at least one), and `keys-2` (match at least 2).\nCustom functions have a fully-qualified name and\nmust accept two integer arguments `count` (number of keys in set) and `matched`\n(number of set keys found in transaction set).\n" + } + } + }, + { + "title": "Keyset Reference", + "description": "Refers to a keyset in the Pact environment/database installed with `define-keyset`.", + "required": [ + "keysetref" + ], + "properties": { + "keysetref": { + "type": "string", + "description": "Installed keyset name." + } + } + }, + { + "title": "User Guard", + "description": "Closure of call to \"guard function\" which is a boolean user function with arguments.\n", + "required": [ + "fun", + "args" + ], + "properties": { + "fun": { + "description": "Fully-qualified guard function name.", + "type": "string" + }, + "args": { + "description": "Argument values to the guard function.", + "type": "array", + "items": { + "$ref": "#/components/schemas/pact-value" + } + } + } + }, + { + "title": "Module Guard", + "type": "object", + "description": "Autonomous guard that only allows module code access, or requires module admin.\n", + "required": [ + "moduleName", + "name" + ], + "properties": { + "moduleName": { + "required": [ + "name", + "namespace" + ], + "properties": { + "name": { + "type": "string", + "description": "module bare name" + }, + "namespace": { + "type": "string", + "description": "module namespace" + } + } + }, + "name": { + "type": "string", + "description": "Distinguishing/informative name for module guard." + } + } + }, + { + "title": "Pact Guard", + "type": "object", + "description": "Autonomous guard that only allows a particular pact execution, referenced by ID, to pass.\nTwo executions of the same defpact code result in distinct pact IDs. A pact guard\ncreated inside of this execution will only pass when running that particular pact.\n", + "required": [ + "pactId", + "name" + ], + "properties": { + "pactId": { + "description": "Defpact execution ID.", + "type": "string" + }, + "name": { + "type": "string", + "description": "Distinguishing/informative name for pact guard." + } + } + } + ] + } + ] + }, + "event": { + "description": "Pact output event.", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Event defcap name." + }, + "module": { + "type": "object", + "description": "Qualified module name of event defcap.", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "module bare name" + }, + "namespace": { + "type": "string", + "description": "module namespace" + } + } + }, + "params": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pact-value" + } + }, + "moduleHash": { + "type": "string", + "description": "Hash of emitting module." + } + } + }, + "pact-error": { + "description": "Verbose object describing failed execution.\n", + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string", + "description": "Descriptive error text." + }, + "callStack": { + "type": "array", + "items": { + "type": "string" + } + }, + "info": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "request-key": { + "title": "Request Key", + "type": "string", + "description": "Unique ID of a pact transaction consisting of its hash.", + "pattern": "^[a-zA-Z0-9_-]{43}$", + "contentEncoding": "base64url", + "minLength": 43, + "maxLength": 43, + "example": "y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw" + }, + "validation-failure": { + "title": "Validation Failure", + "type": "string", + "description": "Failure message of unexecuted command due to an invalid gas payer, meta, or other environments." + }, + "spv-proof": { + "title": "SPV Proof", + "type": "string", + "description": "Backend-specific data for continuing a cross-chain proof.", + "example": "\"eyJzdWJqZWN0Ijp7ImlucHV0IjoiQUJSN0ltZGhjeUk2TlRRMExDSnlaWE4xYkhRaU9uc2ljM1JoZEhWeklqb2ljM1ZqWTJWemN5SXNJbVJoZEdFaU9pSlhjbWwwWlNCemRXTmpaV1ZrWldRaWZTd2ljbVZ4UzJWNUlqb2lZa0Y0TjNOd1dqZFdUbUpZWTNocVZFUkNTamt5U21SdlUyVlFjWGx0U25KNWNXOUNhMWcyUkVoYWJ5SXNJbXh2WjNNaU9pSnBRVTF4Y0ZwaVUxSkRaR2hQUzA1YVVYZzFTMHBOTFZOUlNGRlZXRzF4UlZoUlRIRkNUVVpSVFVkSklpd2laWFpsYm5SeklqcGJleUp3WVhKaGJYTWlPbHNpZEdWemRDMXpaVzVrWlhJaUxDSXpaRGxsT1dZeFptSTBZemt6TnpneU5qWmpZV1JrTmpObE4yRTBOMkkzWVRZME5UTmlaVGsyTVdSaU1ETTNNMlkxWXpWbVlUUXdZV05sWlRaaVpHVm1JaXd4WFN3aWJtRnRaU0k2SWxSU1FVNVRSa1ZTSWl3aWJXOWtkV3hsSWpwN0ltNWhiV1Z6Y0dGalpTSTZiblZzYkN3aWJtRnRaU0k2SW1OdmFXNGlmU3dpYlc5a2RXeGxTR0Z6YUNJNkluVjBYMHBmV2s1cmIzbGhVRlZGU21ocGQxWmxWMjVyVTFGdU9VcFVPWE5SUTFkTFpHcHFWbFp5VjI4aWZWMHNJbTFsZEdGRVlYUmhJanB1ZFd4c0xDSmpiMjUwYVc1MVlYUnBiMjRpT201MWJHd3NJblI0U1dRaU9qRXhOams1TkRaOSJ9LCJhbGdvcml0aG0iOiJTSEE1MTJ0XzI1NiIsIm9iamVjdCI6IkFBQUFFQUFBQUFBQUFBQUJBUGhpTkRUdEFHT0l4dWE4OTFYUGU0NVFRS2QtTFdOekNpc0JDeHlmeDliQ0FPUkRnUUR2RFRrWmdOTzZ2M1ZpbU1wZ2ZGd2kyQm1mZ29jRVdwVmxRRW9EQWVoT1JPeFdBckJidXpldnZLTUdQZTB1RlVfUE8yejM3VC0tY0thdDZ1d3pBVm9DbFVrU1lXaXRDODF0TERVd2JYYVFWRTdnZFp1ckN6d0RiZUlBdlpBcUFKVThWZHZkMS1nYmo2UEtIVXdWQm00UWRvNl9YUkpYdHdKTGE4a0N3OWJhQWQtbXRubnlsUkczOC1WcTZzZmlZWm0xd2tKejhZcU5ZT2gwbVZCTktFR1VBTkdQWlB4NGFhMWFDdTJ1Ty1VRkJXLWxLbFdFeFU0a2JjMkszOFZCT21ZeEFDakxpdjMwazdBaGdwVXBCWUIxcEYwWFRqTmU4d3k4aHQta2FveFFKbTZpQVlXSkFYZlpXZERNdkQ3Z1UydUItWFdTVUh3bVpvM3NzV0stRzh1OTIxempBTzllbVBkOFJRVk5jOWZWZWJHN0lMb2lqVDlYMm9Db1p2Q00xQ29yR3laUUFTLVVZd3c4dkJ1bEVVYXlxaHZEQUFreUthbHk1TXk1bzJYVXZpZlZsNkg5QUM5ZXZsczVxMXh2bGhQbE9UWnJZNVB2SDNFbDd3dTBZTTJQYmZzaE1lUGFBUFpZRFJoWncyXzBVM1hIZllQbmJ6QlQ4bkc3a2gtR09kRTBTcFFCNEVOQ0FVWGEzcGVoMnhVd2dCVHd5WFVvc3RDRjNqQ21Scm9ZRGlEUTVGTGhYNkVQQUdlMUF2cFhJazZFM2tpdnUxY1N4aVFYV0hUcW1pdEUwLTVYaVpjNU4zQ3ZBS1dMNmM1RDdQSV84aW0zbG04cWhtZl84UXp3d2ZFcVpXQXZoQ0dWc1VVdCIsImNoYWluIjoxfQ\"\n" + } + }, + "examples": { + "command": { + "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\"}" + }, + "command-result": { + "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" + } + ] + }, + "payload": { + "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" + } + } + }, + "x-tagGroups": [ + { + "name": "std-pact-api", + "x-displayName": "Standard Pact API", + "tags": [ + "endpoint-local", + "endpoint-send", + "endpoint-poll", + "endpoint-listen" + ] + }, + { + "name": "private-api", + "x-displayName": "Private Pact API", + "tags": [ + "endpoint-private" + ] + }, + { + "name": "spv-api", + "x-displayName": "SPV API", + "tags": [ + "endpoint-spv" + ] + }, + { + "name": "models", + "x-displayName": "Pact API models", + "tags": [ + "model-command", + "model-command-result", + "model-payload", + "model-pact-value" + ] + } + ], + "tags": [ + { + "name": "endpoint-local", + "x-displayName": "Non-transactional execution" + }, + { + "name": "endpoint-send", + "x-displayName": "Transactional batch execution" + }, + { + "name": "endpoint-poll", + "x-displayName": "Batch polling for results" + }, + { + "name": "endpoint-listen", + "x-displayName": "Blocking listen for single transaction result" + }, + { + "name": "endpoint-private", + "x-displayName": "Private transaction execution" + }, + { + "name": "endpoint-spv", + "x-displayName": "SPV proof creation for cross chain transaction" + }, + { + "name": "model-command", + "x-displayName": "Pact Commands", + "description": "\n" + }, + { + "name": "model-command-result", + "x-displayName": "Pact Command Results", + "description": "\n" + }, + { + "name": "model-payload", + "x-displayName": "Pact Command Payloads", + "description": "\n" + }, + { + "name": "model-pact-value", + "x-displayName": "Pact Values", + "description": "\n" + } + ] +} \ No newline at end of file diff --git a/packages/libs/chainweb-node-client/package.json b/packages/libs/chainweb-node-client/package.json index c49d794459..ff10566ac3 100644 --- a/packages/libs/chainweb-node-client/package.json +++ b/packages/libs/chainweb-node-client/package.json @@ -28,6 +28,8 @@ "_phase:build": "heft build --clean", "_phase:test": "heft test --no-build", "build": "heft build --clean", + "generate:openapi-types": "echo 'openapi specs needs fixes' # openapi-typescript \"./openapi/*.json\" --output ./src/openapi", + "postinstall": "npm run generate:openapi-types", "lint": "npx eslint ./src --ext .js,.ts --fix", "test": "rushx build && heft test --no-build" }, diff --git a/packages/libs/chainweb-node-client/src/tests/local.test.ts b/packages/libs/chainweb-node-client/src/tests/local.test.ts index 9247b169ba..363865216b 100644 --- a/packages/libs/chainweb-node-client/src/tests/local.test.ts +++ b/packages/libs/chainweb-node-client/src/tests/local.test.ts @@ -32,7 +32,7 @@ test('/local should return result of tx queried', async () => { const signedCommand1: LocalRequestBody = { cmd: commandStr1, hash: cmdWithOneSignature1.hash, - sigs: [{ sig: cmdWithOneSignature1.sig }], + sigs: [{ sig: cmdWithOneSignature1?.sig ?? null }], }; const commandResult1: LocalResponse = { diff --git a/packages/libs/chainweb-node-client/src/tests/send.test.ts b/packages/libs/chainweb-node-client/src/tests/send.test.ts index acf48f84cb..e78cec3c7b 100644 --- a/packages/libs/chainweb-node-client/src/tests/send.test.ts +++ b/packages/libs/chainweb-node-client/src/tests/send.test.ts @@ -27,7 +27,7 @@ test('/send should return request keys of txs submitted', async () => { const signedCommand1: ICommand = { cmd: commandStr, hash: cmdWithOneSignature1.hash, - sigs: [{ sig: cmdWithOneSignature1.sig }], + sigs: [{ sig: cmdWithOneSignature1?.sig ?? null }], }; const expectedRequestKey1 = signedCommand1.hash; diff --git a/packages/libs/client/etc/client.api.md b/packages/libs/client/etc/client.api.md index 0158353eca..78472ae8bf 100644 --- a/packages/libs/client/etc/client.api.md +++ b/packages/libs/client/etc/client.api.md @@ -22,26 +22,52 @@ export function buildCommandFromTemplate(parts: string[], holes: string[], args: // @internal (undocumented) export function buildUnsignedTransaction(parts: string[], holes: string[], args: Record): IPactCommand & ICommandBuilder<{}>; +// @alpha (undocumented) +export function convertIUnsignedTransactionToICommand(transaction: IUnsignedTransaction): ICommand; + // @alpha (undocumented) export function createPactCommandFromTemplate(tpl: IPactCommand): PactCommand; // @alpha (undocumented) -export interface IChainweaverQuickSignRequestBody { +export interface IChainweaverCap { // (undocumented) - reqs: IUnsignedTransaction[]; + args: Array>; + // (undocumented) + name: string; } // @alpha (undocumented) -export type IChainweaverSig = string; +export interface IChainweaverCapElement { + // (undocumented) + cap: IChainweaverCap; + // (undocumented) + description: string; + // (undocumented) + role: string; +} // @alpha (undocumented) -export interface IChainweaverSignedCommand { +export interface IChainweaverSignBody { // (undocumented) - cmd: string; + caps: IChainweaverCapElement[]; // (undocumented) - sigs: { - [pubkey: string]: IChainweaverSig; - }; + chainId: string; + // (undocumented) + code: string; + // (undocumented) + data: Record; + // (undocumented) + gasLimit: number; + // (undocumented) + gasPrice: number; + // (undocumented) + networkId: string; + // (undocumented) + sender: string; + // (undocumented) + signingPubKey: string; + // (undocumented) + ttl: number; } // @alpha (undocumented) @@ -52,11 +78,11 @@ export interface ICommandBuilder, TArgs exte addData: (data: IPactCommand['data']) => ICommandBuilder & IPactCommand; // (undocumented) addSignatures(...sig: { - pubkey: string; + pubKey: string; sig: string; }[]): ICommandBuilder & IPactCommand; // (undocumented) - createCommand(): ICommand; + createCommand(): IUnsignedTransaction; // (undocumented) local(apiHost: string): Promise; // (undocumented) @@ -125,6 +151,64 @@ export interface IPublicMeta { ttl: number; } +// @alpha (undocumented) +export interface IQuickSignRequestBody { + // (undocumented) + cmdSigDatas: IUnsignedQuicksignTransaction[]; +} + +// @alpha (undocumented) +export type IQuicksignResponse = IQuicksignResponseError | IQuicksignResponseOutcomes; + +// @alpha (undocumented) +export interface IQuicksignResponseCommand { + // (undocumented) + cmd: string; + // (undocumented) + sigs: IQuicksignSigner[]; +} + +// @alpha (undocumented) +export interface IQuicksignResponseError { + // (undocumented) + error: { + type: 'reject'; + } | { + type: 'emptyList'; + } | { + type: 'other'; + msg: string; + }; +} + +// @alpha (undocumented) +export interface IQuicksignResponseOutcomes { + // (undocumented) + responses: { + commandSigData: IQuicksignResponseCommand; + outcome: { + hash: string; + result: 'success'; + } | { + msg: string; + result: 'failure'; + } | { + result: 'noSig'; + }; + }[]; +} + +// @alpha (undocumented) +export type IQuicksignSig = string | null; + +// @alpha (undocumented) +export interface IQuicksignSigner { + // (undocumented) + pubKey: string; + // (undocumented) + sig: IQuicksignSig; +} + // @alpha (undocumented) export interface ITemplate { // (undocumented) @@ -133,6 +217,14 @@ export interface ITemplate { parts: TemplateParts; } +// @alpha (undocumented) +export interface IUnsignedQuicksignTransaction { + // (undocumented) + cmd: string; + // (undocumented) + sigs: IQuicksignSigner[]; +} + // @alpha (undocumented) export interface IUnsignedTransaction { // (undocumented) @@ -140,9 +232,7 @@ export interface IUnsignedTransaction { // (undocumented) hash: string; // (undocumented) - sigs: { - [pubkey: string]: string | null; - }; + sigs: (ISignature | undefined)[]; } // @alpha (undocumented) @@ -162,14 +252,14 @@ export class PactCommand implements IPactCommand, ICommandBuilder; local(apiHost: string): Promise; diff --git a/packages/libs/client/src/index.ts b/packages/libs/client/src/index.ts index 3d4866500e..c88ed053aa 100644 --- a/packages/libs/client/src/index.ts +++ b/packages/libs/client/src/index.ts @@ -3,7 +3,8 @@ */ export * from './pact'; export * from './signing/signWithChainweaver'; -export * from './interfaces/IUnsignedTransaction'; +export * from './signing-api/v1/quicksign'; +export * from './signing-api/v1/sign'; export * from './interfaces/IPactCommand'; export * from './buildCommandFromTemplate'; export * from './buildUnsignedTransaction'; diff --git a/packages/libs/client/src/interfaces/IPactCommand.ts b/packages/libs/client/src/interfaces/IPactCommand.ts index 5fe2ce7202..117a3f8f9c 100644 --- a/packages/libs/client/src/interfaces/IPactCommand.ts +++ b/packages/libs/client/src/interfaces/IPactCommand.ts @@ -30,3 +30,12 @@ export interface IPublicMeta { gasPrice: number; ttl: number; } + +/** + * @alpha + */ +export interface IUnsignedTransaction { + hash: string; + sigs: (ISignature | undefined)[]; + cmd: string; +} diff --git a/packages/libs/client/src/interfaces/IUnsignedTransaction.ts b/packages/libs/client/src/interfaces/IUnsignedTransaction.ts deleted file mode 100644 index d8af2579ff..0000000000 --- a/packages/libs/client/src/interfaces/IUnsignedTransaction.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @alpha - */ -export interface IUnsignedTransaction { - hash: string; - // eslint-disable-next-line @rushstack/no-new-null - sigs: { [pubkey: string]: string | null }; - cmd: string; -} diff --git a/packages/libs/client/src/pact.ts b/packages/libs/client/src/pact.ts index e9295dd076..ea22ed512c 100644 --- a/packages/libs/client/src/pact.ts +++ b/packages/libs/client/src/pact.ts @@ -13,7 +13,7 @@ import { PactValue, } from '@kadena/types'; -import { IPactCommand } from './interfaces/IPactCommand'; +import { IPactCommand, IUnsignedTransaction } from './interfaces/IPactCommand'; import { parseType } from './utils/parseType'; import debug, { Debugger } from 'debug'; @@ -27,7 +27,7 @@ export interface ICommandBuilder< TCaps extends Record, TArgs extends Array = TCaps[keyof TCaps], > { - createCommand(): ICommand; + createCommand(): IUnsignedTransaction; addData: ( data: IPactCommand['data'], ) => ICommandBuilder & IPactCommand; @@ -58,7 +58,7 @@ export interface ICommandBuilder< poll(apiHost: string): Promise; addSignatures( ...sig: { - pubkey: string; + pubKey: string; sig: string; }[] ): ICommandBuilder & IPactCommand; @@ -188,7 +188,7 @@ export class PactCommand * @returns a command that can be send to the blockchain * (see https://api.chainweb.com/openapi/pact.html#tag/endpoint-send/paths/~1send/post) */ - public createCommand(): ICommand { + public createCommand(): IUnsignedTransaction { const dateInMs: number = Date.now(); // convert to IUnsignedTransactionCommand @@ -217,10 +217,10 @@ export class PactCommand // hash command const hash = blakeHash(cmd); - // convert to IUnsignedTransaction - const command: ICommand = { + // TODO: convert to IUnsignedTransaction + const command: IUnsignedTransaction = { hash, - sigs: this.sigs.map((s) => (s === undefined ? { sig: '' } : s)), + sigs: this.sigs, cmd, }; @@ -296,7 +296,10 @@ export class PactCommand public local(apiHost: string): Promise { log(`calling local with: ${JSON.stringify(this.createCommand(), null, 2)}`); - return local(this.createCommand(), apiHost); + return local( + convertIUnsignedTransactionToICommand(this.createCommand()), + apiHost, + ); } /** @@ -331,7 +334,9 @@ export class PactCommand interval = 5000, timeout = 1000 * 60 * 3, onPoll = () => {}, - } = { ...options }; + } = { + ...options, + }; const endTime = Date.now() + timeout; this.status = 'pending'; @@ -380,7 +385,10 @@ export class PactCommand * @alpha */ public async send(apiHost: string): Promise { - const sendResponse = await send({ cmds: [this.createCommand()] }, apiHost); + const sendResponse = await send( + { cmds: [convertIUnsignedTransactionToICommand(this.createCommand())] }, + apiHost, + ); this.requestKey = sendResponse.requestKeys[0].toString(); return sendResponse; } @@ -396,10 +404,10 @@ export class PactCommand return poll({ requestKeys: [this.requestKey] }, apiHost); } - public addSignatures(...sigs: { pubkey: string; sig: string }[]): this { - sigs.forEach(({ pubkey, sig }) => { + public addSignatures(...sigs: { pubKey: string; sig: string }[]): this { + sigs.forEach(({ pubKey, sig }) => { const foundSignerIndex = this.signers.findIndex( - ({ pubKey }) => pubKey === pubkey, + (signer) => signer.pubKey === pubKey, ); if (foundSignerIndex === -1) { throw new Error('Cannot add signature, public key not present'); @@ -420,6 +428,18 @@ export class PactCommand // } } +/** + * @alpha + */ +export function convertIUnsignedTransactionToICommand( + transaction: IUnsignedTransaction, +): ICommand { + return { + ...transaction, + sigs: transaction.sigs.map((s) => ({ sig: s?.sig ?? null })), + }; +} + /** * @alpha */ diff --git a/packages/libs/client/src/signing-api/README.md b/packages/libs/client/src/signing-api/README.md new file mode 100644 index 0000000000..0dbc8f88e6 --- /dev/null +++ b/packages/libs/client/src/signing-api/README.md @@ -0,0 +1,4 @@ +# Signing Api + +- Documentation: https://kadena-io.github.io/signing-api/ +- Source: https://github.com/kadena-io/signing-api diff --git a/packages/libs/client/src/signing-api/v1/quicksign.ts b/packages/libs/client/src/signing-api/v1/quicksign.ts new file mode 100644 index 0000000000..c8e41d6e45 --- /dev/null +++ b/packages/libs/client/src/signing-api/v1/quicksign.ts @@ -0,0 +1,81 @@ +/** + * @alpha + */ +export interface IQuickSignRequestBody { + cmdSigDatas: IUnsignedQuicksignTransaction[]; +} + +/** + * @alpha + */ +export interface IQuicksignSigner { + pubKey: string; + sig: IQuicksignSig; +} + +/** + * @alpha + */ +export interface IUnsignedQuicksignTransaction { + sigs: IQuicksignSigner[]; + cmd: string; +} + +/** + * @alpha + */ +// eslint-disable-next-line @rushstack/no-new-null +export type IQuicksignSig = string | null; + +/** + * @alpha + */ +export type IQuicksignResponse = + | IQuicksignResponseError + | IQuicksignResponseOutcomes; + +/** + * @alpha + */ +export interface IQuicksignResponseOutcomes { + responses: { + commandSigData: IQuicksignResponseCommand; + outcome: + | { + hash: string; + result: 'success'; + } + | { + msg: string; + result: 'failure'; + } + | { + result: 'noSig'; + }; + }[]; +} + +/** + * @alpha + */ +export interface IQuicksignResponseError { + error: + | { + type: 'reject'; + } + | { + type: 'emptyList'; + } + | { + type: 'other'; + msg: string; + }; +} + +/** + * @alpha + */ +export interface IQuicksignResponseCommand { + sigs: IQuicksignSigner[]; + cmd: string; +} diff --git a/packages/libs/client/src/chainweaver-api/v1/sign.ts b/packages/libs/client/src/signing-api/v1/sign.ts similarity index 89% rename from packages/libs/client/src/chainweaver-api/v1/sign.ts rename to packages/libs/client/src/signing-api/v1/sign.ts index ecdbf5678f..d38eb72fa5 100644 --- a/packages/libs/client/src/chainweaver-api/v1/sign.ts +++ b/packages/libs/client/src/signing-api/v1/sign.ts @@ -1,3 +1,6 @@ +/** + * @alpha + */ export interface IChainweaverSignBody { code: string; caps: IChainweaverCapElement[]; @@ -11,12 +14,18 @@ export interface IChainweaverSignBody { networkId: string; } +/** + * @alpha + */ export interface IChainweaverCapElement { role: string; description: string; cap: IChainweaverCap; } +/** + * @alpha + */ export interface IChainweaverCap { name: string; args: Array>; diff --git a/packages/libs/client/src/signing/signWithChainweaver.ts b/packages/libs/client/src/signing/signWithChainweaver.ts index 44bd5641af..84d8caa2d0 100644 --- a/packages/libs/client/src/signing/signWithChainweaver.ts +++ b/packages/libs/client/src/signing/signWithChainweaver.ts @@ -1,31 +1,15 @@ import { IPactCommand } from '../interfaces/IPactCommand'; -import { IUnsignedTransaction } from '../interfaces/IUnsignedTransaction'; import { ICommandBuilder } from '../pact'; +import { + IQuickSignRequestBody, + IQuicksignResponse, + IQuicksignSigner, +} from '../signing-api/v1/quicksign'; import fetch from 'cross-fetch'; import type { Debugger } from 'debug'; import _debug from 'debug'; -/** - * @alpha - */ -export type IChainweaverSig = string; - -/** - * @alpha - */ -export interface IChainweaverSignedCommand { - sigs: { [pubkey: string]: IChainweaverSig }; - cmd: string; -} - -/** - * @alpha - */ -export interface IChainweaverQuickSignRequestBody { - reqs: IUnsignedTransaction[]; -} - const debug: Debugger = _debug('pactjs:signWithChainweaver'); /** @@ -34,25 +18,26 @@ const debug: Debugger = _debug('pactjs:signWithChainweaver'); export async function signWithChainweaver( ...transactions: (IPactCommand & ICommandBuilder>)[] ): Promise<(IPactCommand & ICommandBuilder>)[]> { - const quickSignRequest: IChainweaverQuickSignRequestBody = { - reqs: transactions.map((t) => { + const quickSignRequest: IQuickSignRequestBody = { + cmdSigDatas: transactions.map((t) => { const command = t.createCommand(); return { cmd: command.cmd, - hash: command.hash, - sigs: t.signers.reduce((sigsObject, signer, i) => { - const sig = t.sigs[i]?.sig; - sigsObject[signer.pubKey] = sig === undefined ? null : sig; - return sigsObject; - }, {} as Record), + sigs: t.signers.map((signer, i) => { + return { + pubKey: signer.pubKey, + sig: t.sigs[i]?.sig ?? null, + }; + }), }; }), }; + const body: string = JSON.stringify(quickSignRequest); debug('calling sign api:', body); - const response = await fetch('http://127.0.0.1:9467/v1/quickSign', { + const response = await fetch('http://127.0.0.1:9467/v1/quicksign', { method: 'POST', body, headers: { 'Content-Type': 'application/json;charset=utf-8' }, @@ -62,32 +47,38 @@ export async function signWithChainweaver( // response is not JSON when not-ok, that's why we use try-catch try { - const result = JSON.parse(bodyText) as { - results: IChainweaverSignedCommand[]; - }; - result.results.map((signedCommand, i) => { + const result = JSON.parse(bodyText) as IQuicksignResponse; + + if ('error' in result) { + throw new Error(); + } + + result.responses.map((signedCommand, i) => { transactions[i].addSignatures( - ...Object.keys(signedCommand.sigs).reduce( - (sigs, pubkey) => { - const sig = signedCommand.sigs[pubkey]; - sigs.push({ pubkey, sig }); - return sigs; - }, - [] as { - pubkey: string; - sig: string; - }[], - ), + ...signedCommand.commandSigData.sigs.filter(isASigner), ); }); + return transactions; } catch (error) { throw new Error( 'An error occurred when adding signatures to the command' + - `\nResponse from v1/quickSign was \`${bodyText}\`. ` + + `\nResponse from v1/quicksign was \`${bodyText}\`. ` + `\nCode: \`${response.status}\`` + `\nText: \`${response.statusText}\` ` + `${error}`, ); } } + +function isASigner(signer: IQuicksignSigner): signer is { + pubKey: string; + sig: string; +} { + return ( + 'pubKey' in signer && + 'sig' in signer && + signer.sig !== null && + signer.pubKey.length > 0 + ); +} diff --git a/packages/libs/client/src/signing/tests/signWithChainweaver.test.ts b/packages/libs/client/src/signing/tests/signWithChainweaver.test.ts index e09d2766d6..e2236bf59c 100644 --- a/packages/libs/client/src/signing/tests/signWithChainweaver.test.ts +++ b/packages/libs/client/src/signing/tests/signWithChainweaver.test.ts @@ -4,22 +4,24 @@ jest.mock('cross-fetch', () => { default: jest.fn(), }; }); + import { IPactCommand } from '../../interfaces/IPactCommand'; import { ICommandBuilder, Pact } from '../../pact'; import { - IChainweaverSignedCommand, - signWithChainweaver, -} from '../signWithChainweaver'; + IQuicksignResponse, + IQuicksignResponseOutcomes, +} from '../../signing-api/v1/quicksign'; +import { signWithChainweaver } from '../signWithChainweaver'; import fetch from 'cross-fetch'; describe('signWithChainweaver', () => { jest.setTimeout(1000); - it('makes a call on 127.0.0.1:9467/v1/quickSign with transaction', async () => { + it('makes a call on 127.0.0.1:9467/v1/quicksign with transaction', async () => { (fetch as jest.Mock).mockResolvedValue({ status: 200, - text: () => JSON.stringify({ results: [] }), + text: () => JSON.stringify({ responses: [] } as IQuicksignResponse), json: () => {}, }); @@ -33,19 +35,18 @@ describe('signWithChainweaver', () => { IPactCommand ).addCap('GAS', 'signer-key'); - const { cmd, hash } = unsignedCommand.createCommand(); - const sigs = unsignedCommand.sigs.reduce((sigs, sig, i) => { - const pubkey = unsignedCommand.signers[i].pubKey; - sigs[pubkey] = - sig === undefined ? null : sig.sig === undefined ? null : sig.sig; - return sigs; - // eslint-disable-next-line @rushstack/no-new-null - }, {} as { [pubkey: string]: string | null }); + const { cmd } = unsignedCommand.createCommand(); + const sigs = unsignedCommand.sigs.map((sig, i) => { + return { + pubKey: unsignedCommand.signers[i].pubKey, + sig: sig || null, + }; + }); - const body = JSON.stringify({ reqs: [{ cmd, hash, sigs }] }); + const body = JSON.stringify({ cmdSigDatas: [{ cmd, sigs }] }); await signWithChainweaver(unsignedCommand); - expect(fetch).toBeCalledWith('http://127.0.0.1:9467/v1/quickSign', { + expect(fetch).toBeCalledWith('http://127.0.0.1:9467/v1/quicksign', { body, headers: { 'Content-Type': 'application/json;charset=utf-8' }, method: 'POST', @@ -80,8 +81,19 @@ describe('signWithChainweaver', () => { }); it('adds signatures in multisig fashion to the transactions', async () => { - const mockedResponse: { results: IChainweaverSignedCommand[] } = { - results: [{ cmd: '', sigs: { 'gas-signer-pubkey': 'gas-key-sig' } }], + const mockedResponse: IQuicksignResponseOutcomes = { + responses: [ + { + commandSigData: { + cmd: '', + sigs: [{ pubKey: 'gas-signer-pubkey', sig: 'gas-key-sig' }], + }, + outcome: { + hash: '', + result: 'success', + }, + }, + ], }; (fetch as jest.Mock).mockResolvedValue({ status: 200, @@ -106,9 +118,20 @@ describe('signWithChainweaver', () => { expect(unsignedCommand.sigs).toEqual([{ sig: 'gas-key-sig' }, undefined]); // set a new mock response for the second signature - const mockedResponse2: { results: IChainweaverSignedCommand[] } = { - results: [ - { cmd: '', sigs: { 'transfer-signer-pubkey': 'transfer-key-sig' } }, + const mockedResponse2: IQuicksignResponseOutcomes = { + responses: [ + { + commandSigData: { + cmd: '', + sigs: [ + { pubKey: 'transfer-signer-pubkey', sig: 'transfer-key-sig' }, + ], + }, + outcome: { + hash: '', + result: 'success', + }, + }, ], }; (fetch as jest.Mock).mockResolvedValue({ @@ -122,4 +145,37 @@ describe('signWithChainweaver', () => { { sig: 'transfer-key-sig' }, ]); }); + + it('signs but does not have the signer key and returns sig null', async () => { + const mockedResponse: IQuicksignResponseOutcomes = { + responses: [ + { + commandSigData: { + cmd: '', + sigs: [{ pubKey: 'gas-signer-pubkey', sig: null }], + }, + outcome: { result: 'noSig' }, + }, + ], + }; + + (fetch as jest.Mock).mockResolvedValue({ + status: 200, + text: () => JSON.stringify(mockedResponse), + }); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const pactModule = Pact.modules as any; + + const unsignedCommand = ( + pactModule.coin.transfer('k:from') as ICommandBuilder<{ + GAS: []; + }> & + IPactCommand + ).addCap('GAS', 'gas-signer-pubkey'); + + await signWithChainweaver(unsignedCommand); + + expect(unsignedCommand.sigs).toEqual([undefined]); + }); }); diff --git a/packages/libs/client/src/tests/pact.test.ts b/packages/libs/client/src/tests/pact.test.ts index fcda0643a0..c6349bcab0 100644 --- a/packages/libs/client/src/tests/pact.test.ts +++ b/packages/libs/client/src/tests/pact.test.ts @@ -6,8 +6,12 @@ jest.mock('cross-fetch', () => { }); import { PactNumber } from '@kadena/pactjs'; -import { IUnsignedTransaction } from '../interfaces/IUnsignedTransaction'; -import { ICommandBuilder, Pact, PactCommand } from '../pact'; +import { IUnsignedTransaction } from '../interfaces/IPactCommand'; +import { + convertIUnsignedTransactionToICommand, + Pact, + PactCommand, +} from '../pact'; import fetch from 'cross-fetch'; @@ -152,19 +156,18 @@ describe('Pact proxy', () => { json: () => {}, }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: '1.234' }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; + builder + .addCap('coin.GAS', 'senderPubKey') + .addSignatures({ pubKey: 'senderPubKey', sig: 'sender-sig' }); + await builder.local('fake-api-host.local.co'); const body = builder.createCommand(); expect(fetch).toBeCalledWith('fake-api-host.local.co/api/v1/local', { - body: JSON.stringify(body), + body: JSON.stringify(convertIUnsignedTransactionToICommand(body)), headers: { 'Content-Type': 'application/json' }, method: 'POST', }); @@ -178,13 +181,8 @@ describe('Pact proxy', () => { json: () => ({ requestKeys: ['key1'] }), }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: '1.234' }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; await builder.send('fake-api-host.local.co'); const body = { cmds: [builder.createCommand()] }; @@ -204,13 +202,8 @@ describe('Pact proxy', () => { json: () => ({ requestKeys: ['key1'] }), }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: '1.234' }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; const { requestKeys } = await builder.send('fake-api-host.local.co'); const body = { cmds: [builder.createCommand()] }; @@ -237,13 +230,8 @@ describe('Pact proxy', () => { json: () => ({ requestKeys: ['key1'] }), }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: '1.234' }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; expect(() => builder.poll('fake-api-host.local.co')).toThrow(); }); @@ -256,13 +244,8 @@ describe('Pact proxy', () => { json: () => ({ requestKeys: ['key1'] }), }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: '1.234' }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; let expectingError; @@ -278,13 +261,8 @@ describe('Pact proxy', () => { it('returns a response after polling a succeeding transaction', async () => { jest.useFakeTimers(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: 1.234 }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; (fetch as jest.Mock).mockResolvedValue({ status: 200, @@ -330,13 +308,8 @@ describe('Pact proxy', () => { it('rejects the promise for pollUntil if the transaction failed', async () => { jest.useFakeTimers(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: 1.234 }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; (fetch as jest.Mock).mockResolvedValue({ status: 200, @@ -381,13 +354,8 @@ describe('Pact proxy', () => { json: () => ({ requestKeys: ['key1'] }), }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const pact = Pact as any; - const builder: ICommandBuilder<{}> = pact.modules.coin.transfer( - 'from', - 'to', - { decimal: 1.234 }, - ); + const builder = new PactCommand(); + builder.code = '(coin.transfer "from" "to" 1.234)'; await builder.send('fake-api-host.local.co'); @@ -416,6 +384,8 @@ describe('Pact proxy', () => { }); }); +//TODO: Add timeout test case + describe('TransactionCommand', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const pact = Pact as any; @@ -508,4 +478,35 @@ describe('TransactionCommand', () => { expect(transaction.cmd).not.toEqual(updatedTransaction.cmd); expect(transaction.hash).not.toEqual(updatedTransaction.hash); }); + + it('adds formatted signatures to `sigs` when `addSignatures` is called', async () => { + const transaction = transactionCommand + .addCap('coin.GAS', senderPubKey) + .createCommand(); + + const updatedTransaction = transactionCommand + .addCap('coin.GAS', senderPubKey) + .addSignatures({ + pubKey: senderPubKey, + sig: 'sender-sig', + }) + .createCommand(); + + expect(transaction.sigs).toEqual([undefined]); + expect(updatedTransaction.sigs).toEqual([{ sig: 'sender-sig' }]); + }); + + it('throws error when `addSignatures` is called without signer', async () => { + expect(() => { + transactionCommand = pact.modules.coin['transfer-create']( + sender, + receiver, + () => "(read-keyset 'ks)", + amount, + ).addSignatures({ + pubKey: senderPubKey, + sig: 'sender-sig', + }); + }).toThrow(); + }); }); diff --git a/packages/libs/kadena.js/src/api/pullSignature.ts b/packages/libs/kadena.js/src/api/pullSignature.ts index 079df6b5c4..d983649ff7 100644 --- a/packages/libs/kadena.js/src/api/pullSignature.ts +++ b/packages/libs/kadena.js/src/api/pullSignature.ts @@ -1,5 +1,5 @@ -import type { ISignature, SignatureWithHash } from '@kadena/types'; +import type { ISignatureJson, SignatureWithHash } from '@kadena/types'; -export function pullSignature({ sig }: SignatureWithHash): ISignature { - return { sig: sig }; +export function pullSignature({ sig }: SignatureWithHash): ISignatureJson { + return { sig: sig ?? null }; } diff --git a/packages/libs/pactjs-test-project/src/example-templates/generated-tx-templates/index.ts b/packages/libs/pactjs-test-project/src/example-templates/generated-tx-templates/index.ts index c68d5370b0..e6239260b1 100644 --- a/packages/libs/pactjs-test-project/src/example-templates/generated-tx-templates/index.ts +++ b/packages/libs/pactjs-test-project/src/example-templates/generated-tx-templates/index.ts @@ -112,4 +112,4 @@ export default { return buildUnsignedTransaction(parts, holes, args); } -} \ No newline at end of file +} diff --git a/packages/libs/types/etc/types.api.md b/packages/libs/types/etc/types.api.md index b3b5c79841..9686ba1134 100644 --- a/packages/libs/types/etc/types.api.md +++ b/packages/libs/types/etc/types.api.md @@ -40,7 +40,7 @@ export interface ICommand { // (undocumented) hash: PactTransactionHash; // (undocumented) - sigs: Array; + sigs: Array; } // @alpha @@ -213,6 +213,12 @@ export interface ISignature { sig: string | undefined; } +// @alpha (undocumented) +export interface ISignatureJson { + // (undocumented) + sig: string | null; +} + // @alpha (undocumented) export interface ISignedCommand { // (undocumented) diff --git a/packages/libs/types/src/PactAPI.ts b/packages/libs/types/src/PactAPI.ts index a39d974a63..f1c6deae89 100644 --- a/packages/libs/types/src/PactAPI.ts +++ b/packages/libs/types/src/PactAPI.ts @@ -35,10 +35,12 @@ export interface ISendRequestBody { * @alpha */ export type SendResponse = IRequestKeys; + /** * @alpha */ export type LocalRequestBody = ICommand; + /** * @alpha */ diff --git a/packages/libs/types/src/PactCommand.ts b/packages/libs/types/src/PactCommand.ts index 24f5401091..767e77fe0f 100644 --- a/packages/libs/types/src/PactCommand.ts +++ b/packages/libs/types/src/PactCommand.ts @@ -1,7 +1,6 @@ import type { Base16String } from './Base16String'; import type { IBase64Url } from './Base64Url'; import type { PactValue } from './PactValue'; -import type { ISignature } from './SignCommand'; /** * A Chainweb transaction payload that executes arbitraty Pact code. * @@ -212,7 +211,15 @@ export interface IUserSig { export interface ICommand { cmd: CommandPayloadStringifiedJSON; hash: PactTransactionHash; - sigs: Array; + sigs: Array; +} + +/** + * @alpha + */ +export interface ISignatureJson { + // eslint-disable-next-line @rushstack/no-new-null + sig: string | null; } /**