Runlog gas lanes

Background

What are gas lanes?

Gas lanes allow us to create runlog jobs with different maximum gas prices. This allows us to create cheap runlog jobs that will not be fulfilled during gas spikes and more expensive runlog jobs that are guaranteed to be fulfilled during the highest gas spikes. This is especially useful for runlog users who do not need requests to be fulfilled at high gas prices, making it cheaper overall.

How do we achieve this?

If we were to create runlog jobs with different max gas prices using the same Ethereum account, we would likely end up in a situation where a low gas price transaction is holding up a queue of high gas price transactions. Luckily, the Chainlink node supports using multiple Ethereum accounts. This allows us to purpose each account for its own gas lane.

As an example, we could have this setup of accounts on the node:

  • Account A: max gas price = 50 Gwei

  • Account B: max gas price = 500 Gwei

  • Account C: max gas price = 5,000 Gwei

Setting it up

In some versions of the Chainlink node, the ETH_MAX_GAS_PRICE_GWEI env var will override the gas lane settings. Make sure you're not using this env var with gas lanes prior to v1.5.0.

1. Configuring the accounts

Remember to take note of which gas lane you configure each account for!

Updating existing accounts

The Chainlink node will automatically create a new account on the initial setup. To set the gas lane of this account or any other additional accounts you've added to the node, you can use the command below:

chainlink keys eth update --maxGasPriceGWei <gas price> <address>
# Example to use this account as the 300 Gwei gas lane:
chainlink keys eth update --maxGasPriceGWei 300 0x481df95742cc38b387871e789913659a2469daa6

Add new accounts

To add new accounts to the node (and set their gas lane), you can use the following command:

chainlink keys eth create --maxGasPriceGWei <gas price>
# Example to create a 300 Gwei gas lane:
chainlink keys eth create --maxGasPriceGWei 300

2. Setting up the jobs

Next, we need to configure jobs to use the correct gas lane. We do this by defining the "from" address in the ethTx task of the jobs, e.g.:

submit_tx    [type="ethtx"
               from="<The account address for the desired gas lane>"
               to="0x049bd8c3adc3fe7d3fc2a44541d955a537c2a484"
               data="$(encode_tx)"]

Once we create this job, it will use the account we defined in the from param - which means that this job will not use a gas price higher than what we defined for this account.

If you have existing jobs on your node, you will probably want to modify them to specify which gas lane to use - otherwise it will choose one at random!

Last updated