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
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,10 @@ To keep contracts within size limits, consider modular design. Splitting contrac
22
22
23
23
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.
24
24
25
+
:::caution
26
+
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.
27
+
:::
28
+
25
29
### Operation cost limit
26
30
27
31
Bitcoin Cash enforces an operation cost limit (op-cost) per transaction input. This determines the computational budget available for operations in a contract. The op-cost is based on script length: longer input scripts allow for a higher compute budget.
@@ -70,6 +74,16 @@ function calculateDust(outputSize: number): number {
70
74
Before CashTokens `546` bytes was often used as good default value, however with tokenData outputs have become larger in size.
71
75
For ease of development, it is standard practice to use 1,000 satoshis as dust to outputs. Provably unspendable outputs (OP_RETURN outputs) are exempt from this rule.
72
76
77
+
### Output Standardness
78
+
79
+
Bitcoin Cash only allows a few types of `lockingbytecode` scripts for outputs in the normal network relay rules. These are called 'standard outputs', contrasted to 'non-standard outputs' which cause the transaction not to relay on the network.
80
+
81
+
There's 4 types of standard output types: `P2PKH`, `P2SH` (which includes `P2SH20` & `P2SH32`), `P2MS` and `OP_RETURN` data-outputs. For more details see the [standard outputs documentation][standard-outputs-docs].
82
+
83
+
:::caution
84
+
The `lockingbytecode` standardness rules can be important for smart contract developers, and is why CashScript has helpers like `LockingBytecodeP2PKH`, `LockingBytecodeP2SH32` and `LockingBytecodeNullData`.
85
+
:::
86
+
73
87
## Summary table
74
88
75
89
| Limit type | Constraint |
@@ -81,7 +95,9 @@ For ease of development, it is standard practice to use 1,000 satoshis as dust t
81
95
| Max transaction size | 100,000 bytes |
82
96
| Max OP_RETURN data size | 220 bytes data payload |
83
97
| Dust threshold | based on output size (commonly 1,000 sats is used as dust) |
For further details on transaction validation and standardness rules, see the [documentation on BCH transaction validation](https://documentation.cash/protocol/blockchain/transaction-validation.html).
0 commit comments