Blockchain basics and practical experience in the vehicle

Porsche AG
#NextLevelGermanEngineering
9 min readApr 11, 2019

Even beyond the hype, it is still valuable to understand how blockchain works. Because if you want to put technology to use, and if you want this technology to actually make sense, then you really want to see it through.

Photo by chuttersnap on Unsplash

Blockchain is the technology behind Bitcoin, Ethereum and more. These crypto currencies are often associated with high energy consumption and risky speculations. However, blockchain technology is actually much older than crypto currencies. The foundations of blockchain technology were already developed as far back as 1991. The goal was to sign digital documents with an immutable timestamp so that they cannot be modified or redated. In the analogue world, this task is traditionally performed by trusted intermediaries, such as notaries and lawyers. They bear witness to the immutable signature of documents.

In today’s digital world, blockchain technology performs this task. It is able to create immutability of data and trust without intermediaries. In a digital world, where every piece of information can be reproduced and modified as often as desired, immutability of data is certainly an outstanding characteristic.

Digital fingerprints

It all starts with a digital fingerprint, the so-called hash. The hash of a document is a string of fixed length consisting of letters and numbers. It is calculated using a cryptographic hash function. The calculation of a hash is simple and requires only few resources.

Marc Gardeya: Blockchain 101 and Lessons Learned

Cryptographic hash functions are collision-resistant one-way functions. One-way functions do not allow to go back to the original document from a given hash value. They are a one-way street.

Also it is very unlikely to find two different documents with the same hash, a so-called ‘collision’. Theoretically, though, there are collisions. After all, hash functions map an infinite space to a finite space. However, those collisions are extremely hard to find. ‘Collision resistance’ refers to this probability. The Bitcoin hash function sha256, creates a space of 2²⁵⁶ hash values. To put this in perspective, there are approximately 2⁶⁶ grains of sand on earth. So there are about as many sha256 hash values as there is sand on 2¹⁹⁰ earths.

Nevertheless, there are cryptographic hash functions for which collisions have been found, for example md5. This disqualifies such hash functions for the use within blockchain applications.

Cryptographic hash functions are fundamental to a blockchain. Therefore, it is very important to use a reliable and academically proven one. Developing a cryptographic hash function yourself is very difficult.

Proof of work and difficulty

Now, computing a fingerprint is easy. Our goal is to ensure it requires a lot more work to compute the fingerprint. We do this by requesting not just any fingerprint, but a special one. One that complies to the so-called ‘difficulty’. This special fingerprint is called a proof of work: a unique piece of data that is expensive to produce.

The difficulty defines the number of leading zeros of a fingerprint to be accepted as a proof of work. Therefore, to find a proof of work, you have to try many hash values until you find one that satisfies the difficulty condition. The hash of a document is unique, though, so there aren’t multiple hash values to try out.

Marc Gardeya: Blockchain 101 and Lessons Learned

Mining is a very resource-intensive task, because many hash values are calculated and discarded while searching for a suitable nonce and, thus, a proof of work. This mechanism is fundamentally based on the collision-free and one-way nature of the cryptographic hash function. The difficulty adapts to the volatility of the compute power of the blockchain network and thus makes finding a proof of work take equally long over time. In Bitcoin for example, a proof of work is found approximately every ten minutes. The proof of work is expensive to calculate, but easy to verify.

Assuming you received a document including a nonce and proof of work, it is very easy to verify. You simply calculate the hash of the document including the nonce and compare it to the proof of work. They should match. If an attacker wants to modify a document, he would also have to recalculate the proof of work and find a new nonce. This is much more expensive than just recalculating a fingerprint.

The document together with the nonce, the proof of work and some other meta data, they make up a block. The document in that block can be used to store data, for example transaction data.

Blockchain

Blockchain is a data structure that makes it even harder to manipulate documents once they have been put on the chain. It puts documents in chronological order, and each one knows about the proof of work of the previous document, the so-called predecessor. This link creates the chain within blockchain.

Whenever we compute a fingerprint, we compute the hash of the document, the nonce and the predecessor combined. Now, when we modify the document in a block, the hash becomes invalid and no longer complies to the required difficulty. We need to re-compute the hash, find a new nonce. We need to mine this block again.

Now the new proof goes into the predecessor field of the succeeding block, which now renders that block’s proof invalid. It doesn’t comply to the difficulty requirement anymore either. So we need to mine this block again too.

This process goes on and on. Essentially, you need to walk through all the blocks and re-compute all the proofs. You need to re-mine the entire blockchain. That is actually quite time-consuming. However, if you had the resources, you could still do it.

Older documents with more successors are harder to manipulate because it requires to re-compute more proofs along the chain.

Networks and consensus

Immutability of data and trust without intermediaries are ultimately created by the network topology and the consensus mechanism. We distinguish between three different network topologies.

In a centralized network, a central node controls all communication. This is how traditional IT mainframe systems work.

