Ethclient Providers Block Race
Test your Ethclient Providers with a race to discover x blocks
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)
}