You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/compiler/script-limits.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,23 +11,20 @@ Some of the limits below are hard BCH consensus rules, others are standardness r
11
11
12
12
## Contract-related limits
13
13
14
-
### Maximum contract size
14
+
### Maximum contract size (P2SH)
15
15
16
-
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.
16
+
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**.
17
17
18
-
While typical contracts stay well below this, complex contracts with extensive logic might need adjustments to fit within this constraint.
18
+
### Maximum contract size (P2S)
19
19
20
-
#### Modular contract design
20
+
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 direclty in the **locking bytecode**.
21
21
22
-
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.
23
22
24
23
### NFT commitment length limit
25
24
26
-
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.
25
+
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.
27
26
28
-
:::caution
29
-
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.
30
-
:::
27
+
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.
Copy file name to clipboardExpand all lines: website/docs/guides/cashtokens.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ The maximum size for a fungible token `amount` is the max signed 64-bit integer
38
38
39
39
### Non-Fungible Tokens
40
40
41
-
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.
41
+
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.
42
42
43
43
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`.
0 commit comments