Skip to content

Commit 367f9de

Browse files
authored
Merge pull request #151 from aws-samples/bsc
BNB. Changed BSC > BNB
2 parents e86263c + de4fc2c commit 367f9de

File tree

6 files changed

+223
-345
lines changed

6 files changed

+223
-345
lines changed

lib/bsc/README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,40 @@
44
|:--------------------:|
55
| [@StayHungryStayFoolish](https://github.com/StayHungryStayFoolish), [@frbrkoala](https://github.com/frbrkoala) |
66

7-
BNB Smart Chain (BSC), is a blockchain that supports EVM-compatible smart contracts and protocols. It utilizes the [Proof of Stake Authority(PoSA)](https://docs.bnbchain.org/docs/learn/intro#proof-of-staked-authority) consensus mechanism, which is a hybrid consensus mechanism based on a combination of [Proof of Authority (PoA)](https://en.wikipedia.org/wiki/Proof_of_authority) and [Delegated Proof of Stake (DPoS)](https://bitcoinwiki.org/wiki/DPoS).
7+
BNB Smart Chain (BNB), is a blockchain that supports EVM-compatible smart contracts and protocols. It utilizes the [Proof of Stake Authority(PoSA)](https://docs.bnbchain.org/docs/learn/intro#proof-of-staked-authority) consensus mechanism, which is a hybrid consensus mechanism based on a combination of [Proof of Authority (PoA)](https://en.wikipedia.org/wiki/Proof_of_authority) and [Delegated Proof of Stake (DPoS)](https://bitcoinwiki.org/wiki/DPoS).
88

9-
This blueprint is designed to assist in deploying a single node or a Highly Available (HA) [BNB Smart Chain (BSC) Fullnode](https://docs.bnbchain.org/docs/validator/fullnode/) on AWS. It is intended for use in development, testing, or Proof of Concept purposes.
9+
This blueprint is designed to assist in deploying a single node or a Highly Available (HA) [BNB Smart Chain (BNB) Fullnode](https://docs.bnbchain.org/docs/validator/fullnode/) on AWS. It is intended for use in development, testing, or Proof of Concept purposes.
1010

1111
## Overview of Deployment Architectures
1212

1313
### Single Node setup
14-
![Single Nodes Deployment](./doc/assets/Architecture-Single-BSC-Node-Runners.drawio.png)
14+
![Single Nodes Deployment](./doc/assets/Architecture-Single-BNB-Node-Runners.drawio.png)
1515

16-
1. The AWS Cloud Development Kit (CDK) is used to deploy a single node. The CDK application stores assets like scripts and config files in S3 bucket to copy them to the EC2 instance when launching a BSC Node.
17-
2. A single RPC BSC Fullnode is deployed within in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) and continuously synchronizes with the rest of nodes on BSC Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
18-
3. The BSC node is accessed by dApps or development tools internally. JSON RPC API is not exposed to the Internet to protect the node from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
19-
4. The BSC node send various monitoring metrics for both EC2 and BSC client to Amazon CloudWatch.
16+
1. The AWS Cloud Development Kit (CDK) is used to deploy a single node. The CDK application stores assets like scripts and config files in S3 bucket to copy them to the EC2 instance when launching a BNB Node.
17+
2. A single RPC BNB Fullnode is deployed within in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) and continuously synchronizes with the rest of nodes on BNB Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
18+
3. The BNB node is accessed by dApps or development tools internally. JSON RPC API is not exposed to the Internet to protect the node from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
19+
4. The BNB node send various monitoring metrics for both EC2 and BNB client to Amazon CloudWatch.
2020

2121
### Highly Available setup
2222

23-
![Highly Available Nodes Deployment](./doc/assets/Architecture-HA-BSC-Node-Runners.drawio.png)
23+
![Highly Available Nodes Deployment](./doc/assets/Architecture-HA-BNB-Node-Runners.drawio.png)
2424

25-
1. The CDK is used to deploy highly available (HA) architecture. An S3 bucket is utilized to store [User data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and othether script and configuration files required when launching EC2 as the BSC Node.
26-
2. A set of RPC BSC Fullnodes are deployed within the [Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html) in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) continuously synchronizes with the rest of nodes on BSC Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
27-
3. The BSC nodes are accessed by dApps or development tools internally through [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html). JSON RPC API is not exposed to the Internet to protect nodes from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
28-
4. The BSC nodes send various monitoring metrics for both EC2 and BSC nodes to Amazon CloudWatch.
25+
1. The CDK is used to deploy highly available (HA) architecture. An S3 bucket is utilized to store [User data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and othether script and configuration files required when launching EC2 as the BNB Node.
26+
2. A set of RPC BNB Fullnodes are deployed within the [Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html) in the [Default VPC](https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html) continuously synchronizes with the rest of nodes on BNB Blockchain Network through [Internet Gateway](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html).
27+
3. The BNB nodes are accessed by dApps or development tools internally through [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html). JSON RPC API is not exposed to the Internet to protect nodes from unauthorized access. dApps need to handle user authentication and API protection, like [in this example for dApps on AWS](https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/).
28+
4. The BNB nodes send various monitoring metrics for both EC2 and BNB nodes to Amazon CloudWatch.
2929

3030
## Additional materials
3131

3232
<details>
3333

3434
<summary>Well-Architected Checklist</summary>
3535

36-
This is the Well-Architected checklist for BSC nodes 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.
36+
This is the Well-Architected checklist for BNB nodes 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.
3737

3838
| Pillar | Control | Question/Check | Remarks |
3939
|:------------------------|:----------------------------------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
40-
| Security | Network protection | Are there unnecessary open ports in security groups? | Please note that ports 30303 (TCP/UDP) for BSC are open to public to support P2P protocols. |
40+
| Security | Network protection | Are there unnecessary open ports in security groups? | Please note that ports 30303 (TCP/UDP) for BNB are open to public to support P2P protocols. |
4141
| | | Traffic inspection | Traffic protection is not used in the solution. [AWS Web Applications Firewall (WAF)](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) could be implemented for traffic over HTTP(S), [AWS Shield](https://docs.aws.amazon.com/waf/latest/developerguide/shield-chapter.html) provides Distributed Denial of Service (DDoS) protection. Additional charges will apply. |
4242
| | Compute protection | Reduce attack surface | This solution uses Amazon Linux2 AMI(`Amazon Linux2 AMI(HVM)-Kernel 5.10`). You may choose to run hardening scripts on it. |
4343
| | | Enable people to perform actions at a distance | This solution uses [AWS Systems Manager for terminal session](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html#start-sys-console), not ssh ports. |
@@ -48,12 +48,12 @@ This is the Well-Architected checklist for BSC nodes implementation of the AWS B
4848
| | Application security | Security focused development practices | cdk-nag is being used with appropriate suppressions. |
4949
| Cost optimization | Service selection | Use cost effective resources | 1/ We use Graviton-based binaries to improve costs for compute. We recommend using the `m7g.4xlarge` EC2 instance type to optimize computational costs. 2/ Cost-effective EBS gp3 are used instead of io2. |
5050
| | Cost awareness | Estimate costs | Single RPC node with `m7g.4xlarge` EBS gp3 volumes about 4000 GB(1000 IOPS, 700 MBps/s throughput) with On-Demand pricing will cost around US$854.54 per month in the US East (N. Virginia) region. More cost-optimal option with 3 year EC2 Instance Savings plan the cost goes down to $594.15 USD. To create your own estimate use [AWS Pricing Calculator](https://calculator.aws/#/) |
51-
| Reliability | Resiliency implementation | Withstand component failures | This solution uses AWS Application Load Balancer with RPC nodes for high availability. Newly provisioned BSC nodes triggered by Auto Scaling get up and running in about 300 minutes. |
52-
| | Data backup | How is data backed up? | Considering blockchain data is replicated by nodes automatically and BSC nodes sync from start within an hour, we don't use any additional mechanisms to backup the data. |
51+
| Reliability | Resiliency implementation | Withstand component failures | This solution uses AWS Application Load Balancer with RPC nodes for high availability. Newly provisioned BNB nodes triggered by Auto Scaling get up and running in about 300 minutes. |
52+
| | Data backup | How is data backed up? | Considering blockchain data is replicated by nodes automatically and BNB nodes sync from start within an hour, we don't use any additional mechanisms to backup the data. |
5353
| | Resource monitoring | How are workload resources monitored? | Resources are being monitored using Amazon CloudWatch dashboards. Amazon CloudWatch custom metrics are being pushed via CloudWatch Agent. |
5454
| Performance efficiency | Compute selection | How is compute solution selected? | Compute solution is selected based on best price-performance, i.e. AWS Graviton-based Amazon EC2 instances. |
5555
| | Storage selection | How is storage solution selected? | Storage solution is selected based on best price-performance, i.e. gp3 Amazon EBS volumes with optimal IOPS and throughput. |
56-
| | Architecture selection | How is the best performance architecture selected? | We used a combination of recommendations from the BSC community and our own testing. |
56+
| | Architecture selection | How is the best performance architecture selected? | We used a combination of recommendations from the BNB community and our own testing. |
5757
| Operational excellence | Workload health | How is health of workload determined? | Health of workload is determined via AWS Application Load Balancer Target Group Health Checks, on port 8845. |
5858
| Sustainability | Hardware & services | Select most efficient hardware for your workload | The solution uses Graviton-powered instances. There is a potential to use AWS Graviton-based Amazon EC2 instances which offer the best performance per watt of energy use in Amazon EC2. |
5959
</details>
@@ -127,7 +127,7 @@ npx cdk deploy bsc-common
127127
128128
### Option 1: Single RPC Node
129129
130-
1. The inital deployment a BSC Fullnode and downloading its snapshot typically takes about 2-3 hours. The Full node uses snapshots data, and downloading and decompressing the data takes time. You can grab a cup of coffee☕️ and patiently wait during this process. After deployment, you'll need to wait for the node to synchronize with the BSC Blockchain Network (next step).
130+
1. The inital deployment a BNB Fullnode and downloading its snapshot typically takes about 2-3 hours. The Full node uses snapshots data, and downloading and decompressing the data takes time. You can grab a cup of coffee☕️ and patiently wait during this process. After deployment, you'll need to wait for the node to synchronize with the BNB Blockchain Network (next step).
131131
132132
```bash
133133
pwd
@@ -198,7 +198,7 @@ You will get a response similar to this:
198198
199199
### Option 2: Highly Available RPC Nodes
200200
201-
1. The inital deployment of a BSC Fullnode and downloading its snapshot typically takes about 2-3 hours. The Full node uses snapshots data, and downloading and decompressing the data takes time. You can grab a cup of coffee☕️ and patiently wait during this process. After deployment, you'll need to wait for your another half a day to a day for your nodes to synchronize with the BSC Blockchain Network, depending on how fresh the snapshot was.
201+
1. The inital deployment of a BNB Fullnode and downloading its snapshot typically takes about 2-3 hours. The Full node uses snapshots data, and downloading and decompressing the data takes time. You can grab a cup of coffee☕️ and patiently wait during this process. After deployment, you'll need to wait for your another half a day to a day for your nodes to synchronize with the BNB Blockchain Network, depending on how fresh the snapshot was.
202202
203203
```bash
204204
pwd
@@ -323,7 +323,7 @@ aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
323323
sudo cat /var/log/cloud-init-output.log
324324
```
325325

326-
3. How can I check the BSC service log on EC2?
326+
3. How can I check the BNB service log on EC2?
327327

328328
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
329329

@@ -339,7 +339,7 @@ cd /data
339339
cat bsc.log
340340
```
341341

342-
4. How can I restart the BSC service?
342+
4. How can I restart the BNB service?
343343

344344
Please enter the [AWS Management Console - EC2 Instances](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#Instances:instanceState=running), choose the correct region, copy the instance ID you need to query.
345345

@@ -354,9 +354,9 @@ aws ssm start-session --target $INSTANCE_ID --region $AWS_REGION
354354
sudo systemctl restart bsc
355355
```
356356
> **NOTE:** *You can also try the following command to obtain more information*
357-
> - *Check the BSC service status*
357+
> - *Check the BNB service status*
358358
> - `sudo systemctl status bsc`
359-
> - *View BSC service configuration*
359+
> - *View BNB service configuration*
360360
> - `cat /etc/systemd/system/bsc.service`
361361
362362
5. Where can I find more infromation about BSC RPC API?

0 commit comments

Comments
 (0)