The book swap project: a short story to understand the basics of blockchain

Publish date:

Victor Roger, Associate Consultant, shares a short story to try to provide a better understanding of private blockchains.

Learning how blockchain works can be quite tough. I have learnt this lesson myself when trying to untangle such a technology. Personally, I always need to have a clear understanding of a concept before being able to apply it to anything and blockchain is definitely something worth investing the time in, in order to figure out.

So, before diving into the subject, you should know that broadly speaking there are two types of blockchains: public and private. The former is more widely known than the latter, due to cryptocurrencies like Bitcoin, which are open to the public to invest on. I will focus on the lesser-known private blockchains and their real-world applications. To do that, I’ll use a simple example around which we can build the concept.

The book swapping project

Alice wants to start an office initiative to swap fiction books within Capgemini globally. She sends an email around to her colleagues. Bob, Charlie and Diana decide that they want to participate – they like to read and liked the meme at the end of Alice’s email.

They get on with it and read the rules that Alice explains, to ensure that the scheme doesn’t result in any lost books. Everyone partaking wants to always know who has a specific book. Alice creates an excel file (attached to the email) that everyone should keep on their computer with three columns: “Transaction”, “Signature of giver” and “Signature of receiver”. She thinks it is a good idea that everyone has a copy of the file because if only one had it, there would be a risk of losing all the data if they were to lose or delete the file.

She explains that whenever someone lends a book, the giver and the receiver need to sign the transaction in the Excel file. This data needs to be broadcasted around the group (e.g. sent via email), and everyone should update their spreadsheets accordingly. Also, at the end of each day, everyone should share their file to see that there is a consensus on all the entries. Chances are that someone may have missed a transaction (amid a myriad of other super important emails), but this would be easily spottable at the end of the day when that user sees that everyone else has a transaction that she (or he) doesn’t.

However, simply typing “Alice” and “Bob” next to the entry “Alice gives Don Quixote to Bob” doesn’t give everyone the confidence that Alice has given the book to Bob and hasn’t sold it on eBay. Therefore, Alice explains that she found out about Digital Signatures and that they would be a good way of solving this problem.

Digital Signatures (DS) are a form of cryptography that involve two functions: Sign and Verify. Every user that uses DS has a Public key and a Secret key that are intrinsically related – the public one is generated based on the secret one.

On one hand, the Sign function takes the content of the Entry and the Secret key, and outputs a Signature that is entirely dependent on the message content. Therefore, contrary to handwritten signatures, DS are different for every Entry (also called “Message”).

On the other hand, the Verify function takes the Entry, the Signature and the Public key and outputs “True” only if the Signature was issued by the person to whom the Public key belongs. Otherwise, it will output a “False” message. This way, all of them have a method to ensure that a certain book transaction is safe to be added to their Spreadsheets because it has been unequivocally approved and signed by the interested users (Bob and Alice, in this case).

With this tool in hand, the beginning of all the excel files would look something like this:

As you can see, the first few entries record the books that each one of them are putting into circulation and then show a record of Alice giving one of her books to Bob. They agree that they will only add entries to their spreadsheets, and therefore deem them valid, if:

  • The entry contains a plausible transaction (e.g. Alice can’t give The Hobbit to Diana as she doesn’t have the book, Charlie does. On the other hand, now that Bob has Don Quixote, he can transfer it to someone else)
  • The entry is signed by the concerned person (e.g. The first ones are signed by the user that is making the book available and the last one is signed by Alice, confirming she gave the book, and Bob, confirming that he has received it). Every user should have the public key of all the other users in this book swap initiative, so they can check that the signature is valid before adding the information to their files.

With this system, as long as everyone is being honest, they should have a pretty good methodology to exchange books. But Alice was worried that her book lending community might become really popular and she was concerned about its security and about people tampering with records. “What if I lend a book to Charlie, and in a years’ time he loses it and tries to go back, delete that I originally lent it to him in the first place and tries to convince everyone that the transaction did not happen?” she thinks. (Okay, Alice is a bit paranoid, but it is a fair concern).

Therefore, she also details in the original email that she has found out about an encryption method called “hashing”. Basically, encrypting a message with a hashing function means substituting every single one of its letters (essentially 1s and 0s) for another set of characters. Without going into too much detail, there is a commonly used encryption method – called SHA-256 – that processes (“digests”) any message and outputs a 64-character-long combination of numbers and letters (0-9 and a-f), regardless of the original message’s length. This output (called “hash”) is completely dependent on the content of the message and if anything changes, even if it is only one letter, the resulting hash would be totally different from the previous one.

With this method in hand, Alice explains that at the end of each day, they will group all the transactions of books made, encrypt everything with the hashing function and add the resulting hash to the beginning of next day’s block of transactions. This means that every day that passes by, it becomes more and more complicated to tamper with old records because every block is linked to its predecessors intrinsically. For example, if Charlie were to lose Pride and Prejudice in a years’ time, he would need to change the content of the 364 blocks that have been created over the course of time and then convince the rest of users that that entry wasn’t there on the first place. Highly unlikely.


Now that we understand how Alice’s chain of book-transaction blocks work, there isn’t much of a difference with how actual blockchain works. Blocks might be yielded faster and the members of the network (nodes), might not be a single person but may be whole companies that trade within an ecosystem. Whatever the specifics might be, the skeleton remains the same: a decentralised ledger that provides trust against fraud and end-to-end visibility of transactions, due to everything being grouped in a single place.



Victor Roger

Associate Consultant

Victor joined Capgemini’s Future of Technology capability in September 2018 having studied Industrial Technology Engineering at UPC in Barcelona. He is currently working on a public sector project. Prior to joining Capgemini, Victor was working on a start-up in the Programmatic Marketing industry.

Related Posts

Diversity and inclusion

Celebrating Pride and beyond

Laura Gardner
Date icon July 18, 2019

Putting Pride in its place: we all have a role to play to achieve acceptance and inclusion of...

Diversity and inclusion

Capgemini hosts Power of Inclusion breakfast

Laura Gardner
Date icon July 18, 2019

The Lord Mayor’s ‘Power of Inclusion’ breakfast series brings business leaders together...


Think change and make it happen!

Guest Blogger
Date icon July 11, 2019

New ways of working, “the art of the possible” new technologies, Agile, Digital Operations,...


By continuing to navigate on this website, you accept the use of cookies.

For more information and to change the setting of cookies on your computer, please read our Privacy Policy.


Close cookie information