How to include own tx into the block I'm mining?

to be clear,

I would setup a mining pool and I wish pay the leasers each time the pool generate a block.
How can I add a transaction into a block I’m mining ?

That way I could collect my own transaction fee when I pay leasers.

Thanks :slight_smile:

There is no general way to do this, also the block could be full when you are minging this preventing the tx to be added.
Also I dont see a real use case for this

If it’s not possible it mean that the block is already built even if you don’t know yet that you’re the generator ?

And what about trying to include my Tx on every new block until it’s done by my node ?

ofc there is a chance, so soon you see you are generating microblocks to push it, but I dont see why you would do it or with which adventage

Yes but I see no API to get the node’s current state.
I think I found a way to keep the Tx in my own pool, so it’s a first step.

I see many advantages, but for now it’s mostly to pay fast the leasers (on each block my pool generate I can pay all of them).

I’m not used at all to scala, and I take a lot of time to check and understand the node’s scripts but some hints will be useful.

Please note also, that in Waves NG protocol tx fee are distributed in 40/60 ration between the miner and next miner referencing its block.

1 Like

Why you need to understand the node scripts?

If you pay leasers on the same time you forge the fees, you will never be able to pay all the fees to the leasers, since your last tx will be to slow processed inside your blocks and the block will be over before all tx’s are processed, this causing the tx go to the next forger

Just checked node API at /debug/info

When your node is mining a block the state of minerState will be mining microblocks, you can rely on that.