Gas Station Setup & Usage
Prerequisites
Overview
The majority of Ethereum Virtual Machine (EVM)-based blockchains require a fee to be paid in their base asset to execute transactions of both the base asset and other tokens. Referred to as gas, it is deducted from the account that executed the transaction.
The Gas Station service auto-fuels a vault account with the required base asset when it is enabled for them. Using the service helps cases of Fireblocks customers that choose to use the omnibus account vault structure or similar.
All transfers on Fireblocks, including those between vault accounts, take place on the blockchain. Therefore, you must pay gas fees when transferring funds from the deposit accounts to your omnibus vault account.
The auto-fuel transaction is triggered whenever a withdrawal or deposit is detected to or from that vault account. Fireblocks checks the balance of the vault and transfers gas according to the Gas Station parameters.
This service removes the need to monitor your base asset levels and manually transfer funds to your vault accounts to cover future transaction fees when funds are swept to your central vault (omnibus) account, where they can be invested.
Gas Station - supported networks
Ethereum and all EVM-based networks available in your Fireblocks workspace are supported.
See a complete list of Fireblocks Gas Station's supported networks with additional information.
Common use cases for Gas Station
Many retail businesses utilize the omnibus structure, making the Gas Station service a useful feature when many vault accounts are required to receive individual direct deposits from end clients.
- In this case, you'd monitor the Transaction status using webhooks.
- Then, upon
COMPLETED
transaction status, trigger a sweep from the end-client vault account to your omnibus deposits vault account.
Other business types utilizing the Fireblocks Gas Station:
- Exchanges
- Lending desks
- Neobanks
- Commercial and investment banks
Configuration
Enable the Gas Station
- Contact your Customer Success Manager to enable the Gas Station service for your workspace.
- Verify the following is shown in your workspace:
- Under the Network page, a new Network Connection named Fireblocks Gas Station will appear.
- Under the Whitelisted Addresses page, a new internal wallet called Gas Station Wallet will appear.
The internal Gas Station wallet holds asset addresses reflecting EVM-based assets supported by the Gas Station service that exist on each of the vaults you enable the Gas Station on.
Auto-Fueling
Identify and enable auto-Fuel for each vault account you want to fuel with the Fireblocks Console or Fireblocks API.
Enable auto-fueling in the Fireblocks Console
To enable auto-fueling from the Fireblocks Console for these vault accounts:
- Navigate to My Funds > Accounts in the Fireblocks Console.
- Locate the vault account you would like to enable auto-fueling for.
- Select ⋯ to open that vault account's action menu and select Enable Auto-Fueling.
- Select Enable to confirm your selection.
The Gas Station icon now appears next to the name of this vault account.
Enable auto-fueling using the Fireblocks API
To enable Auto-Fueling from your SDK client:
- Find the vault account ID you want to enable auto-fueling for by making a request to List vault accounts (paginated).
- Make a request to Turn auto-fueling on or off and input your desired vault account ID as the
vaultAccountId
parameter value.
To test, add this function to the code you should already have if you followed any of the language-specific guides under the Developing with Fireblocks section.
async function setAutoFuel(vaultAccountId, autoFuel){
const setAutofuel = await fireblocks.setAutoFuel(vaultAccountId, autoFuel);
console.log(JSON.stringify(setAutofuel, null, 2));
}
setAutoFuel(“0”, true);
def set_auto_fuel(vault_account_id: str, auto_fuel: bool) -> str:
return fireblocks.set_auto_fuel(vault_account_id, auto_fuel)
auto_fuel_status = set_auto_fuel("0", True)
This example sets the auto-fuel boolean to on (true
) for vault account Id 0
.
Gas Station parameters
To configure your Gas Station, you can change parameter settings using API The example below demonstrates how you can request to Edit gas station settings.
See detailed descriptions of Fireblocks Gas Station settings/parameters.
To test, add this function to the code you should already have if you followed any of the language-specific guides under the Developing with Fireblocks section.
async function setGasStationConf(gasThreshold, gasCap, maxPrice){
const gasStation = await fireblocks.setGasStationConfiguration(gasThreshold, gasCap, maxPrice);
console.log(JSON.stringify(gasStation, null, 2));
}
setGasStationConf("0.005", "0.01", "20");
def configure_gas_station(gas_threshold: str, gas_cap: str, max_gas_price: str):
fireblocks.set_gas_station_configuration(gas_threshold=gas_threshold, gas_cap=gas_cap, max_gas_price=max_gas_price)
gas_station_conf = configure_gas_station("0.005", "0.01", "20")
This example triggers the Gas Station to auto-fuel once the ETH balance is below the threshold of 0.005 ETH, and supplies the monitored vaults with 0.01 ETH_TEST at a price no higher than 20 Gwei.
Fund the Gas Station
To fund your Gas Station's internal wallet, deposit ETH or other base gas assets. This will be used to refuel your monitored vault accounts with gas for their outbound transactions.
Funding in the Fireblocks Console
To fund your Gas Station internal wallet from the Fireblocks Console:
- Open the Fireblocks Console in your browser.
- Select Whitelisted Addresses from the navigation panel.
- Search for Gas Station Wallet.
- Select the Gas Station Wallet to open it.
- All available assets and their balances are listed.
Funding using the Fireblocks API
To fund your Gas Station's internal wallet with the Fireblocks API:
- Find the ID of the wallet you want to fund by making a request to List internal wallets.
- Make a request to Create a new transaction and input your desired internal wallet ID as the
walletId
parameter value.
The example below funds the Gas Station wallet with ETH
based on its unique wallet gasStationWalletUUID
, in the value of 0.1
transferred from vault account ID 0
.
async function fundGasStationWallet(assetId, gasStationWalletUUID, fillAmount, fundingVaultId){
const payload = {
assetId: assetId,
source: {
type: PeerType.VAULT_ACCOUNT,
id: fundingVaultId
},
destination: {
type: PeerType.INTERNAL_WALLET,
id: gasStationWalletUUID
},
amount: fillAmount,
note: "Gas Station Funding"
};
const result = await fireblocks.createTransaction(payload);
console.log(JSON.stringify(result, null, 2));
}
fundGasStationWallet("ETH", "gasStationWalletUUID" ,"0.1","0");
def fund_gas_station(asset_id: str, gas_station_wallet_uuid: str, fill_amount: str,funding_vault_id: str):
tx_id = fireblocks.create_transaction(asset_id=asset_id,
amount=fill_amount,
source=TransferPeerPath("VAULT_ACCOUNT", funding_vault_id),
destination=DestinationTransferPeerPath("INTERNAL_WALLET",gas_station_wallet_uuid)
)
print(tx_id)
fund_gas_station("ETH","gasStationWalletUUID", "0.1","0")
Maintaining Gas Station funds
Maintaining funds for the Gas Station is a critical requirement to avoid business interruptions.
Transactions you attempt to make from wallets with insufficient gas will immediately and repeatedly fail until more is added.
To avoid this issue, your Gas Station must be properly funded on time.
Monitor the Gas Station
As your vault accounts get auto-fueled with gas assets transferred from the different Gas Station wallets, the level of each asset in your gas station is reduced and eventually requires additional funding.
From time to time, check the balance of the different assets in your Gas Station wallet, and ensure they are properly funded to meet your business needs. Trigger the fundGasStationWallet
function (shown above) to add more funds as needed.
Get the balances of your Gas Station assets by making a request to Get an asset from an internal wallet.
The example below gets the balance of a specific asset (ETH) in your Gas Station.
async function getGasStationBalance(walletId, assetId){
const internalWalletAsset = await fireblocks.getInternalWalletAsset(walletId, assetId);
console.log(JSON.stringify(internalWalletAsset.balance, null, 2));
}
getGasStationBalance("gasStationWalletUUID", "ETH");
def get_gas_station_balance(wallet_id: str, asset_id: str) -> str:
print(fireblocks.get_internal_wallet_asset(wallet_id, asset_id)['balance'])
get_gas_station_balance("gas_station_wallet_uuid", "ETH")
Monitor transactions for gas levels
It is best practice to monitor for transactions that don't have enough gas to identify problems in this process.
Learn more about best practices for error handling with Fireblocks.
Updated 8 months ago