Mass Effect 3 Mars Dreamscene by droot1986

Outside John Snow Pub, arguably one of the best pubs to visit on a rainy November day in Soho, London, I was having a beer with my dear friend Alex, discussing tech and cryptocurrency like we always do. The thing that struck me the most from the conversation that Alex brought up was the technical challenges of Mars to have its own blockchain due to speed of light delays between Earth and Mars. It took me on a little journey of determining what might a blockchain on Mars look like, what are the challenges brought upon by speed of light and other factors, and how to push forward the efforts of colonizing the Red Planet.

The past few years and especially 2017 have brought cryptocurrency to the mainstream. Everyone and their grandmother can be seen at one point asking around “How can one buy bitcoin?” and “Would you buy Ripple?” among other questions. Every day, someone armed with a badly-edited whitepaper (a paper outlining how the technology works) will raise millions of dollars in Initial Coin Offerings, or ICOs (the cryptocurrency version of a stock market IPO). By now, one can see that, while 99% of the coins will probably fail due to bad planning, overpromised marketing, or because of their scammy nature, there is no doubt that the future of the cryptocurrency market is bright and it has a lot of room for growth.

The race to Mars is on going. SpaceX still is leading the efforts to allow humans for colonization of the Red Planet, most recently with their two simultaneous Falcon Heavy rocket landings.

Falcon Heavy dual rocket landings

I don’t think I could ever get bored of watching this gif.

The marriage of both industries would seem like an interesting thought experiment, which has compelled me to write this article.

Now, for all Mars fans who have no idea what a blockchain is or how it works, then don’t worry, the first three sections Blockchain: An Overview, A Mathematical Puzzle and Determining Consensus will go over the technology in the most simplified way, to the best of my efforts.

If you are absolutely familiar with all things blockchain related and want to skip to the Mars parts, the last part Challenges for Mars would be the spot to start.

Blockchain: An Overview

Symphony of Blockchains, By IOHK

When it comes to cryptocurrency, current world views seem to be hanging in two types of camps. On the one end, there’s the side that tells you that “Oh, cryptocurrency has no value, there’s nothing backing it, it’s worthless”. On the other hand, there’s this crypto-anarchist and libertarian camp that believes that cryptocurrency, and specifically bitcoin, will undermine our entire financial system and destroy banks, governments and venture capital firms.

Both extremes don’t have me convinced. What I’m interested in is the middle-ground, where a cryptocurrency can act as an asset that is used for the blockchain, a store of value and a world currency. The most neutral explanation in my opinion, and greatly so, is by Chain’s blog post “A Letter to Jamie Dimon”. The blog post argues that cryptocurrency is an asset that serves decentralized applications, just like mortgage is an asset that serves home-owners or bonds are assets that serve governments.

So now that we have a formal definition of what a cryptocurrency is, let’s look at what a decentralized application is.

A decentralized application, or dApp for short, is an application that runs on a decentralized network, or a network that isn’t controlled by a single entity. Instead, a decentralized network is run by a peer-to-peer network. Peer-to-peer networks, or P2P, currently exist in torrent applications like bitTorrent or in music-sharing applications like the now-defunct Napster.

Let’s look at a simple example in order to better understand the structure of such an application.

When you visit “https://www.google.com”, you’re hitting Google’s web servers, which upon acknowledging a ping from your browser, returns back to you files and data which will show Google’s famous Search page. Google funds their web servers to allow for tens of thousands of searches per second. Google is what we call a centralized application because all entry to using the application has to go through Google, the company. bitTorrent, on the other hand, is distributed among people who use it, so that files being shared aren’t being owned by bitTorrent itself, but the users who are uploading and downloading them.

The following chart illustrates the general structure of centralized (A) vs. decentralized (B) applications.

Centralized vs. Decentralized Networks

Notice how in centralized networks, the dots outside, which are called nodes, connect to a central node, hence the centralization. In a decentralized network, the nodes form little pools or clusters that connect to one another and are distributed.

Since we are following the definition of cryptocurrency being used for decentralized applications, then that leaves us to define what bitcoin is. In “A Letter to Jamie Dimon”, a good definition here is that bitcoin is “A decentralized application for payments”. Bitcoin is like Paypal for money payments without Paypal, the company running the network, and it being run by many participants.

One of the biggest challenges of having a decentralized application for payments is the issue of timestamping transactions. So, in a centralized system, like say a bank, when you use your credit card to go shopping at the store, the swipe of the card communicates with the bank that you want to pay the merchant money. So, what the bank does is put a timestamp on the transaction after approving it, and then the transfer of money occurs between you the shopper and the merchant selling you the merchandise.

