At the recent Amazon Web Services (AWS) re:Invent 2018 conference, members from Coinbase spoke on the building of their new blockchain infrastructure via Snapchain – the platform’s nickname for the foundation.
“The Infrastructure Team at Coinbase has the goal of enabling any engineer in the company to quickly and securely access and deploy complex infrastructure,” reads a post on the Coinbase Blog. “This effort started with our secure deployment pipeline Codeflow, was extended by our codification tooling GeoEngineer, and utilized by our blockchain infrastructure project Snapchain.”
Detailing the Framework
The post goes on, stating that Coinbase has a strict framework regarding its security and foundational processes. One example is that all of their servers should exist in the short term (less than 30 days,) and should be immutable.
Because of these requirements, apps are sent out in a relatively streamlined way, in which “12-factor apps are blue/green deployed behind a load balancer.” That said, this simplicity is thrown around when blockchain nodes come into play:
“Blockchain nodes detect, validate and relay state updates across the network — they are our eyes & ears into the various cryptocurrency networks we support. When someone sends funds into Coinbase we detect that transaction by listening to a node, and when someone sends funds out of Coinbase we broadcast that transaction through one of our nodes. As such, being able to effectively manage blockchain nodes is critical to our core business operations.”
Fortunately, the post goes into more detail regarding the deployment process:
- Coinbase’s engineers start with an EC2 instance. With this, they move into the node binary.
- That node then reaches out into other nodes within the blockchain network.
- Because all of the nodes are synced to the blockchain, they can start sending data back to the newly deployed node.
- More and more blocks are sent until the new node if fully in-sync with the blockchain.
Full nodes are the best to test this process with, as they tend to have the full blockchain history downloaded onto the device. This could add up to hundreds of gigabytes of data, however, and the whole process could take many weeks to finish. That’s rather inefficient for moving new nodes along. This is where Snapchain comes in:
“Considering the pace of development in the cryptocurrency ecosystem, the safety and reliability constraints of our infrastructure, and the occasional urgency of node upgrades, a full sync from the network on every deploy is not a viable solution for us to be able to move safely and quickly. As a result we designed a new blockchain node backup and deployment system called Snapchain.”
A Two-Pronged Solution
Under Snapchain, two different nodes are launched: snapshot and long-lived. Snapshot nodes sync with the whole chain and push out copies via EBS volumes. Long-lived nodes use those volumes to deploy nodes very quickly. Thank of this as establishing a pre-set for fully synced nodes. Once a new node comes into play, you paste the pre-set on top, and it’s fully synchronized! This way, Coinbase can deploy new nodes whenever they’d like and quickly respond to network upgrades, events, and configurations.
By utilizing Snapchain on top of AWS, Coinbase can “meet the needs of” their engineers thanks to Network Load Balancers (NLBs.) You can read more about that process here.
Interestingly, Snapchain is a “blockchain-agnostic infrastructure.” This way, there isn’t much code that’s specific to any one network. Coinbase can instead add new nodes whenever they would like regardless of the blockchain platform.
In other news, Coinbase has just announced cross-border wire transfers for European and Asian customers. Coinbase Prime users will also be able to access U.S and European “over-the-counter” trading desks on top of the platform’s cold storage solution, Coinbase Custody.