Class: Bitcoin::Message::Tx
Overview
tx message bitcoin.org/en/developer-reference#tx
Constant Summary collapse
- COMMAND =
'tx'
Instance Attribute Summary collapse
-
#tx ⇒ Object
Returns the value of attribute tx.
-
#use_segwit ⇒ Object
Returns the value of attribute use_segwit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tx, use_segwit = false) ⇒ Tx
constructor
A new instance of Tx.
- #to_payload ⇒ Object
Methods inherited from Base
Methods included from Util
#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hkdf_sha256, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #tagged_hash, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?
Methods included from HexConverter
Constructor Details
#initialize(tx, use_segwit = false) ⇒ Tx
Returns a new instance of Tx.
13 14 15 16 |
# File 'lib/bitcoin/message/tx.rb', line 13 def initialize(tx, use_segwit = false) @tx = tx @use_segwit = use_segwit end |
Instance Attribute Details
#tx ⇒ Object
Returns the value of attribute tx.
10 11 12 |
# File 'lib/bitcoin/message/tx.rb', line 10 def tx @tx end |
#use_segwit ⇒ Object
Returns the value of attribute use_segwit.
11 12 13 |
# File 'lib/bitcoin/message/tx.rb', line 11 def use_segwit @use_segwit end |
Class Method Details
.parse_from_payload(payload) ⇒ Object
18 19 20 21 |
# File 'lib/bitcoin/message/tx.rb', line 18 def self.parse_from_payload(payload) tx = Bitcoin::Tx.parse_from_payload(payload, strict: true) new(tx, tx.witness?) end |
Instance Method Details
#to_payload ⇒ Object
23 24 25 |
# File 'lib/bitcoin/message/tx.rb', line 23 def to_payload use_segwit ? tx.to_payload : tx.serialize_old_format end |