{"components":{"responses":{"Error":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Request failed; error gives the reason"}},"schemas":{"Admission":{"properties":{"deferred":{"description":"Held in the deferred set rather than the pool","type":"boolean"},"expires":{"description":"Dropped after this time if no canonical block includes it","minimum":0,"type":"integer"},"id":{"$ref":"#/components/schemas/Hash"},"known":{"description":"Already present in this node's pool or deferred set","type":"boolean"},"not_before":{"minimum":0,"type":"integer"}},"required":["id","known"],"type":"object"},"Block":{"properties":{"bytes":{"minimum":302,"type":"integer"},"canonical":{"type":"boolean"},"height":{"minimum":1,"type":"integer"},"id":{"$ref":"#/components/schemas/Hash"},"nonce":{"pattern":"^[0-9]+$","type":"string"},"parent":{"$ref":"#/components/schemas/Hash"},"producer_hash":{"$ref":"#/components/schemas/Hash"},"producer_hex":{"description":"Miner-selected producer data carried in the body","pattern":"^([0-9a-f]{2})*$","type":"string"},"receipts":{"items":{"$ref":"#/components/schemas/Receipt"},"type":"array"},"receipts_root":{"$ref":"#/components/schemas/Hash"},"state_root":{"$ref":"#/components/schemas/Hash"},"target":{"$ref":"#/components/schemas/Hash"},"timestamp":{"description":"Unix timestamp in seconds","minimum":0,"type":"integer"},"transactions":{"items":{"$ref":"#/components/schemas/Hash"},"type":"array"},"transactions_root":{"$ref":"#/components/schemas/Hash"},"used":{"$ref":"#/components/schemas/Resources"},"votes":{"description":"C/S/D/G: 0 hold, 1 increase, 2 decrease","items":{"enum":[0,1,2],"type":"integer"},"maxItems":4,"minItems":4,"type":"array"},"work":{"description":"Accumulated work through this block","pattern":"^[0-9]+$","type":"string"}},"required":["id","height","parent","timestamp","canonical","transactions","receipts","used","state_root"],"type":"object"},"BlockPage":{"properties":{"from":{"type":"integer"},"items":{"items":{"$ref":"#/components/schemas/Block"},"type":"array"},"next":{"type":"integer"},"tip":{"$ref":"#/components/schemas/Hash"}},"required":["items","from","next","tip"],"type":"object"},"Deferred":{"properties":{"admitted":{"description":"Executed successfully on the tip and now in the pool, awaiting a block","type":"boolean"},"expires":{"minimum":0,"type":"integer"},"last_attempt":{"minimum":0,"type":["integer","null"]},"last_result":{"description":"Receipt status of the last failed execution on the tip; null when it succeeded or was never tried","type":["string","null"]},"not_before":{"minimum":0,"type":"integer"}},"required":["not_before","expires","admitted"],"type":"object"},"Envelope":{"properties":{"hex":{"anyOf":[{"pattern":"^([0-9a-f]{2})*$","type":"string"},{"type":"null"}],"description":"The canonical envelope in hex; null for one larger than 1 MiB, which is read from its block in slices"},"transaction":{"$ref":"#/components/schemas/EnvelopeSummary"}},"required":["hex","transaction"],"type":"object"},"EnvelopeSummary":{"properties":{"budget":{"$ref":"#/components/schemas/Resources"},"code_bytes":{"description":"Original deployment code length; null for calls","minimum":0,"type":["integer","null"]},"encoded_bytes":{"minimum":42,"type":"integer"},"input_bytes":{"minimum":0,"type":"integer"},"kind":{"enum":["call","deploy"],"type":"string"},"target":{"description":"Call target; null for deployment","pattern":"^[0-9a-f]{64}$","type":["string","null"]}},"required":["kind","target","input_bytes","code_bytes","budget","encoded_bytes"],"type":"object"},"Error":{"properties":{"error":{"type":"string"}},"required":["error"],"type":"object"},"Event":{"properties":{"contract":{"$ref":"#/components/schemas/Hash"},"payload_hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"}},"required":["contract","payload_hex"],"type":"object"},"EventPage":{"properties":{"from":{"type":"integer"},"items":{"items":{"properties":{"block":{"$ref":"#/components/schemas/Hash"},"events":{"items":{"$ref":"#/components/schemas/IndexedEvent"},"type":"array"},"height":{"type":"integer"},"timestamp":{"minimum":0,"type":"integer"}},"required":["height","block","timestamp","events"],"type":"object"},"type":"array"},"next":{"type":"integer"},"tip":{"$ref":"#/components/schemas/Hash"}},"required":["items","from","next","tip"],"type":"object"},"Hash":{"description":"32 bytes encoded as lowercase hexadecimal","pattern":"^[0-9a-f]{64}$","type":"string"},"Health":{"properties":{"height":{"minimum":0,"type":"integer"},"ready":{"type":"boolean"},"tip":{"$ref":"#/components/schemas/Hash"}},"required":["ready","height","tip"],"type":"object"},"IndexedEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"properties":{"transaction":{"$ref":"#/components/schemas/Hash"},"transaction_index":{"minimum":0,"type":"integer"}},"required":["transaction_index","transaction"],"type":"object"}]},"Manifest":{"properties":{"code_bytes":{"minimum":1,"type":"integer"},"code_hash":{"$ref":"#/components/schemas/Hash"},"id":{"$ref":"#/components/schemas/Hash"},"state_root":{"$ref":"#/components/schemas/Hash"}},"required":["id","code_hash","code_bytes","state_root"],"type":"object"},"Mempool":{"properties":{"bytes":{"minimum":0,"type":"integer"},"deferred":{"description":"Transactions held until due, not yet in the pool or awaiting a block","items":{"$ref":"#/components/schemas/PoolEntry"},"type":"array"},"items":{"items":{"$ref":"#/components/schemas/PoolEntry"},"type":"array"}},"required":["items","bytes","deferred"],"type":"object"},"Occurrence":{"properties":{"block":{"$ref":"#/components/schemas/Hash"},"height":{"minimum":1,"type":"integer"},"hex":{"anyOf":[{"pattern":"^([0-9a-f]{2})*$","type":"string"},{"type":"null"}],"description":"The canonical envelope in hex; null for one larger than 1 MiB, which is read from its block in slices"},"index":{"minimum":0,"type":"integer"},"receipt":{"$ref":"#/components/schemas/Receipt"},"transaction":{"$ref":"#/components/schemas/EnvelopeSummary"}},"required":["block","height","index","receipt","hex","transaction"],"type":"object"},"PoolEntry":{"properties":{"budget":{"$ref":"#/components/schemas/Resources"},"bytes":{"minimum":0,"type":"integer"},"deferred":{"anyOf":[{"$ref":"#/components/schemas/Deferred"},{"type":"null"}]},"id":{"$ref":"#/components/schemas/Hash"}},"required":["id","bytes","budget"],"type":"object"},"RawBlock":{"additionalProperties":false,"properties":{"hex":{"description":"Canonical block bytes from offset, as lowercase hex: the whole block, or the requested slice","pattern":"^([0-9a-f]{2})*$","type":"string"},"offset":{"description":"Position of the first byte returned","minimum":0,"type":"integer"},"total":{"description":"Length of the whole block in bytes","minimum":0,"type":"integer"}},"required":["hex","offset","total"],"type":"object"},"Receipt":{"properties":{"events":{"items":{"$ref":"#/components/schemas/Event"},"type":"array"},"result_hex":{"pattern":"^([0-9a-f]{2})*$","type":"string"},"status":{"maximum":11,"minimum":0,"type":"integer"},"status_name":{"enum":["Success","Revert","Trap","Compute","Access","Data","Growth","Structure","Missing","InvalidModule","Exists","ReadOnly"],"type":"string"},"transaction":{"$ref":"#/components/schemas/Hash"},"used":{"$ref":"#/components/schemas/Resources"}},"required":["transaction","status","status_name","used","result_hex","events"],"type":"object"},"Resources":{"description":"[C compute, S state accesses, D data, G gross allocation]","items":{"format":"uint64","minimum":0,"type":"integer"},"maxItems":4,"minItems":4,"type":"array"},"Status":{"properties":{"chain_id":{"$ref":"#/components/schemas/Hash"},"deferred_count":{"minimum":0,"type":"integer"},"genesis":{"$ref":"#/components/schemas/Hash"},"height":{"minimum":0,"type":"integer"},"held_headers":{"description":"Block index entries held in memory","minimum":0,"type":"integer"},"limits":{"$ref":"#/components/schemas/Resources"},"mempool_bytes":{"minimum":0,"type":"integer"},"mempool_count":{"minimum":0,"type":"integer"},"name":{"type":"string"},"network":{"description":"The production network, a development chain, or another network, by the genesis","enum":["production","development","other"]},"producer_hex":{"description":"Producer data of the blocks this node builds","pattern":"^([0-9a-f]{2})*$","type":"string"},"resource_order":{"const":["C","S","D","G"],"items":{"type":"string"},"type":"array"},"settled_height":{"description":"Canonical blocks at or below this height are settled: the block index reads them from storage","minimum":0,"type":"integer"},"state_records":{"minimum":0,"type":"integer"},"state_root":{"$ref":"#/components/schemas/Hash"},"stored_blocks":{"minimum":0,"type":"integer"},"tip":{"$ref":"#/components/schemas/Hash"},"uptime_seconds":{"minimum":0,"type":"integer"},"version":{"type":"string"},"work":{"description":"Accumulated branch work, an exact decimal integer","pattern":"^[0-9]+$","type":"string"}},"required":["chain_id","genesis","height","tip","work","state_root","limits","mempool_count"],"type":"object"},"Storage":{"properties":{"contract":{"$ref":"#/components/schemas/Hash"},"key":{"$ref":"#/components/schemas/Hash"},"proof":{"$ref":"#/components/schemas/StorageProof"},"state_root":{"$ref":"#/components/schemas/Hash"},"tip":{"$ref":"#/components/schemas/Hash"},"value_hex":{"description":"Null means absent; empty string is a present empty record","pattern":"^([0-9a-f]{2})*$","type":["string","null"]}},"required":["contract","key","value_hex","state_root"],"type":"object"},"StorageProof":{"description":"A Merkle proof of the record against state_root (wiki: data/state-tree#proofs)","properties":{"end":{"description":"Where the key's path ends: the record's own leaf, an empty subtree, or another record's leaf","enum":["present","empty","other"]},"other_key":{"$ref":"#/components/schemas/Hash"},"other_leaf":{"$ref":"#/components/schemas/Hash"},"record_key":{"$ref":"#/components/schemas/Hash"},"siblings":{"description":"The other child's hash at each level, from the end of the path up to the root","items":{"$ref":"#/components/schemas/Hash"},"type":"array"}},"required":["record_key","end","siblings"],"type":"object"},"StorageReads":{"additionalProperties":false,"properties":{"proof":{"default":false,"description":"Also each record's Merkle proof","type":"boolean"},"reads":{"items":{"additionalProperties":false,"properties":{"contract":{"$ref":"#/components/schemas/Hash"},"key":{"$ref":"#/components/schemas/Hash"}},"required":["contract","key"],"type":"object"},"maxItems":1024,"minItems":1,"type":"array"}},"required":["reads"],"type":"object"},"StorageValues":{"properties":{"state_root":{"$ref":"#/components/schemas/Hash"},"tip":{"$ref":"#/components/schemas/Hash"},"values":{"items":{"properties":{"contract":{"$ref":"#/components/schemas/Hash"},"key":{"$ref":"#/components/schemas/Hash"},"proof":{"$ref":"#/components/schemas/StorageProof"},"value_hex":{"description":"Null means absent; empty string is a present empty record","pattern":"^([0-9a-f]{2})*$","type":["string","null"]}},"required":["contract","key","value_hex"],"type":"object"},"type":"array"}},"required":["values","state_root","tip"],"type":"object"},"Submission":{"additionalProperties":false,"properties":{"hex":{"description":"Canonical binary encoding, represented as lowercase hex","pattern":"^([0-9a-f]{2})*$","type":"string"},"not_before":{"description":"Defer: hold the transaction until this Unix time, then admit it to the pool once it executes successfully on the tip. At most a year ahead; dropped a month after this time if never included","minimum":0,"type":"integer"}},"required":["hex"],"type":"object"},"TransactionLookup":{"properties":{"deferred":{"anyOf":[{"$ref":"#/components/schemas/Deferred"},{"type":"null"}],"description":"Present while this node holds the transaction in its deferred set"},"from":{"minimum":0,"type":"integer"},"has_more":{"type":"boolean"},"id":{"$ref":"#/components/schemas/Hash"},"next":{"minimum":0,"type":"integer"},"occurrences":{"items":{"$ref":"#/components/schemas/Occurrence"},"type":"array"},"pending":{"type":"boolean"},"pending_transaction":{"anyOf":[{"$ref":"#/components/schemas/Envelope"},{"type":"null"}]},"tip":{"$ref":"#/components/schemas/Hash"}},"required":["id","pending","deferred","pending_transaction","occurrences","from","next","has_more","tip"],"type":"object"}}},"info":{"description":"Consumer interface for validated blocks, contracts, receipts, events and public transaction submission. Resource order is C/S/D/G; binary fields are lowercase hex. Reorganizations can replace canonical history. Node administration uses the local CLI. Pagination defaults to 20 entries, caps at 100 and stops before 16 MiB; follow next, and has_more for occurrence pages.","title":"Ting consumer API","version":"0.1.0"},"openapi":"3.1.0","paths":{"/health":{"get":{"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Readiness","tags":["Chain"]}},"/v1/blocks":{"get":{"parameters":[{"in":"query","name":"from","schema":{"default":1,"minimum":1,"type":"integer"}},{"in":"query","name":"limit","schema":{"default":20,"maximum":100,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockPage"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Canonical block page","tags":["Blocks"]}},"/v1/blocks/{id}":{"get":{"parameters":[{"description":"Positive height or 64-character lowercase block hash","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Block"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Block summary and receipts","tags":["Blocks"]}},"/v1/blocks/{id}/raw":{"get":{"parameters":[{"description":"Positive height or 64-character lowercase block hash","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"First byte of the slice","in":"query","name":"offset","schema":{"default":0,"minimum":0,"type":"integer"}},{"description":"Bytes in the slice, at most 1 MiB; without it the whole block, when it fits one response","in":"query","name":"length","schema":{"maximum":1048576,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RawBlock"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Canonical block bytes in hex, whole or sliced","tags":["Blocks"]}},"/v1/contracts/{id}":{"get":{"parameters":[{"description":"64-character lowercase identifier","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Manifest"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Immutable code manifest","tags":["Contracts"]}},"/v1/contracts/{id}/storage/{key}":{"get":{"parameters":[{"description":"64-character lowercase identifier","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"key","required":true,"schema":{"$ref":"#/components/schemas/Hash"}},{"description":"Also the record's Merkle proof against state_root","in":"query","name":"proof","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Storage"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Current record, null if absent","tags":["Contracts"]}},"/v1/events":{"get":{"parameters":[{"in":"query","name":"from","schema":{"default":1,"minimum":1,"type":"integer"}},{"in":"query","name":"limit","schema":{"default":20,"maximum":100,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventPage"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Events by canonical block","tags":["Events"]}},"/v1/mempool":{"get":{"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mempool"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Pending transaction inventory","tags":["Transactions"]}},"/v1/metrics":{"get":{"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Node statistics","tags":["Chain"]}},"/v1/status":{"get":{"parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Canonical node status","tags":["Chain"]}},"/v1/storage":{"post":{"description":"Reads 1 to 1024 records, each named by a contract and a key, all from the same state: one state root, which the answer gives with the canonical tip it belongs to. Records read together therefore never straddle a block. Values come in the order asked, null for an absent record; with proof, each with its Merkle proof against the state root.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageReads"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageValues"}}},"description":"The records"},"400":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Read many storage records from one state","tags":["Contracts"]}},"/v1/transactions":{"post":{"description":"Public admission to the bounded transient mempool. No node token is required. Application authorization is checked by programs during execution. Admission does not imply successful execution. With not_before, the transaction is deferred: held until that time and admitted to the pool once it executes successfully on the tip, surviving restarts and reorganizations until a canonical block includes it or it expires. The example targets a placeholder contract; replace it with a real canonical envelope.","requestBody":{"content":{"application/json":{"example":{"hex":"010040420f00000000000a0000000000000000040000000000000000000000000000070707070707070707070707070707070707070707070707070707070707070700000000"},"schema":{"$ref":"#/components/schemas/Submission"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Admission"}}},"description":"Accepted"},"400":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Submit canonical transaction","tags":["Transactions"]}},"/v1/transactions/{id}":{"get":{"parameters":[{"description":"64-character lowercase identifier","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"from","schema":{"default":0,"minimum":0,"type":"integer"}},{"in":"query","name":"limit","schema":{"default":20,"maximum":100,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionLookup"}}},"description":"Success"},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"}},"summary":"Canonical occurrences and pending status","tags":["Transactions"]}}},"security":[],"servers":[{"description":"This Ting node","url":"/"}]}