You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -10,8 +10,46 @@ This guide walks you through deploying a Bitcoin Core mainnet node in a **Virtua
10
10
11
11
---
12
12
13
+
## Well-Architected
14
+
15
+
<details>
16
+
<summary>Review pros and cons of this solution.</summary>
17
+
18
+
### Well-Architected Checklist
19
+
20
+
This is the Well-Architected checklist for **Bitcoin Core node implementation** of the AWS Blockchain Node Runner app. This checklist takes into account questions from the [AWS Well-Architected Framework](https://aws.amazon.com/architecture/well-architected/) which are relevant to this workload. Please feel free to add more checks from the framework if required for your workload.
| Security | Network protection | Are there unnecessary open ports in security groups? | Port 8332 (RPC) is restricted to the VPC. |
25
+
||| Traffic inspection | Optional: VPC Flow Logs or traffic mirroring can be enabled for deeper inspection. |
26
+
|| Compute protection | Reduce attack surface | This solution uses Amazon Linux 2 AMI. No SSH access is enabled; SSM is used. |
27
+
||| Enable people to perform actions at a distance | This solution uses AWS Systems Manager Session Manager. |
28
+
|| Data protection at rest | Use encrypted Amazon Elastic Block Store (Amazon EBS) volumes | Encrypted Amazon EBS volumes are used. |
29
+
|| Data protection in transit | Use TLS | The AWS Application Load balancer currently uses HTTP listener. Create HTTPS listener with self signed certificate if TLS is desired. |
30
+
|| Authorization and access control | Use instance profile with Amazon Elastic Compute Cloud (Amazon EC2) instances | AWS IAM role is attached to the EC2 instance. |
31
+
||| Following principle of least privilege access | IAM privileges are scoped down to what is necessary. |
32
+
|| Application security | Security focused development practices |`cdk-nag` is used with appropriate suppressions. |
33
+
| Cost optimization | Service selection | Use cost effective resources | Cost efficient T3 instances provide a baseline level of CPU performance with the ability to burst CPU usage at any time for as long as required. T3 instances are designed for applications with moderate CPU usage that experience temporary spikes in use. |
34
+
| Reliability | Resiliency implementation | Withstand component failures | Single node deployment. Can be extended with backup nodes and monitoring. |
35
+
|| Resource monitoring | How are workload resources monitored? | Amazon CloudWatch Dashboards track CPU, memory, disk, network, and block height. |
36
+
| Performance efficiency | Compute selection | How is compute solution selected? | Compute solution is selected based on performance needs and budget. |
37
+
|| Storage selection | How is storage solution selected? | EBS volumes (e.g. gp3 or io2) are selected for consistent throughput and IOPS. |
38
+
| Operational excellence | Workload health | How is health of workload determined? | Health is tracked using CloudWatch custom metrics including block height. |
39
+
| Sustainability | Hardware & services | Select most efficient hardware for your workload | T3A instances offer efficient memory utilization, reducing power and cost. |
40
+
41
+
</details>
42
+
13
43
### Getting Started
14
44
45
+
#### Open AWS CloudShell
46
+
47
+
To begin, ensure you login to your AWS account with permissions to create and modify resources in IAM, EC2, EBS, VPC, S3, KMS, and Secrets Manager.
48
+
49
+
From the AWS Management Console, open the [AWS CloudShell](https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html), a web-based shell environment. If unfamiliar, review the [2-minute YouTube video](https://youtu.be/fz4rbjRaiQM) for an overview and check out [CloudShell with VPC environment](https://docs.aws.amazon.com/cloudshell/latest/userguide/creating-vpc-environment.html) that we'll use to test nodes API from internal IP address space.
50
+
51
+
Once ready, you can run the commands to deploy and test blueprints in the CloudShell.
52
+
15
53
#### Cloning the Repository
16
54
17
55
First, clone the repository and install the dependencies:
@@ -24,7 +62,32 @@ npm install
24
62
25
63
Before proceeding, ensure you have the AWS CLI installed and configured.
1. Make sure you are in the root directory of the cloned repository.
68
+
69
+
2. If you have deleted or don't have the default VPC, create default VPC
70
+
71
+
```
72
+
aws ec2 create-default-vpc
73
+
```
74
+
> **NOTE:***You may see the following error if the default VPC already exists: `An error occurred (DefaultVpcAlreadyExists) when calling the CreateDefaultVpc operation: A Default VPC already exists for this account in this region.`. That means you can just continue with the following steps.*
75
+
76
+
3. Create your own copy of `.env` file and edit it to update with your AWS Account ID and Region:
To interact with the Bitcoin Core RPC endpoint within your isolated VPC environment, run the following command before deploying the Bitcoin Node via CDK:
30
93
@@ -41,53 +104,57 @@ For a deeper dive and an overview of credential rotation, see [RPC Authenticatio
41
104
To deploy a single node setup, use the following command:
- A **Bitcoin node** deployed in a **private subnet** continuously synchronizes with the Bitcoin network using outbound connections through a **NAT Gateway**.
58
-
- Outbound communication flows through an **Internet Gateway (IGW)**, but the node itself does not have a **public IP address** or **Elastic IP (EIP)**.
59
-
- The **NAT Gateway** translates the node's private IP into a public IP for outbound connections, but inbound connections are blocked. This ensures that the node functions as an **outbound-only node** (i.e., it does not accept inbound peer connections), increasing security and reducing data transfer costs.
121
+
- A **Bitcoin node** deployed in a **public subnet** continuously synchronizes with the Bitcoin network.
122
+
- Outbound peer-to-peer (P2P) communication flows through an **Internet Gateway (IGW)**.
123
+
- The node's security group permits incoming P2P connections on port 8333.
124
+
- The node's RPC methods can be accessed from within the VPC.
125
+
- The Solana node sends various monitoring metrics for both EC2 and Solana nodes to Amazon CloudWatch.
- Deploying **multiple Bitcoin nodes** in an **Auto Scaling Group** enhances fault tolerance and availability.
64
-
- The nodes' RPC endpoints are exposed through an **Application Load Balancer (ALB)**. The ALB implements session persistence using a "stickiness cookie". This ensures that subsequent requests from the same client are consistently routed to the same node, maintaining session continuity. The stickiness duration is set to 90 minutes but can be configured for up to 7 days.
65
-
Note: The Bitcoin Core nodes in the HA setup do not share state (e.g., wallet, mempool)
66
-
- HA nodes maintain synchronization through the **NAT Gateway** without exposing the RPC endpoint to the public internet.
131
+
- The nodes' RPC endpoints are exposed through an **Application Load Balancer (ALB)**. The ALB implements session persistence using a "stickiness cookie". This ensures that subsequent requests from the same client are consistently routed to the same node, maintaining session continuity. The stickiness duration is set to 90 minutes but can be configured for up to 7 days. Note: The Bitcoin Core nodes in the HA setup do not share state (e.g., wallet, mempool)
132
+
- HA nodes do not expose the RPC endpoint to the public internet. This endpoint can be accessed from within the VPC.
67
133
68
134
---
69
135
70
-
### Optimizing Data Transfer Costs
71
-
72
-
By deploying as an **outbound-only node**, data transfer costs are significantly reduced since the node does not serve blockchain data to external peers. With its outbound connections, the node(s) are able to maintain full blockchain synchronization.
73
-
74
-
---
75
136
### Accessing and Using bitcoin-cli on a Bitcoin Core Instance
76
137
77
138
To interact with your Bitcoin Core instance, you'll need to use AWS Systems Manager, as direct SSH access is not available.
78
139
79
140
Bitcoin Core supports cookie-based authentication by default, so interacting with the `bitcoin-cli` from the node itself does not require credentials.
80
141
81
-
Follow these steps to make an RPC call:
142
+
From your CloudShell terminal, run the following command to connect to your node via Systems Manager:
This command executes the `getblockchaininfo` RPC method, which returns current state information about the blockchain.
100
167
101
-
3.**Interpreting Results:**
168
+
**Interpreting Results:**
102
169
- The output will provide detailed information about the current state of the blockchain, including the current block height, difficulty, and other relevant data.
103
170
- You can use similar commands to execute other RPC methods supported by Bitcoin Core.
To make an RPC call to a single Bitcoin node, use the following command. Replace `[Bitcoin-Node-Private-IP]` with the actual private IP address of your Bitcoin node:
187
+
To make an RPC call to a single Bitcoin node, run the following command to retrieve the private IP address of your Bitcoin node:
Copy output from the last `echo` command with `BITCOIN_NODE_IP=<internal_IP>` and open [CloudShell tab with VPC environment](https://docs.aws.amazon.com/cloudshell/latest/userguide/creating-vpc-environment.html) to access internal IP address space. Paste `BITCOIN_NODE_IP=<internal_IP>` into the new CloudShell tab. Then query the node:
#### High Availability (HA) RPC Call using credentials
129
202
130
-
For high availability setups utilizing an Application Load Balancer (ALB), use the following command. Replace `[Load-Balancer-DNS-Name]` with your ALB's DNS name:
203
+
Use the following command to retrieve your load balancer's DNS name:
Copy output from the last `echo` command with `RPC_ABL_URL=<internal_IP>` and open [CloudShell tab with VPC environment](https://docs.aws.amazon.com/cloudshell/latest/userguide/creating-vpc-environment.html) to access internal IP address space. Paste `RPC_ABL_URL=<internal_IP>` into the new CloudShell tab.
210
+
211
+
Execute the following command to make an RPC request to your HA node setup:
0 commit comments