Skip to content

Instantly share code, notes, and snippets.

@bbjubjub2494
Created September 23, 2024 19:15
Show Gist options
  • Select an option

  • Save bbjubjub2494/cc961e16561592996549a7abc46e9e2f to your computer and use it in GitHub Desktop.

Select an option

Save bbjubjub2494/cc961e16561592996549a7abc46e9e2f to your computer and use it in GitHub Desktop.
measure the uncompressed size of a transaction that registers a farcaster account
package main
import (
"context"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rlp"
"log"
)
// This will measure the uncompressed size of a transaction that registers a farcaster account on OP mainnet
func main() {
rpc_url := "https://mainnet.optimism.io"
// this is a recent transaction to the farcaster bundler contract
tx_hash := "0x19537dcc9d39f3e058903ce32543458d35ecd23f11d64e9b960574ce66657ec5"
ctx := context.Background()
c, err := ethclient.Dial(rpc_url)
if err != nil {
log.Fatal(err)
}
tx, _, err := c.TransactionByHash(ctx, common.HexToHash(tx_hash))
if err != nil {
log.Fatal(err)
}
data, err := rlp.EncodeToBytes(tx)
if err != nil {
log.Fatal(err)
}
// print result
println(len(data))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment