View chain version number

This section describes how to view the chain version number.

The reference code is as follows:

package main

import (
	"context"
	"fmt"

	cess "github.com/CESSProject/cess-go-sdk"
)

var RPC_ADDRS = []string{
	"wss://testnet-rpc0.cess.cloud/ws/",
	"wss://testnet-rpc1.cess.cloud/ws/",
	"wss://testnet-rpc2.cess.cloud/ws/",
}

func main() {
	sdk, err := cess.New(
		context.Background(),
		cess.ConnectRpcAddrs(RPC_ADDRS),
	)
	if err != nil {
		panic(err)
	}

	// Query chain version
	fmt.Println(sdk.ChainVersion())
}

Last updated