Closed BlinkyStitt closed 5 years ago
The overhead of calling the mint function is basically constant. For optimum efficiency you will want to mint as many tokens as possible per call. However, if you try to mint too many tokens, the tx requires a lot of gas and its inclusion in a block becomes less and less likely. (assuming you're only paying a low gas price to fill up the empty space in blocks)
It looks like https://github.com/projectchicago/gastoken/blob/master/miner/example_constant_price.py#L35 mints 26 (0x1a) tokens. Was there any particular reason this number was picked?
We just eyeballed it. Minting 26 tokens spreads the constant overhead over 26 tokens, so it's pretty efficient. At the same time, it costs ~1M gas. So there is a good chance the transaction will be mined reasonably quickly.
gas_delta
looks like it is for "overwriting" old transactions with the same nonce.
I'm working on a smart contract that I'm expecting to use a lot of gas and gastoken looks like one way for me to reduce costs.
The calculator on https://gastoken.io/ is very helpful for knowing how much gastoken to free, but is there a similar calculation for optimizing the minting process?
It looks like https://github.com/projectchicago/gastoken/blob/master/miner/example_constant_price.py#L35 mints 26 (0x1a) tokens. Was there any particular reason this number was picked?
Can you also explain what
gas_delta
is doing in the example code?