Title: help with paytomany Post by: almqq on August 25, 2023, 11:05:40 AM Hi, I am trying to get paytomany working, using the command line. I tried this:
Code: electrum paytomany bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq 0.0001 bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q 0.0001 and got this error Code: electrum paytomany: error: argument outputs: invalid <lambda> value: 'bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq' What am I doing wrong? PS: "electrum payto ..." works, but not "electrum paytomany ..." Title: Re: help with paytomany Post by: Knight Hider on August 25, 2023, 11:26:36 AM Hi, I am trying to get paytomany working, using the command line. I tried this: Use this (from stackexchange (https://bitcoin.stackexchange.com/questions/44050/how-do-i-properly-paytomany-using-electrum-via-script)):Code: electrum paytomany bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq 0.0001 bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q 0.0001 Code: electrum paytomany "[[\"bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq\", 0.0001], [\"bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q\", 0.0001]]" I tested it myself: Code: electrum --testnet -w $wallet paytomany "[[\"tb1q8gyrph2e8fxv523zlajrfahm5vswsg4ccw90zu\", 0.001], [\"tb1qx52vxtymu4t6asm24s2h50tz0pqs88alx8w5vz\", 0.0002]]" --Knight Hider Title: Re: help with paytomany Post by: almqq on August 25, 2023, 11:46:11 AM I managed. The answer is this format:
electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]' Title: Re: help with paytomany Post by: Knight Hider on August 26, 2023, 09:01:02 AM I managed. The answer is this format: The single quotes won't allow for variable substitution. But it is easier than escaping double quotes.electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]' --Knight Hider Title: Re: help with paytomany Post by: pooya87 on August 27, 2023, 05:30:48 AM For cases like this, it is best and easiest to use some JSON library that would create the string itself instead of trying to hardcode it yourself. In that case you just create your "array" with the addresses and amounts and simply call the ToString method to get the result you want to pass to the commandline. That should take care of all the quotes, brackets, etc. needed for a correct value.
Title: Re: help with paytomany Post by: Yamane_Keto on August 27, 2023, 01:08:25 PM I managed. The answer is this format: this actually how json.dumps works and used in electrum code I find that trying to write it manually may cause some problems, so the easiest solution is to create a CSV file with the address, amount, and let's name this file P2M.csv, then write this codeelectrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]' Code:
0.0004 is mining fee you can change it or add raw_input to check transaction before sending it To see more codes or code details above https://github.com/ramuta/electrum-script-tutorial What am I doing wrong? The error was in duplicating the code, the syntax you used is not correct, this is the explanation of the codeCode: @command('wp') https://github.com/spesmilo/electrum/blob/master/electrum/commands.py |