Five ideas to understand bitcoin

Today at lunch I had an interesting conversation with my father-in-law who was curious about Bitcoin. Lately I’ve received curious questions about this from peers, friends and family, so I think it could be a good idea to put my thoughts in writing. If you would like to get a more detailed view, I recommend visiting or reading “Mastering Bitcoin” by Andreas M. Antonopoulos.

Bitcoin is an algorithm described in 2008 in still anonymous Satoshi Nakamoto’s whitepaper “Bitcoin: A Peer-to-Peer Electronic Cash System”. This algorithm is developed and maintained by the open source community and run by the miners, who get bitcoin as compensation mining bitcoin blocks.

Who creates these bitcoins? can’t this bitcoin creating entity create more and more?

This is a great question, to understand it, first you need to understand five ideas:

  1. What is a hash?

A hash is a function that for an input of any size returns an output of fixed size (256 bits) with 3 very interesting characteristics: 1) this function is calculated very fast 2) a minuscule change in the input (a comma in the bible) produces a radically different output, so there is no danger in mistaking one hash for another. 3) the probability of having two different inputs that produce the same output is similar to finding an atom in the observable universe.

  1. What is a blockchain?

A block is a data structure which holds information of the last transactions that have happened. Within this data structure, one field holds the hash of the previous block. This hash links each block to the previous one forming a linked list, or chain.

If a malicious user wants to modify a transaction which happened in the past, let’s say 30 blocks ago, to record that he received 100 instead of 1, he would need to modify the 30th block on which his transaction happened, calculate the new hash of the modified 30th block, modify the link field of the 29th block with the modified hash of the 30th block, calculate a new hash for the modified 29th block and modify the link field of the 28th block to add this new hash, and so on until the most recent block.

  1. How are bitcoins generated?

A miner can be any normal person running the bitcoin software in their computer. In the bitcoin network, there are thousands of transactions happening every second, these transactions are communicated to all the miners who compete to be the one to calculate the next block the first. A new block is created by the fastest miner every 10 minutes. In order to be the fastest, the miner has to solve a simple problem which can only be solved by trial and error: create the new block with the pending transactions, fill the salt field with a value of your choosing, so that the first 10 characters of this block’s hash are 0. The algorithm self-regulates the difficulty (number of characters which must be 0) so that a new block is calculated every 10 minutes.

The miner which produces the block the first is allowed to add to the block an additional transaction giving him 5 bitcoins. This answers the original question, “who creates these bitcoins?” the miners. “can’t this bitcoin creating entity create more and more?” No, only the miners can create more by competing for the next block and obtaining the reward.

  1. How can I get bitcoins?

You can either obtain bitcoin from someone who you know has them, in exchange for goods or services, or you can go to a market such as or, create an account, transfer some EUR to your account from your bank and send an order in the market to buy bitcoin. Cryptocurrency market orders function the same way as you may be use to buying and selling securities at your bank’s online webpage.

  1. How can I use bitcoins?

Once you have bitcoin, you can store them at your market’s account or you can transfer them to your bitcoin wallet (a software which you install on your computer), you can send bitcoin to any other bitcoin wallet anywhere in the world.

Bitcoin allows cross border, immediate payment without needing to rely in any intermediary institution such as a bank, or an online payment company (paypal).

If you are interested in digging deeper into bitcoin, I recommend you watch this video by Andreas M. Antonopoulos.



What would happen if the ECB issued a crypto-Euro?

A hobby of mine is to develop visions of future scenarios. For it you just need to give as certain one event and think about how this event would reverberate in the rest of reality.

For example, what would happen if teleportation was made available? We could imagine that this would immediately be a game changer for the housing sector. Everyone would prefer to live by the coast or in the country, and every morning teleport to work. It would as well change radically the shape of cities, as cars would no longer be needed. CO2 emissions would be reduced, ending global warming. Car manufacturers, taxi drivers, truck drivers would suddenly be jobless as their services would be substituted by teleportation services, both of passengers and things. Country borders would also disappear, as it would no longer be possible to guard them… You get the idea.

Whereas teleportation is not likely in the near future, here’s a more interesting vision to discuss: what would happen if the ECB issued a crypto-Euro? (currently BoE, ECB and FED, among others, are researching the potential)


