Bitcoin is the most widely adopted and valuable cryptocurrency, known for its decentralization and security. Stacks, a Layer 2 solution built on top of Bitcoin, aims to unlock Bitcoin’s full potential by enabling fast, cheap, Bitcoin-secured transactions and smart contract functionality without modifying the Bitcoin protocol itself. Stacks uses a consensus mechanism called Proof of Transfer (PoX) to connect its nodes to Bitcoin. This mechanism involves Stacks miners bidding Bitcoin to earn the right to produce Stacks blocks and receive rewards in the form of newly minted STX tokens and transaction fees. Signers (validators) lock their STX tokens (the native token of the Stacks network) to validate the blocks produced by miners, ensuring they conform to the protocol rules and maintain the connection to Bitcoin. In return, signers receive the Bitcoin spent by miners as a reward. The Stacks ecosystem consists of three types of nodes: miners, signers, and followers. Miners create new blocks, signers validate transactions, and followers download the blockchain, verify transactions, and independently cross-verify transactions to avoid relying on a central party.
In this post, we demonstrate how to swiftly deploy Stacks blockchain nodes on AWS with the AWS Blockchain Node Runners blueprint.
Solution overview
The following diagram illustrates how Stacks blockchain works.
Enterprises and developers building on the Stacks blockchain can easily deploy their own consensus and Remote Procedure Call (RPC) nodes on AWS using the open-source Blockchain Node Runners initiative. This allows you to connect your decentralized applications (dApps) to the Stacks blockchain with minimal effort while reducing operational costs and improving reliability. As of this writing, the AWS Node Runners Stacks blueprint currently supports deploying Stacks nodes in the two configurations, a single node and a highly available (HA) setup, with plans to support miner and signer configurations in the future.
Detailed deployment instructions are available in the Stacks Node Runners blueprint.
Single-node deployment
The single-node deployment method is suitable for validating transactions or running an RPC node for non-production needs.
The workflow includes the following steps:
A Stacks node is deployed in the default VPC and synchronizes with the rest of the Stacks network through the internet gateway.
The node is accessible to dApps or development tools within the default VPC, with the JSON RPC API not exposed to the internet for security.
The node stores secrets locally and backs them up in AWS Secrets Manager.
Monitoring metrics for the Amazon Elastic Compute Cloud (Amazon EC2) instance and Stacks node are sent to Amazon CloudWatch.
The following diagram illustrates the single-node deployment architecture.
Highly available node deployment
The HA node setup is recommended for production-grade dApps. It consists of multiple RPC nodes managed by an Auto Scaling group and running behind an Application Load Balancer. The HA setup is currently only available for the follower configuration.
The workflow consists of the following steps:
A set of base or extended RPC Stacks nodes are deployed within an Auto Scaling group in the default VPC and synchronize with the Stacks network through the internet gateway.
The nodes are accessible to dApps or development tools through the Application Load Balancer, with the JSON RPC API not exposed to the internet.
The nodes store secrets locally and back them up in Secrets Manager.
Monitoring metrics for the EC2 instances and Stacks nodes are sent to CloudWatch.
The following diagram illustrates the HA node deployment architecture.
Recommended infrastructure
For running a Stacks node on the mainnet, the Stacks community recommends a 512 GB disk with an instance type of either c4.4xlarge or m5.large. The c4.4xlarge processes blocks more efficiently, whereas the m5.large meets the minimum vCPU requirement.
Conclusion
In this post, we introduced Stacks. Stacks aims to unlock Bitcoin’s full potential by enabling smart contracts and fast, cheap transactions on a Layer 2 solution connected to Bitcoin. We then explored two deployment options for Stacks nodes. By running a Stacks node on AWS using the Node Runners blueprint, organizations can increase the ecosystem’s decentralization and avoid relying on third-party providers. Visit the AWS Node Runners blueprint for Stacks to get started. If you have questions, you can ask them on AWS Re:Post, with tag “blockchainâ€.
About the Author
James Burdon is a Senior Blockchain Specialist Solutions Architect at AWS, focused on helping Web3 startups. James has over 25 years of IT consultancy experience and has been helping startups running on AWS for over 7 years.
Nikolay Vlasov is a Senior Solutions Architect with the AWS Worldwide Specialist Solutions Architect organization, focused on blockchain-related workloads. He helps customers to run workloads for decentralized web and ledger technologies on AWS.
Source: Read More