Building payroll system in Ethereum blockchain, what did we learn?
Blockchain has been all the rage in recent years. Many are the cries, each louder than the other, on how this new technology will change the world and disrupt business from finance and entertainment to fishing; everything, really. Multinational corporations are falling over each other to build their competence and release something blockchainy.
![Google Trends analysis on the term "blockchain"](https://images.contentful.com/pqts2v0qq7kz/5gx8VFHMRyAYO0QqISimEQ/cee956a3d88ee8bee92369b0babe6fe0/trend-blockchain-scaled_s1800x0_q80_noupscale.png) Google Trends analysis on the term "blockchain"
Since we, at Futurice, have made it our business to understand both technology and business, we want to understand this phenomenon as well. We are not that interested in the hype game, so we decided to actually use blockchain for something real to find out what’s what.
Juho Vähä-Herttua is a senior technologist who’s been figuring out how shit works since all we had was eight bits. To say that he’s a person who is not easily impressed would be an understatement and he wouldn’t be impressed. He is also a long term open source contributor and an active member of open source Spice Program.
The cornerstone of our Spice program is that the company supports any and all open source activities that our employees choose to occupy themselves with on their free time. One form of support is financial; if the employee chooses to report the hours spent on working on open source to the company, the next paycheck comes with a bonus.
Some people report contributions every month, some once a year, some never. The popularity has been on the rise though and we haven’t had any automation in handling these reports. It’s been slowly becoming a time-consuming chore to collect all the data at the end of the month and report them to payroll.
So Juho had an idea, let’s use Ethereum blockchain to store the relevant hour reports to do the payroll calculation. In fact, let's go a step further and do the payroll calculation on the blockchain as well.
The new reporting system would work like this:
- Futurice employee accesses an internal web UI with her browser to report an open source contribution. She is authenticated with her company account while doing so.
- She keys in the relevant information:
- A title of a public URL to identify the contribution
- Time spent in hours and minutes
- A description of the contribution, not stored in the blockchain
- The entered information, together with an encrypted user identifier, but sans the contribution description, gets stored in the Ethereum blockchain.
- The same information, now complete with the description, is also sent to a company instant messaging channel.
- At the end of each month an application is run on the blockchain to calculate and return the bonus for each employee, who has reported contributions.
- This refined payroll information is forwarded to the people and systems who make our salaries happen.
The instant messaging channel inbox is how we used to report these contributions. As part of our pursuit of organisational transparency, any Futurice employee can browse these reports.
The user identifier is encrypted to allow people to maintain decoupling of their identities. Someone might contribute to an open source project under a pseudonym, and would not want this identity of hers to be connected with her real person. This is fine and should not invalidate our sponsorship. However, because of the aforementioned reporting transparency, our employees can make the connection.
People liked the idea, so Juho implemented the system. It’s based on Ethereum contracts and our people are reporting their free time open source contributions through it. Through Ethereum network this payroll data is scattered around the globe.
Now that Juho has first hand experience on building something on blockchain, let’s find out what he thinks about the technology and its possibilities!
So, first of all, can you explain blockchain like we were five?
Once upon a time Santa had a huge problem; he wanted to keep track of who has been naughty and who has been nice in a way that is fair for all the children in the world. He created a book with so many pages that no one could count them, and gave elves the task of writing one chapter to the book every day, one elf at a time. Each chapter is carefully examined by all the other elves to make sure there is no cheating and the presents surely go to the children who really deserve them. Every elf who writes an accepted chapter is given some elf candy as a reward for their hard work, since all elves love elf candy.
Whenever an elf saw a child behaving well or badly, they could either wait for their turn to write it on a new page or simply send it to a group chat of all the elves and maybe even offer some extra elf candy to make others notice it faster. Most stories end up to the book through this group chat since there are so many elves eagerly waiting for their turn that waiting for one’s own turn would take a lot of time and Santa might not get the messages on time before Christmas. So whenever you hear the words blockchain or public ledger, try to think of it as the Santa’s book in this story and all the computers as elves. Because in principle they are all the same thing.
EDIT! You can now find this story visualised as a comic at: http://spiceprogram.org/blockchain
Did it make sense to use blockchain for our use case?
At first it would not seem to make any sense to outsource calculation of our salaries with real money at stake to unknown and potentially hostile foreign entities that are also very likely to be our competitors. On the other hand this is a prime example of how a large enough group of people working for their personal gain end up creating a system that is fair for everyone, which is the basic premise of blockchain technology, very much like the invisible hand described by Adam Smith in the context of self-interest in market economy.
However, in this particular case of payroll calculation there is no reason why it couldn’t have been done without blockchain technology. But our whole Open Source Program is based on transparency and openness, and blockchain opens up a way to give information of the number of participants and supported projects for anyone to analyse and build on. In addition to this, if we ever wanted to extend this programme outside of our own company for selected individuals, the open blockchain would provide a ready-made platform we could build on.
How do you identify meaningful uses for blockchain then?
Deciding on what to use blockchain for is a difficult question, and also a question most companies investing in blockchain implementation are currently asking themselves. One thing that is quite certain though is blockchain is mainly suitable for creating data storage systems that work using predefined rules but are not controlled by any single entity. So to put it briefly, blockchain is a database for platforms that evolve through their use rather than through a single point of control.
What are your thoughts about Ethereum?
Ethereum is a very interesting experiment, and in my opinion was the first interesting open application of blockchain since the start of Bitcoin. The main difference to Bitcoin is that it allows more complicated smart contracts, a term originally coined by computer scientist Nick Szabo, that can be used to add more complex logic to the blockchain instead of just using it as a huge distributed database. Ethereum also implements new methods that aim to reduce the transaction time compared to Bitcoin to make it more usable in real-world applications, and seems to use more of a trial and error method to problem solving, which allows it to move fast.
However, the design decisions made in Ethereum come with a price. The complexity of having a generic programming language for smart contracts has resulted in attacks that try to slow down the system up to the point of it being unusable, which in turn has forced the community to do several bugfix revisions to the base technology. In a blockchain the history cannot be modified, each bugfix results in basically splitting the blockchain in two incompatible parts, which is not desirable since it breaks interoperability with old clients. Also the faster transaction times inevitably lead to larger challenges in scalability when the total amount of data grows faster.
Taking all of this into account I still think Ethereum is a nice platform for experimenting with blockchains and smart contracts right now and this is the main reason we chose Ethereum as the basis of our experiment as well. And I kind of like the fact that it gives credit to the blockchain pioneers through naming its basic units (wei, szabo, finney) after the key people in the early days of blockchain technology: Wei Dai, Nick Szabo and Hal Finney. But because of the aforementioned technical issues I wouldn’t recommend it for large scale mission critical deployments, it was released just over 18 months ago and no one knows where it will be three years from now on.
How do you decide on meaningful uses for smart contracts?
First of all the term smart contract is somewhat misleading, since smart contracts are code just like every other piece of software out there. The idea is that current legal contracts are often vague and hard to interpret, so we should write our contracts in code instead and let the code have absolute control over all transactions, therefore saving lots of money in both interpreting contracts and resolving contractual disputes. However, contracts always involve people one way or another, and contracts between people are governed by the contract law of each country which defines what kinds of contracts can be considered legally binding. From a legal perspective contracts should be always interpreted in the existing legal framework, which makes handing absolute control to the code somewhat impossible in real life.
If we ignore the misleading name for smart contracts and simply consider them as distributed business logic, there are as many meaningful uses for smart contracts as there there are for blockchains. To put it simply, if blockchain is a database without a single point of control, smart contract is an application programming interface controlling the modification of that data.
This includes, but is not limited to, basic user access control and locking data to prevent further modifications.
Will this technology disrupt businesses across the board?
There is no simple answer to this, but if I had to answer shortly I would say yes it will most likely disrupt businesses, but not across the board. Personally I like to compare blockchain technology and the whole movement around it to the free software movement.
Back in the early days software was written largely by hackers and academics in an open manner, but as time went by more and more people started to do business writing software and wanted to have more control in how their software was used. By the 80s closed source software was the norm and open source more of an exception, but as the availability of computers grew so did the amount of people doing programming and the people being tired of reinventing the wheel and being restricted by others. This lead to the rise of the free software movement, which similar to the blockchain community had its ideological basis in classical liberalism and to some extent in individualist anarchism through the connections to the hacker culture. That all brought us to where we are now with Linux and related software running huge parts of our infrastructure and our mobile phones. The main reason for this has been that software has become more or less a commodity and the focus has shifted from owning software to using software and owning information.
I think whatever open source has done to the software industry, blockchain technology has a chance to do it to big data. But just like open source, open data is not suitable for every business model. If businesses are willing to give away control of some of their data and let others build on it, there is a chance of accelerated growth in data intensive fields and therefore more and bigger business opportunities as well. Just think of how for example Wikipedia has reduced the need for encyclopedias, but at the same time significantly accelerated growth by giving more people access to more information and letting users not only consume but also produce new content.
Naturally in cases where giving away control is not acceptable it is also possible to create private blockchains with no third party involvement whatsoever, but that would reduce the blockchain to a simple fault tolerant distributed database, which is hardly disrupting and quite unlikely the most suitable technology for the job. The potential power of a blockchain based system comes from using it for one thing, but at the same time maintaining a platform that allows other applications for the data as well. If we can efficiently utilise this potential or not remains to be seen.
This blog post, including both the text and images, but not the linked documents or web content, is licensed under a Creative Commons Attribution 4.0 International License. Attribution to Futurice Oy (www.futurice.com).
- Teemu TurunenCorporate Hippie