{"id":20277330,"url":"https://github.com/bitjson/bch-bigint","last_synced_at":"2025-04-11T05:43:34.048Z","repository":{"id":250352925,"uuid":"833425418","full_name":"bitjson/bch-bigint","owner":"bitjson","description":"Augments VM Limits CHIP by removing one additional Bitcoin Cash VM limit: the number length limit (A.K.A. nMaxNumSize).","archived":false,"fork":false,"pushed_at":"2024-11-16T02:46:08.000Z","size":295,"stargazers_count":5,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T01:31:43.582Z","etag":null,"topics":["bigint","bitcoin","bitcoin-cash","bitcoin-cash-chip","bitcoin-script"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitjson.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-25T03:11:10.000Z","updated_at":"2024-11-16T02:46:12.000Z","dependencies_parsed_at":"2024-10-25T00:31:11.412Z","dependency_job_id":"3b86ebec-3661-4f85-965a-31cb6dcf2413","html_url":"https://github.com/bitjson/bch-bigint","commit_stats":null,"previous_names":["bitjson/bch-bigint"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitjson%2Fbch-bigint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitjson%2Fbch-bigint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitjson%2Fbch-bigint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitjson%2Fbch-bigint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitjson","download_url":"https://codeload.github.com/bitjson/bch-bigint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351449,"owners_count":21089270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bigint","bitcoin","bitcoin-cash","bitcoin-cash-chip","bitcoin-script"],"created_at":"2024-11-14T13:17:58.764Z","updated_at":"2025-04-11T05:43:34.039Z","avatar_url":"https://github.com/bitjson.png","language":null,"readme":"# CHIP-2024-07 BigInt: High-Precision Arithmetic for Bitcoin Cash\n\n        Title: High-Precision Arithmetic for Bitcoin Cash\n        Type: Standards\n        Layer: Consensus\n        Maintainer: Jason Dreyzehner\n        Status: Draft\n        Initial Publication Date: 2024-07-24\n        Latest Revision Date: 2024-10-01\n        Version: 1.1.0\n\n## Summary\n\nThis proposal augments [`CHIP: Targeted Virtual Machine Limits`](https://github.com/bitjson/bch-vm-limits) by removing one additional Bitcoin Cash Virtual Machine limit: the number length limit (A.K.A. `nMaxNumSize`).\n\n## Motivation\n\nMany financial and cryptographic applications require higher-precision arithmetic than is currently available to Bitcoin Cash contracts.\n\nWhile Bitcoin Cash's 2022 upgrade [increased the maximum number length from 4 bytes to 8 bytes](https://gitlab.com/GeneralProtocols/research/chips/-/blob/master/CHIP-2021-02-Bigger-Script-Integers.md), the design of the Bitcoin Cash Virtual Machine's anti-Denial-Of-Service limits prevented further increase.\n\nFollowing [`CHIP: Targeted Virtual Machine Limits`](https://github.com/bitjson/bch-vm-limits), the Virtual Machine (VM) can correctly account for arithmetic operation costs, so higher-precision arithmetic operations can be enabled without increasing the processing or memory requirements of the VM.\n\n## Benefits\n\nBy allowing contracts to efficiently operate on larger numbers, this proposal improves contract security and reduces transaction sizes.\n\n### Safer Contracts\n\nThis proposal obviates the need for higher-precision math emulation. As a result, existing applications can be simplified, making them easier to develop and review. Additionally, by making arithmetic overflows less common, contracts are less likely to include vulnerabilities or faults which can expose users to attacks and losses.\n\n### Reduced Transaction Sizes\n\nBecause this proposal allows existing contracts to remove higher-precision math emulation, transactions employing these contracts are reduced in size. This reduces transaction fees for contract users, and it reduces storage and bandwidth costs for validators.\n\n## Deployment\n\nDeployment of this specification is proposed for the May 2025 upgrade.\n\n- Activation is proposed for `1731672000` MTP, (`2024-11-15T12:00:00.000Z`) on `chipnet`.\n- Activation is proposed for `1747310400` MTP, (`2025-05-15T12:00:00.000Z`) on the BCH network (`mainnet`), `testnet3`, `testnet4`, and `scalenet`.\n\nThis proposal requires [`CHIP: Targeted Virtual Machine Limits`](https://github.com/bitjson/bch-vm-limits).\n\n## Technical Specification\n\nThe limit on the maximum length of Bitcoin Cash VM numbers (A.K.A. `nMaxNumSize`) is removed.\n\nNote that the [10,000-byte stack element length limit](https://github.com/bitjson/bch-vm-limits#increased-stack-element-length-limit) (A.K.A. `MAX_SCRIPT_ELEMENT_SIZE`) continues to limit both numeric operands and numeric results, and [Arithmetic Operation Cost](https://github.com/bitjson/bch-vm-limits#arithmetic-operation-cost) prevents excessive usage of arithmetic operations.\n\n## Tests \u0026 Benchmarks\n\n[`CHIP: Targeted Virtual Machine Limits`](https://github.com/bitjson/bch-vm-limits) includes a suite of functional tests and benchmarks to verify the behavior and performance of all operations within virtual machine implementations, including high-precision arithmetic operations. See [CHIP Limits: Tests \u0026 Benchmarks](https://github.com/bitjson/bch-vm-limits/blob/master/tests-and-benchmarks.md) for details.\n\n## Implementations\n\nPlease see the following reference implementations for additional examples and test vectors:\n\n- **C++**:\n  - [Bitcoin Cash Node (BCHN)](https://bitcoincashnode.org/) – A professional, miner-friendly node that solves practical problems for Bitcoin Cash. [Merge Request !1876](https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/merge_requests/1876).\n- **Go**:\n  - [BCHD](https://bchd.cash/) – An alternative full node bitcoin cash implementation written in Go (golang). [OPReturnCode/bchd PR #1](https://github.com/OPReturnCode/bchd/pull/1)\n- **Java**:\n  - [Bitcoin Verde](https://bitcoinverde.org/) – Bitcoin Verde is a Java full-node implementation of the Bitcoin Cash protocol. Bitcoin Verde provides a block explorer, development library, and network implementation diversification. [Issue #24](https://github.com/SoftwareVerde/bitcoin-verde/issues/24)\n- **JavaScript/TypeScript**:\n  - [Libauth](https://github.com/bitauth/libauth) – An ultra-lightweight, zero-dependency JavaScript library for Bitcoin Cash. [Pull Request #139](https://github.com/bitauth/libauth/pull/139).\n  - [Bitauth IDE](https://github.com/bitauth/bitauth-ide) – An online IDE for bitcoin (cash) contracts. [Pull Request #101](https://github.com/bitauth/bitauth-ide/pull/101).\n\n## Risk Assessment\n\n- [Appendix: Risk Assessment \u0026rarr;](risk-assessment.md)\n  - [Risks \\\u0026 Security Considerations](risk-assessment.md#risks--security-considerations)\n    - [User Impact Risks](risk-assessment.md#user-impact-risks)\n      - [Reduced or Equivalent Node Validation Costs](risk-assessment.md#reduced-or-equivalent-node-validation-costs)\n      - [Increased or Equivalent Contract Capabilities](risk-assessment.md#increased-or-equivalent-contract-capabilities)\n    - [Consensus Risks](risk-assessment.md#consensus-risks)\n      - [Full-Transaction Test Vectors](risk-assessment.md#full-transaction-test-vectors)\n      - [New Performance Testing Methodology](risk-assessment.md#new-performance-testing-methodology)\n      - [`Chipnet` Preview Activation](risk-assessment.md#chipnet-preview-activation)\n    - [Denial-of-Service (DoS) Risks](risk-assessment.md#denial-of-service-dos-risks)\n      - [Expanded Node Performance Safety Margin](risk-assessment.md#expanded-node-performance-safety-margin)\n    - [Protocol Complexity Risks](risk-assessment.md#protocol-complexity-risks)\n      - [Simplification of Protocol and Contract Review](risk-assessment.md#simplification-of-protocol-and-contract-review)\n      - [Elimination of Potential Protocol Ambiguity](risk-assessment.md#elimination-of-potential-protocol-ambiguity)\n      - [Obviation of Future Precision-Emulation Enhancements](risk-assessment.md#obviation-of-future-precision-emulation-enhancements)\n  - [Upgrade Costs](risk-assessment.md#upgrade-costs)\n    - [Node Upgrade Costs](risk-assessment.md#node-upgrade-costs)\n    - [Ecosystem Upgrade Costs](risk-assessment.md#ecosystem-upgrade-costs)\n  - [Maintenance Costs](risk-assessment.md#maintenance-costs)\n    - [Node Maintenance Costs](risk-assessment.md#node-maintenance-costs)\n    - [Ecosystem Maintenance Costs](risk-assessment.md#ecosystem-maintenance-costs)\n\n## Rationale\n\n- [Appendix: Rationale \u0026rarr;](rationale.md)\n  - [Extraction from `CHIP: Targeted Virtual Machine Limits`](rationale.md#extraction-from-chip-targeted-virtual-machine-limits)\n  - [Removal of Number Length Limit](rationale.md#removal-of-number-length-limit)\n    - [Alternative: Preserve 8-Byte Limit](rationale.md#alternative-preserve-8-byte-limit)\n      - [Scenario: Never Increase](rationale.md#scenario-never-increase)\n      - [Scenario: Delay Activation](rationale.md#scenario-delay-activation)\n    - [Alternative: Select a Higher Constant Limit](rationale.md#alternative-select-a-higher-constant-limit)\n    - [Full Removal Simplifies Protocol and Contract Review](rationale.md#full-removal-simplifies-protocol-and-contract-review)\n    - [Removal of Overflow Behavior](rationale.md#removal-of-overflow-behavior)\n      - [Consideration of Potential Impacts](rationale.md#consideration-of-potential-impacts)\n  - [Omission of Implementation-Specific Technical Documentation](rationale.md#omission-of-implementation-specific-technical-documentation)\n  - [Omission of VM Number Format or Operation Documentation](rationale.md#omission-of-vm-number-format-or-operation-documentation)\n\n## Evaluation of Alternatives\n\nNotable alternatives evaluated in the rationale are summarized here for ease of review:\n\n- **Indefinitely retained 8-byte limit** – Wasteful in every applicable measure when compared to this proposal, requiring: greater overall network bandwidth usage, larger individual transaction sizes, greater overall block storage requirements, and greater net computation costs of equivalent arithmetic operations across all validating nodes on the network. See [Scenario: Never Increase](rationale.md#scenario-never-increase).\n\n- **Temporarily retained 8-byte limit** – Wasteful of node implementation resources, requiring two entirely independent review cycles (separated by one or more years), with significantly greater implementation risks, significant discarded first-cycle effort in the second cycle, a potential decrease in new resources available to all node implementations, and non-trivial disruption risks. See [Scenario: Delay Activation](rationale.md#scenario-delay-activation).\n\n- **Selection of higher constant limit** – Selection of any particular constant would be arbitrary. See [Alternative: Select a Higher Constant Limit](rationale.md#alternative-select-a-higher-constant-limit)\n\n- **Full removal of limit** – This proposals chosen solution – reduces overall protocol complexity, simplifies contract review, and reduces future protocol complexity risks. See [Full Removal Simplifies Protocol and Contract Review](rationale.md#full-removal-simplifies-protocol-and-contract-review).\n\n## Stakeholder Responses \u0026 Statements\n\n[Stakeholder Responses \u0026 Statements \u0026rarr;](stakeholders.md)\n\n## Feedback \u0026 Reviews\n\n- [BigInt CHIP Issues](https://github.com/bitjson/bch-bigint/issues)\n- [`CHIP 2024-07 BigInt` - Bitcoin Cash Research](https://bitcoincashresearch.org/t/chip-2024-07-bigint-high-precision-arithmetic-for-bitcoin-cash/1356)\n\n## Acknowledgements\n\nThank you to the following contributors for reviewing and contributing improvements to this proposal, providing feedback, and promoting consensus among stakeholders:\n[Calin Culianu](https://github.com/cculianu), [bitcoincashautist](https://github.com/A60AB5450353F40E), [Andrew#128](https://gitlab.com/andrew-128), [Fernando Pelliccioni](https://gitlab.com/fpelliccioni), [Mathieu Geukens](https://github.com/mr-zwets), [Joshua Green](https://github.com/joshmg), [OPReturnCode](https://github.com/OPReturnCode), [Jeremy](https://bitcoincashpodcast.com/), [Kallisti.cash](https://kallisti.io), [Corbin Fraser](https://corbinfraser.com/), [imaginary_username](https://gitlab.com/im_uname), [John Nieri](https://gitlab.com/emergent-reasons), [Jonathan Silverblood](https://gitlab.com/monsterbitar), [Josh Ellithorpe](https://github.com/zquestz), [John Moriarty](https://x.com/BitcoinOutLoud), [minisatoshi](https://minisatoshi.cash/), [Andrew Groot](https://github.com/thesquaregroot), [Tom Zander](https://github.com/zander), [Rosco Kalis](https://github.com/rkalis), [Richard Brady](https://github.com/rnbrady).\n\n## Changelog\n\nThis section summarizes the evolution of this document.\n\n- **v1.1.1 – 2024-10-01** ([`d1406b69`](https://github.com/bitjson/bch-bigint/commit/d1406b6984c5528983a029c79111646e95286b8c))\n  - Add [Risk Assessment](risk-assessment.md)\n  - Expand [Rationale](rationale.md)\n  - Add [Evaluation of Alternatives](#evaluation-of-alternatives)\n- **v1.1.0 – 2024-08-28** ([`616a7a94`](https://github.com/bitjson/bch-bigint/commit/616a7a948dca97aef1126715aa6fe8b3edbe35f8))\n  - Remove the VM number length limit ([#1](https://github.com/bitjson/bch-bigint/issues/1))\n- **v1.0.0 – 2024-07-24** ([`b114c957`](https://github.com/bitjson/bch-bigint/commit/b114c95729e670f4b0780d4fd14590c35d281d77))\n  - Initial publication\n\n## Copyright\n\nThis document is placed in the public domain.\n","funding_links":[],"categories":["Discussion"],"sub_categories":["Previous consensus changes, May 2023:"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitjson%2Fbch-bigint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitjson%2Fbch-bigint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitjson%2Fbch-bigint/lists"}