{"id":"XE-0064","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"87","source_url":"https://github.com/xeprotocol/xe/issues/87","reporter_id":25,"title":"openapi: uint64 fields (timestamp, pow_nonce) typed as plain integer exceed 2^53; generated JS clients corrupt them and cannot verify block hashes (Medium)","area":"sdk-docs-web","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"accepted","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T13:57:20.029862+00:00","updated_at":"2026-11-10T11:38:21.609530+00:00","source_created_at":"2026-10-26T21:28:24+00:00","told_at":"2026-11-10T00:15:43+00:00","status_changed_at":"2026-10-29T14:04:13.228328+00:00","url":"https://bounty.xe.network/XE-0064","body":"- Suggested tier: Medium (\"inconsistent API responses\"), may be seen as related to #13\n- Area: openapi.json field typing; every read endpoint that returns blocks\n- Found: 2026-10-26, node `xe/92d83d1`, openapi.json 1.0.0\n\n## Summary\n\nBlock `timestamp` (unix nanoseconds, about 1.79e18) and `pow_nonce` (up to 2^64-1) always exceed JavaScript's `Number.MAX_SAFE_INTEGER` (2^53-1 = 9007199254740991). The OpenAPI document types them as plain `{\"type\": \"integer\"}` with no `format: int64`, no string representation, and no warning, and the API returns them as bare JSON numbers. Any client generated from the contract, or any client using standard `JSON.parse`, silently corrupts these values.\n\nBecause `timestamp` and `pow_nonce` are both inputs to the block hash preimage (`core/encoding.go`), a standard JS client that reads a block and tries to verify or re-derive its hash gets the wrong bytes and cannot verify ANY block. The official SDK avoids this only by shipping a custom lossless (bigint) JSON parser; the documented contract gives no signal that this is required.\n\n## Evidence\n\nLive value from `GET /blocks/recent`: `\"timestamp\":1793041910652017920`, `\"pow_nonce\":2032484613864776222`.\n\n```js\nJSON.parse('{\"timestamp\":1793041910652017920,\"pow_nonce\":2032484613864776222}')\n// -> timestamp 1793041910652018000   (wrong: last digits lost)\n// -> pow_nonce 2032484613864776200   (wrong)\n```\n\nSpec (openapi.json 1.0.0, schema `Block`):\n\n```\ntimestamp -> {\"type\":\"integer\",\"description\":\"Block time as unix nanoseconds.\"}\npow_nonce -> {\"type\":\"integer\",\"description\":\"Proof-of-work nonce ...\"}\nbalance   -> {\"type\":\"integer\",\"minimum\":0, ...}      // micro-units; can exceed 2^53 for large holdings\namount    -> {\"type\":\"integer\", ...}\n```\n\nNo `format: int64`, no `type: string`, no note. A typical generator emits `number` for `integer`, so the corruption is silent.\n\n## Impact\n\n- Every non-SDK JS consumer of the API corrupts `timestamp` and `pow_nonce` on every block, and `balance`/`amount` once they pass 2^53 micro-units.\n- Block hash verification is impossible for such a client, since the corrupted timestamp/nonce change the preimage. This defeats the point of exposing the fields.\n- #13 (explorer rounds pow_nonce) is one downstream symptom of this same contract defect; this report is the contract-level cause plus the hash-verification consequence.\n- No fund risk.\n\n## Suggested fix\n\n- Mark these fields `format: int64` and, better for JSON, serialise uint64 fields as strings (as many chains do) or document that clients MUST use a lossless parser. Whichever is chosen, the contract should signal it so generated clients do not silently corrupt data.\n\n## Payout\n\nXE address: `6591eab453dbd93b27e2cd674712f94b42d9e7e4d52980b966fa6da4ccd832dc` (same as #75).\n","patch_refs":[{"id":537,"repo":"xeprotocol/xe","kind":"pr","ref":"344","title":"fix(core,web,docs): preserve 64-bit integer precision across JSON block parsing and unmarshaling (Fixes #87)","url":"https://github.com/xeprotocol/xe/pull/344","note":"","state":"open","author":"ocakciomursel-pixel","added_by":"desk","created_at":"2026-11-10T18:23:11.945740+00:00"}],"thread":[{"id":1571,"source":"github","source_ref":"6755092716","author":"XE desk","team":true,"body":"Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is\nupdated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0064.","created_at":"2026-11-10T00:15:43+00:00"}]}