Bitcoin Forum
May 10, 2024, 05:15:15 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to place tx in own mempool without broadcasting?  (Read 191 times)
luv2drnkbr (OP)
Hero Member
*****
Offline Offline

Activity: 793
Merit: 1016



View Profile
February 15, 2018, 03:43:34 PM
Merited by ABCbits (1)
 #1

Is there a way I can add a transaction to my own memory pool without broadcasting it to the network?  Imagine I am mining my own transactions and want them kept secret from the network unless they are in a block.  (For example, a time-locked commitment that triggers another event which I want to make sure can only happen AFTER my tx is in a block.)

As far as I can figure, the only way to do this is to mine the transaction myself.  And right now, the only way I can think to do that is to run two nodes where one is a bridge "blocks only" node and is the sole node that the other (mining) node connects to.  Then I can add transactions to the mining node manually.  But then it won't know about any other transactions on the network that I might want to also include in the block I am mining.

Is there a way to accomplish this?  To have my transaction in my block template without broadcasting it?

1715361315
Hero Member
*
Offline Offline

Posts: 1715361315

View Profile Personal Message (Offline)

Ignore
1715361315
Reply with quote  #2

1715361315
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715361315
Hero Member
*
Offline Offline

Posts: 1715361315

View Profile Personal Message (Offline)

Ignore
1715361315
Reply with quote  #2

1715361315
Report to moderator
1715361315
Hero Member
*
Offline Offline

Posts: 1715361315

View Profile Personal Message (Offline)

Ignore
1715361315
Reply with quote  #2

1715361315
Report to moderator
1715361315
Hero Member
*
Offline Offline

Posts: 1715361315

View Profile Personal Message (Offline)

Ignore
1715361315
Reply with quote  #2

1715361315
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
February 16, 2018, 01:10:09 AM
Merited by ABCbits (2), RGBKey (2)
 #2

You can modify Bitcoin Core from source to disable transaction relay for things that come from the sendrawtransaction RPC command. Just remove or comment out these lines: https://github.com/bitcoin/bitcoin/blob/master/src/rpc/rawtransaction.cpp#L1018-L1022

luv2drnkbr (OP)
Hero Member
*****
Offline Offline

Activity: 793
Merit: 1016



View Profile
February 16, 2018, 04:59:21 PM
 #3

Oh gee that's a good idea.  And that just applies to the RPC call, right?  So it wouldn't interfere with broadcasting the transaction if/when the block is mined..??

Assuming that's the case, that's exactly what I'm looking for, thanks!  One quick question, is that code you highlighted also responsible for using sendrawtransaction via the bitcoin-cli program, or do I need to find and commend out code somewhere else for doing it via the cli?  Either way, it's no trouble to use the RPC interface, so you've definitely given me a working solution.  Thanks!

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
February 16, 2018, 06:18:41 PM
 #4

Oh gee that's a good idea.  And that just applies to the RPC call, right?  So it wouldn't interfere with broadcasting the transaction if/when the block is mined..??
Yes, it should only applies to the RPC call. Of course you should test that for yourself before actually using it.

Assuming that's the case, that's exactly what I'm looking for, thanks!  One quick question, is that code you highlighted also responsible for using sendrawtransaction via the bitcoin-cli program, or do I need to find and commend out code somewhere else for doing it via the cli?  Either way, it's no trouble to use the RPC interface, so you've definitely given me a working solution.  Thanks!
You can use bitcoin-cli. bitcoin-cli is just a tool to interact with the RPC interface.

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!