ckb-script-error-codes

This is a wiki to collect documentations about error codes returned by various ckb scripts.

View the Project on GitHub

TYPE_ID System Script Error Codes

This is the built-in TYPE_ID system script, which must be referenced by type hash. The code hash is just “TYPE_ID” in hex encoded by ASCII. The script is not executed by VM, and the source code in the CKB Rust implementation can be found here.

-1

ERROR_ARGS

TYPE_ID script should only accept one argument, which is the hash of all inputs when creating the cell.

-2

ERROR_TOO_MANY_CELLS

There could be at most one input cell and one output cell with current TYPE_ID script group.

-3

ERROR_INVALID_INPUT_HASH

If there’s only one output cell with current TYPE_ID script group and no input cell, we are creating such a cell. We also need to validate that the first argument matches the hash of following items concatenated:

  1. First CellInput of the transaction.
  2. Index of the first output cell in current script group.

The the hash does not match, the verification fails with error ERROR_INVALID_INPUT_HASH (-3).