项目作者: cwntr

项目描述 :
Implementations of clients for Stakenet technologies such as XSN Core Wallet, XSN Block Explorer and XSN Lightning Network lnd.
高级语言: Go
项目地址: git://github.com/cwntr/go-stakenet.git
创建时间: 2020-01-09T10:27:49Z
项目社区:https://github.com/cwntr/go-stakenet

开源协议:MIT License

下载


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

What Name Reference Date
CLI XSN Core Wallet github.com/X9Developers/XSN 2020-01
API XSN Block Explorer github.com/X9Developers/block-explorer 2020-01
CLI XSN Lightning Wallet github.com/lightningnetwork 2020-01

Usage Explorer Client

  1. import (
  2. "fmt"
  3. "github.com/cwntr/go-stakenet/explorer"
  4. "github.com/cwntr/go-stakenet/tools"
  5. )
  6. func testExplorer() {
  7. // no parameter will do on-fly-requests and responses without caching
  8. e := explorer.NewXSNExplorerAPIClient(nil)
  9. stats, err := e.GetStats()
  10. if err != nil {
  11. return
  12. }
  13. fmt.Printf("stats: %v\n", stats)
  14. // with recorder pointer parameter will locally store request and response pairs. This should only be used for responses
  15. // that will not change. e.g. get all details of a block, since a block is not gonna change.
  16. recorderPath := "records/xsn_block/%s"
  17. blockHash := "bf069bd8e1ce427c3dd7adf1aacc907051536210351bb8abcc76325486bce61d"
  18. blockRec, err := tools.CreateRecorder(fmt.Sprintf(recorderPath, blockHash))
  19. if err != nil {
  20. return
  21. }
  22. e2 := explorer.NewXSNExplorerAPIClient(blockRec)
  23. blockData, err := e2.GetBlockByQuery(blockHash)
  24. blockRec.Stop() //flush
  25. fmt.Printf("blockData: %v\n", blockData)
  26. }