3.1 KiB
3.1 KiB
Shared Libraries
palladiumconsensus
The purpose of this library is to make the verification functionality that is critical to Palladium's consensus available to other applications, e.g. to language bindings.
API
The interface is defined in the C header palladiumconsensus.h located in src/script/palladiumconsensus.h.
Version
palladiumconsensus_version returns an unsigned int with the API version (currently 1).
Script Validation
palladiumconsensus_verify_script returns an int with the status of the verification. It will be 1 if the input script correctly spends the previous output scriptPubKey.
Parameters
const unsigned char *scriptPubKey- The previous output script that encumbers spending.unsigned int scriptPubKeyLen- The number of bytes for thescriptPubKey.const unsigned char *txTo- The transaction with the input that is spending the previous output.unsigned int txToLen- The number of bytes for thetxTo.unsigned int nIn- The index of the input intxTothat spends thescriptPubKey.unsigned int flags- The script validation flags (see below).palladiumconsensus_error* err- Will have the error/success code for the operation (see below).
Script Flags
palladiumconsensus_SCRIPT_FLAGS_VERIFY_NONEpalladiumconsensus_SCRIPT_FLAGS_VERIFY_P2SH- Evaluate P2SH (BIP16) subscriptspalladiumconsensus_SCRIPT_FLAGS_VERIFY_DERSIG- Enforce strict DER (BIP66) compliancepalladiumconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY- Enforce NULLDUMMY (BIP147)palladiumconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY- Enable CHECKLOCKTIMEVERIFY (BIP65)palladiumconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY- Enable CHECKSEQUENCEVERIFY (BIP112)palladiumconsensus_SCRIPT_FLAGS_VERIFY_WITNESS- Enable WITNESS (BIP141)
Errors
palladiumconsensus_ERR_OK- No errors with input parameters (see the return value ofpalladiumconsensus_verify_scriptfor the verification status)palladiumconsensus_ERR_TX_INDEX- An invalid index fortxTopalladiumconsensus_ERR_TX_SIZE_MISMATCH-txToLendid not match with the size oftxTopalladiumconsensus_ERR_DESERIALIZE- An error deserializingtxTopalladiumconsensus_ERR_AMOUNT_REQUIRED- Input amount is required if WITNESS is used
Example Implementations
- NPalladium (.NET Bindings)
- node-libpalladiumconsensus (Node.js Bindings)
- java-libpalladiumconsensus (Java Bindings)
- palladiumconsensus-php (PHP Bindings)