View storage node details

This section describes how to view details of a storage node.

The reference code is as follows:

package main

import (
	"context"
	"fmt"

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

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

// Storage node account to view
var account_miner = "cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y"

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

	// Resolve the public key of the account
	publicKey, err := utils.ParsingPublickey(account_miner)
	if err != nil {
		panic(err)
	}

	// Query storage node details
	fmt.Println(sdk.QueryStorageMiner(publicKey))
}

Last updated