Skip to main content

Anyone Can Pay

The Anyone-Can-Pay is a Lock Script that enables users to send any amount of CKB or sUDT to a Cell without the traditional minimum 61 CKBytes requirement. It is particularly useful for small-value token transfers and introduces optional minimum transfer thresholds to mitigate potential DDoS attacks from spam micro-transactions.

How It Works

The Anyone-Can-Pay Lock Script extends the default secp256k1-blake2b-sighash-all lock and supports two unlocking modes:

  1. Signature-Based Unlocking: If a valid signature matching the lock’s public key hash is provided, the Cell behaves like a normal one and can be spent freely by the owner.

  2. Non-Signature Unlocking (Anyone Can Pay): If no signature is provided, the lock allows anyone to add CKB or UDT to the cell, subject to strict validation rules:

    • Only one input and one output Cell are allowed per unique Lock + Type Script pair.
    • The CKB and UDT in the output must not be less than those in the input.
    • Optional minimum thresholds (e.g., 10^x shannons or UDT base units) must be met if specified.
    • Cells with Type Scripts must follow the sUDT format (≥16 bytes of data).
    • Prevents unauthorized merging or splitting of Anyone-Can-Pay Cells to avoid storage bloat and fee inefficiencies.

The Lock Script uses an argument format like <public key hash> <CKByte minimum> <UDT minimum>, allowing the Cell owner to configure minimum acceptable deposits. This design offers a secure, flexible way to support micro-transactions on CKB without overburdening the network.

Reference RFC

Deployment

  • Mainnet
parametervalue
code_hash0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354
hash_typetype
tx_hash0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d
index0x0
dep_typedep_group
  • Testnet
parametervalue
code_hash0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356
hash_typetype
tx_hash0xec26b0f85ed839ece5f11c4c4e837ec359f5adc4420410f6453b1f6b60fb96a6
index0x0
dep_typedep_group