How to place tx in own mempool without broadcasting?

The following content was written by luv2drnkbr on February 15, 2018, 03:43:34 PM in the thread How to place tx in own mempool without broadcasting?. All content is owned by the author of the bitcointalk.org post. (original)


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?

The following content was written by achow101 on February 16, 2018, 01:10:09 AM in the thread How to place tx in own mempool without broadcasting?. All content is owned by the author of the bitcointalk.org post. (original)


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

The following content was written by luv2drnkbr on February 16, 2018, 04:59:21 PM in the thread How to place tx in own mempool without broadcasting?. All content is owned by the author of the bitcointalk.org post. (original)


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!

The following content was written by achow101 on February 16, 2018, 06:18:41 PM in the thread How to place tx in own mempool without broadcasting?. All content is owned by the author of the bitcointalk.org post. (original)


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.

Subscribe our latest updates

Don't miss out. Be the first one to know when a new guide or tool comes out.

Subscription Form

Support Us ❤

Creating learning material requires a lot of time and resources. So if you appreciate what we do, send us a tip to bc1qm02xguzxxhk7299vytrt8sa8s6fkns2udf8gjj. Thanks!