I imagine this would take the shape of a permissioned blockchain where the nodes would be run by the central banks of the euro-area countries. Each Central bank would run one node, and be the issuer of wallets for the citizens of their respective countries. This wallet would probably be embedded into the chip of each citizen’s id card. The ID card would change to hold NFC (near field communication) similar to today’s visa cards that you can pay with just by holding the card close to the point of payment. Through a mixture of fingerprint readers in our iphones (something you are), an NFC ID card (something you have), and a password (something you know), the person could be identified and authorized to operate. This should take care of KYC/AML regulation issues.

Once we can imagine a user is authorized to send a payment through the ECB-run blockchain to another user we have a system where bank accounts would no longer be needed and would be substituted by these wallets. Debit cards would not be needed. As for Credit Cards such as Visa, the credit service would still be useful, and Visa would probably have to start providing their service through this blockchain.

ECB could guarantee a 1 to 1 parity between euro and cryptoeuro. With this, the current extreme volatility that cryptocurrencies like bitcoin are facing would disappear. Without fx risk, european citizens would not have issues changing their fiat vs crypto and spending it freely. (Today I’m afraid of spending my bitcoins because in a week they could have increased their value in 30%)

Salaries would be paid in cryptoeuros, groceries would be bought in this cryptocurrency, and slowly but surely, cash in paper or metal would eventually disappear. Having a cashless society would mean more efficient (automatic) tax collection, and less tax evasion, which would allow governments to lower taxes to their citizens.

Once payments on this blockchain are ubiquituous, the next logical step is to accept that people ( and corporations, and robots, and cars… on the internet nobody knows you are a refrigerator) will give and receive loans on this blockchain. These loans could take the form of a standardized smart contract by which the receiver of the loan would be permissioned to take the funds and the issuer of the loan would deposit the lent funds into the smart contract. Upon interest payment date, the smart contract would send funds from the smart contract to the issuer. It would be the responsibility of the receiver of the loan to ensure sufficient funds are deposited into the smart loan to pay for the interest. In case of default the smart contract could automatically warn the authorities to update the rating of the defaulting party, and trigger if appropriate guarantees from insurers to cover the payment.

Bonds would follow the exact same mechanism, adding the possibility to the lender to unwind his position by selling the bond on a blockchain operated secondary market.

Settlement of all exchanges would be minutes instead of days. No Backoffice tasks would be needed since everything would be automatically settled. Regulatory reporting would become trivial and automatic since all the information would be held in the blockchain.

Security of this system must of course be watertight. A security error could lead to the funds of any individual or corporation being stolen. On a nightmare scenario, an organized cyber-criminal organization could attack every node of the blockchain and delete all possessions, debts and ratings leaving Europe bankrupt, with a clean slate and total chaos.

Of course these scenarios are just science fiction, but the funny thing about science is that any scientific breakthrough was at some point only science fiction before it became science and then reality. Who knows what the future will bring..

MIT Fintech: Future commerce

I just received my MIT Fintech Future commerce certificate! 🙂

It’s been a very interesting 12 week online training where I learnt about impending disruptions to the financial technologies landscape. I highly recommend it to those of you interested in fintech.

In fact I enjoyed it so much that I have now enrolled in the Big Data and Social Analytics course! 😀


Creating a private ethereum blockchain from scratch

Following this webpage  and this one (beware, some steps are deprecated), I’ve been able to create my own ethereum private blockchain. I document it here for those who would like to do the same.

Create a new user, group and home directory, for example privateeth1 and install geth for this user

sudo su
useradd privateeth1
groupadd privateeth
mkdir /home/privateeth1
chown privateeth1:privateeth /home/privateeth1
apt-get install -y build-essential libgmp3-dev golang
sudo su privateeth1
mkdir /home/privateeth1/ethereum
cd /home/privateeth1/ethereum
git clone
cd go-ethereum/
make geth

create the genesis block and initialise the blockchain

cd /home/privateeth1/ethereum/
cat > genesisBlock.json
“nonce”: “0x0000000000000042”,
“mixhash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“difficulty”: “0x4000”,
“alloc”: {},
“coinbase”: “0x0000000000000000000000000000000000000000”,
“timestamp”: “0x00”,
“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“extraData”: “Custom Ethereum Genesis Block”,
“gasLimit”: “0xffffffff”
go-ethereum/build/bin/geth init genesisBlock.json

start up geth in a customised port and network Id

go-ethereum/build/bin/geth –networkid 9999

open a new terminal and attach a geth console

