codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 09:44:55 AM Last edit: February 01, 2016, 12:24:32 PM by codedelux |
|
I think it could be "more safe" and friendly for new devs if you could call a single function with fromAddress, toAddres and addressForWhatsLeft from console in a single command.
My example:
sendFunction(arrayFrom, arrayTo, addressForWhatsLeft)
When using the testnet I lost my coins a couple of times trying to figure out how to create transactions and handle the spare change.
Thanks for your time.
*Edited better explanation.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 09:49:48 AM |
|
My example:
sendFunction(arrayFrom, arrayTo, addressForWhatsLeft)
As the "address for what's left" (after fees of course) is just another "to" you only need this: sendFunction(arrayFrom, arrayTo
which funnily enough is what is provided.
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 09:55:26 AM |
|
My example:
sendFunction(arrayFrom, arrayTo, addressForWhatsLeft)
As the "address for what's left" (after fees of course) is just another "to" you only need this: sendFunction(arrayFrom, arrayTo
which funnily enough is what is provided. But don't you need to calc the exact amount for the last address?
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 09:57:11 AM |
|
But don't you need to calc the exact amount for the last address?
Are you referring to fee calculation? (perhaps I am not quite understanding the issue you are describing)
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 10:06:44 AM |
|
But don't you need to calc the exact amount for the last address?
Are you referring to fee calculation? (perhaps I am not quite understanding the issue you are describing) Yes, the fee calc is one of the things I find hard to calc when getting into the console api. "These addresses have 10 btc. Send 1 here and here and here. Calc the fee's and send the rest here". Return true of possible, else false.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 10:12:04 AM |
|
If you just use the "sendtoaddress" then it will look after the change automatically for you (as well as choosing the UTXOs automatically) - I don't think it can get much simpler than that.
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 10:31:01 AM |
|
If you just use the "sendtoaddress" then it will look after the change automatically for you (as well as choosing the UTXOs automatically) - I don't think it can get much simpler than that.
How would you suggest handling 'source coins'/change manually if you use sendtoaddress without using 'accounts'? I followed this https://bitcoin.org/en/developer-examples#transaction-tutorial when I started out. I found it to be quite complicated to handle the source and the change this way. Googling it shows that lots of people have trouble with the select source and change handling.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 10:33:17 AM |
|
How is this complicated? > bitcoin-cli -regtest sendtoaddress $ADDRESS 10.00
(I fail to see how it could really be any simpler) If you don't want to deal with the UTXOs, fee calculation and change address then you just use "sendtoaddress" and it does all of that for you.
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 10:44:55 AM |
|
But why not meet in the middle? Why only the most simplistic and the most complex? Why not have a function that allows source/to/change handling directly and let core guard it from stupid mistakes? It's not a new function, only a helper.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 11:04:22 AM |
|
But why not meet in the middle? Why only the most simplistic and the most complex? Why not have a function that allows source/to/change handling directly and let core guard it from stupid mistakes? It's not a new function, only a helper.
I do believe that they added something to prevent you from sending a ridiculously large fee now (which would have helped me out a long time back when I first started playing with raw transactions). Perhaps you should look into some of the other available wallets (maybe they'll have closer to the functionality you are wanting)?
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 11:15:33 AM |
|
I used php to achive what I wanted, but without the https://bitcoin.org/en/developer-examples it would have been too hard for me. After talking to a friend about it who got stuck in sendmany, only using the commanline, I thought I would bring it up here.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 01, 2016, 11:20:18 AM |
|
I guess the problem is that I'm not really getting the actual "use case" that you are trying to handle (so it's not clear to me exactly why the standard send commands are not suitable).
Certainly I would agree that "raw transactions" are only for advanced users.
|
|
|
|
codedelux (OP)
Full Member
Offline
Activity: 125
Merit: 100
c++
|
|
February 01, 2016, 11:24:11 AM |
|
I wanted to split coins sent to an address between players and the rest would go to the bank or a random random player.
|
|
|
|
bob123
Legendary
Offline
Activity: 1624
Merit: 2481
|
|
February 01, 2016, 11:40:14 AM |
|
If you just use the "sendtoaddress" then it will look after the change automatically for you (as well as choosing the UTXOs automatically) - I don't think it can get much simpler than that.
Thats exactly what i just wanted to write. I think its simple enough. You just have to look into it before starting sending TX's
|
|
|
|
|