Open benhaben opened 2 months ago
package main import ( "log" "time" "context" "fmt" "github.com/gagliardetto/solana-go/rpc" "golang.org/x/time/rate" ) func main() { cluster := rpc.MainNetBeta rpcClient := rpc.NewWithCustomRPCClient(rpc.NewWithLimiter( cluster.RPC, rate.Every(time.Second), // time frame 5, // limit of requests per time frame )) // Get the recent blockhash: recent, err := rpcClient.GetLatestBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { log.Fatalf("Failed to get latest blockhash: %v", err) } fmt.Printf(" Blockhash: %s\n", recent.Value.Blockhash) fmt.Printf(" LastValidBlockHeight: %d\n", recent.Value.LastValidBlockHeight) }
report error : Failed to get latest blockhash: rpc call getLatestBlockhash() on https://api.mainnet-beta.solana.com: Post "https://api.mainnet-beta.solana.com": read tcp 127.0.0.1:60388->127.0.0.1:33210: read: connection reset by peer
same problem. did u solve it?
Maybe your IP got blocked? It's public RPC.
report error : Failed to get latest blockhash: rpc call getLatestBlockhash() on https://api.mainnet-beta.solana.com: Post "https://api.mainnet-beta.solana.com": read tcp 127.0.0.1:60388->127.0.0.1:33210: read: connection reset by peer