Bitcoin Forum
October 03, 2024, 07:32:04 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to disable or break TX push when using sendtoaddress?  (Read 645 times)
21st-century (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
April 14, 2014, 10:14:55 PM
 #1

I am in the process of writing some code at the moment and I'm looking for a way to use the official Bitcoin client for as much of this as possible. Basically, I would like to find a way to return a raw transaction representing the result from executing a JSON-RPC sendtoaddress call but without sending the actual transaction. As far as I can tell, the Bitcoind's API doesn't support this, but there might yet be a way to programmatically break the daemon and convince Bitcoin the TX was sent when it wasn't. Perhaps by manipulating connected peers? Actually I don't even need the raw transaction. I just need the transaction ID and a guarantee the transaction it was derived from hasn't been sent.

Any help would be appreciated Wink
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 287


View Profile
April 14, 2014, 11:17:04 PM
 #2

What language are you writing your code in? You can just use the raw transaction api without tinkering with the source code?

Bitwasp Developer.
21st-century (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
April 14, 2014, 11:26:09 PM
 #3

What language are you writing your code in? You can just use the raw transaction api without tinkering with the source code?

I am using Python and yes, indeed, I can use raw transactions but the advantage of the sendtoaddress function is it automatically takes care of combining inputs, handling fees, and setting up outputs for change. That is tedious work I might get wrong if I try re-implement. I am currently making progress with hacking Bitcoin not to send the transaction. It involves setting connect=127.0.0.1 in the config, killing the daemon after the sendtoaddress and then removing the database entry. Bitcoin can't send the transaction like this but still returns a TX ID. It's kind of worse than just manually implementing sendtoaddress so I probably won't be using this.

Do you know of any good libraries that might help replicate sendtoaddress?
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 287


View Profile
April 16, 2014, 08:22:11 AM
 #4

I'm not so sure on python! but since you're already hacking bitcoind you're probably on the right track. Maybe create a duplicate of sendtoaddress that only returns the raw transaction?

Otherwise you're right, you'd have to do a lot of coding yourself just to piece together essentially the same thing bitcoind does.

Bitwasp Developer.
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!