GithubHelp home page GithubHelp logo

said1296 / gethaws Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

Geth client for AWS Managed Blockchain

License: MIT License

Go 100.00%
aws client connector geth geth-node go golang geth-aws managed-blockchain

gethaws's Introduction

Geth Client For AWS Managed Blockchain

Generates RPC clients for regular JSON-RPC clients such as Infura or Alchemy, and for Managed Blockchain which uses a custom authentication mechanism.

Installing

go get github.com/said1296/gethaws

Limitations

Only works for HTTP client, will add support for other client types if people request it.

Usage

In this example the clients are configured loading the configuration from env variables. Further config instructions found at:

https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/

You can also pass an aws.Config struct instead of nil to CreateClients in order to use a custom aws.Config.

package main

import (
    "context"
    "github.com/aws/aws-sdk-go-v2/config"
    "net/http"
    "os"
)

func main() {
    err := os.Setenv("AWS_REGION", "us-east-2")
    if err != nil {
        panic(err)
    }
    err = os.Setenv("AWS_ACCESS_KEY_ID", "my_access_key_id")
    if err != nil {
        panic(err)
    }
    err = os.Setenv("AWS_SECRET_ACCESS_KEY", "my_secret_access_key")
    if err != nil {
        panic(err)
    }
    
    // The most common use cases will only use the first returned client, the rpc client is for low level calls not 
    // implemented by geth.
    // The clients can also be created with a manually created aws.Config by passing it instead of nil.
    client, rpcClient, err := gethaws.CreateClients(ctx.Background(), "https://ethereum.managedblockchain/1jsj1i23213nk32mo1", nil)
    if err != nil {
        panic(err)
    }
}

gethaws's People

Contributors

said1296 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.