{"id":21531984,"url":"https://github.com/chainbound/fiber-go","last_synced_at":"2026-02-27T00:04:11.345Z","repository":{"id":59047343,"uuid":"534112225","full_name":"chainbound/fiber-go","owner":"chainbound","description":"Fiber client in Go","archived":false,"fork":false,"pushed_at":"2025-03-31T07:32:55.000Z","size":5594,"stargazers_count":5,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T08:28:42.519Z","etag":null,"topics":["devp2p","ethereum","go-ethereum","golang","mev","p2p"],"latest_commit_sha":null,"homepage":"https://fiber.chainbound.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainbound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-08T08:06:37.000Z","updated_at":"2025-03-06T09:58:50.000Z","dependencies_parsed_at":"2023-11-13T12:26:27.992Z","dependency_job_id":"07bdd18f-2857-4b88-a2b0-19b679bbd493","html_url":"https://github.com/chainbound/fiber-go","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainbound%2Ffiber-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainbound%2Ffiber-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainbound%2Ffiber-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainbound%2Ffiber-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainbound","download_url":"https://codeload.github.com/chainbound/fiber-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248134761,"owners_count":21053525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devp2p","ethereum","go-ethereum","golang","mev","p2p"],"created_at":"2024-11-24T02:18:25.515Z","updated_at":"2026-02-27T00:04:06.091Z","avatar_url":"https://github.com/chainbound.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `fiber-go`\n\nGo client package for interacting with Fiber Network.\n\n## Installation\n\n```bash\ngo get github.com/chainbound/fiber-go\n```\n\n## Usage\n\n### Connecting\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n}\n```\n\n### Client Configuration\n\nThe default configuration should work for most use cases, but you can customize it:\n\n```go\n// Create a custom configuration\nconfig := fiber.NewConfig()\n    .SetReadBufferSize(1024)\n    .SetIdleTimeout(10 * time.Second) // Restart connections idle for 10 seconds\n    .SetHealthCheckInterval(10 * time.Second) // Check connection health every 10 seconds\n\n// Use the configuration with a client\nclient := fiber.NewClientWithConfig(endpoint, apiKey, config)\n```\n\n#### Available Configuration Options\n\n- `EnableCompression()`: Enables gzip compression for all requests and responses\n- `SetWriteBufferSize(size int)`: Sets the gRPC write buffer size\n- `SetReadBufferSize(size int)`: Sets the gRPC read buffer size\n- `SetConnWindowSize(size int32)`: Sets the gRPC connection window size\n- `SetWindowSize(size int32)`: Sets the gRPC window size\n- `SetIdleTimeout(timeout time.Duration)`: Sets a timeout after which idle connections will be restarted automatically. Set to 0 to disable (default).\n- `SetHealthCheckInterval(interval time.Duration)`: Sets the interval for health checks. Set to 0 to disable (default).\n- `SetLogLevel(level string)`: Sets the log level. Default is `panic` (which never logs).\n\n### Subscriptions\n\nYou can find some examples on how to subscribe below. `fiber-go` uses the familiar `go-ethereum` core types where possible,\nmaking it easy to integrate with existing applications.\n\n#### Transactions\n\nTransactions are returned as `*fiber.TransactionWithSender` which is a wrapper around `go-ethereum` `*types.Transaction` plus the sender's address.\nThe sender address is included in the message to avoid having to recompute it from ECDSA signature recovery in the client, which can be slow.\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n    \"github.com/chainbound/fiber-go/filter\"\n    \"github.com/chainbound/fiber-go/protobuf/api\"\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    ch := make(chan *fiber.TransactionWithSender)\n    go func() {\n        if err := client.SubscribeNewTxs(nil, ch); err != nil {\n            log.Fatal(err)\n        }\n    }()\n\n    for message := range ch {\n        handleTransaction(message.Transaction)\n    }\n}\n```\n\n#### Filtering\n\nThe first argument to `SubscribeNewTxs` is a filter, which can be `nil` if you want to get all transactions.\nA filter can be built with the `filter` package:\n\n```go\nimport (\n    ...\n    \"github.com/chainbound/fiber-go/filter\"\n)\n\nfunc main() {\n    ...\n\n    // Construct filter\n    // example 1: all transactions with either of these addresses as the receiver\n    f := filter.New(filter.Or(\n        filter.To(\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"),\n        filter.To(\"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\"),\n    ))\n\n    // example 2: all transactions with a value greater than or equal to 1 ETH\n    f := filter.New(filter.ValueGte(big.NewInt(1) * big.NewInt(1e18)))\n\n    // example 3: all transactions with a value equal to 1 ETH\n    f := filter.New(filter.ValueEq(big.NewInt(1) * big.NewInt(1e18)))\n\n    // example 4: all transactions with a value less than or equal to 1 ETH\n    f := filter.New(filter.ValueLte(big.NewInt(1) * big.NewInt(1e18)))\n\n    // example 5: all ERC20 transfers on the 2 tokens below\n    f := filter.New(filter.And(\n        filter.MethodID(\"0xa9059cbb\"),\n        filter.Or(\n            filter.To(\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"),\n            filter.To(\"0xdAC17F958D2ee523a2206206994597C13D831ec7\"),\n        ),\n    ))\n\n    ch := make(chan *fiber.TransactionWithSender)\n    go func() {\n        // apply filter\n        if err := client.SubscribeNewTxs(f, ch); err != nil {\n            log.Fatal(err)\n        }\n    }()\n\n    ...\n}\n```\n\nYou can currently filter the following properties\n\n- To\n- From\n- MethodID\n- Value (greater than, less than, equal to)\n\n#### Execution Payloads (new blocks with transactions)\n\nExecution payloads are returned as `*fiber.Block` which is a wrapper around `go-ethereum` native types such as `Header`, `Transaction` and `Withdrawal`.\n\n```go\nimport (\n    ...\n    fiber \"github.com/chainbound/fiber-go\"\n)\n\nfunc main() {\n    ...\n\n    ch := make(chan *fiber.Block)\n\n    go func() {\n        if err := client.SubscribeNewExecutionPayloads(ch); err != nil {\n            log.Fatal(err)\n        }\n    }()\n\n    for block := range ch {\n        handlePayload(block)\n    }\n}\n```\n\n#### Beacon Blocks\n\nBeacon blocks follow the [Consensus specs](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#signedbeaconblock).\nThe returned items are `*fiber.BeaconBlock` which is a wrapper around `go-eth-2` `SignedBeaconBlock` depending on the hardfork version:\n\nEach `*fiber.BeaconBlock` contains the `DataVersion` field which indicates the hardfork version of the beacon block.\nThe returned type will contain either a Bellatrix (3), Capella (4) or Deneb (5) hardfork block depending on the specified DataVersion.\n\n```go\nimport (\n    ...\n    fiber \"github.com/chainbound/fiber-go\"\n)\n\nfunc main() {\n    ...\n\n    ch := make(chan *fiber.BeaconBlock)\n\n    go func() {\n        if err := client.SubscribeNewBeaconBlocks(ch); err != nil {\n            log.Fatal(err)\n        }\n    }()\n\n    for block := range ch {\n        handleBeaconBlock(block)\n    }\n}\n```\n\n#### Raw Beacon Blocks\n\nRaw beacon blocks are raw, SSZ-encoded bytes that you can manually decode into [SignedBeaconBlocks](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#signedbeaconblock) in your application.\n\n```go\nimport (\n    ...\n    fiber \"github.com/chainbound/fiber-go\"\n)\n\nfunc main() {\n    ...\n\n    ch := make(chan []byte)\n\n    go func() {\n        if err := client.SubscribeNewRawBeaconBlocks(ch); err != nil {\n            log.Fatal(err)\n        }\n    }()\n\n    for block := range ch {\n        handleRawBeaconBlock(block)\n    }\n}\n```\n\n### Sending Transactions\n\n#### `SendTransaction`\n\nThis method supports sending a single `go-ethereum` `*types.Transaction` object to the Fiber Network.\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"math/big\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n\n    \"github.com/ethereum/go-ethereum/core/types\"\n    \"github.com/ethereum/go-ethereum/common\"\n    \"github.com/ethereum/go-ethereum/crypto\"\n\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    // Example transaction\n    tx := types.NewTx(\u0026types.DynamicFeeTx{\n        Nonce:     nonce,\n        To:        common.HexToAddress(\"0x....\"),\n        Value:     big.NewInt(100),\n        Gas:       21000,\n        GasFeeCap: big.NewInt(x),\n        GasTipCap: big.NewInt(y),\n        Data:      nil,\n    })\n\n    pk, _ := crypto.HexToECDSA(\"PRIVATE_KEY\")\n    signer := types.NewLondonSigner(common.Big1)\n\n    signed, err := types.SignTx(tx, signer, pk)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    hash, timestamp, err := client.SendTransaction(ctx, signed)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    doSomething(hash, timestamp)\n}\n```\n\n#### `SendTransactionSequence`\n\nThis method supports sending a sequence of transactions to the Fiber Network.\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"math/big\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n\n    \"github.com/ethereum/go-ethereum/core/types\"\n    \"github.com/ethereum/go-ethereum/common\"\n    \"github.com/ethereum/go-ethereum/crypto\"\n\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    // Example transaction\n    tx := types.NewTx(\u0026types.DynamicFeeTx{\n        Nonce:     nonce,\n        To:        common.HexToAddress(\"0x....\"),\n        Value:     big.NewInt(100),\n        Gas:       21000,\n        GasFeeCap: big.NewInt(x),\n        GasTipCap: big.NewInt(y),\n        Data:      nil,\n    })\n\n    pk, _ := crypto.HexToECDSA(\"PRIVATE_KEY\")\n    signer := types.NewLondonSigner(common.Big1)\n\n    signed, err := types.SignTx(tx, signer, pk)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // type should be *types.Transaction (but signed, e.g. v,r,s fields filled in)\n    target := someTargetTransaction\n\n    hashes, timestamp, err := client.SendTransactionSequence(ctx, target, signed)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    doSomething(hashes, timestamp)\n}\n```\n\n#### `SendRawTransaction`\n\nThis method supports sending a single raw, RLP-encoded transaction to the Fiber Network.\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"math/big\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n\n    \"github.com/ethereum/go-ethereum/core/types\"\n    \"github.com/ethereum/go-ethereum/common\"\n    \"github.com/ethereum/go-ethereum/crypto\"\n\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    // Example transaction\n    tx := types.NewTx(\u0026types.DynamicFeeTx{\n        Nonce:     nonce,\n        To:        common.HexToAddress(\"0x....\"),\n        Value:     big.NewInt(100),\n        Gas:       21000,\n        GasFeeCap: big.NewInt(x),\n        GasTipCap: big.NewInt(y),\n        Data:      nil,\n    })\n\n    pk, _ := crypto.HexToECDSA(\"PRIVATE_KEY\")\n    signer := types.NewLondonSigner(common.Big1)\n\n    signed, err := types.SignTx(tx, signer, pk)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    bytes, err := signed.MarshalBinary()\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    hash, timestamp, err := client.SendRawTransaction(ctx, bytes)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    doSomething(hash, timestamp)\n}\n```\n\n#### `SendRawTransactionSequence`\n\nThis method supports sending a sequence of raw, RLP-encoded transactions to the Fiber Network.\n\n```go\nimport (\n    \"context\"\n    \"log\"\n    \"math/big\"\n    \"time\"\n\n    fiber \"github.com/chainbound/fiber-go\"\n\n    \"github.com/ethereum/go-ethereum/core/types\"\n    \"github.com/ethereum/go-ethereum/common\"\n    \"github.com/ethereum/go-ethereum/crypto\"\n\n)\n\nfunc main() {\n    endpoint := \"fiber.example.io\"\n    apiKey := \"YOUR_API_KEY\"\n    client := fiber.NewClient(endpoint, apiKey)\n    defer client.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n    defer cancel()\n    if err := client.Connect(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    // Example transaction\n    tx := types.NewTx(\u0026types.DynamicFeeTx{\n        Nonce:     nonce,\n        To:        common.HexToAddress(\"0x....\"),\n        Value:     big.NewInt(100),\n        Gas:       21000,\n        GasFeeCap: big.NewInt(x),\n        GasTipCap: big.NewInt(y),\n        Data:      nil,\n    })\n\n    pk, _ := crypto.HexToECDSA(\"PRIVATE_KEY\")\n    signer := types.NewLondonSigner(common.Big1)\n\n    signed, err := types.SignTx(tx, signer, pk)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    bytes, err := signed.MarshalBinary()\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Type should be []byte\n    targetTransaction := someTargetTransaction\n\n    hashes, timestamp, err := client.SendRawTransactionSequence(ctx, targetTransaction, bytes)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    doSomething(hashes, timestamp)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainbound%2Ffiber-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainbound%2Ffiber-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainbound%2Ffiber-go/lists"}