Skip to content

Instantly share code, notes, and snippets.

@icostan
Created November 14, 2018 08:09
Show Gist options
  • Save icostan/c7fd040710213423aa5f81bf330680a0 to your computer and use it in GitHub Desktop.
Save icostan/c7fd040710213423aa5f81bf330680a0 to your computer and use it in GitHub Desktop.
Input = Struct.new :value, :tx_hash, :index, :unlock_script, :sequence do
def initialize(value, tx_hash, index, unlock_script: '', sequence: 0xfffffffff)
super value, tx_hash, index, unlock_script, sequence
end
def serialize
script_hex = script_to_hex(unlock_script)
hash_to_hex(tx_hash) + int_to_hex(index) +
byte_to_hex(hex_size(script_hex)) + script_hex + int_to_hex(sequence)
end
end
input = Input.new 23_990_000, 'ea8a64e122304637e8da016836e9afd59fc1179dfa15affc40d63b34e7db0cec', 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment