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


#1

Hello,
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:


#2

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


#3

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 ?


#4

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


#5

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.


#6

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.


#7

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