$0.00444 -2.77%
VET · 4d

[Peter Zhou] What you might not know about VeChainThor yet (Part IV) — Mining gas price

What you might not know about VeChainThor yet (Part IV) — Mining gas price

This is the fourth article of the “What you might not know about VeChainThor yet” series. You can find the link of the previous article at the end.

VeChainThor allows a transaction (TX) sender to mine extra gas price for his TX. In particular, the sender conducts some computation locally to search for the best TX nonce that maximizes some predefined proof of work (PoW) within a limited amount of time before he sends the TX off to the network.

When processing the TX, the system converts any valid PoW into extra gas price for calculating the reward for packing the TX into a new block for the block generator. In this way, the TX sender can increase the priority of the TX within the TX pool at the cost of some local computation.

How to Mine?

Let n and g represent the values of TX fields Nonce and Gas, respectively. We use b to denote the number of the block indexed by TX field BlockRef and h the number of the block that includes the TX. Let Ω denote the TX without fields Nonce and Signature, S the TX sender's account address, P the base gas price, H the hash function and E the RLP encoding function.

The PoW, w, is defined as:

The extra gas price, Δ P, is computed as:

with the following constraint

The VTHO reward r for packing the TX into a new block is computed as:

where φ ∈ [0, 1] is the gas price coefficient and g*the actual amount of gas used for executing the TX.

From the above equations, we know that

Since b is a valid block number, BlockRef must refer to an existing block, that is, its value must equal the first four bytes of an existing block ID; The TX must be packed into a block within the period of 30 blocks after block b, or otherwise, the PoW would not be recognized by the system; The extra gas price ΔP can not be greater than base gas price P. Demo

I have made a demo that implements the relev...

Continue on
Recent news