Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0107cd8
Update default VM target to BCH_2026
rkalis Oct 9, 2025
36b02bc
Update script limits & docs
rkalis Oct 9, 2025
45a975a
Use MockNetworkProvider in examples
rkalis Oct 9, 2025
b778131
Add do-while loop to grammar and AST builder
rkalis Oct 14, 2025
1576fa5
Add checks for final require statement to loop
rkalis Oct 14, 2025
92f2084
Add typechecking for do-while loop condition
rkalis Oct 14, 2025
e9b5827
Add TODO for OP_NOT OP_NOT <> '' optimisation
rkalis Oct 14, 2025
59f608a
Add compilation / code generation logic for do-while loops
rkalis Oct 14, 2025
8517d7f
Add number comparison negation optimisations + update release notes
rkalis Oct 16, 2025
1955959
Do not perform final-verify check inside loops
rkalis Oct 16, 2025
e45f428
Add loops to docs
rkalis Oct 16, 2025
1514d30
Bump version to 0.13.0-next.0
rkalis Oct 16, 2025
4b12a4d
Fix loop scope not being closed bug
rkalis Nov 13, 2025
251c933
Fix require statement detection inside loops and add tests for it
rkalis Nov 13, 2025
4414225
Rework console.log handling for loops + add tests
rkalis Nov 13, 2025
3e1851f
Update release notes
rkalis Nov 13, 2025
02a6732
Bump version to 0.13.0-next.1
rkalis Nov 13, 2025
e86391a
Fix tests
rkalis Nov 13, 2025
f3d3fd7
Fix spellcheck
rkalis Nov 13, 2025
0964b87
Merge remote-tracking branch 'origin/master' into next
rkalis Dec 16, 2025
e4dba7d
update next docs
mr-zwets Dec 31, 2025
45f6ee9
tweak next docs
mr-zwets Dec 31, 2025
4ede297
small spellfix
mr-zwets Jan 2, 2026
762db95
Merge branch 'next' into update-next-docs
rkalis Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions website/docs/compiler/script-limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@ Some of the limits below are hard BCH consensus rules, others are standardness r

## Contract-related limits

### Maximum contract size
### Maximum contract size (P2SH)

The Bitcoin Cash limits contract bytecode to **1,650 bytes** in the standardness rules. Transactions with contract bytecode won't be relayed by most nodes.
The Bitcoin Cash limits contract bytecode for P2SH outputs is **10,000 bytes** by the BCH consensus rules. Technically this limit is the 'maximum unlocking bytecode length' because for P2SH outputs the full script is provided in the **unlocking bytecode**.

While typical contracts stay well below this, complex contracts with extensive logic might need adjustments to fit within this constraint.
### Maximum contract size (P2S)

#### Modular contract design
The Bitcoin Cash limits contract bytecode for P2S outputs is **201 bytes** by the BCH consensus rules. Technically this limit is the 'maximum locking bytecode length' because for P2S outputs the script is provided directly in the **locking bytecode**.

To keep contracts within size limits, consider modular design. Splitting contract logic into smaller, independent components allows each function to be deployed separately, reducing transaction size. See [Contract Optimization](/docs/guides/optimization) for more details.

### NFT commitment length limit

NFT commitments can store up to 40 bytes of data as local state. If more data is needed, you can hash the full state and store only the hash in the commitment data. Later, when required, the full state must be provided and validated against the stored hash.
NFT commitments can store up to 128 bytes of data as local state. This 128-bytes limit on commitment length is of practical importance for contract authors, as workarounds are needed to keep more data in local state.

:::caution
The 40-bytes limit on commitment length is of great practical importance for contract authors. Workarounds are needed to keep more bytes of local state in smart contracts.
:::
If your local state grows larger than the allowed maximum, one option is to hash the full state and store only the hash in the commitment data. Later, when using the local state, the full state must be provided and validated against the stored state hash.

### Operation cost limit

Expand All @@ -47,7 +44,7 @@ function maxOperationCost(unlockingBytecodeLength) {

- Signature operation count (SigChecks): Limits the number of signature verifications (`OP_CHECKSIG`, `OP_CHECKDATASIG`) per transaction to ensure efficient validation.
- Hashing limit: Limits the number of hashing operations (`OP_SHA256`, `OP_HASH160`) allowed per transaction to prevent excessive resource usage.
- Stack element byte length: Each stack element has a maximum length of 10,000 bytes, affecting Pay-to-Script-Hash (P2SH) contracts.
- Stack element byte length: stack elements have a maximum length of 10,000 bytes.

## General transaction limits

Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/cashtokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The maximum size for a fungible token `amount` is the max signed 64-bit integer

### Non-Fungible Tokens

The `nft` info on a UTXO will only be present if the UTXO contains an NFT. The `nft` object has 2 properties: the `capability` and the `commitment`. The `commitment` is the data field for the NFT which can is allowed to be up to 40 bytes.
The `nft` info on a UTXO will only be present if the UTXO contains an NFT. The `nft` object has 2 properties: the `capability` and the `commitment`. The `commitment` is the data field for the NFT which can is allowed to be up to 128 bytes.

Capability `none` then refers to an immutable NFT where the commitment cannot be changed. The `mutable` capability means the `commitment` field can change over time, usually to contain smart contract state. Lastly the `minting` capability means that the NFT can create new NFTs from the same `category`.

Expand Down