The design of decentralized applications proposes that there exists no third-party that can time stamp a transaction. If Elon wants to send Mark $10 in a decentralized network, then having a third-party validate it centralizes the system since we are still relying on a timestamping authority, like a bank, to approve and authorize a transaction.

How do we solve for double-spending, so that Elon, who only has $10, isn’t allowed to send Mark $10 and then Satoshi another $10? What can we do when no entity can verify that Elon has insufficient funds for the second transaction. The centralized banking system would immediately stop Elon’s second transaction from going through, since it would see that he has $0 after sending $10 to Mark.

Then, what is the solution to the timestamping issue in a decentralized network?

Well, with bitcoin, the proposal is for people competing to become timestampers. They join a peer-to-peer network, like the ones for bitTorrent and Napster.

Image courtesy of Preshing

Timestampers then can participate in the bitcoin network and compete to timestamp transactions in a block by solving a mathematical puzzle. First timestamper-contestant in the network to solve the mathematical puzzle gets the right to be the timestamper and to timestamp the transactions happening in that block, which is generated every 10 minutes.

Now, you’re probably wondering why anyone wants to be a timestamper for bitcoin network transactions? What’s the point? Who cares if no one confirms Elon’s transfer of $10 worth of bitcoin to Mark?

The cool and important thing about bitcoin, is that the timestamper who solves the mathematical puzzle first and announces it to the network is rewarded with new bitcoins which are added into the circulation. So, the financial reward creates the incentive for a person to become a timestamper.

This is effectively what we call “mining” in cryptocurrency land. A timestamper is a simplified word to mean a miner. From now on, we will just call them miners. Once a miner solves the block’s mathematical puzzle, it is announced to the network, the block is added to the ledger, and the miners network moves on to the next block.

A Mathematical Puzzle

Cryptocurrency Mining Image by Typeboard

We have previously brushed over the term block, but what is a block exactly. A block can be thought of as a “basket” that holds some transactions for 10 minutes. The basket is given to each miner, who try to solve its mathematical puzzle.

Each basket, or block, contains transactions for that period. If Elon sent Mark $10, that transaction gets added to the basket, which is issued to all miners in the network. 1 hour later, if Mark decided to give back Elon back his $10, the transaction for that gets added to a new basket at which is issued to miners along with any other transactions for that period.

Now, I want to touch up a bit on the mathematical puzzle and it’s basic functionalities.

The whole idea behind solving a mathematical puzzle is to artificially compute a difficult number to find inside the block. Doing so levels the playing field between competing miners. Miners later on will band together to form a pool, whose combined computing power gives them an edge at finding that difficult number over their peers.

The solution to the puzzle of mining is called Proof of Work. Every miner is trying to generate a Proof of Work, or a number from a mathematical puzzle, in order to timestamp all the transactions occurring inside that block.

Let’s look a little bit at the features of Proof of Work.

Proof of Work is a piece of data that is very difficult to generate but very easy for others to verify. The miners finding that secret number in the block incur a financial cost (of electricity consumption on expensive computer hardware) whenever they mine. This proves necessary, as any ease in mining a block might result in bad actors using that power to modify the ledger. A financial cost to mining proves that miners have skin in the game and trying to keep the network honest. This is thanks to their profits generated from newly minted bitcoins issued from block generation gives the currency value since the miners sell it on the market in order to pay the bills.

We have said that Proof of Work is easy to verify but very difficult to generate. This is because part of the Proof of Work algorithm relies on a really awesome modern cryptographic tool called a hash function, which is function that can map any data of arbitrary size to a fixed size output of data.

If we denote the hash function as:

y = H(x)

Where H is the hash function, x is the input, and y is the output of the hash function, the hash function is very easy to compute if we know x.

However, if we don’t know x, but only know y, the output, it’s super difficult to invert this and find x from y. This is because brute-forcing an attack to find x (basically trying all sorts of possible entries for x until we get y) would be 2^k, where in the case of bitcoin, it’s 256, so 2²⁵⁶ tries to guess x, or:

Image by Learn Cryptography

So, in order for one person to reverse engineer a transaction and find the possible input, there’s is a 1 in over 115 quattuorvigintillion (a 78 digit number) chance of finding it. That number is bigger than all the atoms in the perceivable universe, and by a large amount!

Now, each block contains within it the hash output of the previous block, thus creating a chain. This is how it has come to be known as a blockchain:

Blockchain diagram designed by yours truly

Once the proof is found by the miner, it is announced to the entire network. Then, after a network confirmation, the block is added to the chain.

Anyone trying to tamper the blockchain at a specific block back in time will have to use bruteforce to do work on all the other blocks connected to it, since modifying a single value in a block makes the entire blockchain false, due to the each block being connected to the hash of the previous block. Immutability is what makes the blockchain so powerful here, since it’s super hard to tamper with the ledger.

