Class: Sibit::Tx::Input
- Inherits:
-
Object
- Object
- Sibit::Tx::Input
- Defined in:
- lib/sibit/tx.rb
Overview
Transaction input.
- Author
Yegor Bugayenko (yegor256@gmail.com)
- Copyright
Copyright (c) 2019-2026 Yegor Bugayenko
- License
MIT
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#prev_script ⇒ Object
readonly
Returns the value of attribute prev_script.
-
#script_sig ⇒ Object
Returns the value of attribute script_sig.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#witness ⇒ Object
Returns the value of attribute witness.
Instance Method Summary collapse
-
#initialize(hash, index, script, key, value) ⇒ Input
constructor
A new instance of Input.
- #prev_out ⇒ Object
- #prev_out_index ⇒ Object
- #segwit? ⇒ Boolean
Constructor Details
#initialize(hash, index, script, key, value) ⇒ Input
Returns a new instance of Input.
75 76 77 78 79 80 81 82 83 |
# File 'lib/sibit/tx.rb', line 75 def initialize(hash, index, script, key, value) @hash = hash @index = index @prev_script = script @key = key @value = value @script_sig = '' @witness = [] end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
72 73 74 |
# File 'lib/sibit/tx.rb', line 72 def hash @hash end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
72 73 74 |
# File 'lib/sibit/tx.rb', line 72 def index @index end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
72 73 74 |
# File 'lib/sibit/tx.rb', line 72 def key @key end |
#prev_script ⇒ Object (readonly)
Returns the value of attribute prev_script.
72 73 74 |
# File 'lib/sibit/tx.rb', line 72 def prev_script @prev_script end |
#script_sig ⇒ Object
Returns the value of attribute script_sig.
73 74 75 |
# File 'lib/sibit/tx.rb', line 73 def script_sig @script_sig end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
72 73 74 |
# File 'lib/sibit/tx.rb', line 72 def value @value end |
#witness ⇒ Object
Returns the value of attribute witness.
73 74 75 |
# File 'lib/sibit/tx.rb', line 73 def witness @witness end |
Instance Method Details
#prev_out ⇒ Object
85 86 87 |
# File 'lib/sibit/tx.rb', line 85 def prev_out [@hash].pack('H*') end |
#prev_out_index ⇒ Object
89 90 91 |
# File 'lib/sibit/tx.rb', line 89 def prev_out_index @index end |
#segwit? ⇒ Boolean
93 94 95 96 |
# File 'lib/sibit/tx.rb', line 93 def segwit? bytes = [@prev_script].pack('H*').bytes bytes.length == 22 && bytes[0].zero? && bytes[1] == 20 end |