Open AAweidai opened 2 years ago
import util
from test_framework.address import program_to_witness, key_to_p2wpkh
from test_framework.key import ECKey
from test_framework.messages import CTxInWitness, COutPoint, CTransaction, CTxIn, CTxOut
from test_framework.script import TapTree, TapLeaf, TaprootSignatureHash, SIGHASH_ALL_TAPROOT, Tapbranch
from test_framework.musig import generate_musig_key
from pprint import pprint
def generate_bip340_key_pair(secret=None):
"""Convenience function to generate a BIP0340 private-public key pair."""
if secret is None:
d = ECKey()
d.generate()
else:
d = ECKey().set(secret)
P = d.get_pubkey()
if P.get_y() % 2 != 0:
d.negate()
P.negate()
return d, P
# generate alice bob charlie key
privkey_alice, pubkey_alice = generate_bip340_key_pair(
secret=103910053441657220738925612114654039920823302334302261834756476233133311987138)
privkey_bob, pubkey_bob = generate_bip340_key_pair(
secret=75573449985348711764142460376289265944117193680909672902170333608986796225238)
privkey_charlie, pubkey_charlie = generate_bip340_key_pair(
secret=33705509085456474265534912245246680268484766969648186791871278745425848684352)
segwit_version = 1
pubkey_charlie_bytes = pubkey_charlie.get_bytes()
segwit_address_charlie = program_to_witness(segwit_version, pubkey_charlie_bytes)
segwit_address_script_pubkey_charlie = "5120" + pubkey_charlie_bytes.hex()
print("charlie Script pubkey: ", segwit_address_script_pubkey_charlie)
print("charlie Regtest address format: ", segwit_address_charlie)
print("charlie Mainnet address format: ", program_to_witness(segwit_version, pubkey_charlie_bytes, main=True), "\n")
# Start node
test = util.TestWrapper()
test.setup()
node = test.nodes[0]
tx = node.generate_and_send_coins(segwit_address_charlie)
tx_hex = tx.serialize().hex()
print("init tx: ", tx_hex, "\n")
c_map, pubkey_agg = generate_musig_key([pubkey_alice, pubkey_bob, pubkey_charlie])
if pubkey_agg.get_y() % 2 != 0:
pubkey_agg.negate()
# Construct tapleaves
tapleafA = TapLeaf().construct_pk(pubkey_alice)
tapleafB = TapLeaf().construct_pk(pubkey_bob)
tapleafC = TapLeaf().construct_pk(pubkey_charlie)
# Construct taptree nodes.
tapbranchAB = Tapbranch(tapleafA, tapleafB)
tapbranchABC = Tapbranch(tapbranchAB, tapleafC)
# Construct the taptree.
taptree = TapTree(key=pubkey_agg, root=tapbranchABC)
segwit_v1_script, taptweak, control_map = taptree.construct()
# generate Taproot pubkey
taptweak_pubkey = pubkey_agg.tweak_add(taptweak)
# generate segwit address
taptweak_pubkey_b = taptweak_pubkey.get_bytes()
segwit_version = 1
segwit_address = program_to_witness(segwit_version, taptweak_pubkey_b)
segwit_address_script_pubkey = "5120" + taptweak_pubkey_b.hex()
print("Agg Script pubkey: ", segwit_address_script_pubkey)
print("Agg Regtest address format: ", segwit_address)
print("Agg Mainnet address format: ", program_to_witness(segwit_version, taptweak_pubkey_b, main=True), "\n")
spending_tx = test.create_spending_transaction(tx.hash, version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey)
output_amount_sat = 10_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
remain_output = CTxOut(nValue=80_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0)
signatureA = privkey_charlie.sign_schnorr(sighashA)
spending_tx.wit.vtxinwit.append(CTxInWitness([signatureA]))
print("send btc to segwit address, tx hex:", spending_tx.serialize().hex(), "\n")
assert node.test_transaction(spending_tx)
node.sendrawtransaction(spending_tx.serialize().hex(), 0)
# tx decode
tx = spending_tx
decode = node.decoderawtransaction(str(tx.serialize().hex()))
# print("\ndecode tx raw transaction:")
# pprint(decode)
spending_tx = test.create_spending_transaction(decode['txid'], version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
output_amount_sat = 5_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey)
remain_output = CTxOut(nValue=4_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0,
scriptpath=True,
script=tapleafA.script)
signatureA = privkey_alice.sign_schnorr(sighashA)
# print("Signature for TapLeafA: {}\n".format(signatureA.hex()))
# Add witness to transaction
# Tip: Witness stack for script path - [satisfying elements for tapscript] [TapLeaf.script] [controlblock]
# Tip: Controlblock for a tapscript in control_map[TapLeaf.script]
witness_elements = [signatureA, tapleafA.script, control_map[tapleafA.script]]
spending_tx.wit.vtxinwit.append(CTxInWitness(witness_elements))
assert node.test_transaction(spending_tx)
spending_tx_hex = spending_tx.serialize().hex()
print("\n", "send others from segwit address, spending_tx hex: ", spending_tx_hex, "\n")
# print("\ndecode spending_tx raw transaction:")
# pprint(node.decoderawtransaction(str(spending_tx_hex)))
test.shutdown()
import util
from test_framework.address import program_to_witness, key_to_p2wpkh
from test_framework.key import ECKey
from test_framework.messages import CTxInWitness, COutPoint, CTransaction, CTxIn, CTxOut
from test_framework.script import TapTree, TapLeaf, TaprootSignatureHash, SIGHASH_ALL_TAPROOT, Tapbranch, CScript, \
OP_RETURN
from test_framework.musig import generate_musig_key
from pprint import pprint
def generate_bip340_key_pair(secret=None):
"""Convenience function to generate a BIP0340 private-public key pair."""
if secret is None:
d = ECKey()
d.generate()
else:
d = ECKey().set(secret)
P = d.get_pubkey()
if P.get_y() % 2 != 0:
d.negate()
P.negate()
return d, P
# generate alice bob charlie key
privkey_alice, pubkey_alice = generate_bip340_key_pair(
secret=103910053441657220738925612114654039920823302334302261834756476233133311987138)
privkey_bob, pubkey_bob = generate_bip340_key_pair(
secret=75573449985348711764142460376289265944117193680909672902170333608986796225238)
privkey_charlie, pubkey_charlie = generate_bip340_key_pair(
secret=33705509085456474265534912245246680268484766969648186791871278745425848684352)
segwit_version = 1
pubkey_charlie_bytes = pubkey_charlie.get_bytes()
segwit_address_charlie = program_to_witness(segwit_version, pubkey_charlie_bytes)
segwit_address_script_pubkey_charlie = "5120" + pubkey_charlie_bytes.hex()
print("charlie Script pubkey: ", segwit_address_script_pubkey_charlie)
print("charlie Regtest address format: ", segwit_address_charlie)
print("charlie Mainnet address format: ", program_to_witness(segwit_version, pubkey_charlie_bytes, main=True), "\n")
# Start node
test = util.TestWrapper()
test.setup()
node = test.nodes[0]
tx = node.generate_and_send_coins(segwit_address_charlie)
tx_hex = tx.serialize().hex()
print("init tx: ", tx_hex, "\n")
c_map, pubkey_agg = generate_musig_key([pubkey_alice, pubkey_bob, pubkey_charlie])
if pubkey_agg.get_y() % 2 != 0:
pubkey_agg.negate()
# Construct tapleaves
tapleafA = TapLeaf().construct_pk(pubkey_alice)
tapleafB = TapLeaf().construct_pk(pubkey_bob)
tapleafC = TapLeaf().construct_pk(pubkey_charlie)
# Construct taptree nodes.
tapbranchAB = Tapbranch(tapleafA, tapleafB)
tapbranchABC = Tapbranch(tapbranchAB, tapleafC)
# Construct the taptree.
taptree = TapTree(key=pubkey_agg, root=tapbranchABC)
segwit_v1_script, taptweak, control_map = taptree.construct()
# generate Taproot pubkey
taptweak_pubkey = pubkey_agg.tweak_add(taptweak)
# generate segwit address
taptweak_pubkey_b = taptweak_pubkey.get_bytes()
segwit_version = 1
segwit_address = program_to_witness(segwit_version, taptweak_pubkey_b)
segwit_address_script_pubkey = "5120" + taptweak_pubkey_b.hex()
print("Agg Script pubkey: ", segwit_address_script_pubkey)
print("Agg Regtest address format: ", segwit_address)
print("Agg Mainnet address format: ", program_to_witness(segwit_version, taptweak_pubkey_b, main=True), "\n")
spending_tx = test.create_spending_transaction(tx.hash, version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey)
output_amount_sat = 10_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
# op return
commitment_bytes = bytes.fromhex("35516a706f3772516e7751657479736167477a6334526a376f737758534c6d4d7141754332416255364c464646476a38")
op_return_output_script = CScript([OP_RETURN, commitment_bytes])
op_return_output = CTxOut(nValue=0, scriptPubKey=op_return_output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
remain_output = CTxOut(nValue=80_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, op_return_output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0)
signatureA = privkey_charlie.sign_schnorr(sighashA)
spending_tx.wit.vtxinwit.append(CTxInWitness([signatureA]))
print("send btc to segwit address, tx hex:", spending_tx.serialize().hex(), "\n")
assert node.test_transaction(spending_tx)
node.sendrawtransaction(spending_tx.serialize().hex(), 0)
# tx decode
tx = spending_tx
decode = node.decoderawtransaction(str(tx.serialize().hex()))
# print("\ndecode tx raw transaction:")
# pprint(decode)
spending_tx = test.create_spending_transaction(decode['txid'], version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
output_amount_sat = 5_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey)
remain_output = CTxOut(nValue=4_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0,
scriptpath=True,
script=tapleafA.script)
signatureA = privkey_alice.sign_schnorr(sighashA)
# print("Signature for TapLeafA: {}\n".format(signatureA.hex()))
# Add witness to transaction
# Tip: Witness stack for script path - [satisfying elements for tapscript] [TapLeaf.script] [controlblock]
# Tip: Controlblock for a tapscript in control_map[TapLeaf.script]
witness_elements = [signatureA, tapleafA.script, control_map[tapleafA.script]]
spending_tx.wit.vtxinwit.append(CTxInWitness(witness_elements))
assert node.test_transaction(spending_tx)
spending_tx_hex = spending_tx.serialize().hex()
print("\n", "send others from segwit address, spending_tx hex: ", spending_tx_hex, "\n")
# print("\ndecode spending_tx raw transaction:")
# pprint(node.decoderawtransaction(str(spending_tx_hex)))
test.shutdown()
import util
from test_framework.address import program_to_witness, key_to_p2wpkh
from test_framework.key import ECKey
from test_framework.messages import CTxInWitness, COutPoint, CTransaction, CTxIn, CTxOut
from test_framework.script import TapTree, TapLeaf, TaprootSignatureHash, SIGHASH_ALL_TAPROOT, Tapbranch
from test_framework.musig import generate_musig_key
from pprint import pprint
def generate_bip340_key_pair(secret=None):
"""Convenience function to generate a BIP0340 private-public key pair."""
if secret is None:
d = ECKey()
d.generate()
else:
d = ECKey().set(secret)
P = d.get_pubkey()
if P.get_y() % 2 != 0:
d.negate()
P.negate()
return d, P
# generate alice bob charlie key
privkey_alice, pubkey_alice = generate_bip340_key_pair(
secret=103910053441657220738925612114654039920823302334302261834756476233133311987138)
privkey_bob, pubkey_bob = generate_bip340_key_pair(
secret=75573449985348711764142460376289265944117193680909672902170333608986796225238)
privkey_charlie, pubkey_charlie = generate_bip340_key_pair(
secret=33705509085456474265534912245246680268484766969648186791871278745425848684352)
segwit_version = 1
pubkey_charlie_bytes = pubkey_charlie.get_bytes()
segwit_address_charlie = program_to_witness(segwit_version, pubkey_charlie_bytes)
segwit_address_script_pubkey_charlie = "5120" + pubkey_charlie_bytes.hex()
print("charlie Script pubkey: ", segwit_address_script_pubkey_charlie)
print("charlie Regtest address format: ", segwit_address_charlie)
print("charlie Mainnet address format: ", program_to_witness(segwit_version, pubkey_charlie_bytes, main=True), "\n")
# Start node
test = util.TestWrapper()
test.setup()
node = test.nodes[0]
tx = node.generate_and_send_coins(segwit_address_charlie)
tx_hex = tx.serialize().hex()
print("init tx: ", tx_hex, "\n")
c_map, pubkey_agg = generate_musig_key([pubkey_alice, pubkey_bob, pubkey_charlie])
if pubkey_agg.get_y() % 2 != 0:
pubkey_agg.negate()
# Construct tapleaves
tapleafA = TapLeaf().construct_pk(pubkey_alice)
tapleafB = TapLeaf().construct_pk(pubkey_bob)
tapleafC = TapLeaf().construct_pk(pubkey_charlie)
# Construct taptree nodes.
tapbranchAB = Tapbranch(tapleafA, tapleafB)
tapbranchABC = Tapbranch(tapbranchAB, tapleafC)
# Construct the taptree.
taptree = TapTree(key=pubkey_agg, root=tapbranchABC)
segwit_v1_script, taptweak, control_map = taptree.construct()
# generate Taproot pubkey
taptweak_pubkey = pubkey_agg.tweak_add(taptweak)
# generate segwit address
taptweak_pubkey_b = taptweak_pubkey.get_bytes()
segwit_version = 1
segwit_address = program_to_witness(segwit_version, taptweak_pubkey_b)
segwit_address_script_pubkey = "5120" + taptweak_pubkey_b.hex()
print("Agg Script pubkey: ", segwit_address_script_pubkey)
print("Agg Regtest address format: ", segwit_address)
print("Agg Mainnet address format: ", program_to_witness(segwit_version, taptweak_pubkey_b, main=True), "\n")
spending_tx = test.create_spending_transaction(tx.hash, version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey)
output_amount_sat = 10_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
remain_output = CTxOut(nValue=80_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0)
signatureA = privkey_charlie.sign_schnorr(sighashA)
spending_tx.wit.vtxinwit.append(CTxInWitness([signatureA]))
print("send btc to segwit address(hot address), tx hex:", spending_tx.serialize().hex(), "\n")
assert node.test_transaction(spending_tx)
node.sendrawtransaction(spending_tx.serialize().hex(), 0)
# tx decode
tx = spending_tx
decode = node.decoderawtransaction(str(tx.serialize().hex()))
# print("\ndecode tx raw transaction:")
# pprint(decode)
# legacy p2sh address, mainnet
cold_addr = "3FLBhPfEqmw4Wn5EQMeUzPLrQtJMprgwnw"
cold_addr_script_pubkey = "a91495a12f1eba77d085711e9c837d04e4d8868a834387"
spending_tx = test.create_spending_transaction(decode['txid'], version=2)
output_script = bytes.fromhex(cold_addr_script_pubkey)
output_amount_sat = 5_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey)
remain_output = CTxOut(nValue=4_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0,
scriptpath=True,
script=tapleafA.script)
signatureA = privkey_alice.sign_schnorr(sighashA)
# print("Signature for TapLeafA: {}\n".format(signatureA.hex()))
# Add witness to transaction
# Tip: Witness stack for script path - [satisfying elements for tapscript] [TapLeaf.script] [controlblock]
# Tip: Controlblock for a tapscript in control_map[TapLeaf.script]
witness_elements = [signatureA, tapleafA.script, control_map[tapleafA.script]]
spending_tx.wit.vtxinwit.append(CTxInWitness(witness_elements))
assert node.test_transaction(spending_tx)
spending_tx_hex = spending_tx.serialize().hex()
print("\n", "send cold address from segwit address, spending_tx hex: ", spending_tx_hex, "\n")
# print("\ndecode spending_tx raw transaction:")
# pprint(node.decoderawtransaction(str(spending_tx_hex)))
test.shutdown()
import util
from test_framework.address import program_to_witness, key_to_p2wpkh
from test_framework.key import ECKey
from test_framework.messages import CTxInWitness, COutPoint, CTransaction, CTxIn, CTxOut
from test_framework.script import TapTree, TapLeaf, TaprootSignatureHash, SIGHASH_ALL_TAPROOT, Tapbranch
from test_framework.musig import generate_musig_key
from pprint import pprint
def generate_bip340_key_pair(secret=None):
"""Convenience function to generate a BIP0340 private-public key pair."""
if secret is None:
d = ECKey()
d.generate()
else:
d = ECKey().set(secret)
P = d.get_pubkey()
if P.get_y() % 2 != 0:
d.negate()
P.negate()
return d, P
# generate alice bob charlie key
privkey_alice, pubkey_alice = generate_bip340_key_pair(
secret=103910053441657220738925612114654039920823302334302261834756476233133311987138)
privkey_bob, pubkey_bob = generate_bip340_key_pair(
secret=75573449985348711764142460376289265944117193680909672902170333608986796225238)
privkey_charlie, pubkey_charlie = generate_bip340_key_pair(
secret=33705509085456474265534912245246680268484766969648186791871278745425848684352)
segwit_version = 1
pubkey_charlie_bytes = pubkey_charlie.get_bytes()
segwit_address_charlie = program_to_witness(segwit_version, pubkey_charlie_bytes)
segwit_address_script_pubkey_charlie = "5120" + pubkey_charlie_bytes.hex()
print("charlie Script pubkey: ", segwit_address_script_pubkey_charlie)
print("charlie Regtest address format: ", segwit_address_charlie)
print("charlie Mainnet address format: ", program_to_witness(segwit_version, pubkey_charlie_bytes, main=True), "\n")
# Start node
test = util.TestWrapper()
test.setup()
node = test.nodes[0]
tx = node.generate_and_send_coins(segwit_address_charlie)
tx_hex = tx.serialize().hex()
print("init tx: ", tx_hex, "\n")
c_map, pubkey_agg = generate_musig_key([pubkey_alice, pubkey_bob, pubkey_charlie])
privkey_alice_c = privkey_alice * c_map[pubkey_alice]
privkey_bob_c = privkey_bob * c_map[pubkey_bob]
privkey_charlie_c = privkey_charlie * c_map[pubkey_charlie]
if pubkey_agg.get_y() % 2 != 0:
pubkey_agg.negate()
privkey_alice_c.negate()
privkey_bob_c.negate()
privkey_charlie_c.negate()
# Construct tapleaves
tapleafA = TapLeaf().construct_pk(pubkey_alice)
tapleafB = TapLeaf().construct_pk(pubkey_bob)
tapleafC = TapLeaf().construct_pk(pubkey_charlie)
# Construct taptree nodes.
tapbranchAB = Tapbranch(tapleafA, tapleafB)
tapbranchABC = Tapbranch(tapbranchAB, tapleafC)
# Construct the taptree.
taptree = TapTree(key=pubkey_agg, root=tapbranchABC)
segwit_v1_script, taptweak, control_map = taptree.construct()
# generate Taproot pubkey
tweaked_privkey = privkey_alice_c.add(privkey_bob_c.get_bytes()).add(privkey_charlie_c.get_bytes()).add(
taptweak)
taptweak_pubkey = pubkey_agg.tweak_add(taptweak)
if taptweak_pubkey.get_y() % 2 != 0:
taptweak_pubkey.negate()
tweaked_privkey.negate()
# generate segwit address
taptweak_pubkey_b = taptweak_pubkey.get_bytes()
segwit_version = 1
segwit_address = program_to_witness(segwit_version, taptweak_pubkey_b)
segwit_address_script_pubkey = "5120" + taptweak_pubkey_b.hex()
print("Agg Script pubkey: ", segwit_address_script_pubkey)
print("Agg Regtest address format: ", segwit_address)
print("Agg Mainnet address format: ", program_to_witness(segwit_version, taptweak_pubkey_b, main=True), "\n")
spending_tx = test.create_spending_transaction(tx.hash, version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey)
output_amount_sat = 10_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
remain_output = CTxOut(nValue=80_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0)
signatureA = privkey_charlie.sign_schnorr(sighashA)
spending_tx.wit.vtxinwit.append(CTxInWitness([signatureA]))
print("send btc to segwit address, tx hex:", spending_tx.serialize().hex(), "\n")
assert node.test_transaction(spending_tx)
node.sendrawtransaction(spending_tx.serialize().hex(), 0)
# tx decode
tx = spending_tx
decode = node.decoderawtransaction(str(tx.serialize().hex()))
# print("\ndecode tx raw transaction:")
# pprint(decode)
spending_tx = test.create_spending_transaction(decode['txid'], version=2)
output_script = bytes.fromhex(segwit_address_script_pubkey_charlie)
output_amount_sat = 5_000_000 # remove transaction fee from output amount
output = CTxOut(nValue=output_amount_sat, scriptPubKey=output_script)
remain_output_script = bytes.fromhex(segwit_address_script_pubkey)
remain_output = CTxOut(nValue=4_000_000, scriptPubKey=remain_output_script)
spending_tx.vout = [output, remain_output]
# Create sighash for ALL
sighashA = TaprootSignatureHash(spending_tx,
[tx.vout[0]],
SIGHASH_ALL_TAPROOT,
input_index=0)
signatureA = tweaked_privkey.sign_schnorr(sighashA)
assert taptweak_pubkey.verify_schnorr(signatureA, sighashA)
spending_tx.wit.vtxinwit.append(CTxInWitness([signatureA]))
spending_tx_hex = spending_tx.serialize().hex()
print("\n", "send others from segwit address, spending_tx hex: ", spending_tx_hex, "\n")
assert node.test_transaction(spending_tx)
# print("\ndecode spending_tx raw transaction:")
# pprint(node.decoderawtransaction(str(spending_tx_hex)))
test.shutdown()
Test Data
Transaction sent to segwit v1 address
Spend from segwit v1 address