Smart Contract Technical Underpinnings (Blockchain Report Excerpt)
Along with our regular daily clean tech news coverage, CleanTechnica also produces in-depth reports on various aspects of clean energy and clean transport. One of the emerging technologies we cover that isn’t directly a clean tech innovation is blockchain, which promises to be a catalyst for innovation in the green economy in the very near future. Blockchain is probably most widely known to the public as “having something to do with cryptocurrency and Bitcoin, right?” which is partially correct, but the technology itself has a wide range of applications, some of which will be crucial in the fields of distributed renewable energy, grid management, and energy storage, and smart contracts, among others.
The full report Blockchain – An Innovation Enabler for Clean Technology, which was published in July, is a deep dive into blockchain and its potential, and we will be posting more excerpts from the report over the coming weeks. (Read the last installment here.)
Centralized vs Distributed
The last nuance is that there are implementations of blockchain technologies that do have a central trusted authorizer. Hyper-ledger is an open source collaborative effort created to advance cross-industry blockchain technologies hosted by The Linux Foundation. It gets around the competition for finding hashes by centralizing that piece into a consensus Cloud with other nodes verifying the work done by the consensus Cloud. IBM is very big in enterprise blockchain exploration as the main contributor to Hyperledger Fabric, one of the open source blockchain frameworks hosted by The Linux Foundation, and sells its own IBM Blockchain based on Hyperledger Fabric. This simplifies the deployment and allows value chains to be created and joined more easily.
Smart contract technical underpinnings
A smart contract is a computer program that runs on the blockchain. That means it runs on the distributed computers which choose to support blockchains. Smart contracts are arguably a subset of the more generalized term distributed applications, or dApps.
In bitcoin and Ethereum terms, dApps run on the computers of the miners. In Hyperledger Fabric, they run on the consensus cloud and on the validators’ computers. Among other things, this means that a smart contract is usually running in a bunch of places at once and consuming computing resources. This isn’t parallelism, but the multiplicity, and requires management so that excess resources aren’t consumed. Ethereum uses the concept of gas, which is the measure of the number of resources a smart contract uses during execution and provides some tools for the management of it.
One of the biggest standards is Ethereum, and it has implemented something called smart contracts or distributed applications (dApps). It developed a Turing-complete programming language called Solidity which lives in its blockchain technology and which executes in its Ethereum Virtual Machine (EVM).
Smart contracts are typically constrained to the blockchain’s architecture. That means instructions are constrained to the size of a transaction in a block and variables are equally constrained to the size of a transaction. In Ethereum, that’s 256 bits or 32 bytes. Due to the nature of blockchain itself, the memory architecture is a stack, which means that it’s static. Modifying variables means adding a change to the top of the stack as a transaction.
This constraint also means that smart contracts can only see things which are entered into the blockchain by a transaction. If, for example, you wanted to use a US dollar exchange rate on a certain date, an external program would have to read the exchange rate and insert it into a variable in the blockchain for the smart contract to read.
Cryptocurrencies are built on specific blockchain technologies. Smart contracts run on exactly the same blockchain technology and at heart only understand the cryptocurrency of the blockchain technology they execute on. If you run a smart contract on Ethereum, you can only use the ether cryptocurrency. Cryptocurrencies and their associated smart contracts are tightly coupled. This is in contrast to the loose coupling I articulated as a value proposition for innovation in “7 Reasons Why the Future is Electric,” but it may not be as important to innovation in this context and it is possible to hedge for downsides of this coupling.
Some blockchains such as Ethereum have implemented Turing-complete languages. The formal definition is that the language can be used to write the language. For cleantech purposes, it means that the most complex interactions can be expressed in the language. Other blockchains, such as Stellar, have implemented simplified instruction sets suitable mostly for smart escrow contracts. This doesn’t mean that they can’t be used for other purposes, but you can’t assume you will achieve sophisticated results solely on the blockchain, so attention to the specific blockchain is required. And there are tradeoffs. Ethereum has much slower transactions and more expensive transactions and smart contract facilities than Stellar at present. It’s probable that Ethereum will be faster, but not necessarily cheaper in the coming months.