Bitcoin Forum
May 29, 2024, 09:24:08 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Programmatically interfacing with Bitcoin RPC  (Read 615 times)
InsidiousPoet (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
July 28, 2016, 03:22:17 PM
 #1

Hello apologize if this is the wrong place for this topic.
I have a few newbie questions if ye don't mind.

I would like to programmatically generate wallet addresses (say 3 addresses per wallet and 3 wallets total) and send and receive transactions to those addresses. I’ve read into the RPC and lazyapi and because this is more a learning exercise I would like to not use the lazy api and instead use the RPC.
Ive read some of the docs and I believe i can use the RPC api with any of the supported client libraries such as in this link
https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29
and can expand on that with these calls
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
which would give me most of the functionality I require.
im comfortable using C variants/Java/Python/PHP etc so I was going to use a supported library like https://github.com/jgarzik/python-bitcoinrpc

what are accounts? are they wallets?
will I need to or should I use raw transactions? or would sendtoaddress work?
what is the benefit of the raw transactions? or just sendtoaddress?

Thanks and sorry if I was not clear enough on anything and I will provide more info if necessary.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
July 28, 2016, 03:34:28 PM
 #2

what are accounts? are they wallets?
Accounts are not the same as wallets. They are simply used for organizing your receiving addresses. You should not use the accounting system as it is deprecated and will be removed.

will I need to or should I use raw transactions? or would sendtoaddress work?
Sendtoaddress should be find, so long as you don't need to manage which UTXOs are spent.

what is the benefit of the raw transactions? or just sendtoaddress?
Raw transactions allow you to control everything about a transaction; the UTXOs to spend, addresses, and fees. However they are more advanced, and if done incorrectly, can result in the loss of a lot of Bitcoin.

InsidiousPoet (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
July 28, 2016, 04:07:31 PM
 #3

what are accounts? are they wallets?
Accounts are not the same as wallets. They are simply used for organizing your receiving addresses. You should not use the accounting system as it is deprecated and will be removed.
Thank you for your Input knightdk.
So ignore accounts as they are meaningless and going away soon, better to manage address's in wallets.

will I need to or should I use raw transactions? or would sendtoaddress work?
Sendtoaddress should be find, so long as you don't need to manage which UTXOs are spent.
When would or wouldn't I need to manage UTXO's? If ive 10btc in wallet A and sendtoaddress B 5btc, the remaining 5btc change would move to a new address in wallet A? is this something id need rawtrans for to specify the change address etc.

what is the benefit of the raw transactions? or just sendtoaddress?
Raw transactions allow you to control everything about a transaction; the UTXOs to spend, addresses, and fees. However they are more advanced, and if done incorrectly, can result in the loss of a lot of Bitcoin.

I am aware of the damage that raw transaction can do, and having lets say even a digit or value wrong could result in a lost transaction/btc. Obviously I want to understand this fully before I code and again test on the testnet before I consider running it normally.
I am really just doing this to be able to do it and learn more, not necessarily something to be used in production/as a service, but I would like it to be as good as something that could be used in production if that makes sense.
Thanks again
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
July 28, 2016, 04:18:41 PM
 #4

When would or wouldn't I need to manage UTXO's?
Manage UTXOs meaning choosing which outputs you want to use as your transaction inputs.

You would want to do this if you want to have some privacy by not allowing two addresses to be spend linked with each other.

If ive 10btc in wallet A and sendtoaddress B 5btc, the remaining 5btc change would move to a new address in wallet A? is this something id need rawtrans for to specify the change address etc.
If you want to manage the change address, you will need to use a raw transaction. sendtoaddress will create a change address for you.

I am aware of the damage that raw transaction can do, and having lets say even a digit or value wrong could result in a lost transaction/btc. Obviously I want to understand this fully before I code and again test on the testnet before I consider running it normally.
I am really just doing this to be able to do it and learn more, not necessarily something to be used in production/as a service, but I would like it to be as good as something that could be used in production if that makes sense.
Thanks again
It's not just getting a digit wrong. If you don't create a change output, the change will become your fee. If you don't add correctly, you may end up having too high a fee or too low.

InsidiousPoet (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
July 28, 2016, 05:26:57 PM
 #5

Manage UTXOs meaning choosing which outputs you want to use as your transaction inputs.

You would want to do this if you want to have some privacy by not allowing two addresses to be spend linked with each other.
Perfect got it thanks, I probably would want to go the raw transaction route in that case

If you want to manage the change address, you will need to use a raw transaction. sendtoaddress will create a change address for you.
seems like I would need a rawtransaction anyway, as you mentioned with regards to spend linked

I am aware of the damage that raw transaction can do, and having lets say even a digit or value wrong could result in a lost transaction/btc. Obviously I want to understand this fully before I code and again test on the testnet before I consider running it normally.
I am really just doing this to be able to do it and learn more, not necessarily something to be used in production/as a service, but I would like it to be as good as something that could be used in production if that makes sense.
Thanks again
It's not just getting a digit wrong. If you don't create a change output, the change will become your fee. If you don't add correctly, you may end up having too high a fee or too low.
Thanks that also cleared up some mental confusion I had
So raw transaction while more complicated seems to be the way I should approach this as again im trying to learn as much as possible and not take the easy shortcut.
And again I would use the testnet and not play around with actual bitcoins on the main blockchain
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!