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?

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.

| improve this answer | |
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?

| improve this answer | |
  • 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 May 20 '17 at 17:31
  • @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 May 20 '17 at 17:32
  • 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 May 20 '17 at 17:39
  • @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 May 20 '17 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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