基于区块链的毕业设计go-eth2-client – go-eth2-客户端

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计go-eth2-client – go-eth2-客户端 是一篇很好的国外资料

go-eth2-client

go-eth2-client - go-eth2-客户端 go-eth2-client - go-eth2-客户端 go-eth2-client - go-eth2-客户端 go-eth2-client - go-eth2-客户端 go-eth2-client - go-eth2-客户端

Go library providing an abstraction to multiple Ethereum 2 beacon nodes. Its external API follows the official Ethereum 2 APIs specification.

This library is under development; expect APIs and data structures to change until it reaches version 1.0.

Table of Contents

  • Install
  • Usage
  • Maintainers
  • Contribute
  • License

Install

go-eth2-client is a standard Go module which can be installed with:

go get github.com/attestantio/go-eth2-client

Support

go-eth2-client supports multiple beacon nodes. At current it provides support for the following:

  • Prysm using its GRPC interface
  • Lighthouse using its HTTP interface
  • Teku using its HTTP interface

Usage

go-eth2-client provides independent implementations for each beacon node interface, however it is generally easier to use the auto interface, as that will automatically select the correct client given the supplied address.

Please read the Go documentation for this library for interface information.

Example

Below is a complete annotated example to access a beacon node.

package main  import (     "context"     "fmt"          eth2client "github.com/attestantio/go-eth2-client"     "github.com/attestantio/go-eth2-client/auto"     "github.com/rs/zerolog" )  func main() {     // Provide a cancellable context to the creation function.     ctx, cancel := context.WithCancel(context.Background())     client, err := auto.New(ctx,         // WithAddress supplies the address of the beacon node, in host:port format.         auto.WithAddress("localhost:4000"),         // LogLevel supplies the level of logging to carry out.         auto.WithLogLevel(zerolog.WarnLevel),     )     if err != nil {         panic(err)     }          fmt.Printf("Connected to %sn", client.Name())          // Client functions have their own interfaces.  Not all functions are     // supported by all clients, so checks should be made for each function when     // casting the service to the relevant interface.     if provider, isProvider := client.(eth2client.SlotsPerEpochProvider); isProvider {         slotsPerEpoch, err := provider.SlotsPerEpoch(ctx)         if err != nil {             panic(err)         }         fmt.Printf("Slots per epochs is %dn", slotsPerEpoch)     }      // Cancelling the context passed to New() frees up resources held by the     // client, closes connections, clears handlers, etc.     cancel() } 

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2020 Attestant Limited


go-eth2-client

<go-eth2-client><go-eth2-client><go-eth2-client><go-eth2-client><go-eth2-client><go-eth2-client><go-eth2-client>go-eth2-client - go-eth2-客户端

Go库,为多个以太坊eth2信标节点提供抽象。它的外部API遵循官方的以太坊eth2API规范。

这个库正在开发中;在达到1.0版之前,API和数据结构会发生变化。

go-eth2-client是一个标准的go模块,可以安装在:

go-eth2-client支持多个信标节点。目前,它提供以下支持:

go-eth2-client为每个信标节点接口提供独立的实现,但是通常更容易使用自动接口,因为它会根据提供的地址自动选择正确的客户端。

有关接口信息,请阅读此库的Go文档。

下面是访问信标节点的完整注释示例。

吉姆·麦克唐纳:@mcdee。

欢迎投稿。请检查问题。

Apache-2.0©2020认证有限公司使用GRPC接口许可Prysm

  • Lighthouse使用其HTTP接口
  • Teku使用其HTTP接口
  • Go库,为多个以太坊eth2信标节点提供抽象。它的外部API遵循官方的以太坊eth2API规范。

    这个库正在开发中;在达到1.0版之前,API和数据结构会发生变化。

    Table of Contents

    • Lighthouse使用其HTTP接口
    • Teku使用其HTTP接口
    • Maintainers
    • Contribute
    • License

    Install

    go-eth2-client是一个标准的go模块,可以安装在:

    go get github.com/attestantio/go-eth2-client

    Support

    go-eth2-client支持多个信标节点。目前,它提供以下支持:

    • Prysm using its GRPC interface
    • Lighthouse using its HTTP interface
    • Teku using its HTTP interface

    Usage

    go-eth2-client为每个信标节点接口提供独立的实现,但是通常更容易使用自动接口,因为它会根据提供的地址自动选择正确的客户端。

    有关接口信息,请阅读此库的Go文档。

    Example

    下面是访问信标节点的完整注释示例。

    package main  import (     "context"     "fmt"          eth2client "github.com/attestantio/go-eth2-client"     "github.com/attestantio/go-eth2-client/auto"     "github.com/rs/zerolog" )  func main() {     // Provide a cancellable context to the creation function.     ctx, cancel := context.WithCancel(context.Background())     client, err := auto.New(ctx,         // WithAddress supplies the address of the beacon node, in host:port format.         auto.WithAddress("localhost:4000"),         // LogLevel supplies the level of logging to carry out.         auto.WithLogLevel(zerolog.WarnLevel),     )     if err != nil {         panic(err)     }          fmt.Printf("Connected to %sn", client.Name())          // Client functions have their own interfaces.  Not all functions are     // supported by all clients, so checks should be made for each function when     // casting the service to the relevant interface.     if provider, isProvider := client.(eth2client.SlotsPerEpochProvider); isProvider {         slotsPerEpoch, err := provider.SlotsPerEpoch(ctx)         if err != nil {             panic(err)         }         fmt.Printf("Slots per epochs is %dn", slotsPerEpoch)     }      // Cancelling the context passed to New() frees up resources held by the     // client, closes connections, clears handlers, etc.     cancel() } 

    Maintainers

    吉姆·麦克唐纳:@mcdee。

    Contribute

    欢迎投稿。请检查问题。

    License

    Apache-2.0©2020认证有限公司使用GRPC接口许可Prysm

  • Lighthouse使用其HTTP接口
  • Teku使用其HTTP接口
  • 部分转自网络,侵权联系删除区块链源码网

    www.interchains.cc

    https://www.interchains.cc/17535.html

    区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
    区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计go-eth2-client – go-eth2-客户端

    提供最优质的资源集合

    立即查看 了解详情