Categorygithub.com/cwntr/go-stakenet
repositorypackage
1.0.6
Repository: https://github.com/cwntr/go-stakenet.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

go-stakenet

License Build Status Codacy Badge PRs Welcome

A collection of different clients for Stakenet (XSN) techologies. Find out more about Stakenet: https://stakenet.io/

You can see all the clients active and in use on https://stakenet.info

Installation

requirement: go v1.11+

> go get -u github.com/cwntr/go-stakenet

Stakenet (XSN) Clients implemented

WhatNameReferenceDate
CLIXSN Core Walletgithub.com/X9Developers/XSN2020-01
APIXSN Block Explorergithub.com/X9Developers/block-explorer2020-01
CLIXSN Lightning Walletgithub.com/lightningnetwork2020-01

Usage Explorer Client

import (
	"fmt"

	"github.com/cwntr/go-stakenet/explorer"
	"github.com/cwntr/go-stakenet/tools"
)

func testExplorer() {
	// no parameter will do on-fly-requests and responses without caching
	e := explorer.NewXSNExplorerAPIClient(nil)
	stats, err := e.GetStats()
	if err != nil {
		return
	}
	fmt.Printf("stats: %v\n", stats)



	// with recorder pointer parameter will locally store request and response pairs. This should only be used for responses
	// that will not change. e.g. get all details of a block, since a block is not gonna change.
	recorderPath := "records/xsn_block/%s"
	blockHash := "bf069bd8e1ce427c3dd7adf1aacc907051536210351bb8abcc76325486bce61d"
	blockRec, err := tools.CreateRecorder(fmt.Sprintf(recorderPath, blockHash))
	if err != nil {
		return
	}

	e2 := explorer.NewXSNExplorerAPIClient(blockRec)
	blockData, err := e2.GetBlockByQuery(blockHash)
	blockRec.Stop() //flush

	fmt.Printf("blockData: %v\n", blockData)
}