Class: Katapaty::TxDecode
- Inherits:
-
Object
- Object
- Katapaty::TxDecode
- Defined in:
- lib/katapaty/tx_decode.rb
Defined Under Namespace
Classes: InvalidOpReturn, InvalidOutput, MultisigUnsupported, UndefinedBehavior
Constant Summary collapse
- DEFAULT_PREFIX =
'CNTRPRTY'- OP_RETURN_PARTS =
/^OP_RETURN ([a-z0-9]+)$/- P2PKH_PARTS =
/^OP_DUP OP_HASH160 ([a-z0-9]+) OP_EQUALVERIFY OP_CHECKSIG$/- OP_MULTISIG_PARTS =
/^[12] ([a-z0-9 ]+) ([23]) OP_CHECKMULTISIG$/
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#decrypt_key ⇒ Object
Returns the value of attribute decrypt_key.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#receiver_addr ⇒ Object
Returns the value of attribute receiver_addr.
-
#sender_addr ⇒ Object
Returns the value of attribute sender_addr.
Instance Method Summary collapse
- #decrypt(chunk) ⇒ Object
-
#initialize(tx, options = {}) ⇒ TxDecode
constructor
A new instance of TxDecode.
Constructor Details
#initialize(tx, options = {}) ⇒ TxDecode
Returns a new instance of TxDecode.
22 23 24 25 26 27 28 |
# File 'lib/katapaty/tx_decode.rb', line 22 def initialize(tx, = {}) @prefix = [:prefix] || DEFAULT_PREFIX @decrypt_key = [:decrypt_key] || [tx.inputs[0].prev_out.reverse_hth].pack('H*') parse! (tx.respond_to? :outputs) ? tx.outputs.collect{|out| out.parsed_script.to_string } : tx end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
20 21 22 |
# File 'lib/katapaty/tx_decode.rb', line 20 def data @data end |
#decrypt_key ⇒ Object
Returns the value of attribute decrypt_key.
20 21 22 |
# File 'lib/katapaty/tx_decode.rb', line 20 def decrypt_key @decrypt_key end |
#prefix ⇒ Object
Returns the value of attribute prefix.
20 21 22 |
# File 'lib/katapaty/tx_decode.rb', line 20 def prefix @prefix end |
#receiver_addr ⇒ Object
Returns the value of attribute receiver_addr.
20 21 22 |
# File 'lib/katapaty/tx_decode.rb', line 20 def receiver_addr @receiver_addr end |
#sender_addr ⇒ Object
Returns the value of attribute sender_addr.
20 21 22 |
# File 'lib/katapaty/tx_decode.rb', line 20 def sender_addr @sender_addr end |
Instance Method Details
#decrypt(chunk) ⇒ Object
30 31 32 |
# File 'lib/katapaty/tx_decode.rb', line 30 def decrypt(chunk) RC4.new(decrypt_key).decrypt chunk end |