Module: Bitcoin::PSBT

Defined in:
lib/bitcoin/psbt.rb,
lib/bitcoin/psbt/tx.rb,
lib/bitcoin/psbt/input.rb,
lib/bitcoin/psbt/output.rb,
lib/bitcoin/psbt/hd_key_path.rb

Defined Under Namespace

Classes: HDKeyPath, Input, Output, Tx

Constant Summary collapse

PSBT_MAGIC_BYTES =

constants for PSBT

0x70736274
PSBT_GLOBAL_TYPES =
{unsigned_tx: 0x00}
PSBT_IN_TYPES =
{non_witness_utxo: 0x00, witness_utxo: 0x01, partial_sig: 0x02,
sighash: 0x03, redeem_script: 0x04, witness_script: 0x05,
bip32_derivation: 0x06, script_sig: 0x07, script_witness: 0x08}
PSBT_OUT_TYPES =
{redeem_script: 0x00, witness_script: 0x01, bip32_derivation: 0x02}
PSBT_SEPARATOR =
0x00

Class Method Summary collapse

Class Method Details

.serialize_to_vector(key_type, key: nil, value: nil) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/bitcoin/psbt.rb', line 23

def self.serialize_to_vector(key_type, key: nil, value: nil)
  key_len = key_type.itb.bytesize
  key_len += key.bytesize if key
  s = Bitcoin.pack_var_int(key_len) << Bitcoin.pack_var_int(key_type)
  s << key if key
  s << Bitcoin.pack_var_int(value.bytesize) << value
  s
end