Author

Topic: Making it easier to handle change/leftovers (Read 986 times)

legendary
Activity: 1624
Merit: 2481
February 01, 2016, 07:40:14 AM
#14
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
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 07:24:11 AM
#13
I wanted to split coins sent to an address between players and the rest would go to the bank or a random random player.
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 07:20:18 AM
#12
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.
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 07:15:33 AM
#11
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.
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 07:04:22 AM
#10
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)?
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 06:44:55 AM
#9
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.
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 06:33:17 AM
#8
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.

How is this complicated?

Code:
> 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.
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 06:31:01 AM
#7
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.
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 06:12:04 AM
#6
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.

full member
Activity: 128
Merit: 100
c++
February 01, 2016, 06:06:44 AM
#5
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.
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 05:57:11 AM
#4
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)
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 05:55:26 AM
#3
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:

Code:
sendFunction(arrayFrom, arrayTo

which funnily enough is what is provided.


But don't you need to calc the exact amount for the last address?
legendary
Activity: 1890
Merit: 1072
Ian Knowles - CIYAM Lead Developer
February 01, 2016, 05:49:48 AM
#2
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:

Code:
sendFunction(arrayFrom, arrayTo

which funnily enough is what is provided.
full member
Activity: 128
Merit: 100
c++
February 01, 2016, 05:44:55 AM
#1
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.
Jump to: