viem-goviem-go

getBlobBaseFee

Returns the current blob base fee in wei

Import

Import the public actions package so you can call this action.

import "github.com/ChefBingbong/viem-go/actions/public"

Usage

An example showing how to construct a public client and query the current blob base fee.

import (
"context"
"log"
"github.com/ChefBingbong/viem-go/actions/public"
"github.com/ChefBingbong/viem-go/client"
"github.com/ChefBingbong/viem-go/client/transport"
"github.com/ChefBingbong/viem-go/chain/definitions"
)
ctx := context.Background()
publicClient, err := client.CreatePublicClient(client.PublicClientConfig{
Chain: definitions.Mainnet,
Transport: transport.HTTP("https://eth.llamarpc.com"),
})
if err != nil {
log.Fatal(err)
}
defer func() { _ = publicClient.Close() }()
blobBaseFee, err := public.GetBlobBaseFee(ctx, publicClient)
if err != nil {
log.Fatal(err)
}
log.Printf("Blob base fee: %s wei", blobBaseFee.String())

Returns

*big.Int

The current blob base fee in wei.

Parameters

This action takes no parameters.

JSON-RPC Method

Underlying JSON-RPC method used by this action.

eth_blobBaseFee (EIP-4844)