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:
-
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.
-
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.
Deployment
- Mainnet
parameter | value |
---|---|
code_hash | 0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354 |
hash_type | type |
tx_hash | 0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d |
index | 0x0 |
dep_type | dep_group |
- Testnet
parameter | value |
---|---|
code_hash | 0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356 |
hash_type | type |
tx_hash | 0xec26b0f85ed839ece5f11c4c4e837ec359f5adc4420410f6453b1f6b60fb96a6 |
index | 0x0 |
dep_type | dep_group |