Bitcoin Forum
May 05, 2024, 10:39:50 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: help with paytomany  (Read 121 times)
almqq (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
August 25, 2023, 11:05:40 AM
 #1

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 ..."

1714948790
Hero Member
*
Offline Offline

Posts: 1714948790

View Profile Personal Message (Offline)

Ignore
1714948790
Reply with quote  #2

1714948790
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714948790
Hero Member
*
Offline Offline

Posts: 1714948790

View Profile Personal Message (Offline)

Ignore
1714948790
Reply with quote  #2

1714948790
Report to moderator
1714948790
Hero Member
*
Offline Offline

Posts: 1714948790

View Profile Personal Message (Offline)

Ignore
1714948790
Reply with quote  #2

1714948790
Report to moderator
1714948790
Hero Member
*
Offline Offline

Posts: 1714948790

View Profile Personal Message (Offline)

Ignore
1714948790
Reply with quote  #2

1714948790
Report to moderator
Knight Hider
Member
**
Offline Offline

Activity: 240
Merit: 59

a young loner on a crusade


View Profile
August 25, 2023, 11:26:36 AM
Merited by pooya87 (2), nc50lc (1), DireWolfM14 (1)
 #2

Hi, I am trying to get paytomany working, using the command line. I tried this:

Code:
electrum paytomany bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq 0.0001 bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q 0.0001
Use this (from stackexchange):
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]]"
02000000000101b2dac704d87285da38ff6bed65dcf73c6f12c73d66641bb7cdcf333ee10429870000000000fdffffff03204e0000000000001600143514c32c9be557aec36aac157a3d627841039fbfa0860100000000001600143a0830dd593a4cca2a22ff6434f6fba320e822b8fc2e020000000000160014f0e691d48c49b0bc85e1365d82aea8f61cc5fcad024730440220379bb9b1be007b324047d8c8809233b023ae5c69299f270fbfab23e9863af31302203173e4f3b608ec738be630b8826e19dfd0fe60c88f054bbbf60c674f041b9346012103a1e21244b4d983ebdcb5ec074a5c0d4103bc69b794369f15f65f644b4538ae152bc32500

--Knight Hider

in a world of criminals who operate above the law
one man can make a difference and you are going to be that man
almqq (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
August 25, 2023, 11:46:11 AM
 #3

I managed. The answer is this format:

electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]'
Knight Hider
Member
**
Offline Offline

Activity: 240
Merit: 59

a young loner on a crusade


View Profile
August 26, 2023, 09:01:02 AM
Merited by DireWolfM14 (1)
 #4

I managed. The answer is this format:

electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]'
The single quotes won't allow for variable substitution. But it is easier than escaping double quotes.

--Knight Hider

in a world of criminals who operate above the law
one man can make a difference and you are going to be that man
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10549



View Profile
August 27, 2023, 05:30:48 AM
 #5

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Yamane_Keto
Sr. Member
****
Offline Offline

Activity: 476
Merit: 486



View Profile WWW
August 27, 2023, 01:08:25 PM
 #6

I managed. The answer is this format:

electrum paytomany '[["bc1qnp7d483d79j6pcx6rfc9yw46xrevplcxtuurhq",0.0001], ["bc1qt6enaefhrhue9q4hyszx4kn9zvqvucktruvh2q",0.0001]]'
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 code

Code:

import csv
input_file = csv.DictReader(open("/full/path/to/your/P2M.csv"))

// Full path

outputs = []

for row in input_file:
    tup = (row["address"], float(row["amount"]))
    outputs.append(tup)

print outputs

    transaction = paytomany(outputs, 0.0004)
    print transaction


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 code

Code:
    @command('wp')
    async def paytomany(self, outputs, fee=None, feerate=None, from_addr=None, from_coins=None, change_addr=None,
                        nocheck=False, unsigned=False, rbf=True, password=None, locktime=None, addtransaction=False, wallet: Abstract_Wallet = None):

https://github.com/spesmilo/electrum/blob/master/electrum/commands.py

.BEST.CHANGE..███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!