I'm using bitcoinlib for python to create a transaction and send it but I'm getting the following error:

Funds not sent, exception error: Error connecting to blockchair on url 
response [400] 
         "error":"Invalid transaction. Error: TX decode failed. Make sure the tx has at least one input.",
             "since":"2021-12-03 03:58:11",
             "until":"2021-12-03 03:59:11","time":null
             "last_major_update":"2021-07-19 00:00:00",

Here is my decoded transaction:

    "addresses": [
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 683,
    "hash": "7f2f01b7a7d55cc9e13aa6604b115fcf07ada6ee6179a6342c0f8d7d5668de3d",
    "inputs": [
            "addresses": [
            "age": 712033,
            "output_index": 55,
            "output_value": 33756,
            "script_type": "pay-to-witness-pubkey-hash",
            "sequence": 4294967295
    "outputs": [
            "addresses": [
            "script": "00149dde1d0113a7468f605bef751aa03a020cad3d2b",
            "script_type": "pay-to-witness-pubkey-hash",
            "value": 33073
            "addresses": [
            "script": "a914f1b553ddc46d0414e9b05b9667d65c5081d4f00a87",
            "script_type": "pay-to-script-hash",
            "value": 0
    "preference": "low",
    "received": "2021-12-03T03:58:47.770766807Z",
    "relayed_by": "",
    "size": 117,
    "total": 33073,
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 2,
    "vsize": 115

The python code I used to create the transaction:

w = Wallet(wallet_name, db_uri=db_uri)
t = w.transaction_create([(to_address, float(satstosend))])

I'm not sure why it's complaining that I don't have an input, but it's odd to me that I see one input and two outputs. I'm not sure if I'm creating the transaction incorrectly or if it has something to do with the fact that I'm trying to send from a native segwit address to a segwit address (bc1 -> 3XX). Any help would be appreciated.

  • It's possible that blockchair believes the transaction to be a non-segwit transaction (because of the marker and flag bytes required for segwit txs) and so is incorrectly parsing it. Have you tried a different broadcast API?
    – Ava Chow
    Dec 3, 2021 at 5:02
  • Yes I've tried blocksmurfer and ran into a generic error telling me the transaction failed but with no reason. Dec 3, 2021 at 8:29
  • So after trying a few different providers, blockstream gave me the same error message. Funds not sent, exception error: Error connecting to blockstream on url https://blockstream.info/api/tx, response [400] sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."} Dec 3, 2021 at 9:05

1 Answer 1


I figured it out, I simply was missing a step. I wasn't signing my transaction before sending.

>>> t.sign('my_private_key')
>>> res = srv.sendrawtransaction(t.raw_hex())
>>> res

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.