Qtum Goes Mobile
Smart contracts lay the foundations for a new age of decentralized computation, while providing a powerful tool for the automation of many business processes. However, until now, smart contracts could only be executed on machines equipped with heavy, specialized software, carrying a copy of the entire blockchain, which can be dozens of gigabytes large. This, up until now, has rendered the mobile use of smart contracts and decentralized applications unfeasible, hindering blockchain technology from achieving its full potential.
Qtum removes this enormous barrier and allows smart contracts and dApps to function in environments that were formerly inaccessible to decentralized applications, including mobile phones and IoT appliances.
Qtum achieves this by building upon Bitcoin’s unspent transaction output (UTXO) model and its ability to sustain lite wallets. Lite wallets, utilizing the SPV protocol, allow users to interact with the bitcoin network and validate their own transactions, without having to download and sync with the entire blockchain. Bitcoin wallets use this feature to enable users to send and receive payments on their smartphones, requiring nothing more than a lightweight app. Qtum extends this capability, allowing lite wallets for the first time to engage with smart contracts and decentralized applications.
Understanding the SPV Protocol
The Simple Payment Verification (or SPV) protocol was originally specified in Satoshi Nakamoto’s whitepaper as a means to proof that a transaction has been included in a verified block without having to analyze its content, which can contain thousands of transactions.
Thanks to the unique method with which bitcoin associates coins with addresses (the UTXO model, about which you can read here), this can be achieved using two lightweight pieces of data: an updated chain of recent block headers (which describes blocks without listing the transactions contained in them), and a “Merkle branch”, linking the transaction of interest to the block it is timestamped in. These two pieces of information are between several kilobytes to a few Megabytes large, but contain all relevant information needed to deduce the validity of a transaction with very high certainty.
In order to obtain these pieces of information, a lite wallet or any other SPV client, simply queries several full network nodes and compares the results until it receives a coherent version of the two. By linking the transaction of interest to a place in the header chain using the Merkle branch, the SPV protocol can then determine if a network node has accepted it. By counting the number of blocks added after the transaction, SPV can further confirm that the network as a whole has ruled the transaction as valid. Since consecutive blocks are associated with an aggregated mining difficulty, it can be deduced that a high number of blocks corresponds with a higher probability that the transaction is indeed part of the coherent blockchain. Normally five to six blocks are sufficient to declare a transaction as proven beyond reasonable doubt.
An SPV client building a partial Merkle tree to the relevant block header.
If the hash of the root node of the partial Merkle tree equals the hash of the Merkle root in the block header, the SPV client has cryptographic proof that the transaction was included in that block
Image source: http://bitcoin.stackexchange.com/questions/32529/what-is-a-thin-client
In order to send funds, or otherwise add an entry to the blockchain, an SPV client pings a full network node which then broadcasts the transaction according to the standard Bitcoin protocol. With this, an SPV client can “piggyback”, so to speak, on a network of validating nodes and fully interact with the blockchain without having to invest the computational resources this normally entails.
SPV and Smart Contracts
At their core, smart contracts are conditioned transactions which are programmed to execute if specific, pre-determined requirements are met. Utilizing Qtum’s Account Abstraction Layer, these transactions can contain code, which is then transferred to a modified version of Ethereum’s Virtual Machine (EVM) for execution. This way smart contracts can serve as the basis for a variety of use cases: from payments which are to be settled if certain conditions are met, to fully fledged applications with user-oriented UX/UI elements.
In order to engage with a smart contract or dApp, an SPV client uses the same method described above, which allows Bitcoin lite wallets to receive and send payments. The code inherent to the smart contract is then executed on a full node, which broadcasts outputs and execution results back to the SPV client. This way a slim SPV client, installed on a mobile device, can engage with decentralized applications, utilizing the computational resources of the blockchain network without itself having to operate a validating node.
SPV and the Internet of Things
The IoT comprises physical devices, vehicles, entire buildings, and other items embedded with software, sensors, and network connectivity, that enable these objects to collect and exchange data. The IoT allows objects to be sensed or controlled remotely across existing network infrastructure, creating opportunities for a direct integration of the physical world into computer-based systems, resulting in improved efficiency and economic benefit, in addition to reduced human intervention.
Alas, with such omnipresent inter-connectivity many security concerns arise. Essentially, anything naively connected to the internet can and will eventually be hacked and exploited, as the recent avalanche of botnet attacks very well demonstrates.
In order to prevent our future smart cities and homes from giving birth to the embodiment of a dystopian hacker phantasie, a cryptographic security mechanism is needed which renders most, if not all known digital attack vectors physically impossible.
The obvious candidate for such a mechanism is the blockchain, which during the last decade has managed to securely store and transact billions of USDs, without being centrally operated or maintained. Temporarily excusing premature alpha-glitches such as the Ethereum Dao Hack, it could be credibly argued that blockchain technology in its essence has been empirically proven to be close to uncompromisable in terms of transaction verification.
This reliability, of course, does not protect us from “social hacking”, or otherwise sophisticated means of obtaining information, which would allow an attacker to exploit the IoT in ways hard to imagine today. However, blockchain technology remains the safest bet when exposing our entire household, and even whole cities, to the kind of interconnectivity the future most probably will provide and demand from us.
Using blockchain technology to facilitate a secure IoT is not a new idea. However, until now most solutions proposing smart contracts to operate IoT devices seemed rather cumbersome for the same reason mobile use cases for decentralized applications have been unfeasible. Securing and operating smart devices with Ethereum contracts, for example, would require each and every appliance in a smart house to function as a full ethereum node - carrying gigabytes of blockchain data and performing arduous calculations to the point that a standard household would resemble a small mining farm in terms of electricity usage.
Utilizing the SPV protocol, as stated above, would free smart devices from the obligation to process the entire blockchain every time someone desires toast for tea, relying on a network of specialized nodes which do so anyway. This would simplify the production of smart devices, as well as the “smarting up” of existing appliances, while lowering operation costs considerably.
With this, the possibilities provided by smart contract-based automation of business process are virtually endless. Relying on existing Pi-devices already present in most standard appliances, Qtum contracts can potentially control any device with an accessible API. This way the interaction of “things” in a given business could be programmed and orchestrated with very little investment in specialized hardware.
For example, as elaborated in Qtum’s whitepaper, a gas station could change the price of petrol by adjusting a smart contract, or automate anything from ordering petrol via a contract triggered by tank sensors to adjusting temperatures in the station’s store fridge. Today such an arrangement would probably be technically possible using expensive proprietary systems, but economically irrational in most cases. However, relying on existing hardware and network infrastructures the way Qtum allows, would transform this kind of high-end automation into a commonplace practice.
- + more