Achieving Consensus

Now that we have talked about what blockchains are and what proof of work is, we shall go in details about block times. Bitcoin, by design, has an expected block time of 10 minutes. That means, for every new block that’s issued to the miners network simultaneously, the expected time for a miner to generate a Proof of Work data file from mining the block shouldn’t exceed 10 minutes. If within 10 minutes, no miner was able to solve the block, the difficulty of the Proof of Work algorithm is adjusted accordingly.

This allows for flexibility as one miner can’t control the timestamping competition with more computing power to solve for the Proof of Work. For example, if a miner can mine a block in a few seconds of it being issued, the Proof of Work algorithm would be too easy and the difficulty would be adjusted to make it harder to find the Proof of Work data right away. So, if the miner invested a lot of money in computing power that gave him edge in the game, the increase in difficulty will set them back a lot while leveling the playing field for others.

We talked before that when a miner solves the block and gets the Proof of Work data, they announce it immediately to the entire network, which then updates the ledger and moves on to the next block. Some external force looking to tamper with the blockchain will need to reverse engineer the miner’s Proof of Work to get to the previous block. From there, they need to reverse engineer the key of that block to get to the next block until they finally get to the transactions they want to tamper with. This is costly and nearly impossible to do without losing more money than when you mine the currency instead.

Before we discuss how consensus is achieved or why it is needed in the blockchain, let’s look at a scenario that result in a chain split.

Let’s say, Elon and Mark both are mining bitcoin simultaneously. By some luck or randomness, both Elon and Mark solve the block and announce their Proof of Work to the bitcoin network. What happens in this scenario is that part of the network will first receive Elon’s Proof and the other part will receive Mark’s Proof. This leads to a situation where some network participants have a chain with Elon’s block as the head block and the other’s get Mark’s block as the head block.

Why, that’s what we call a chain split! The blockchain becomes split into two chains, those on Team Elon and those on Team Mark.

Office Cat Vote cartoon by Mark Anderson

Now, let’s take a step back for a second. How is consensus established in bitcoin to determine who is the right chain? By bitcoin’s design, in the event of 2 chains, the longer chain wins, since the assumption is that it is the one most used.

This makes a lot of sense, since, we would rather follow the rules of the game of the longer chain in existence, since its ledger history seems more legitimate in a way.

Now, how does that translate to two chains of equal length for Team Elon and Team Mark. In this scenario, both teams will compete to mine the next block after that, and the team who mines the block first adds it to the chain, thus becoming the longer of the two chains, and all nodes will follow it. Longest chain wins. #TeamElon always.

Now, we have reached a point of basic understanding of the inner mechanics of blockchains, and more specifically, bitcoin. Bitcoin was proposed by an anonymous person using the alias Satoshi Nakamoto. He issued a whitepaper in the Cypherpunk community back in 2009 titled Bitcoin: A Peer-to-Peer Electronic Cash System. The rest we can say, is history. I highly encourage you to read the paper, it’s only 9 pages long.

Challenges for Mars

How does all this translate to Mars?

Well, we have already discussed how mining and cryptocurrencies function, as well as the mechanics of proof of work and achieving consensus.

If say, Martian miners on Valles Marineris want to mine bitcoin, which has the majority of miners on Earth, the delay in communication due to the speed of light will eventually result in a chain split.

Say, the Martian miner solved a Proof of Work algorithm for bitcoin, and he announces the PoW to the network. Due to the speed of light limiting communication time between Earth and Mars to 13 minutes, the time it’ll take to propagate to everyone back on Earth will take long, and by the time they received the announcement, someone on Earth probably already solved for the block size in the previous block and all the Earth miners are following a different chain that’s longer than the one on Mars.

So, the result is a chain split between Earth and Mars, resulting in say Bitcoin Earth and Bitcoin Mars. This is not a scenario that we ever want to achieve because chain splits divide communities and result in two currencies without any idea about how to fix the situation.

We can maybe increase the bitcoin block size to say 20–30 minutes, but that’ll defeat the point, because transactions take longer to confirm. Imagine having to wait 30 minutes at the store for your credit card transaction to be approved. Yeesh, no thanks.

So, how does one get a blockchain for Mars working?

One solution is to treat each planetary mining operation as a sidechain and to have a mainchain operating as final settlement on sidechain transactions. The idea of having several different blockchains operating on the side and being used for specific purposes (like expensive computations that don’t slow down the mainchain) is becoming more popular in the cryptocurrency community.