Decentralized networks distribute this control to several selected nodes in the network. Today’s cloud infrastructure is built in a decentralized way such that various data centers around the globe serve their geographical regions while also staying in sync.

In a distributed network though, each node is an equal participant. This is how torrent networks operate. Distributed networks are very resilient to outages. Nodes drop in and out all the time and others take over. Distributed networks are very stable. The Internet was originally designed this way before it developed into a more centralized topology with the rise of cloud computing (graphic 3).

Many blockchains do not belong to one operator alone. Instead they run on a decentralized or even a distributed network. To do so, the entire blockchain is duplicated on all nodes, new transactions and blocks are added simultaneously and appended to the blockchain. During operation, these nodes synchronize and agree on each block and thus on the one true blockchain. They reach consensus.

This means that it’s no longer necessary to trust a single operator. Instead, the network itself creates the trust. Manipulation via hostile attacks is now even more difficult. An attacker would have to take over the majority of the entire network by providing more than 50 percent of the mining power. He would also have to be able to find proof of work with an above-average frequency in order to determine which data goes into the blockchain, therefore reaching consensus with himself. Such attacks are referred to as ’51 percent attacks’. With the growing size of a blockchain network, such attacks become increasingly rare.

Vehicles as witnesses

Immutability of data and trust without intermediaries are created by a distributed network with proof mechanism and consensus. The vehicle fleet in the field could become such a distributed network, as each individual vehicle would be a node. Data in this network would be secured against manipulation and it would become auditable. The vehicle fleet generates the trust.

Marc Gardeya: Blockchain 101 and Lessons Learned

Every vehicle must be able to produce a proof. Due to its focus on high compute power, the classic proof of work might not be the smartest way to contribute to network trust. We need a proof variant in order to go into mobile ECUs. It would therefore be conceivable that only a smaller amount of repeatedly randomly selected vehicles participate in the proof of a block. The others wait until they are selected so they do not consume any energy during this time. We have implemented this principle as a prototype at Porsche.

‘Proof of stake’ or ‘delegated proof of stake’ are alternative methods that provide proof based on the investment of a node, the stake, rather than on compute power like proof of work. In this nascent blockchain industry we’re only at the beginning to develop a viable and balanced proof mechanism for edge devices in the Internet of Things.

The common concern about blockchain technology driving up the global demand of electricity is well understood. And we are making progress towards solving this problem. Some modern blockchains are already implementing proof mechanisms with lower energy consumption. Those might be worth considering when it comes to onboard in-vehicle use.

In a Bitcoin blockchain, the nodes testify to the validity of each other’s transactions stored in the blocks. This way, they prevent a token being spent twice. Similarly, vehicles could testify to each other’s environmental observations. One vehicle could, for example, observe a road marking while another could support this observation and also testify that the former was actually at the place of observation at the specified time. Through mutual witnessing, they prevent the reporting of false observations and form a protection against manipulation. They provide observations with a proof of location. And they reach consensus without actually revealing their own location through so-called zero knowledge proofs.

These observations are immutably stored in the distributed fleet network and they become auditable. They can be used for mapping traffic, weather, road conditions and more. We call this process decentralized mapping.

As of today, maps are created by central map providers. In the future, some parts of map creation could possibly become decentralized to increase transparency through auditability.

Does it make sense to use Blockchain in my project?

The ‘Blockchain Beyond the Hype — Decision Tree’, published by the World Economic Forum, offers a compact initial analysis of whether blockchain is an appropriate solution for a defined problem. It is composed of a number of questions that assist in figuring out whether a blockchain is the correct approach for a particular business or not.

‘Blockchain Beyond the Hype — Decision Tree’ by the World Economic Forum

A simple flowchart with a dozen yes/no questions quickly leads to an initial assessment. ‘Blockchain Beyond the Hype — Decision Tree’ is freely available on the internet as part of the WEF white paper Blockchain Beyond the Hype — A Practical Framework for Business Leaders.

The proof, the blockchain, the distributed network and consensus are the building blocks to create immutability of data and trust without intermediaries, solely through software and the network.

Today blockchain technology is still in its infancy, much like the internet in 1995. At that time there was no Google, and Facebook wasn’t even on the horizon. Well, the times, they are a-changin’.

Marc Gardeya, End-to-End Architect Connected Car at Porsche

Marc Gardeya is End-to-End Architect Connected Car at Porsche and Certified Bitcoin Professional (CBP). You can follow him on Twitter to understand the Cryptosphere. You can find the German article and the slides about Blockchain basics and practical experience in the vehicle on Marc’s LinkedIn profile.

To find out more about Porsche and Technology, follow us on Twitter, LinkedIn and Instagram.

--

--

Porsche AG
#NextLevelGermanEngineering

Official Medium Account of Porsche AG | #NextLevelGermanEngineering #createtomorrow | More: newsroom.porsche.com |