blockcypher / node-client

Node.js SDK for the BlockCypher Web services. See http://www.blockcypher.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error broadcasting transaction

LAMike310 opened this issue · comments

Hi Blockcypher team,

I got some help earlier on the correct way to format a transaction using the TX skeleton, so I decided to try it again when I got home. I created a new, un-broadcasted, transaction, and I got this error when posting:

{ error: 'Error validating transaction: Transaction 02b1be3be0a6a4f7d8e369cca88520443b3fc0993d3660d4d52e5f383d505650 has an input referencing an unknown transaction: d69adc7c6a355ea4297755350f86c52710a6ebd72a150215c276f3cd4c659d5e.' }

The transaction referenced in the error has 6 confirmations after about an hour:

https://live.blockcypher.com/btc/tx/d69adc7c6a355ea4297755350f86c52710a6ebd72a150215c276f3cd4c659d5e/

Is there a minimum amount of transactions needed for the API to broadcast? Thanks again for helping me earlier!

Here's the raw transaction hash and a gist of the script I'm using:

var axios = require('axios')
axios.post('https://api.blockcypher.com/v1/bcy/test/txs/push',
        {"tx": "01000000015e9d654ccdf376c21502152ad7eba61027c5860f35557729a45e356a7cdc9ad6000000008a47304402201f06d4679b3f835215c338bace1d8b317aeade5346309389b60f4d7753f5a710022033d9e5aafdd4154889b6ab71eb927b8879eeb3dc9c6c2e665e665485f71a4e0b014104f0087a849a6e9ebc5b3fb9090849a22b72c71564e165458a9957150a7dd24639f1f60746cbfa25950ec9bc7064a77141a78c5a309ff7cc0b90050e8a6a1a8ed7ffffffff02da210000000000001976a914fed9eb51a9d13032e4cf2d6a4856fe8bde18b18c88ac0000000000000000546a4c5177723335322d33316472342d4141412d30322d31362d31352d32336f6c2d313030303030303030302d33323132322d333435352d363933352d323334392d323334302d31323333322d30322d31302d313500000000"}
      )
      .then(function (response) {
        console.log(response.data);
      })
      .catch(function (response) {
        console.log(response.data);
      });

Hi there,

It looks like you're pushing to our bcy/test chain endpoint. This is a different chain than bitcoin main with entirely different transactions. To build a bcy/test transaction, you'll need to reference a previously unspent blockcypher testnet transaction- our faucet will help you get started there. Check out http://dev.blockcypher.com/#testing for more information.

@LAMike310: Closing this issue now, if you still have trouble feel free to reopen with new information.