https://github.com/said1296/gethaws
Geth client for AWS Managed Blockchain
https://github.com/said1296/gethaws
aws client connector geth geth-aws geth-node go golang managed-blockchain
Last synced: 3 months ago
JSON representation
Geth client for AWS Managed Blockchain
- Host: GitHub
- URL: https://github.com/said1296/gethaws
- Owner: said1296
- License: mit
- Created: 2022-10-03T15:27:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-14T23:07:00.000Z (over 3 years ago)
- Last Synced: 2023-09-13T09:13:41.456Z (over 2 years ago)
- Topics: aws, client, connector, geth, geth-aws, geth-node, go, golang, managed-blockchain
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)
}
}
```