ethclientProvidersBlockRace

package module
v0.0.0-...-f5caef4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2022 License: GPL-2.0 Imports: 7 Imported by: 1

README

Go Reference Go Report Card Coverage Status

Ethclient Providers Block Race

Test your Ethclient Providers with a race to discover x blocks

race

Prerequisite

Required:

Usage

go get github.com/rrobrms/ethclient-providers-block-race.go
import race "github.com/rrobrms/ethclient-providers-block-race"

func MyFunc() {
	var (
		blockCount = 23
		wsProviders = []string{
			"wss://eth-mainnet.g.alchemy.com/v2/ALCHEMY_API_KEY",
			"wss://mainnet.infura.io/ws/v3/INFURA_API_KEY",
			"wss://rpc.ankr.com/eth",
		}
	)

	best, err := race.New(wsProviders, blockCount)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("\nyou should use this provider: %s\n", best)
}

Documentation

Overview

Run block race with the providers urls you wish to test. Choose also the number of block the race should last, it will return the fastest one to use for your client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(wsProviders []string, blockCount int) (best string, err error)

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL