Sendmany Doesn't Work

Discussion in 'Transactions' started by Grumlin, Mar 1, 2016.

  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. Grumlin

    Grumlin New Member

    Feb 25, 2016
    43
    1
    Male
    it doesn't work

    >dcrctl.exe --wallet sendmany "default" {"DshM....":100,"DshM.....":100}
    sendmany command: parameter #2 'amounts' must be valid JSON which unsmarshals to a map[string]float64 (code: ErrInvalidType)
    Usage:
    sendmany "fromaccount" {"address":amount,...} (minconf=1 "comment")
    what i did incorrect?
     
  2. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    I answered in the other thread, but I'll move it here since it's a better place for it.

    Since you're typing it into the command line you need to quote the JSON portion with single quotes to prevent the shell from misinterpreting the command.

    dcrctl.exe --wallet sendmany "default" '{"DshM....":100,"DshM.....":100}'
     
  3. Grumlin

    Grumlin New Member

    Feb 25, 2016
    43
    1
    Male
    #3 Grumlin, Mar 3, 2016
    Last edited: Mar 3, 2016
    it's not working too, the same error

    dcrctl.exe --wallet sendmany "default" '{"Ds...":'37',"Ds...":'37'}'
    sendmany command: parameter #2 'amounts' must be valid JSON which unsmarshals to a map[string]float64 (code: ErrInv
    alidType)
    Usage:
    sendmany "fromaccount" {"address":amount,...} (minconf=1 "comment"
     
  4. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    The single quotes should only be around the entire string, not the numbers too. I highlighted the single quotes which are incorrect in red and the ones which are correct in green.
     
  5. Grumlin

    Grumlin New Member

    Feb 25, 2016
    43
    1
    Male
    not working

    dcrctl.exe --wallet sendmany "default" '{"Ds...":37,"Ds...":37}'
    sendmany command: parameter #2 'amounts' must be valid JSON which unsmarshals to a map[string]float64 (code: ErrInv
    alidType)
    Usage:
    sendmany "fromaccount" {"address":amount,...} (minconf=1 "comment")
     
  6. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    Oh, I know what the issue is. I rarely use cmd.exe for the shell (because it isn't very good), and so I misremembered how the quoting rules work there.

    With cmd.exe you have to use double quotes for the entire argument and escape the inner double quotes. So, like the following:

    Code:
    dcrctl.exe --wallet sendmany "default" "{\"Ds...\":37,\"Dsinvalid\":37}"
    
     
    chappjc and Grumlin like this.

Share This Page