A conversation I had with ETCDev’s Cody Burns helped shed some light on 13 minutes delay issue. He proposed a mainchain, let’s say, called the Interplanetary Blockchain, with block times of 3 hours, will take in sidechain transactions that flush to it. So, Bitcoin Earth and Bitcoin Mars act as the sidechains here with normal block times like before, but the transfer of wealth between chains occurs by moving them across the Interplanetary Blockchain. I highly suggest reading more about sidechains and Cody’s proposal for Stargates.

Sidechains are seeing a lot of innovations right now. For instance, SputnikVM from Ethereum Classic is a standalone Ethereum Virtual Machine that can run on its own as a sidechain on IOT devices. It can be applied to satellites, among other things, which would truly be interesting from a mining perspective. Satellite solar panels can mine at a higher efficiency due to their proximity to the sun day and night, something like 40% efficiency.

In fact, such an idea has been discussed before by cryptographers like Peter Todd, where we can generate more electrical power by mining bitcoin in space.

How would that work? Well, we know that beaming electricity from space has been proposed as a solution for getting more power from space without the interference of cloud (which decreases efficiency) like in the case of terrestrial solar power. Now, the new proposition is that, instead of all that fancy tech needed to physically beam electricity from space to earth, why not use bitcoin instead? Bitcoin transfer from space to earth represents the money behind the power generated.

NASA’s MAVEN mission on Mars

A cryptocurrency satellite will mine the equivalent amount of watts needed in bitcoins, which can then be transferred back to earth to be used to buy the actual power needed from the grid. Therefore, power becomes less costly as value is sent back to the electricity companies in terms of equivalent bitcoin value.

Let’s take this one step further. Say, our colonists on the first base on Mars have excess energy from their satellites and solar panels. They can use the excess power to mine for cryptocurrency on Mars when there’s a surplus, which can be converted back to an earth-based cryptocurrency via the interplanetary blockchain, while helping fund the colonist mission on Mars by guaranteeing more money going towards supply trips to Mars to support the colony.

In fact, let’s even think on a higher level.

If we are sending humans to Mars to settle on a base, then it’s most likely going to be with a private space company based on Earth than a nation space agency (sorry, NASA, but SLS isn’t going to cut it for us taxpayers). This means, with the absence of a nation as a colonizer in a way, the role private space companies will play would be that of starting from scratch while being as cost-efficient and sustainable as possible.

Any private space company worth its salt would never carry with it gold and paper currency to Mars for the colonists to use as credit. It just adds extra weight and is a very inefficient way of transporting monetary value.

So, what would a private space company do? Why, issue a cryptocurrency for the Mars monetary base. A cryptocurrency that miners try to mine today, but where the rewards of each block are allocated by percentage. Miners would keep the 80% percentage of the new coins issued per block if they mined it, while 20% can go towards a treasury to fund preparations for a Martian colony.

The treasury can take care of accruing required resources here on Earth ahead of time before the first Mars mission to establish a colony, and then use those funds to plan out the mission. There is currently research into decentralized treasuries, as with the great work being done by IOHK (a world-leading blockchain engineering firm), forming a wonderful marriage of cryptography and economics and political science. On the political front, liquid democracies provide very interesting cryptographic forms of delegative voting, where one can assign their vote to a delegate rather than a representative. The delegate is someone that you trust to vote in your interests, but requires less hassle for being a delegate since they need not campaign to be allowed to vote. We can have such delegates assigned voting on future changes to Mars. Such models currently are being implemented in the Cardano network for the Ouroboros Proof of Stake consensus algorithm.

By convincing big space players like SpaceX and NASA and others to participate in the creation of a Martian cryptocurrency, we can get the ball rolling on future Martian exploration endeavors. Investors would be able to buy the Martian cryptocurrency as a security in return for the long term perceived value of a Martian colony and economy.

A Martian currency will be super valuable, and not just due to the satellite solar power mining example mentioned previously, but also in other ways.

Imagine now that we can allow entrepreneurs to issue security tokens for future businesses on top of the Martian cryptocurrency. This is all very speculative, but fun to think about. Imagine a company issuing tokens for precious metal mining on Mars, another for the solar power, one for Martian delicacies, another for Martian-grown marijuana (that’d be something).

What about Martian internet? The light speed limitation we talked about before makes it slow for Martians to surf the Earth-fueled Internet, and delays in data transfer will be a business opportunity for entrepreneurs to figure out fast ways to send all that data (like, say quantum entanglement, which is super theoretical at this point).

The list of business possibilities for Mars is endless, but it seems like a cryptocurrency to fuel our Martian endeavors might be a good option to consider. A Martian economy can be grown ahead of time to be able to secure its own future by the time a colony is established and trading on the market. It’s time for the cryptocurrency community to start asking itself: “When Mars?”.