Skip to content

ScriptValidationError: Unknown script type #31

@massmux

Description

@massmux

in this code

def spend(wif,bitcoin_address,recipient_address):
    private = PrivateKey.from_wif(wif)
    address = Address(bitcoin_address)
    # balance is in bitcoin
    bal=address.balance()
    net_amount=bal-0.0002
    print(net_amount)
    send_to = {recipient_address: net_amount}
    estimate_fee = estimatefee(speed="average")
    tx = address.send(to=send_to, fee=0.0002, private=private)
    print(tx)
    result=tx.broadcast()
    return result

i run with
spend("wifxxx","bc1source","bc1qdest")

i get this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/voucherbot/wallet.py", line 152, in spend
    tx = address.send(to=send_to, fee=0.0002, private=private)
  File "/usr/local/lib/python3.8/site-packages/cryptotools/BTC/address.py", line 159, in send
    inp.sign(private)
  File "/usr/local/lib/python3.8/site-packages/cryptotools/BTC/transaction.py", line 139, in sign
    output_type = self.ref().type()
  File "/usr/local/lib/python3.8/site-packages/cryptotools/BTC/transaction.py", line 271, in type
    return get_type(self.script)
  File "/usr/local/lib/python3.8/site-packages/cryptotools/BTC/script.py", line 145, in get_type
    raise ScriptValidationError(f"Unknown script type: {bytes_to_hex(script)}")
cryptotools.BTC.error.ScriptValidationError: Unknown script type: 

but it seems that bech32 (bc1q) is supported by the lib.
where am i wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions