Documentation ¶
Index ¶
- Constants
- Variables
- func PredicateAlwaysFalse() []byte
- func PredicateAlwaysTrue() []byte
- func PredicateArgumentEmpty() []byte
- func PredicateArgumentPayToPublicKeyHash(sig []byte, sigScheme byte, pubKey []byte) []byte
- func PredicateArgumentPayToPublicKeyHashDefault(sig []byte, pubKey []byte) []byte
- func PredicatePayToPublicKeyHash(hashAlg byte, pubKeyHash []byte, sigScheme byte) []byte
- func PredicatePayToPublicKeyHashDefault(pubKeyHash []byte) []byte
- func RunScript(predicateArgument []byte, bearerPredicate []byte, sigData []byte) error
Constants ¶
const ( OpDup = 0x76 OpHash = 0xa8 OpPushHash = 0x4f OpPushPubKey = 0x55 OpPushSig = 0x54 OpCheckSig = 0xac OpEqual = 0x87 OpVerify = 0x69 OpPushBool = 0x51 )
const ( HashAlgSha256 = 0x01 HashAlgSha512 = 0x02 BoolFalse = 0x00 BoolTrue = 0x01 SigSchemeSecp256k1 = 0x01 )
const MaxScriptBytes = 65536
const StartByte = 0x53
Variables ¶
Functions ¶
func PredicateAlwaysFalse ¶
func PredicateAlwaysFalse() []byte
PredicateAlwaysFalse is a predicate that evaluates to false
func PredicateAlwaysTrue ¶
func PredicateAlwaysTrue() []byte
PredicateAlwaysTrue is a predicate that evaluates to true with an empty argument.
func PredicateArgumentEmpty ¶
func PredicateArgumentEmpty() []byte
PredicateArgumentEmpty predicate argument for PredicateAlwaysTrue
func PredicateArgumentPayToPublicKeyHash ¶
PredicateArgumentPayToPublicKeyHash creates argument for pay to public key hash predicate.
func PredicateArgumentPayToPublicKeyHashDefault ¶
PredicateArgumentPayToPublicKeyHashDefault same as PredicateArgumentPayToPublicKeyHash(sig, secp256k1, pubkey)
func PredicatePayToPublicKeyHash ¶
PredicatePayToPublicKeyHash is a predicate that evaluates true if a valid signature and public key is given as arguments
func PredicatePayToPublicKeyHashDefault ¶
PredicatePayToPublicKeyHashDefault same as PredicatePayToPublicKeyHash(sha256, pubkeyHash, secp256k1)
func RunScript ¶
RunScript executes the given script. If the script contains OpCheckSig opCode then correct sigData must be supplied. The script is considered valid if after execution there's only one TRUE value on the stack, otherwise error is returned.
An example P2PKH script format: BearerPredicate: [Dup, Hash <SHA256>, PushHash <SHA256> <32 bytes>, Equal, Verify, CheckSig <secp256k1>] PredicateArgument: [PushSig <secp256k1> <65 bytes>, PushPubKey <secp256k1> <33 bytes>]
Same example with byte encoding BearerPredicate: [0x53, 0x76, 0xa8, 0x01, 0x4f, 0x01, <32 bytes>, 0x87, 0x69, 0xac, 0x01] PredicateArgument: [0x53, 0x54, 0x01, <65 bytes>, 0x55, 0x01, <33 bytes>]
Types ¶
This section is empty.