Class: Bitcoin::Taproot::CustomDepthBuilder
- Inherits:
-
SimpleBuilder
- Object
- SimpleBuilder
- Bitcoin::Taproot::CustomDepthBuilder
- Defined in:
- lib/bitcoin/taproot/custom_depth_builder.rb
Overview
A class that takes the script tree configuration as a nested array and constructs the Taproot output. TODO WIP
Constant Summary
Constants included from Opcodes
Opcodes::DUPLICATE_KEY, Opcodes::NAME_MAP, Opcodes::OPCODES_MAP, Opcodes::OP_0, Opcodes::OP_0NOTEQUAL, Opcodes::OP_1, Opcodes::OP_10, Opcodes::OP_11, Opcodes::OP_12, Opcodes::OP_13, Opcodes::OP_14, Opcodes::OP_15, Opcodes::OP_16, Opcodes::OP_1ADD, Opcodes::OP_1NEGATE, Opcodes::OP_1SUB, Opcodes::OP_2, Opcodes::OP_2DIV, Opcodes::OP_2DROP, Opcodes::OP_2DUP, Opcodes::OP_2MUL, Opcodes::OP_2OVER, Opcodes::OP_2ROT, Opcodes::OP_2SWAP, Opcodes::OP_3, Opcodes::OP_3DUP, Opcodes::OP_4, Opcodes::OP_5, Opcodes::OP_6, Opcodes::OP_7, Opcodes::OP_8, Opcodes::OP_9, Opcodes::OP_ABS, Opcodes::OP_ADD, Opcodes::OP_AND, Opcodes::OP_BOOLAND, Opcodes::OP_BOOLOR, Opcodes::OP_CAT, Opcodes::OP_CHECKMULTISIG, Opcodes::OP_CHECKMULTISIGVERIFY, Opcodes::OP_CHECKSIG, Opcodes::OP_CHECKSIGADD, Opcodes::OP_CHECKSIGVERIFY, Opcodes::OP_CODESEPARATOR, Opcodes::OP_DEPTH, Opcodes::OP_DIV, Opcodes::OP_DROP, Opcodes::OP_DUP, Opcodes::OP_ELSE, Opcodes::OP_ENDIF, Opcodes::OP_EQUAL, Opcodes::OP_EQUALVERIFY, Opcodes::OP_FROMALTSTACK, Opcodes::OP_GREATERTHAN, Opcodes::OP_GREATERTHANOREQUAL, Opcodes::OP_HASH160, Opcodes::OP_HASH256, Opcodes::OP_IF, Opcodes::OP_IFDUP, Opcodes::OP_INVALIDOPCODE, Opcodes::OP_INVERT, Opcodes::OP_LEFT, Opcodes::OP_LESSTHAN, Opcodes::OP_LESSTHANOREQUAL, Opcodes::OP_LSHIFT, Opcodes::OP_MAX, Opcodes::OP_MIN, Opcodes::OP_MOD, Opcodes::OP_MUL, Opcodes::OP_NEGATE, Opcodes::OP_NIP, Opcodes::OP_NOP, Opcodes::OP_NOP1, Opcodes::OP_NOP10, Opcodes::OP_NOP2, Opcodes::OP_NOP3, Opcodes::OP_NOP4, Opcodes::OP_NOP5, Opcodes::OP_NOP6, Opcodes::OP_NOP7, Opcodes::OP_NOP8, Opcodes::OP_NOP9, Opcodes::OP_NOT, Opcodes::OP_NOTIF, Opcodes::OP_NUMEQUAL, Opcodes::OP_NUMEQUALVERIFY, Opcodes::OP_NUMNOTEQUAL, Opcodes::OP_OR, Opcodes::OP_OVER, Opcodes::OP_PICK, Opcodes::OP_PUBKEY, Opcodes::OP_PUBKEYHASH, Opcodes::OP_PUSHDATA1, Opcodes::OP_PUSHDATA2, Opcodes::OP_PUSHDATA4, Opcodes::OP_RESERVED, Opcodes::OP_RESERVED1, Opcodes::OP_RESERVED2, Opcodes::OP_RETURN, Opcodes::OP_RIGHT, Opcodes::OP_RIPEMD160, Opcodes::OP_ROLL, Opcodes::OP_ROT, Opcodes::OP_RSHIFT, Opcodes::OP_SHA1, Opcodes::OP_SHA256, Opcodes::OP_SIZE, Opcodes::OP_SUB, Opcodes::OP_SUBSTR, Opcodes::OP_SUCCESSES, Opcodes::OP_SWAP, Opcodes::OP_TOALTSTACK, Opcodes::OP_TUCK, Opcodes::OP_VER, Opcodes::OP_VERIF, Opcodes::OP_VERIFY, Opcodes::OP_VERNOTIF, Opcodes::OP_WITHIN, Opcodes::OP_XOR
Instance Attribute Summary collapse
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Attributes inherited from SimpleBuilder
Instance Method Summary collapse
- #add_branch(leaf1, leaf2 = nil) ⇒ Object
- #add_leaf(leaf) ⇒ Object
- #control_block(leaf) ⇒ Object
- #inclusion_proof(leaf) ⇒ Object
-
#initialize(internal_key, tree) ⇒ Bitcoin::Taproot::CustomDepthBuilder
constructor
Constructor.
Methods inherited from SimpleBuilder
#build, #tweak_private_key, #tweak_public_key
Methods included from Opcodes
defined?, name_to_opcode, op_success?, opcode_to_name, opcode_to_small_int, small_int_to_opcode
Constructor Details
#initialize(internal_key, tree) ⇒ Bitcoin::Taproot::CustomDepthBuilder
Constructor
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 13 def initialize(internal_key, tree) super(internal_key, []) raise ArgumentError, "tree must be an array." unless tree.is_a?(Array) raise ArgumentError, "tree must be binary tree." unless tree.length == 2 tree.each do |item| unless item.is_a?(Array) || item.is_a?(Bitcoin::Taproot::LeafNode) raise ArgumentError, "tree must consist of either an array or LeafNode." end raise ArgumentError, "tree must be binary tree." if item.is_a?(Array) && item.length != 2 end @tree = tree end |
Instance Attribute Details
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
7 8 9 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 7 def tree @tree end |
Instance Method Details
#add_branch(leaf1, leaf2 = nil) ⇒ Object
30 31 32 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 30 def add_branch(leaf1, leaf2 = nil) raise NotImplementedError end |
#add_leaf(leaf) ⇒ Object
26 27 28 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 26 def add_leaf(leaf) raise NotImplementedError end |
#control_block(leaf) ⇒ Object
34 35 36 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 34 def control_block(leaf) raise NotImplementedError # TODO end |
#inclusion_proof(leaf) ⇒ Object
38 39 40 |
# File 'lib/bitcoin/taproot/custom_depth_builder.rb', line 38 def inclusion_proof(leaf) raise NotImplementedError # TODO end |