bitcoin script stack

alias for #to_pubkey_script_sig alias for #to_pubkey_script_sig generate input script sig spending a pubkey output with given signature and pubkey.returns a #raw binary script sig of the form: generate input script sig spending a pubkey output with given signature and pubkey.returns a #raw binary script sig of the form: generate pubkey tx script for given pubkey.returns a #raw binary script of the form: generate pubkey tx script for given pubkey.returns a #raw binary script of the form: generate p2sh output script for given p2sh hash160.returns a #raw binary script of the form: generate p2sh output script for given p2sh hash160.returns a #raw binary script of the form: generate input script sig spending a p2sh-multisig output script.returns a #raw binary script sig of the form: generate input script sig spending a p2sh-multisig output script.returns a #raw binary script sig of the form: generate p2sh multisig output script for given args.

returns the p2sh output script, and the redeem script needed to spend it.see #to_multisig_script for the redeem script, and #to_p2sh_script for the p2sh script.generate p2sh multisig output script for given args.generate OP_RETURN output script with given data.returns a #raw binary script of the form: generate OP_RETURN output script with given data.returns a #raw binary script of the form: generate input script sig spending a multisig output script.returns a #raw binary script sig of the form: generate input script sig spending a multisig output script.returns a #raw binary script sig of the form: generate multisig output script for given pubkeys, expecting m signatures.returns a #raw binary script of the form: generate multisig output script for given pubkeys, expecting m signatures.returns a #raw binary script of the form: generate hash160 tx for given address.returns a #raw binary script of the form: generate hash160 or p2sh output script, depending on the #type of the given address.

bytes is typically input_script + output_script Loosely correlates with IsLowDERSignature() from interpreter.cpp Loosely correlates with IsLowDERSignature() from interpreter.cpp Loosely correlates with IsLowDERSignature() from interpreter.cpp Loosely correlates with IsDERSignature() from interpreter.cpp Loosely correlates with IsDERSignature() from interpreter.cpp Loosely correlates with IsDERSignature() from interpreter.cpp script object of a string representation script object of a string representation Converts OP_{0,1,2,…,16} into 0, 1, 2, …, 16.Returns nil for other opcodes.Converts OP_{0,1,2,…,16} into 0, 1, 2, …, 16.Compares two arrays of bytes Compares two arrays of bytes Compares two arrays of bytes #raw script binary of a string representation #raw script binary of a string representation take a multisig script sig (or p2sh multisig script sig) and add another signature to it after the OP_0.

Used to sign a tx by multiple parties.Signatures must be in the same order as the pubkeys in the output script being redeemed.take a multisig script sig (or p2sh multisig script sig) and add another signature to it after the OP_0.Adds opcode (OP_0, OP_1, … OP_CHECKSIG etc.)Adds binary string as pushdata.Pushdata will be encoded in the most compact form (unless the string contains internal info about serialization that's added by Script class) Returns self.get single address, or first for multisig script get all addresses this script corresponds to (if possible) get the hash160 for this hash160 or pubkey script get the hash160 address for this hash160 script get the pubkey addresses for this multisig script get the public keys for this multisig script get the data possibly included in an OP_RETURN script get the public key for this pubkey script get the pubkey address for this pubkey script get the inner p2sh script is this a hash160 (address) script is this a multisig script is this an #op_return script Alias for: is_pay_to_script_hash?

is this a :script_hash (pay-to-script-hash/p2sh) script?Also aliased as: is_p2sh?is this a pubkey script Also aliased as: is_send_to_ip?Verify the script is only pushing data onto the #stack Alias for: is_pubkey?check if script is in one of the recognized standard formats An empty array of bytes is pushed onto the #stack.The number 1 is pushed onto the #stack.Same as OP_TRUE 1 is added to the input.The number -1 is pushed onto the #stack.1 is subtracted from the input.The input is divided by 2.Removes the top two #stack items.Duplicates the top two #stack items.The input is multiplied by 2.Copies the pair of items two spaces back in the #stack to the front.The fifth and sixth items back are moved to the top of the #stack.Swaps the top two pairs of items.Duplicates the top three #stack items.The input is made positive.a is added to b. If both a and b are not 0, the output is 1.If a or b is not 0, the output is 1.Otherwise 0. do a CHECKMULTISIG operation on the current #stack, asking check_callback to do the actual signature verification.

CHECKMULTISIG does a m-of-n signatures verification on scripts of the form: see en.bitcoin.it/wiki/BIP_0011 for details./bitcoin/bitcoin/blob/master/src/script.cpp#L931 TODO: validate signature order TODO: take global opcode count Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward.do a CHECKSIG operation on the current #stack, asking check_callback to do the actual signature verification.This is used by Protocol::Tx#verify_input_signature Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.All of the signature checking words will only match signatures to the data after the most recently-executed OP_CODESEPARATOR.Puts the number of #stack items onto the #stack.Removes the top #stack item.Duplicates the top #stack item.If the preceding OP_IF or OP_NOTIF or OP_ELSE was not executed then these statements are and if the preceding OP_IF or OP_NOTIF or OP_ELSE was executed then these statements are not.Ends an if/else block.

Returns 1 if the inputs are exactly equal, 0 otherwise.Same as OP_EQUAL, but runs OP_VERIFY afterward.Puts the input onto the top of the main #stack.Removes it from the alt #stack.Returns 1 if a is greater than b, 0 otherwise.Returns 1 if a is greater than or equal to b, 0 otherwise.The input is hashed twice: first with SHA-256 and then with RIPEMD-160.The input is hashed two times with SHA-256.If the top #stack value is not 0, the statements are executed.The top #stack value is removed.If the input is true, duplicate it.Returns 1 if a is less than b, 0 otherwise.Returns 1 if a is less than or equal to b, 0 otherwise.Returns the larger of a and b. Returns the smaller of a and b.The sign of the input is flipped.Removes the second-to-top #stack item.Does nothing If the input is 0 or 1, it is flipped.Otherwise the output will be 0.If the top #stack value is 0, the statements are executed.Returns 1 if the numbers are equal, 0 otherwise.Same as OP_NUMEQUAL, but runs OP_VERIFY afterward.

Returns 1 if the numbers are not equal, 0 otherwise.Copies the second-to-top #stack item to the top.The item n back in the #stack is copied to the top.Marks transaction as #invalid.The input is hashed using RIPEMD-160.The item n back in the #stack is moved to the top.The top three items on the #stack are rotated to the left.The input is hashed using SHA-1.The input is hashed using SHA-256.Returns the length of the input string.b is subtracted from a.The top two items on the #stack are swapped.Puts the input onto the top of the alt #stack.Removes it from the main #stack.The item at the top of the #stack is copied and inserted before the second-to-top item.Transaction is #invalid unless occuring in an unexecuted OP_IF branch Marks transaction as #invalid if top #stack value is not true.True is removed, but false is not.Returns 1 if x is within the specified range (left-inclusive), 0 otherwise.#parse #raw script #pay_to_script_hash: en.bitcoin.it/wiki/BIP_0016
{ OP_CHECKSIG} | OP_HASH160 OP_EQUAL Make sure opcodes used to push data match their intended length ranges #run the script.