Skip to content

500 when following /sendmany example from the docs #16

Closed

Description

@mhluongo

Following the example at https://bitgo.com/api/?shell#send-coins-to-multiple-addresses, I my local express server and got

> curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -d '{"recipients": [{"address": "2N7Sms6BqZaQVp6Cv73qhJeDHmbSzAe7gV1", "amount": 1000}], "walletPassphrase": "passprhase" }' "http://localhost:3080/api/v1/wallet/$WALLETID/sendmany"

{"error":"invalid bitcoin address: 0"} # the server shows this is a 500

After fooling with it a bit, I tried the same tx using /sendcoins:

> curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -d '{"address": "2N7Sms6BqZaQVp6Cv73qhJeDHmbSzAe7gV1", "amount": 1000, "walletPassphrase": "passphrase" }' "http://localhost:3080/api/v1/wallet/$WALLETID/sendcoins"

{"error":"output value is less than dust threshold"}

I increase the amount in the /sendmany example, and it works. I think both should respond with the same error message (and no 500s).

Activity

  1. changed the title [-]500 when payment is less than the dust threshold using BitGo-Express[/-] [+]500 when using /sendmany with BitGo-Express[/+] on Nov 19, 2015
  2. mhluongo commented on Nov 19, 2015

    @mhluongo
    Author

    Correction- the dust threshold is irrelevant, I made a mistake in the console. So I guess the question is- is sendmany broken? Or does it expect different input?

  3. mhluongo commented on Nov 19, 2015

    @mhluongo
    Author

    Ah, it looks an issue with the docs + not properly distinguishing between an array and an object in the JS.

    The docs say /sendmany takes a recipients argument like [{address: '38BKDNZbPcLogvVbcx2ekJ9E6Vv94DqDqw’, amount: 1500}, ..], not {'38BKDNZbPcLogvVbcx2ekJ9E6Vv94DqDqw': 1500}.

    Editing the title and leaving this open as a docs issue.

  4. changed the title [-]500 when using /sendmany with BitGo-Express[/-] [+]500 when following /sendmany example from the docs[/+] on Nov 19, 2015
  5. bencxr commented on Nov 19, 2015

    @bencxr
    Contributor

    Hey there, can you clarify which network you were running Bitgo express on ? Your examples show both testnet and bitcoin addresses (if you use a testnet address on prod it will give the invalid address error).

  6. mhluongo commented on Nov 19, 2015

    @mhluongo
    Author

    @bencxr the original example is the code that I ran- on testnet. The other comments are about the docs, and thus use mainnet addresses.

    It's a simple problem- the docs specify the wrong data structure to send, and wallet.js doesn't properly validate the data, instead throwing an inscrutable 500.

    If there's a repo for the docs (or I just missed them) I'd be happy to provide a PR. I'm less confident in my JS or I'd patch that as well.

  7. mhluongo commented on Nov 19, 2015

    @mhluongo
    Author

    The first example was what I ran on testnet. The second is from the docs- it's using mainnet addresses because I copied it straight out.

  8. bencxr commented on Nov 20, 2015

    @bencxr
    Contributor

    @mhluongo the docs specify the more recent version of the structure. If you look into transactionBuilder.js, you will see that we actually support both (backwards compatible). You can specify an array of address: amount object or dictionary of address keys with amounts (however you can't send more than one output to the same address this way). So I don't think that was the cause of a problem in this case.

  9. mhluongo commented on Nov 20, 2015

    @mhluongo
    Author

    Realized I'm running an odler version- git pulling and trying it again

  10. added a commit that references this issue on Oct 1, 2019
  11. added a commit that references this issue on Jul 1, 2020
  12. added a commit that references this issue on Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions