Portworx & Red Hat Hands-on Labs Register Now
2017 was a year in which crypto-currencies hit the mainstream – mainly because of the unprecedented increase in market-capitalization. In 2017 alone, the market-cap of all crypto-currencies increased from 22 billion dollars to a peak of over 800 billion.
Don’t worry – this post is not about speculating on the price of crypto-currencies. Instead – it acknowledges the huge increase in public mindshare of these assets, explores the revolutionary ideas behind the underlying technology – blockchain and shows how by using Portworx, you can run production grade applications that are based upon them.
The infrastructure requirements for running production grade blockchain applications present a unique set of challenges. This series of posts will demonstrate how Portworx becomes an invaluable tool to help overcome those challenges and shows how Portworx is uniquely placed to gain a competitive advantage in this brave new world of crypto.
If you already have a good understanding of how blockchains work and want to learn how Portworx can help you run production grade applications, you can skip the next section or jump directly into one of the sub-posts that deal with a specific aspect of how Portworx can help running these blockchain applications in production:
- Using Portworx to improve mining pool performance
- Deal with the growing ledger size using Portworx
- Acceptance test smart contracts with Portworx to avoid expensive mistakes
Blockchain background
The building block of a cryptocurrency is a trustless and distributed data-structure known as a blockchain.
Whilst the many cryptocurrencies have different features and operate in various different ways – they all use this underlying data-structure. So, what does this structure look like and what kind of storage challenges does it present for operations folk wanting to run applications based upon it?
To answer that question – let’s take a closer look at how it all works:
Ledger
The main job of a cryptocurrency is to keep a record of account balances and record any transactions between accounts. A bank’s internal record of transactions and resulting account balances is known as a ledger and in essence is a database that is both centralised and trusted.
The bank ledger is centralised because it lives in one single place, within the confines of the banks data-centre(s) and nowhere else. Perhaps the database is sharded (and hopefully replicated!) but in essence it exists within the confines of a single institution.
This brings us onto the issue of trust. What is stopping the board of directors voting to reset all account-balances to zero? Well, the banks reputation would be ruined and it would be bad for business. For this reason – customers trust that bank to handle deposits and withdrawals responsibly.
A cryptocurrency ledger performs the same role – it keeps a record of transactions between accounts and can as such, report the balance of an account. The difference being that the ledger is distributed across thousands of computers that have no relationship to each other apart from a network connection. You can run a copy of the software for any of the crypto-currencies on your home computer and this will be as equal as any other node. There are no rules behind who can run a node and there is no central institution that has more power than anyone else.
A blockchain ledger is also trustless – it inherently assumes that bad actors will constantly attempt to cheat the system and perform various attacks to extract money they are not entitled to. A combination of cryptography, economic incentives and thousands of unrelated participants competing with each other to mine valid blocks means that it’s practically impossible to cheat the system.
Both systems have the same outcome – people can trust it to keep their money safe.
Transaction
A cryptocurrency is not much use if you cannot transfer value from one account to another. This is the same as a traditional bank where person A wants to pay person B some money and so will instruct their bank to send that amount from their account to the account of the recipient.
In more fundamental terms – a transaction represents a state mutation, an action that will modify some values in the ledger.
With crypto-currencies that support smart contracts (such as Ethereum, Cardano and NEO) a transaction represents more than the simple transfer of value between two accounts. Because these currencies support the running of code – a transaction in these currencies will perform state mutations that are the result of running that code.
In all cases – a transaction needs to be recorded in the ledger such that it is visible and it’s effects can be accounted for and verified.
Before a transaction can be submitted to the network – it might be signed using a private key. This gives the transaction it’s authority – without the private key for an account you cannot make payments from it.
Block
A collection of transactions is grouped together into a block and appended to the global ledger in sequence.
Each cryptocurrency has different values for how many transactions are put into a single block and how often a block is appended to the ledger.
Blocks are created by a process called mining where many computers are competing with each other for the right to publish the next block (more on that later).
Once a block is mined – it is deemed as valid and the transactions within it can affect the global ledger. The time taken between blocks and how many transactions are in a single block directly affect the total throughput capacity of the currency. Think of this as the bandwidth of a cryptocurrency. The total number of transactions per second can be calculated thus:
transactions per block (10) X blocks per second (0.1)
So – if each block can contain 10 transactions and a new block is published every 10 seconds – the total transaction capacity of that cryptocurrency is 1.
Chain
Once a block has been mined – it is added to the blockchain which is a sequential list of previously published blocks. Each block that is appended to the chain must have a pointer to the previous block in a cryptographically secure way and as such, this sequence of blocks forms a chain.
This chain of blocks behaves like an append only database. There is no in place mutation of a value – the current state of the ledger is calculated by stepping through each block and applying the transactions in that block to the current state of the ledger.
Compare this to a system that allows mutation:
- current balance of Alice is 3.14
- modify the balance of Alice in place and deduct 0.1
- current balance of Alice is now 3.04
In the above system – there is only ever the current balance for Alice – it is mutable.
In the case of a blockchain – values are immutable. Values are never changed in place – instead, we step through each transaction and apply it to the old value to calculate a new value.
With this system – it is possible to travel back and forth in time by applying and un-doing transactions. It is this design that enables thousands of computers to co-operate and come to consensus about the current and correct values for the balance of each account.
Mining
Mining is the process that decides who has the right to publish the next block.
In basic terms – high powered computers are competing with each other for the right to publish the next block in return for a financial reward.
The miners are constantly performing a proof of work by which the system is kept secure from bad actors.
To become the miner of the next block – you must have performed a computation that represents an investment of computer power that you wouldn’t want to risk by cheating. In other words – if you have used X electricity to find the secret required to mine the next block – economic incentives mean you are better off earning the block reward (which is > X) than risking your existing investment of time and electricity by attempting to cheat. Add the fact that thousands of computers are competing with you to mine the next block and that it’s easy to determine (using cryptography) if a miner has cheated and the economic incentives mean that miners stay honest. If a miner decides to try and cheat – the block they attempt to submit will be rejected by the thousands of competing computers and they won’t receive the reward. The phrase for the combination of these ideas is crypto-economics.
It has been reported that the mining process required to secure the bitcoin network, consumes more electricity than Ireland over the course of a year. That is because the proof of work becomes harder over time as more miners compete with each other.
The work itself is inherently useless – computers are constantly trying to find the hash of a number that starts with a set number of zeros. Because hash functions are one-way – all you can do is try random values until you stumble across the correct one – there is no way of calculating the correct value, it has to be trial and error. This has no use other than to prove the miner has spent a considerable amount of computer power to produce that number.
Coins such as Ethereum and others are soon moving to a proof of stake system which uses a stake (i.e. amount of money) that is at risk if the miner attempts to cheat. Because that does not involve running billions of hashes per second trying to find the correct value (which is what uses all that electricity) – it is much more ecologically sound.
Examples of blockchain applications
When running blockchain based applications – you will need to interact with the distributed ledger for the cryptocurrency you are using. To do this, you will need to run a copy of the software that has a fully synched and up to date ledger downloaded to disk.
In this peer-to-peer world, there is no such thing as a server. You run a copy of the code for that particular cryptocurrency and interact with it using an RPC interface. Each node is equal – there is not a master node or any other such concept.
Let’s take a look at the types of applications you might run on top of these cryptocurrency nodes:
- Mining applications that pools high performance infrastructure to increase the chance of mining the next block
- An exchange that facilitates the trading of crypto-assets and so interacts with the blockchain to allow deposits and withdrawals – binance and gdax are popular examples of this
- System providing a web-interface to user wallets – coinbase is a well known example of this
- Distributed Application interacting with the blockchain – for example a GUI that interacts with a smart contract
- Paas style system that enables users to deploy their own blockchain based applications
Each of the applications above would need to be running the node for their respective cryptocurrency (as well as a range of other services that could be stateful). Unless you are running a development or a pet-project, it is highly likely you would be running these applications inside some kind of data-centre – either on-premise or using a cloud provider.
Any blockchain node will require compute, storage and network infrastructure and as such, from an operational perspective, can be treated like traditional applications.
It is common to run these nodes inside Docker and deploy them to cloud-hosted servers that offer high-performance networking and high-performance SSD local storage.
Especially in the case of mining or trading exchanges – it is vital that you don’t have performance bottlenecks as this will affect your bottom line.
How Portworx enables production grade blockchain applications
Being the industry leader in running stateful applications in production – we have a lot of experience in helping customers deliver high-performance production grade storage solutions for their applications.
Especially when dealing with applications that involve money – it is more important than ever to use the very best tools to both increase profitability and reduce the risk of expensive failures.
Each of the following posts will deal with a specific aspect of how Portworx can help and will focus on that topic in depth.
In summary – to run production blockchain applications:
- Use Portworx to improve mining pool performance
- Deal with the growing ledger size using Portworx
- Acceptance test smart contracts with Portworx to avoid expensive mistakes
If you are considering running a production-grade blockchain based application – be sure to read the above posts and discover how running Portworx as your storage solution will help.
Aspects of different crypto-currencies
There are many different crypto-currencies each with a focus on a different aspect or feature-set. All of them are built upon a blockchain style foundation with the exception of Nano which uses a variation called the block-lattice.
Here is a selection of different coins and the main feature they focus upon:
Bitcoin
Bitcoin is the original blockchain based cryptocurrency. First released as a whitepaper by the as yet unidentified Satoshi Nakamoto – it has taken the role as the original and most valuable cryptocurrency. It’s focus was originally on being a currency – in the purest sense meaning a transfer of value. However, it’s popularity has also been a thorn in it’s side because of increasing fees and the large amount of time taken to make a simple payment – it is now looked at as a store of value akin to gold.
Ethereum
The defining property of Ethereum is that it offers a Turing complete compute environment in which you can run smart contracts.
All coins offer both storage and network layers in that they both record transactions that mutate a ledger that is saved to disk (storage) and communicate with other peers using the Internet (network),
Ethereum (and other smart-contract platforms) add a compute layer that means computations can be performed in a distributed and trustless manner.
Ethereum has enabled the creation of tokens – essentially crypto-currencies in their own right but that are implemented as a smart contract running on the Ethereum network. Because Ethereum is Turing complete, you can in theory implement anything using it. It is interesting that one of the main uses of it so far has been to create second-layer crypto-currencies (tokens) on-top of another cryptocurrency (Ethereum).
Monero
Monero has a focus on privacy. The underlying ledger for other cryptocurrencies is public and un-encrypted. Whilst personally identifiable information is not recorded on the Bitcoin ledger, the holder of a wallet (akin to a bank-account) can transfer value to another wallet and the transaction itself is viewable by anyone. All you can see is that wallet A transferred X amount to wallet B but this information is public and anyone can trace the path of payments made between accounts.
Monero encrypts not only the wallet but also each and every transaction made between accounts including the wallet address and the amount. In this way – it’s impossible to trace payments and make deductions about transaction paths from the public Monero ledger.
Cardano
Cardano is a cryptocurrency that can run smart contracts in the same way as Ethereum.
Cardano distinguishes itself with a focus on Formal Verification which is seen as desirable when dealing with financial computations.
Nano
Nano uses a revolutionary new design known as the block-lattice that gives it the following properties:
No fees – blockchain based coins all have some kind of fee that is incurred when you make a payment from one account to another whereas nano has no fees – you send 0.00001 nano and 0.00001 is received with no fee deducted (useful for micro-transactions that could be less than one cent or penny).
Near instant transactions – because of the design of the block-lattice – payments using Nano take only a few seconds compared to Bitcoin which can be anything between 30 minutes and over 16 hours in extreme cases
No mining – as mentioned, the proof of work used by most crypto-currencies consumes a large amount of electricity. Because of the fundamental difference in the underlying design – Nano has no mining and so is ecologically sound today.
Conclusion
This post has given some background on cryptocurrencies and the kind of applications you can run on them.
In summary – to run production blockchain applications:
- Using Portworx to improve mining pool performance
- Deal with the growing ledger size using Portworx
- Acceptance test smart contracts with Portworx to avoid expensive mistakes
We pride ourselves on our knowledge of both production grade storage and the brave new world of crypto-currencies – if you have any questions about what you have read or just want to chat, get in touch!.
Be sure to download and try Portworx today so you can see how it works and get a feel for the product – it’s free to try for 30 days!
Here are some links that you might find useful to find out more about our product and awesome team:
* Docs
* Product introduction
* Our customers
* Team
Share
Subscribe for Updates
About Us
Portworx is the leader in cloud native storage for containers.
Thanks for subscribing!
Kai Davenport
Kai has worked on internet-based systems since 1998 and currently spends his time using Kubernetes, Docker and other container tools and programming in Node.js and Go.