Sending using blockchain.info

2

According to https://github.com/blockchain/api-v1-client-node/tree/master/MyWallet#send-bitcoin wallet.send doesn't require a from field. When I run wallet.getBalance() it states that I have BTC in my wallet (received days ago). However if I do:

const balanceResponse = await wallet.getBalance();
console.log(balanceResponse);
// { balance: 100000000 }
wallet.send("<receiving address>", 510000, {
  fee: 10000
})

{"error":"Insufficient funds","available":0,"needed":0.0051,"sweep_amount_satoshi":0,"sweep_fee_satoshi":0}

I've only ever received BTC once in my wallet. If I use that address in the from field:

wallet.send("<receiving address>", 510000, {
  from: "<sending address>",
  fee: 10000
})

I now get

{"error":"Error signing and pushing transaction"}

What am I doing wrong?

Kit Sunde

Posted 2017-05-20T04:55:05.390

Reputation: 123

Answers

2

The Wallet Service requires the from option to be specified when sending from an account. It's only optional when your BTC is located in your normal, imported addresses.

Assuming you received funds to your first wallet account, you would set from: 0 and the send should succeed.

Justin Tormey

Posted 2017-05-20T04:55:05.390

Reputation: 36

0

The first call tells you that it finds "available:0". Since that should try to use all of your received funds, this is likely also the reason why the second call fails.

Are you sure that you've established a session with the same wallet that you received funds to "days ago"? Perhaps you're not correctly authenticated or it was another wallet? Are you sure that the coins are still in the same wallet?

Murch

Posted 2017-05-20T04:55:05.390

Reputation: 41 609

wallet.getBalance() shows my balance the send call happens right after, I only have 1 wallet which is the default one. If I haven't correctly authenticated I would assume that wallet.getBalance() would fail right?Kit Sunde 2017-05-20T17:31:01.490

@KitSunde: Could you perhaps add the response of "getBalance" to your question? Is your incoming transaction confirmed or are you tracking an unconfirmed balance?Murch 2017-05-20T17:32:17.443

I've added it, but it doesn't really say anything beside that I have value in my wallet. My incoming transaction was on May 18th, it has > 400 confirmations, the transaction shows up as confirmed on blockchain.info and in my wallet.Kit Sunde 2017-05-20T17:39:12.320

@KitSunde: Okay, sorry, then I'm out of ideas and I'm not familiar enough with the API of blockchain.info to give further suggestions. I'll leave this answer, because it provides additional information for would-be future answerers. (Or perhaps you can incorporate the relevant bits to your question, and then I can delete it.)Murch 2017-05-20T17:42:26.920