I understand the mempool is local to each node. I also understand the contents of the pool can thus change by node, and each miner is free to pick their tx's from their mempool for a block.

My question is, can you create a transaction yourself, include it in a block you mined, and never broadcast the tx as a txpool entry beyond your own node? only as part of the block you mined yourself, as long as it is a valid tx/block otherwise?

Specifically at this point I am interested to understand the validation logic for included transactions. I tried to read some of the code and found two places:




So if you can bypass the txpool, do the checks in add_tx never happen?

1 Answer 1


Yes, you can include a tx in a block without it being in the txpool.

If you mine the block and send it to other peers, they will request the transaction since they don't have it in their txpool and need it to verify the block, so you can then send it.

If you don't send it then, your block will be ignored since it cannot be verified.

Note that when those peers then verify the block after you send the tx, they will temporarily add it to their txpool since that's part of verifying the tx with the monerod code, but you still will never have added it to yours (it will require some code changes of course, but not much).

  • Thanks! So does every tx go through mempool when the chain is scanned from the beginning up to currect height? Do you have any pointer to where this happens in the code? I tried to look through the code for calls to tx_memory_pool::add_tx() but cannot find a clear flow.
    – kg_sYy
    Commented Jun 8, 2021 at 19:23
  • 2
    With the existing monerod, every tx goes through the txpool when syncing. See handle_incoming_tx, called from handle_notify_new_block, calling handle_incoming_txs, which calls add_new_tx.
    – user36303
    Commented Jun 8, 2021 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.