go-ethereum/build/bin/geth attach

from within the geth console create an account and write down the address. We will initialise the amount of Ether to this account.

> personal.newAccount()

Edit the genesis block to add your account’s initial balance, afterwards initialise the blockchain again

cd /home/privateeth1/ethereum/
cat > genesisBlock.json
“nonce”: “0x0000000000000042”,
“mixhash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“difficulty”: “0x4000”,
“alloc”: {

“write here the account address that you received from personal.newAccount(), for example 0x55a0040fd8ac1177d598e8880cee248c7c9ac1b9”:

{ “balance”:”10000000000000000000000″ }

“coinbase”: “0x0000000000000000000000000000000000000000”,
“timestamp”: “0x00”,
“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“extraData”: “Custom Ethereum Genesis Block”,
“gasLimit”: “0xffffffff”
go-ethereum/build/bin/geth init genesisBlock.json

Now you can run geth again and you will see the balance in your account to have been updated.

go-ethereum/build/bin/geth –networkid 1234 console
> web3.fromWei(eth.getBalance(eth.coinbase),”ether”)

next step is to install geth on another computer and have them communicate. I leave that for the next post 🙂

Encrypting files with GPG

One of the concerns I have in this new world of cryptocurrency wallets is that I’ve never had a file that was worth thousands of Euros! Until now the worst thing that could happen (twice) was that I could lose all my photos…

The immediate solution I imagine to make sure I don’t lose my wallet is to make many copies of it and spread them around all my computers, gdrive and dropbox. But what if some hacker gains access to the file? He could somehow crack my password and gain access to my ETH stash!

The solution I have found so far is to keep several encrypted copies of my wallet. After doing some research I like GPG (the Gnu version of PGP) which is open source and has been around for a long time. This way, if the hacker gained access to this file he would first need to crack the encryption and the Ethereum password having 2 strong layers of complexity.

I’ve installed it so far in my Windows and Mac computers and it’s pretty straight forward.

  1. Windows:
    1. Go to and download the windows executable (currently Gpg4win 2.3.2)
    2. Once it’s installed you can use the following programs:
      1. kleopatra: with this tool you can create and manage your certificates.
        1. Go to File>New Certificate>Create a personal OpenPGP key pair and follow the instructions. Don’t forget your passphrase! 🙂
          1. kleopatra
        2. Once you have your private/public key pair generated you may want to share your public key with the world so they can send you encrypted messages which only you can decrypt. You can do this by right clicking on your certificate and selecting “Export Certificates…”
          1. kleopatra1
        3. A file will be generated with your public key which looks something like the below picture. Put this in your blog, email signature, billboard… you can share this public key with no risk. People can use it to send you encrypted messages. You can see my public key here
          1. kleopatra2
        4. You may also want to export your private key, to copy it to another computer on which you will want to decrypt messages. Take care to ensure your private key is not shared with anyone. To do this right click on your certificate and select “Export Secret Keys…”
          1. kleopatra3
      2. GgpEx: You can access this tool by right clicking on any file and selecting the GpgEx menu. For example to encrypt a file right click on your file (for example your Ethereum wallet) and select under the GpgEx menu>Encrypt
        1. gpgex
      3. You will now see a new file with the extension .gpg This file is encrypted and can only be decrypted by you.
      4. To decrypt it you can right click on it>GpgEx Menu>Decrypt. Insert your password and the file is decrypted.
        1. gpgex1
  2. For Mac the idea is the same, I’m using
    1. You can create new encryption keys with “GPG Keychain”. You can also copy from a different computer the private keys that you have created (in my case with the windows computer) and import them by clicking on Import.
      1. gpgmac2
    2. Once the keys are generated (or imported) you can decrypt a file by right clicking on it and selecting “Services>OpenPGP: Decrypt File”
      1. gpgpmac


Thanks to this I can now export my Ethereum wallet. Encrypt it and save a copy in my google drive, which I can download to any computer on which I have my gpg private key in case I need to send some ETH.

My first DAO: Jamon DAO

By following this tutorial I’ve understood how to create a “Distributed Autonomous Organisation” (DAO). This particular example is a democratic organisation with 3 voting members (let me know, and I’ll add your hash to become voting member) who manage a smart contract with a balance of JC167 (JamonCoin).

Any member of the DAO can send a proposal, for example: “Send the admin JC100, so he can buy a jamon sandwich” the rest of the members have a fixed amount of time (in my example 5 minutes) to cast their votes. If the voting is successful (in my case it must be by absolute majority), then the proposal can be validated and the funds will be sent.

Jamon DAO


By when a cashless world?

I’m sitting in a bar at the airport, waiting for my plane to board. The lady brings me my beer and when I see the QR code in the ticket, for a second I imagine a time when we’ll be able to scan that code with our iphone and have the payment automagically done 🙂

UBS creates Smart Bonds on Ethereum. Is this possible?

In november 2015, Stephan Karpischek, and Ian Cusden from UBS presented a prototype for an Ethereum smart contract that represented a bond issuance.

I’m interested in Bond issuances on the blockchain, as I think it could bring many interesting use cases for small and medium companies to raise money.

However I don’t understand one thing: How can the smart contract guarantee payment of coupons, or principal at maturity? one way would be for the smart contract to block enough cryptocurrency to pay back all the coupons and the principal at the end, but this would render the bond useless. The only possible alternative is that the smart bond can fail to pay back either coupons or principal at maturity. This must be the case, and it changes a big preconception I had about smart contracts, that they guaranteed payment and that this would avoid litigation.

Smart contracts don’t guarantee payment. Now that I think about it, smart contracts don’t even guarantee that they’ll have enough gas to keep running until the maturity of the bond. Smart contracts just automate execution and settlement, which is already pretty cool. 🙂

Understanding Blockchain: What is a Hash?

A hash is a one way function that transforms a string of data of arbitrary size to a bit string of a fixed size. This function has the following properties:

  1. It is quick
  2. It is impossible to figure out the original string of data from the hash. (except by brute force, trying all possible input strings until we obtain the same hash)
  3. Two different inputs will always produce different outputs
  4. A small change to the input string changes the output radically
  5. Same input always produces same output.

Hash is useful for example when you want to make sure that a file that you have downloaded is the file that the owner of the file intended for you to download and it has not been modified in transit.

For example, you want to download notepad++ so you go to the website and click on the link to download the Notepad++ Installer. A file downloads, but, how do you know the file hasn’t been corrupted or somehow modified while downloading?


You can check if the hash of the file you downloaded is the same hash that the owner of the website indicates. If you click on the link called “Sha-1 digests for binary packages”


You can see the SHA-1 hash (there are many hash functions, SHA-1, MD5, SHA-256…) of the file should be 6a54e0e8c8dbfca68abe3cbe66d99c66ced59cea


You can now use any SHA-1 hash calculator to chech that the file you have downloaded matches the hash that should be. This would indicate that the bits of this file are exactly the same bits as of the file that the website owner put on the website for download. If we change even 1 bit, the hash would be completely different.

If you have a linux computer you can use command sha1sum and you can see that the resulting hash is exactly the same one. You don’t need to go character by character checking, since if the file had been altered, the result would be wildly different.


If you don’t have a linux command line you can use an online sha1 calculator to see that with the same input, the SHA-1 function will return the same hash, no matter in which platform or computer you execute the function.


Hash functions are used everywhere when we need to check that a file or string of bits matches what we expect. For example VLC player uses hash to look for subtitles to the movie you are playing. Linux uses hash to check that the password you have entered matches the password hash that is stored in the hard drive. This ensures that if someone hacks into the computer, and obtains the passwords file, there is no function that can obtain the original password from the hash, since hash is only one way, but at the same time it’s trivial for the operating system to verify if the password you have entered is correct (since it will produce the same hash as the one stored in the hard drive).

Hash is a key piece of the blockchain algorithm. Since I intend to disect the blockchain algorithm to explain it piece by piece, it’s important that the basic pieces are well understood.


What is Fintech?

Fintech is short for “Financial Technology” and covers all technologies applied to finance. It is used mainly to refer to disruptive innovations in the Financial industry which is a topic that’s getting a lot of traction, specially since in 2008 Satoshi Nakamoto published his 9 page paper on bitcoin. However, many of these fintech disruptions don’t necessarily come from new technologies, just new ways of using existing technology.

One way fintech disruption can be classified is

  1. Infrastructure: Technical Innovations to infrastructure are necessary to solve business problems and enable disruption.
    1. Identity: One of the big concerns of regulators is KYC (Know your customer). In an online world, what can be done to ensure that a person is who he claims to be? With the concept of wallets which are anonymous, what can be done to ensure money movements can be associated with their owners? This is important to avoid money laundering, financing of terrorism, tax evasion…
    2. Privacy: On the other end of the spectrum of KYC, privacy is also important for end users. MIT are working on Enigma which is a blockchain based, distributed computer similar to Ethereum but with a focus on solving the millionaire’s problem (two millionaires want to know who of them is richer without disclosing their wealth) and allow calculations to be performed by the nodes without disclosing the data (but only pieces of the data which do not give a vision regarding the whole)
    3. Security: If all my bitcoins are sitting in my bitcoin wallet, which is a file in my computer and I lose my file, or forget my password, all my bitcoins are gone forever. If a hacker was able to copy my wallet, which is just a normal file, and was able to find out my password (for example hacking my keepass by compromising my computer) he could transfer all my bitcoins to his wallet and I would have lost them forever.
  2. Money and Payments: Mankind has come a long way from the cash only world where currency was backed by precious metals. Plastic credit and debit cards are the current norm. Paypal, near touch payments with mobile devices are trying to become mainstream, but a big disrupting technology has emerged in 2008: The Blockchain. The Blockchain enables:
    1. peer to peer payments:
      1. Until now when Alice wanted to send Bob money remotely, the only way to do this was to go through a trusted intermediary (a bank, a remittance company, paypal…). With blockchains like the one used by Bitcoin or Ethereum Alice can pay Bob directly, with no intermediary, and more importantly almost no fees. This will radically improve the lives of people who try to send money back to their families in developed countries, for which they need to pay exorbitant fees, wait in line and hope that the money is not lost, while at the other end of the transaction, the recipient has to go through a similarly daunting process.
      2. The peers in a transaction don’t neccesarily need to be human. M2M (Machine to machine) payments is something that can be feasible. For example is building locks that will open if a smart contract tells them to open.
    2. Cryptographically guarantee that a record can not be modified
      1. Entries in the blockchain cannot be modified. The older an entry is the more time it would take an attacker to be able to forge an alternative chain. Thanks to proof of work, we can rest assured that an attack is not possible. I’ll go deeper into these fun techie ideas in future posts.
    3. smart contracts
      1. Smart contracts enable programs to be run on the blockchain allowing these programs to send payments automatically if certain conditions are met (for example Alice could bet with Bob on the outcome of a match. The smart contract could check for the result of the match and transfer the money from Alice to Bob automatically once the result is known)
    4. immediate settlement
      1. Currently in capital markets, settlement is done two or three days after the trade is done due to the complex legacy infrastructure that it must go through. With blockchain, the transaction could be settled in minutes instead of days.
    5. No settlement risk
      1. Since transactions are atomic, the transaction either gets done or it does not. Hence there would be no settlement risk. However there are some views that claim that a blockchain can never really finalise a transaction as it is theoretically possible that due to the way the consensus algorithm works, the latest blocks may be rolled back. Vitalik Buterin, founder of the Ethereum foundation argues that by that same logic, the current system can also never really finalise a settlement, since the registry could be burnt down or defaced by a malicious user.
  3. Capital Markets:
    1. In the capital markets space, disruptive technologies are emerging in the form of:
      1. Robo-Advisors: Artificial Intelligence is enabling automated investment advice. For example, or offer this service
      2. Equity crowdfunding: A trend towards equity crowdfunding is emerging where shares in the company would be acquired by the crowdfunders, an example of this is or
      3. Blockchain driven markets: Digital Asset Holdings is a very strong startup, aiming at creating a market which is settled over a blockchain. Many strong incumbents are backing this initiative which looks very promising. This platform would deliver on the promise of instant settlement. Ethereum and Digital Asset Holdings are the two fintech disruptors which interest me the most.
  4. Marketplaces:
    1. SME lending companies such as Bond Street, On Deck, or Funding Circle are enabling investors to fund SMEs without SMEs needing to ask a bank
    2. Banking the unbanked: Mpesa is a vodafone initiative which allows people in developing countries to send and receive money from their cellphones via PIN protected SMS. Users can recharge their accounts through airtime resellers and retail outlets playing the role of banking agents.
    3. Credit ratings for the unbanked: companies like First Access are allowing individuals and SME in developing countries to obtain a credit rating when applying for a loan at a bank. First Access gain permission from the client to acquire his cellphone payment history from his cellphone provider, with this history of payments they can give the bank a credit rating for a direct loan.