{
 "format": "zoobc-conformance-vectors/1",
 "edition": "0.6.1",
 "chapter": "31",
 "license": "CC BY 4.0, ZooBC Foundation",
 "cases": [
  {
   "id": "31-1-route-miss",
   "chapter": "31",
   "section": "1",
   "title": "A path that matches no route answers 404 with an empty body",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/nonexistent404",
    "status": "404",
    "body": ""
   }
  },
  {
   "id": "31-1-bad-tx-id",
   "chapter": "31",
   "section": "1",
   "title": "A transaction id of the wrong shape",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/transactions/zzz",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"Invalid transaction id: expected 64 hex characters, the ZTX_ form, or the decimal transaction id\",\"code\":400}"
   }
  },
  {
   "id": "31-1-bad-block-hash",
   "chapter": "31",
   "section": "1",
   "title": "A block hash of the wrong length",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blocks/hash/12",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"Invalid block hash: expected 64 hex characters\",\"code\":400}"
   }
  },
  {
   "id": "31-1-app-id-overflow",
   "chapter": "31",
   "section": "1",
   "title": "An app id above the 64-bit range",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/apps/18446744073709551616",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"invalid app id\",\"code\":400}"
   }
  },
  {
   "id": "31-1-options-node",
   "chapter": "31",
   "section": "1",
   "title": "OPTIONS at the node answers 200 with the CORS headers and an empty body",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "OPTIONS /api/v1/node/info",
    "status": "200",
    "body": ""
   },
   "note": "Headers: Access-Control-Allow-Origin: *; Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS; Access-Control-Allow-Headers: Content-Type, X-Node-Public-Key, X-Timestamp, X-Signature. A gateway in front of the node may answer OPTIONS itself with its own headers (§9)."
  },
  {
   "id": "31-2-sign",
   "chapter": "31",
   "section": "2",
   "title": "Sign GET /api/v1/node/public-ip at 1,793,715,000",
   "kind": "31-signed-request",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seed": "5a6f6f42432d737065632d7369676e65642d726571756573742d6b65792d3031",
    "method": "GET",
    "path": "/api/v1/node/public-ip",
    "timestamp": "1793715000",
    "body": ""
   },
   "expected": {
    "public_key": "59fa151ccaaff39645ac675ef5e4cfef87a35c958b970d8eadb4daad7b3cce02",
    "preimage": "4745543a2f6170692f76312f6e6f64652f7075626c69632d69703a313739333731353030303a",
    "signature": "c312bd27eb0e2f285734b8c31e94f5a32291b933e8494ef486870568ac32f0d53cf017c3cfbe6fc137c67047f12ea15960c81dd55d900a017a383fe9ded35c06"
   }
  },
  {
   "id": "31-2-accepted",
   "chapter": "31",
   "section": "2",
   "title": "The signed request is accepted within 300 s of its timestamp",
   "kind": "31-auth-check",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "public_key": "59fa151ccaaff39645ac675ef5e4cfef87a35c958b970d8eadb4daad7b3cce02",
    "timestamp": "1793715000",
    "signature": "c312bd27eb0e2f285734b8c31e94f5a32291b933e8494ef486870568ac32f0d53cf017c3cfbe6fc137c67047f12ea15960c81dd55d900a017a383fe9ded35c06",
    "method": "GET",
    "path": "/api/v1/node/public-ip",
    "body": "",
    "now": "1793715300"
   },
   "expected": {
    "verdict": "accepted"
   }
  },
  {
   "id": "31-2-no-headers",
   "chapter": "31",
   "section": "2",
   "title": "The same request without headers",
   "kind": "31-auth-check",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "method": "GET",
    "path": "/api/v1/node/public-ip",
    "body": "",
    "now": "1793715000"
   },
   "expected": {
    "error": "Authentication failed: Missing X-Node-Public-Key header"
   }
  },
  {
   "id": "31-2-sig-130",
   "chapter": "31",
   "section": "2",
   "title": "A 130-character signature",
   "kind": "31-auth-check",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "public_key": "59fa151ccaaff39645ac675ef5e4cfef87a35c958b970d8eadb4daad7b3cce02",
    "timestamp": "1793715000",
    "signature": "c312bd27eb0e2f285734b8c31e94f5a32291b933e8494ef486870568ac32f0d53cf017c3cfbe6fc137c67047f12ea15960c81dd55d900a017a383fe9ded35c0600",
    "method": "GET",
    "path": "/api/v1/node/public-ip",
    "body": "",
    "now": "1793715000"
   },
   "expected": {
    "error": "Authentication failed: Invalid X-Signature: must be 128 hex characters"
   }
  },
  {
   "id": "31-2-expired",
   "chapter": "31",
   "section": "2",
   "title": "The request 301 s after its timestamp",
   "kind": "31-auth-check",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "public_key": "59fa151ccaaff39645ac675ef5e4cfef87a35c958b970d8eadb4daad7b3cce02",
    "timestamp": "1793715000",
    "signature": "c312bd27eb0e2f285734b8c31e94f5a32291b933e8494ef486870568ac32f0d53cf017c3cfbe6fc137c67047f12ea15960c81dd55d900a017a383fe9ded35c06",
    "method": "GET",
    "path": "/api/v1/node/public-ip",
    "body": "",
    "now": "1793715301"
   },
   "expected": {
    "error": "Authentication failed: Request expired: timestamp must be within 5 minutes of current time"
   }
  },
  {
   "id": "31-2-other-path",
   "chapter": "31",
   "section": "2",
   "title": "The signature does not cover another path",
   "kind": "31-auth-check",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "public_key": "59fa151ccaaff39645ac675ef5e4cfef87a35c958b970d8eadb4daad7b3cce02",
    "timestamp": "1793715000",
    "signature": "c312bd27eb0e2f285734b8c31e94f5a32291b933e8494ef486870568ac32f0d53cf017c3cfbe6fc137c67047f12ea15960c81dd55d900a017a383fe9ded35c06",
    "method": "GET",
    "path": "/api/v1/node/info",
    "body": "",
    "now": "1793715000"
   },
   "expected": {
    "error": "Authentication failed: Invalid signature"
   }
  },
  {
   "id": "31-2-public-ip-answer",
   "chapter": "31",
   "section": "2",
   "title": "The answer of the signed public-IP request",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/node/public-ip (signed)",
    "status": "200",
    "body": "{\"ip\":…,\"port\":…,\"remote_addr\":…,\"remote_port\":…}"
   },
   "note": "The fields of the answer, when the clock is within 300 s of 1,793,715,000; the values are the caller's."
  },
  {
   "id": "31-3-address-route",
   "chapter": "31",
   "section": "3",
   "title": "GET /api/v1/address/ of a typed native account",
   "kind": "31-typed-address",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6",
    "route": "address"
   },
   "expected": {
    "address": "00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6",
    "account_type": "0",
    "type_name": "ZooBC",
    "bytes": "36"
   },
   "note": "The route answers {\"input\":\"00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6\",\"address\":\"00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6\",\"account_type\":0,\"type_name\":\"ZooBC\",\"bytes\":36}."
  },
  {
   "id": "31-3-zbc-text",
   "chapter": "31",
   "section": "3",
   "title": "The ZBC_ text of the same account",
   "kind": "31-typed-address",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "ZBC_XTFYBAQN_HY7443TC_6HBIHLHW_WCVYQSUT_PL2HCIG6_F77IRI4T_WTLOGT6O"
   },
   "expected": {
    "address": "00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6",
    "account_type": "0",
    "bytes": "36"
   }
  },
  {
   "id": "31-3-zbc-checksum",
   "chapter": "31",
   "section": "3",
   "title": "The ZBC_ text with its first base32 character changed, on a route marked T",
   "kind": "31-typed-address",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "address": "ZBC_YTFYBAQN_HY7443TC_6HBIHLHW_WCVYQSUT_PL2HCIG6_F77IRI4T_WTLOGT6O"
   },
   "expected": {
    "error": "Invalid ZBC address: Address checksum validation failed"
   },
   "note": "GET /api/v1/accounts/<it> answers 400 {\"success\":false,\"error\":\"Invalid ZBC address: Address checksum validation failed\",\"code\":400}: the three check bytes no longer match SHA3-256(key ‖ ZBC)."
  },
  {
   "id": "31-3-zbc-checksum-address-route",
   "chapter": "31",
   "section": "3",
   "title": "The same text on GET /api/v1/address/",
   "kind": "31-typed-address",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "address": "ZBC_YTFYBAQN_HY7443TC_6HBIHLHW_WCVYQSUT_PL2HCIG6_F77IRI4T_WTLOGT6O",
    "route": "address"
   },
   "expected": {
    "error": "not an address this chain can hold"
   },
   "note": "A 400."
  },
  {
   "id": "31-3-eth-0x",
   "chapter": "31",
   "section": "3",
   "title": "0x and 40 hex digits is an Ethereum account",
   "kind": "31-typed-address",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "0x3bc64c92d9bb1c5826643b081108b892e2e7f590"
   },
   "expected": {
    "address": "040000003bc64c92d9bb1c5826643b081108b892e2e7f590",
    "account_type": "4",
    "bytes": "24"
   }
  },
  {
   "id": "31-4-fee-params",
   "chapter": "31",
   "section": "4",
   "title": "The fee parameters of a fresh TestNet chain",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/fee-params",
    "status": "200",
    "body": "{\"min_fee\":2500000,\"min_node_registration_fee\":2500000,\"fee_scale\":1000000,\"initial_fee_scale\":1000000,\"effective_min_fee\":2500000,\"one_zbc\":100000000,\"dataset_storage_cost_per_mib\":5000000,\"storage_oracle_multiplier_ppm\":1000000,\"min_payload_persistence_blocks\":17280,\"dataset_billing_period_blocks\":172800,\"block_time_interval\":15,\"token_persist_period_cost\":10000000,\"token_free_persist_blocks\":172800,\"min_token_persist_blocks\":5760,\"account_rent_period_cost\":1000000,\"account_rent_period_blocks\":172800,\"node_registration_minimum\":10000000000,\"node_registration_entry_minimum\":10000000000,\"queue_median_fraction_bps\":5000,\"producer_share_bps\":0,\"overpay_kept\":false,\"fee_above_minimum\":\"refunded\"}"
   },
   "note": "No vote applied, the fee scale at its initial value; node_registration_entry_minimum equals the voted minimum while the queue is empty."
  },
  {
   "id": "31-4-effective-min-fee",
   "chapter": "31",
   "section": "4",
   "title": "effective_min_fee at the initial fee scale",
   "kind": "31-effective-min-fee",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "fee_scale": "1000000"
   },
   "expected": {
    "effective_min_fee": "2500000"
   }
  },
  {
   "id": "31-4-estimate-fee",
   "chapter": "31",
   "section": "4",
   "title": "The fee estimate of a SendZBC: the fields in order",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/estimate-fee?type=1",
    "status": "200",
    "body": "{\"minimum_fee\":…,\"duty\":false,\"fee_exactly_zero\":false,\"survival\":0,\"survival_active\":true,\"transaction_version\":1,\"survival_minimum\":10000000,\"survival_below_minimum\":false,\"survival_payload_bytes\":8,\"survival_rent_per_period\":…,\"survival_periods\":0,\"survival_free_until_height\":…,\"survival_paid_through_height\":…,\"total_debit_excluding_amount\":…,\"fee_above_minimum\":\"refunded\",\"producer_share_bps\":0,\"escrow_rent\":0,\"overpay_refunded\":true,\"one_zbc\":100000000,\"timestamp\":…}"
   },
   "note": "minimum_fee is the floor of 04 §2 for a type-1 transaction of 8 body bytes at tip + 1 and total_debit_excluding_amount equals it; survival_rent_per_period is 13 §2 for 8 bytes; the two heights are the free window's end for tip + 1 (13 §2); timestamp is the node's clock."
  },
  {
   "id": "31-4-estimate-fee-kind",
   "chapter": "31",
   "section": "4",
   "title": "An escrow kind the estimate does not know",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/estimate-fee?type=1&escrow_kind=other",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"escrow_kind must be single, request, cosigned or cosigned_request\",\"code\":400}"
   }
  },
  {
   "id": "31-4-status-fresh",
   "chapter": "31",
   "section": "4",
   "title": "The status of a fresh TestNet chain (tip 0)",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/status",
    "status": "200",
    "body": "{\"height\":0,\"confirmed_height\":0,\"finalized_height\":0,\"escrow_release_height\":345600,\"escrow_timeout_cap_seconds\":5183985,\"burned_total\":0,\"latest_block_hash\":\"<the chain's block-0 hash>\",\"survival_mode\":true,\"survival_mode_tip\":false,\"survival_min_producers\":5,\"survival_distinct_producers\":0,\"latest_block_time\":1793509027}"
   },
   "note": "The genesis file's survival_min_producers 5, main_snapshot_interval 172,800 and main_snapshot_min_height 760."
  },
  {
   "id": "31-4-escrow-cap-fresh",
   "chapter": "31",
   "section": "4",
   "title": "escrow_timeout_cap_seconds at tip 0: (345,600 − 1) × 15",
   "kind": "31-escrow-cap",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "tip": "0",
    "main_snapshot_interval": "172800",
    "main_snapshot_min_height": "760"
   },
   "expected": {
    "escrow_release_height": "345600",
    "escrow_timeout_cap_seconds": "5183985"
   },
   "note": "(1 div 172,800 + 2) × 172,800 = 345,600; 345,600 − 172,800 ≥ 760, so the minimum height does not move it."
  },
  {
   "id": "31-4-status-survival-fresh",
   "chapter": "31",
   "section": "4",
   "title": "The survival fields at tip 0: block 1 is judged in survival mode",
   "kind": "36-survival-status",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "min_producers": "5",
    "tip": "0"
   },
   "expected": {
    "survival_mode": "true",
    "survival_mode_tip": "false",
    "survival_min_producers": "5",
    "survival_distinct_producers": "0"
   },
   "note": "No producer in the empty window [1, 0], 0 < 5."
  },
  {
   "id": "31-4-status-survival",
   "chapter": "31",
   "section": "4",
   "title": "The survival fields at tip 10,000 with 4 distinct blocksmiths in [9,881, 10,000] and the stored flag true",
   "kind": "36-survival-status",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "min_producers": "5",
    "producers": "[A,B,C,D]*2500",
    "tip": "10000",
    "tip_flag": "true"
   },
   "expected": {
    "survival_mode": "true",
    "survival_mode_tip": "true",
    "survival_min_producers": "5",
    "survival_distinct_producers": "4"
   }
  },
  {
   "id": "31-4-status-survival-five",
   "chapter": "31",
   "section": "4",
   "title": "The same tip with 5 distinct blocksmiths in that window and the stored flag true",
   "kind": "36-survival-status",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "min_producers": "5",
    "producers": "[A,B,C,D,E]*2000",
    "tip": "10000",
    "tip_flag": "true"
   },
   "expected": {
    "survival_mode": "false",
    "survival_mode_tip": "true",
    "survival_min_producers": "5",
    "survival_distinct_producers": "5"
   }
  },
  {
   "id": "31-4-escrow-cap",
   "chapter": "31",
   "section": "4",
   "title": "escrow_timeout_cap_seconds at tip 12,473: (345,600 − 12,474) × 15",
   "kind": "31-escrow-cap",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "tip": "12473",
    "main_snapshot_interval": "172800",
    "main_snapshot_min_height": "760"
   },
   "expected": {
    "escrow_release_height": "345600",
    "escrow_timeout_cap_seconds": "4996890"
   }
  },
  {
   "id": "31-4-rules",
   "chapter": "31",
   "section": "4",
   "title": "The rules route on either chain with its 11 genesis registered nodes counted",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/rules",
    "status": "200",
    "body": "{\"activation_floor_blocks\":5760,\"bundle_id\":601,\"bundles\":[],\"counted_seats\":11,…,\"production_halt\":\"\",…,\"rules\":[…],\"signal_window_blocks\":720}"
   },
   "note": "125 rules, each with \"height\":0,\"source\":\"consensus_parameters\"; signal_window_blocks = min(max(720, 55), 1,440)."
  },
  {
   "id": "31-4-rules-split-policy",
   "chapter": "31",
   "section": "4",
   "title": "The rules route's entry of split_policy",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/rules",
    "status": "200",
    "body": "{\"accumulating\":true,\"active\":true,\"active_next_block\":true,\"blocks_until_active\":0,\"bundle\":0,\"default_height\":30000,\"default_off_height\":null,\"description\":…,\"height\":0,\"name\":\"split_policy\",\"off_height\":null,\"off_source\":\"compiled_default\",\"recorded_off\":null,\"recorded_on\":{\"block_hash\":\"<the chain's block-0 hash>\",\"height\":0},\"retirable\":false,\"retired\":false,\"scheduled_height\":0,\"source\":\"consensus_parameters\",\"transaction_types\":[{\"name\":\"SetSplitPolicyTransaction\",\"type\":54}],\"warm_up_blocks\":0}"
   },
   "note": "default_height is the height the binary carries for the rule when a genesis names none; height is the genesis's 0."
  },
  {
   "id": "31-4-rules-spine-equivocation",
   "chapter": "31",
   "section": "4",
   "title": "The rules route's entry of spine_equivocation_report",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blockchain/rules",
    "status": "200",
    "body": "{…,\"bundle\":601,…,\"name\":\"spine_equivocation_report\",…,\"transaction_types\":[{\"name\":\"SpineEquivocationReportTransaction\",\"type\":62}],…}"
   }
  },
  {
   "id": "31-4-block-above-range",
   "chapter": "31",
   "section": "4",
   "title": "A block height above 4,294,967,295",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blocks/height/4294967296",
    "status": "404",
    "body": "{\"success\":false,\"error\":\"Block not found\",\"code\":404}"
   }
  },
  {
   "id": "31-4-block-0",
   "chapter": "31",
   "section": "4",
   "title": "Block 0",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/blocks/height/0",
    "status": "200",
    "body": "{…,\"version\":1,…,\"transaction_count\":0,…}"
   }
  },
  {
   "id": "31-5-version-string",
   "chapter": "31",
   "section": "5",
   "title": "A body with \"version\":\"x\"",
   "kind": "03-json-submit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "json": "{\"version\":\"x\"}"
   },
   "expected": {
    "error": "field 'version' must be an integer"
   }
  },
  {
   "id": "31-5-empty-body",
   "chapter": "31",
   "section": "5",
   "title": "An empty object",
   "kind": "03-json-submit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "json": "{}"
   },
   "expected": {
    "error": "field 'signature' is required"
   }
  },
  {
   "id": "31-5-tx-envelope",
   "chapter": "31",
   "section": "5",
   "title": "A body {\"tx\":1} in another envelope",
   "kind": "03-json-submit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "json": "{\"tx\":1}"
   },
   "expected": {
    "error": "field 'signature' is required (this route takes the transaction fields listed in the API guide, each signed by its sender; 'tx' and 'signatures' are not among them)"
   }
  },
  {
   "id": "31-5-v1-expiry",
   "chapter": "31",
   "section": "5",
   "title": "A version-1 body with an expiry of 600",
   "kind": "03-json-submit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "json": "{\"version\":1,\"expiry\":600}"
   },
   "expected": {
    "error": "expiry needs transaction version 3: a version-1 transaction carries no expiry (its signed bytes have no place for one)"
   }
  },
  {
   "id": "31-5-cancel-digest",
   "chapter": "31",
   "section": "5",
   "title": "The cancel digest for the vectors' genesis hash and a transaction hash",
   "kind": "31-cancel-digest",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "genesis": "e003e4e3557ef19f0519bd345009dea7fb43b3445eaa043920c5dc23b3302871",
    "transaction_hash": "f1d31b42df64c11031b32a16a24a1431f88320553509e9920b2045556b493d85"
   },
   "expected": {
    "preimage": "5a42432d43414e43454ce003e4e3557ef19f0519bd345009dea7fb43b3445eaa043920c5dc23b3302871f1d31b42df64c11031b32a16a24a1431f88320553509e9920b2045556b493d85",
    "digest": "29a3616beb95955d8c2cd1744346a43255439a9927cfffc39381bd527a22c074"
   },
   "note": "An example genesis value: a chain substitutes its own block-0 hash. The cancel body is {\"signature\":\"<128 hex: the sender's signature over the digest>\"}."
  },
  {
   "id": "31-6-treasury",
   "chapter": "31",
   "section": "6",
   "title": "The TestNet treasury before its first schedule fire",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/ZBC_CIHOJSU5_EWGXKZLJ_AHWEQNZX_HYDXMM3J_VV263DLD_7IY4PYFX_5ADSND7R",
    "status": "200",
    "body": "{\"address\":\"ZBC_CIHOJSU5_EWGXKZLJ_AHWEQNZX_HYDXMM3J_VV263DLD_7IY4PYFX_5ADSND7R\",\"spendable_balance\":100000000000000,\"balance\":100000000000000,\"locked_balance\":0,\"total_balance\":100000000000000,\"pop_revenue\":0,\"transact_policy\":0}"
   },
   "note": "Its genesis row: 1,000,000 ZBC, no node, no reward yet, no policy; at any confirmed height before the first fire, 86,400 s after genesis (08)."
  },
  {
   "id": "31-6-history",
   "chapter": "31",
   "section": "6",
   "title": "The shape of an account's newest history row",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/<a sender's address>/history?limit=1",
    "status": "200",
    "body": "{\"address\":<as given>,\"limit\":1,\"offset\":0,\"transactions\":[{\"id\":<decimal string>,\"block_height\":…,\"timestamp\":…,\"transaction_type\":…,\"direction\":\"out\",\"sender\":<hex>,\"recipient\":<hex or \"\">,\"amount\":…,\"fee\":…,\"transaction_hash\":<64 hex>}],\"next_cursor\":\"<height>:<id>\"}"
   }
  },
  {
   "id": "31-6-history-empty",
   "chapter": "31",
   "section": "6",
   "title": "The history of an account with no transaction yet",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/<an account>/history?limit=1",
    "status": "200",
    "body": "{\"address\":…,\"limit\":1,\"offset\":0,\"transactions\":[],\"next_cursor\":null}"
   }
  },
  {
   "id": "31-6-pubkey-taproot",
   "chapter": "31",
   "section": "6",
   "title": "The key of a Taproot account is its address's 32-byte program",
   "kind": "31-account-pubkey",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "09000000dff1d77f2a671c5f36183726db2341be58feae1da2deced843240f7b502ba659"
   },
   "expected": {
    "address": "09000000dff1d77f2a671c5f36183726db2341be58feae1da2deced843240f7b502ba659",
    "account_type": "9",
    "type_name": "Bitcoin Taproot",
    "curve": "secp256k1",
    "public_key": "dff1d77f2a671c5f36183726db2341be58feae1da2deced843240f7b502ba659",
    "source": "address",
    "transaction_hash": "null",
    "verified": "true",
    "note": "a BIP-340 x-only output key (Taproot, the tweaked key): 32 bytes, no parity byte"
   },
   "note": "The Taproot account of the first BIP-340 key of 33 §3."
  },
  {
   "id": "31-6-pubkey-eth-unknown",
   "chapter": "31",
   "section": "6",
   "title": "An Ethereum account that has not published a key nor sent anything",
   "kind": "31-account-pubkey",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "040000003bc64c92d9bb1c5826643b081108b892e2e7f590"
   },
   "expected": {
    "address": "040000003bc64c92d9bb1c5826643b081108b892e2e7f590",
    "account_type": "4",
    "type_name": "Ethereum",
    "curve": "secp256k1",
    "public_key": "null",
    "source": "null",
    "transaction_hash": "null",
    "verified": "false",
    "note": "this account has not published a key and has not sent a transaction yet"
   },
   "note": "The Ethereum account of 33 §3."
  },
  {
   "id": "31-6-pubkey-eth-sent",
   "chapter": "31",
   "section": "6",
   "title": "The same account after it sent a transaction signed with v 27 or 28",
   "kind": "31-account-pubkey",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "address": "040000003bc64c92d9bb1c5826643b081108b892e2e7f590",
    "sent": "2c67e6ec6aa795e8ae01447ac9f3a57616dc2cf17ddbe367d8dfc564e923c1e268487e15e10d153c32c41a2820a383628098d155fc6eefb44ba37e93e99f05f1"
   },
   "expected": {
    "public_key": "2c67e6ec6aa795e8ae01447ac9f3a57616dc2cf17ddbe367d8dfc564e923c1e268487e15e10d153c32c41a2820a383628098d155fc6eefb44ba37e93e99f05f1",
    "source": "transaction",
    "verified": "true"
   },
   "note": "The 64-byte key recovered over the signing digest, whose Keccak-256 ends in the address; transaction_hash is that transaction's hash."
  },
  {
   "id": "31-6-pubkey-short",
   "chapter": "31",
   "section": "6",
   "title": "A 2-byte address on the pubkey route",
   "kind": "31-account-pubkey",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "address": "0400"
   },
   "expected": {
    "error": "not an address this chain can hold"
   },
   "note": "A 400."
  },
  {
   "id": "31-6-bare-key",
   "chapter": "31",
   "section": "6",
   "title": "A node refuses a bare 32-byte key as an account",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6",
    "status": "404",
    "body": "{\"success\":false,\"error\":\"accounts are typed: a bare 32-byte key is not an account on this chain\",\"code\":404}"
   },
   "note": "A node's answer; the public domain answers this path from the archival service (§9)."
  },
  {
   "id": "31-6-bad-cursor",
   "chapter": "31",
   "section": "6",
   "title": "A malformed history cursor",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/<any>/history?cursor=abc",
    "status": "400"
   }
  },
  {
   "id": "31-6-bad-from-height",
   "chapter": "31",
   "section": "6",
   "title": "A from_height that is not a block height",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/accounts/<any>/transactions?from_height=x",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"from_height and to_height must be block heights; scan_blocks is capped at 500\",\"code\":400}"
   }
  },
  {
   "id": "31-7-governance-params",
   "chapter": "31",
   "section": "7",
   "title": "The governable prices of a fresh TestNet chain in its first cycle",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/governance/params",
    "status": "200",
    "body": "{\"transaction_type\":51,\"rule\":\"average\",\"up_limit_pct\":20,\"down_limit\":\"half\",\"cycle_length\":172800,\"cycle_first_block\":1,\"count_height\":172800,\"counted_seats\":11,\"registry_floor\":7,\"floor_met\":true,\"parameters\":[{\"name\":\"storage_oracle_multiplier_ppm\",\"source\":\"consensus_parameters\",\"current\":1000000,\"min\":100000,\"max\":10000000,\"votable_min\":500000,\"votable_max\":1200000,\"votes_this_cycle\":0,\"projected\":1000000},{\"name\":\"dataset_storage_cost_per_mib\",\"source\":\"consensus_parameters\",\"current\":5000000,\"min\":1,\"max\":10000000000,\"votable_min\":2500000,\"votable_max\":6000000,\"votes_this_cycle\":0,\"projected\":5000000},…"
   },
   "note": "11 counted registered nodes, no vote. The beginning of the answer; eight prices, then transfer_fee with commit_transaction_type 7 and reveal_transaction_type 263."
  },
  {
   "id": "31-7-release-list-fresh",
   "chapter": "31",
   "section": "7",
   "title": "The release registry of a fresh chain",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/release/list",
    "status": "200",
    "body": "{\"releases\":[]}"
   }
  },
  {
   "id": "31-7-release-list",
   "chapter": "31",
   "section": "7",
   "title": "The release registry after one registration",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/release/list",
    "status": "200",
    "body": "{\"releases\":[{\"version\":\"v0.6.1-testnet-arm64\",\"manifest_hash\":\"<M, 64 hex>\",\"release_address\":\"<the authority's 36-byte account, hex>\",\"revoked\":false,\"block_height\":348}]}"
   },
   "note": "The release authority registers v0.6.1-testnet-arm64 at height 348 with manifest hash M."
  },
  {
   "id": "31-7-quote",
   "chapter": "31",
   "section": "7",
   "title": "60,025 bytes at 1 ZBC per MiB, a 0.1 ZBC deposit",
   "kind": "31-longevity-quote",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "bytes": "60025",
    "price_per_mib": "100000000",
    "deposit": "10000000"
   },
   "expected": {
    "rent_per_period": "5724431",
    "periods": "2"
   }
  },
  {
   "id": "31-7-withdrawal-requests-empty",
   "chapter": "31",
   "section": "7",
   "title": "The withdrawal requests of a custody on a chain without a request row",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/withdrawal-requests?custody=00",
    "status": "200",
    "body": "{\"bridge_withdrawal_credit\":true,\"finalized_height\":<the floor>,\"requests\":[]}"
   }
  },
  {
   "id": "31-7-withdrawal-requests-range",
   "chapter": "31",
   "section": "7",
   "title": "An empty height range: scanned_to is from_height − 1",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/withdrawal-requests?custody=00&from_height=10&to_height=5",
    "status": "200",
    "body": "{\"bridge_withdrawal_credit\":true,\"finalized_height\":<the floor>,\"from_height\":10,\"requests\":[],\"scanned_to\":9}"
   }
  },
  {
   "id": "31-7-withdrawal-id",
   "chapter": "31",
   "section": "7",
   "title": "The withdrawal id of a trigger resolved at height 1,200",
   "kind": "31-withdrawal-id",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "trigger": "d75df025be21ac74af3327c20186b415927367402a5b5028447e95c224f74d21",
    "oracle_result_height": "1200"
   },
   "expected": {
    "preimage": "d75df025be21ac74af3327c20186b415927367402a5b5028447e95c224f74d21b0040000",
    "withdrawal_id": "0x3b4a638b4f6e7f3f3bc034171f0c22d4473966d1227b86260a049f6a15419a8e"
   },
   "note": "GET /api/v1/bridge/withdrawals/<the trigger> then carries \"oracle_result_height\":1200,\"withdrawal_id\":\"0x3b4a…9a8e\"."
  },
  {
   "id": "31-7-withdrawal-wei",
   "chapter": "31",
   "section": "7",
   "title": "The same withdrawal's release_amount_wei for its 100,000,000 units of ZETH",
   "kind": "34-withdrawal-view",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "trigger_hash": "d75df025be21ac74af3327c20186b415927367402a5b5028447e95c224f74d21",
    "request": "5 100000000 0x9A080FFFE4105361b023220bD21Be0B9418E908e",
    "n": "11",
    "result_height": "1200",
    "attestations": "0 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n1 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n2 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n3 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n4 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n5 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n6 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199\n7 5:100000000:0x9A080FFFE4105361b023220bD21Be0B9418E908e| 1199"
   },
   "expected": {
    "resolved": "true",
    "amount": "100000000",
    "release_amount_wei": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
   },
   "note": "10^18 wei: amount x 10^10, as 0x and 64 hex digits."
  },
  {
   "id": "31-7-coins-zeth",
   "chapter": "31",
   "section": "7",
   "title": "The ZETH entry of /bridge/coins on either shipped chain",
   "kind": "34-custody",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "token_id": "5",
    "symbol": "ZETH",
    "chain": "ethereum",
    "asset": "native"
   },
   "expected": {
    "custody_account": "00000000b070ddf68c3270c38319c7c4c76166a2c76d8e9a75c368c6769d0fe5cf4f4df2",
    "zbc_withdraw_address": "ZBC_WBYN35UM_GJYMHAYZ_Y7CMOYLG_ULDW3DU2_OXBWRRTW_TUH6LT2P_JXZAEBCI",
    "withdrawals_open": "true",
    "withdrawals_closed_reason": ""
   },
   "note": "The entry: {\"token_id\":\"5\",\"symbol\":\"ZETH\",\"chain\":\"ethereum\",\"asset\":\"native\",\"deposit_address\":\"0x9A080FFFE4105361b023220bD21Be0B9418E908e\",\"custody_account\":…,\"zbc_withdraw_address\":…,\"withdrawals_open\":true,\"withdrawals_closed_reason\":\"\",\"decimals\":8}."
  },
  {
   "id": "31-7-orderbook-no-market",
   "chapter": "31",
   "section": "7",
   "title": "The order book without a market",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/exchange/orderbook",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"market required\",\"code\":400}"
   }
  },
  {
   "id": "31-7-deposit-not-deposit",
   "chapter": "31",
   "section": "7",
   "title": "A deposit view of an id that is not a deposit event",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/deposits/ZBWDR1:00ff",
    "status": "404",
    "body": "{\"success\":false,\"error\":\"not a bridge deposit event\",\"code\":404}"
   }
  },
  {
   "id": "31-7-withdrawal-no-request",
   "chapter": "31",
   "section": "7",
   "title": "A withdrawal view of a trigger with no request row",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/withdrawals/00ff",
    "status": "404",
    "body": "{\"success\":false,\"error\":\"no executed custody credit for this trigger\",\"code\":404}"
   }
  },
  {
   "id": "31-7-withdrawal-requests-no-custody",
   "chapter": "31",
   "section": "7",
   "title": "The withdrawal requests without a custody",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/withdrawal-requests",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"custody (hex account address) is required\",\"code\":400}"
   }
  },
  {
   "id": "31-7-withdrawal-requests-bad-height",
   "chapter": "31",
   "section": "7",
   "title": "A from_height that does not parse",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/bridge/withdrawal-requests?custody=00&from_height=x",
    "status": "400",
    "body": "{\"success\":false,\"error\":\"invalid height range\",\"code\":400}"
   }
  },
  {
   "id": "31-8-nodes-tip-0",
   "chapter": "31",
   "section": "8",
   "title": "A registry row at tip 0",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/nodes",
    "status": "200",
    "body": "{\"node_id\":<number>,\"node_id_str\":<the same, decimal>,\"node_public_key\":<the file's node key, 64 hex>,\"account_address\":<the file's owner account, 72 hex>,\"registration_height\":0,\"locked_balance\":0,\"registration_status\":0,\"participation_score\":2000000000000,\"stored_participation_score\":2000000000000,\"earns\":true,\"mature\":true,\"height\":0,\"roll_call\":{\"state\":\"absent\"},…,\"node_address\":…}"
   },
   "note": "11 rows; a row whose RollCall waits in this node's pool reads \"roll_call\":{\"state\":\"pending\",\"transaction_id\":<decimal string>}; the summary \"roll_call\":{\"window_end\":20,\"open\":true,\"answered\":0,\"absent\":<11 − pending>,\"removed\":0,\"pending\":<the RollCalls in this node's pool>,\"seats\":[11 entries]}."
  },
  {
   "id": "31-8-nodes-answered",
   "chapter": "31",
   "section": "8",
   "title": "The roll call from block 20 on, every node answered in block 1",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET /api/v1/nodes",
    "status": "200",
    "body": "\"roll_call\":{\"window_end\":20,\"open\":false,\"answered\":11,\"absent\":0,\"removed\":0,\"pending\":0,…}"
   },
   "note": "Each row's \"roll_call\":{\"state\":\"answered\",\"height\":1}."
  },
  {
   "id": "31-8-attest-remote",
   "chapter": "31",
   "section": "8",
   "title": "/internal/attest from a caller that is not loopback",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "POST /internal/attest",
    "status": "403",
    "body": "{\"success\":false,\"error\":\"Forbidden: /internal/attest is loopback-only\",\"code\":403}"
   }
  },
  {
   "id": "31-8-attest-api-path",
   "chapter": "31",
   "section": "8",
   "title": "There is no /api/v1/internal/attest route",
   "kind": "reference",
   "validity": "invalid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "POST /api/v1/internal/attest",
    "status": "404",
    "body": ""
   },
   "note": "A route miss: an empty body."
  },
  {
   "id": "31-9-archival-info",
   "chapter": "31",
   "section": "9",
   "title": "The archival service's node info: its keys",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET https://zoobc.network/api/v1/node/info",
    "status": "200",
    "body": "{\"archival_node\":true,\"archival_version\":…,\"blockchain_height\":…,\"blocks_behind\":…,\"confirmed_depth\":3,\"genesis_hash\":<the chain's block-0 hash, uppercase hex>,\"height\":…,\"newer_release\":…,\"node_id\":\"archival-api\",\"node_version\":…,\"p2pAddress\":\"\",\"peer_count\":0,\"public_api_url\":\"https://<the configured public hostname>\",\"signing_tag\":\"ZBC-TX\",\"signing_version\":2,\"source_height\":…,\"synced\":…,\"syncing\":…,\"version\":…}"
   },
   "note": "Exactly these keys (plus sync_note only when the node's database reports no height), at the archival program's defaults: confirmed_depth is 3 while a mirror database serves and 0 when the node's own database is served directly; public_api_url is \"\" when no public hostname is configured; synced = source_height > 0 and source_height − height ≤ confirmed_depth."
  },
  {
   "id": "31-9-archival-spine-0",
   "chapter": "31",
   "section": "9",
   "title": "Spine block 0 from the archival service",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET https://zoobc.network/api/v1/spine/blocks/0",
    "status": "200",
    "body": "{\"block_hash\":<the spine genesis hash, uppercase>,\"blocksmith_public_key\":<uppercase>,\"hash\":<the same hash>,\"height\":0,\"previous_block_hash\":…,\"previous_hash\":…,\"timestamp\":1793509027}"
   },
   "note": "The timestamp is the shipped spine file's genesis_timestamp."
  },
  {
   "id": "31-9-archival-account",
   "chapter": "31",
   "section": "9",
   "title": "An account from the archival service",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "request": "GET https://zoobc.network/api/v1/accounts/00000000bccb80820d3e3fce6e62f1c283acf6b0ab884a937af47120de2ffe88a393b4d6",
    "status": "200",
    "body": "{\"account\":\"ZBC_XTFYBAQN_HY7443TC_6HBIHLHW_WCVYQSUT_PL2HCIG6_F77IRI4T_WTLOGT6O\",\"account_address\":\"00000000BCCB80820D3E3FCE6E62F1C283ACF6B0AB884A937AF47120DE2FFE88A393B4D6\",\"address\":\"ZBC_XTFYBAQN_HY7443TC_6HBIHLHW_WCVYQSUT_PL2HCIG6_F77IRI4T_WTLOGT6O\",\"balance\":…,\"locked_balance\":…,\"pop_revenue\":…,\"spendable_balance\":…,\"total_balance\":…,\"transact_policy\":…}"
   },
   "note": "The text form of 01 over the 36 bytes; the balances are the chain's."
  }
 ]
}
