<p>There is no way to reliably pick the block in which your transaction will be mined. The best you can do is to broadcast your transaction right after the previous block is mined, and set the fee high enough to get it into the next block. However, this won't always work:</p>
<ul>
<li>Transactions propagate through the network with random deliberate delays to protect the privacy of the originating node. This means a miner can find the next block before the transaction reaches them. You might be able to bypass these delays by submitting your transaction directly to all miners and pools that support it. Even without these delays the miner could mine the block before updating their block template, which they might do once every few seconds.</li>
<li>The next block could include transactions submitted privately to the miner (pool) that overpay your transactions and push it out of the next expected block. You wouldn't see these transactions in your mempool and so you might set the fee too low. Worse yet, the miner could be selling the entire block space in a private deal for a token mint or whatever, and no fee could get you in. Finally, your desired block might end up being <a href="https://bitcoin.stackexchange.com/questions/tagged/empty-blocks">empty</a>.</li>
</ul>
<p>Transaction locktimes don't help you because a transaction can only be broadcast after its locktime expires. Recently I've seen calls for creating an extension to the mempool that would accept transactions with soon-expiring locktimes, which would help in your case as all miners would have your transaction at the time it's ready to be mined.</p>

CC BY-SA 4.0
2024-02-25T20:58:39.853Z
2024-04-19T04:22:19.353Z
2024-04-19T04:22:19.353Z
Vojtěch Strnad
<p>I am developping a bot for a customer with the following goals in mind:</p>
<ul>
<li>to inscribe a satoshi with the block number that it has been mined in (ordinal inscription) on every block. i think this is called bitmap, and you write blocknumber.bitmap.</li>
</ul>
<p>I have managed to build this bot, connect it to my local bitcoincore node and spam a minting transaction every block by listening to the number returned via &quot;getblock&quot; command to bitcoin core, but i don't know how to actually pick the block that the transaction will be minted in since this seems to be a random process decided by miners and their management of the mempool. So what happens is that the block number inscribed is rarely the correct one, since i try to write either the current block number or the current block number +1 or +2.</p>
<p>Is there a process that would allow me to either decide which block my transaction will get mined in, or to dynamically change the text as it is mined to get the actual block number?</p>

<transactions><mining-pools><block><ordinals><height>
How to pick the block in which a transaction will get mined?
Yann
# How to pick the block in which a transaction will get mined?

(Asked by: username_0 on 2024-02-25)

I am developping a bot for a customer with the following goals in mind:

* to inscribe a satoshi with the block number that it has been mined in (ordinal inscription) on every block. i think this is called bitmap, and you write blocknumber.bitmap.

I have managed to build this bot, connect it to my local bitcoincore node and spam a minting transaction every block by listening to the number returned via "getblock" command to bitcoin core, but i don't know how to actually pick the block that the transaction will be minted in since this seems to be a random process decided by miners and their management of the mempool. So what happens is that the block number inscribed is rarely the correct one, since i try to write either the current block number or the current block number +1 or +2.

Is there a process that would allow me to either decide which block my transaction will get mined in, or to dynamically change the text as it is mined to get the actual block number?

**Tags:** transactions, mining-pools, block, ordinals, height


---

## 1 answers

### Answer by username_1 on 2024-02-25. Score: 2 | Accepted answer

There is no way to reliably pick the block in which your transaction will be mined. The best you can do is to broadcast your transaction right after the previous block is mined, and set the fee high enough to get it into the next block. However, this won't always work:

* Transactions propagate through the network with random deliberate delays to protect the privacy of the originating node. This means a miner can find the next block before the transaction reaches them. You might be able to bypass these delays by submitting your transaction directly to all miners and pools that support it. Even without these delays the miner could mine the block before updating their block template, which they might do once every few seconds.
* The next block could include transactions submitted privately to the miner (pool) that overpay your transactions and push it out of the next expected block. You wouldn't see these transactions in your mempool and so you might set the fee too low. Worse yet, the miner could be selling the entire block space in a private deal for a token mint or whatever, and no fee could get you in. Finally, your desired block might end up being [empty](https://bitcoin.stackexchange.com/questions/tagged/empty-blocks).

Transaction locktimes don't help you because a transaction can only be broadcast after its locktime expires. Recently I've seen calls for creating an extension to the mempool that would accept transactions with soon-expiring locktimes, which would help in your case as all miners would have your transaction at the time it's ready to be mined.


---

