https://github.com/nethereum/nethereum.aws
Example of setting up Web3 to interact with AWS Managed Blockchain
https://github.com/nethereum/nethereum.aws
Last synced: about 1 year ago
JSON representation
Example of setting up Web3 to interact with AWS Managed Blockchain
- Host: GitHub
- URL: https://github.com/nethereum/nethereum.aws
- Owner: Nethereum
- License: mit
- Created: 2021-01-25T10:03:28.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-25T14:12:05.000Z (about 5 years ago)
- Last Synced: 2025-01-11T21:25:13.362Z (about 1 year ago)
- Language: C#
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nethereum.AWS
Example of setting up Web3 to interact with AWS Managed Blockchain
The new AWS Managed blockchain to connect to Ethereum Mainnet, Ropsten and others, requires each request to be signed and authenticated using AWS V4 signatures. This provides the template on how to achieve this.
For more information on the AWS Ethereum managed check this: https://docs.aws.amazon.com/managed-blockchain/latest/ethereum-dev/ethereum-json-rpc.html
```csharp
const string AWS_ACCESS_KEY_ID = "AKIAIOSFODNN7EXAMPLE";
const string AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY";
const string AMB_HTTP_ENDPOINT = "https://nd-6eaj5va43jggnpxouzp7y47e4y.ethereum.managedblockchain.us-east-1.amazonaws.com/";
const string PRIVATE_KEY = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
static async Task Main(string[] args)
{
var account = new Account(PRIVATE_KEY);
var web3 = AWSWeb3Factory.CreateWeb3(account, AMB_HTTP_ENDPOINT, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, "eu-west-2");
var blockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();
Console.WriteLine(blockNumber.Value);
}
```