cashscript icon indicating copy to clipboard operation
cashscript copied to clipboard

add P2S support (2026 network upgrade)

Open mr-zwets opened this issue 4 months ago • 2 comments

There is a proposal to allow for standard P2S outputs on BCH as part of the 2026 network upgrade.

This proposal makes Pay to Script (P2S) outputs standard and increases the length limits on token commitments and standard unlocking bytecode.

We could add an extra p2s option to a contract's addressType although it is technically not an address type.

new Contract(
  artifact: Artifact,
  constructorArgs: ConstructorArgument[],
  options? : {
    provider: NetworkProvider,
    addressType: 'p2sh20' | 'p2sh32',
  }
)

We could also make P2S part of the artifact and add it as a compiler option, but I don't think it would change anything about the artifact 's compiled lockingbytecode

mr-zwets avatar Aug 17 '25 06:08 mr-zwets

similar to the idea of #292 to make provider a required option, the addressType might have to become a required option so people have to be aware when the pick their addresstype

mr-zwets avatar Aug 17 '25 07:08 mr-zwets

For the changes to the contract and nft limits:

Token Commitment Length

The limit on maximum length of token commitments is raised from 40 bytes to 128 bytes. See Rationale: Selection of Maximum Token Commitment Length.

Unlocking Bytecode Length

The limit on maximum standard input bytecode length (A.K.A. MAX_TX_IN_SCRIPT_SIG_SIZE – 1,650 bytes) is removed such that the maximum unlocking bytecode length is equal for both standard and consensus validation: 10,000 bytes (A.K.A. MAX_SCRIPT_SIZE). See Rationale: Unification of Standard and Consensus Unlocking Bytecode Length.

mr-zwets avatar Aug 18 '25 07:08 mr-zwets