# Ethereum on Amazon Managed Blockchain [![license](https://img.shields.io/github/license/cdklabs/cdk-ethereum-node?color=green)](https://opensource.org/licenses/MIT) [![release](https://img.shields.io/github/v/release/cdklabs/cdk-ethereum-node?color=green)](https://github.com/cdklabs/cdk-ethereum-node/releases) [![npm:version](https://img.shields.io/npm/v/@cdklabs/cdk-ethereum-node?color=blue)](https://www.npmjs.com/package/@cdklabs/cdk-ethereum-node) [![PyPi:version](https://img.shields.io/pypi/v/cdklabs.cdk-ethereum-node?color=blue)](https://pypi.org/project/cdklabs.cdk-ethereum-node/) [![Maven:version](https://img.shields.io/maven-central/v/io.github.cdklabs/cdk-ethereum-node?color=blue&label=maven)](https://central.sonatype.dev/artifact/io.github.cdklabs/cdk-ethereum-node/0.0.61) [![NuGet:version](https://img.shields.io/nuget/v/Cdklabs.CdkEthereumNode?color=blue)](https://www.nuget.org/packages/Cdklabs.CdkEthereumNode) This repository contains a CDK construct to deploy an Ethereum node running on Amazon Managed Blockchain. The following networks are supported: * Mainnet (default) * Testnet: Goerli * Testnet: Rinkeby * Testnet: Ropsten ## Installation Note that this construct requires [AWS CDK v2](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install). #### JavaScript ```bash npm install --save @cdklabs/cdk-ethereum-node ``` #### Python ```bash pip3 install cdklabs.cdk-ethereum-node ``` #### Java Add the following to `pom.xml`: ```xml io.github.cdklabs cdk-ethereum-node ``` #### .NET ```bash dotnet add package Cdklabs.CdkEthereumNode ``` ## Usage A minimally complete deployment is shown below. By default, a `bc.t3.large` node will be created on the Ethereum Mainnet. ```typescript import { Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { EthereumNode, Network, InstanceType } from '@cdklabs/cdk-ethereum-node'; export class MyStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); new EthereumNode(this, 'Example'); } } ``` The equivalent Python code is as follows: ```python from aws_cdk import Stack from cdklabs.cdk_ethereum_node import EthereumNode class MyStack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) EthereumNode(self, 'Example') ``` The following is a more complex instantiation illustrating some of the node configuration options available. ```typescript new EthereumNode(this, 'Example', { network: Network.ROPSTEN, availabilityZone: 'us-east-1b', instanceType: InstanceType.BURSTABLE3_LARGE, }); ``` See the [API Documentation](API.md) for details on all available input and output parameters. ## References * [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/home.html) * [Amazon Managed Blockchain](https://aws.amazon.com/managed-blockchain/) * [Ethereum](https://ethereum.org/en/developers/docs/) ## Contributing Pull requests are welcomed. Please review the [Contributing Guidelines](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md). ## Security See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. ## Authors * Trinity Key (trinikey@amazon.com) * Marc Gozali (gozalim@amazon.com) ## License This project is licensed under the MIT-0 License. See the [LICENSE](LICENSE) file for details. # API Reference ## Constructs ### EthereumNode #### Initializers ```typescript import { EthereumNode } from '@cdklabs/cdk-ethereum-node' new EthereumNode(scope: Construct, id: string, props?: EthereumNodeProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | EthereumNodeProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Optional - *Type:* EthereumNodeProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### ~~`isConstruct`~~ ```typescript import { EthereumNode } from '@cdklabs/cdk-ethereum-node' EthereumNode.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | availabilityZone | string | The Availability Zone in which the node exists. | | instanceType | InstanceType | The Amazon Managed Blockchain instance type for the node. | | network | Network | Managed Blockchain Ethereum network identifier. | | region | string | The Region in which the node exists. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `availabilityZone`Required ```typescript public readonly availabilityZone: string; ``` - *Type:* string The Availability Zone in which the node exists. --- ##### `instanceType`Required ```typescript public readonly instanceType: InstanceType; ``` - *Type:* InstanceType The Amazon Managed Blockchain instance type for the node. --- ##### `network`Required ```typescript public readonly network: Network; ``` - *Type:* Network Managed Blockchain Ethereum network identifier. --- ##### `region`Required ```typescript public readonly region: string; ``` - *Type:* string The Region in which the node exists. --- ## Structs ### EthereumNodeProps Construct properties for `EthereumNode`. #### Initializer ```typescript import { EthereumNodeProps } from '@cdklabs/cdk-ethereum-node' const ethereumNodeProps: EthereumNodeProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | availabilityZone | string | The Availability Zone in which the node will be created. | | instanceType | InstanceType | The Amazon Managed Blockchain instance type for the Ethereum node. | | network | Network | The Ethereum Network in which the node will be created. | --- ##### `availabilityZone`Optional ```typescript public readonly availabilityZone: string; ``` - *Type:* string - *Default:* us-east-1a The Availability Zone in which the node will be created. --- ##### `instanceType`Optional ```typescript public readonly instanceType: InstanceType; ``` - *Type:* InstanceType - *Default:* BURSTABLE3_LARGE The Amazon Managed Blockchain instance type for the Ethereum node. --- ##### `network`Optional ```typescript public readonly network: Network; ``` - *Type:* Network - *Default:* The default network selected is Mainnet network The Ethereum Network in which the node will be created. --- ## Enums ### InstanceType Supported instance types for Managed Blockchain nodes. #### Members | **Name** | **Description** | | --- | --- | | BURSTABLE3_LARGE | *No description.* | | BURSTABLE3_XLARGE | *No description.* | | STANDARD5_LARGE | *No description.* | | STANDARD5_XLARGE | *No description.* | | STANDARD5_XLARGE2 | *No description.* | | STANDARD5_XLARGE4 | *No description.* | | COMPUTE5_XLARGE | *No description.* | | COMPUTE5_XLARGE2 | *No description.* | | COMPUTE5_XLARGE4 | *No description.* | --- ##### `BURSTABLE3_LARGE` --- ##### `BURSTABLE3_XLARGE` --- ##### `STANDARD5_LARGE` --- ##### `STANDARD5_XLARGE` --- ##### `STANDARD5_XLARGE2` --- ##### `STANDARD5_XLARGE4` --- ##### `COMPUTE5_XLARGE` --- ##### `COMPUTE5_XLARGE2` --- ##### `COMPUTE5_XLARGE4` --- ### Network Supported Ethereum networks for Managed Blockchain nodes. #### Members | **Name** | **Description** | | --- | --- | | MAINNET | *No description.* | | GOERLI | *No description.* | | RINKEBY | *No description.* | | ROPSTEN | *No description.* | --- ##### `MAINNET` --- ##### `GOERLI` --- ##### `RINKEBY` --- ##### `ROPSTEN` ---