In code we trust

Where does decentralization begin? It might seem like a bit of a strange question but it is quite relevant. Decentralization begins in a place where the source code of a given project is stored. Cardano is written in the programming language Haskell and everybody can find the source code on GitHub. The source code is open and available for viewing and downloading. Programmers can propose a change of the source code in order to fix some issues or add new functionality. Why does decentralization begin on GitHub? Well, the IOG team has written the source code and you can find all the rules and algorithms to which people decided to trust. So what can you find there? For example, the rule, that only 45,000,000,000 ADA coins exist. There are also rules for monetary expansion and transaction fees. These rules are related to economic and incentive models. Moreover, there are rules for blocks and transactions. For example, all received valid transactions will be added to the blockchain and stay there forever. These rules ensure censorship-resistance. There are also consensus rules and algorithms, for example about a selection of slot leaders, proofs that blocks must contain to be considered as valid, etc. These rules are important for scalability, security, and decentralization of the protocol. When you say that you want to use Cardano since you believe in the technology then you basically say that you trust all the rules that are in the source code. That is why people often say “In code, we trust.” or “Do not trust, verify.”. Rules in the source code directly influence the level of decentralization, the number of coins that are currently in circulation, the maximum supply of coins, security, and everything you could name when you talk about public blockchain.

GitHub is a centralized server where the source code is stored. The code has been written by programmers, which means by humans, that have decided about all the rules. Moreover, they constantly update the source code. Every protocol needs maintenance and new development. How does it happen that it is possible to launch a decentralized network? It is actually easy. The source code can be processed in a way that it is possible to run it on a node or on your laptop. Thus pool operators can operate their pools and you can operate a full node on your laptop. We have forgotten to mention that Cardano is actually a distributed protocol. Thus, the level of decentralization depends on the number of independent people that operate full nodes, mainly the nodes that can produce new blocks. It can be said that full node operators trust the rules in the source code and are willing to run it on their own hardware after the transformation process. It should be mentioned that the transformation process does not change the rules but just enables running the source code on a given operating system.

Users of Cardano, or any other blockchain network, basically trust the rules that have been implemented by a few people or teams. The source code is just the result that the team has produced. If you realize that then you basically trust the team. To the team that has the power to change the rules. The changes in rules might be more or less significant. You can think that you trust the network, more precisely you trust the network consensus that is maintained by people operating full nodes. It is also the correct perception. You just need to realize that whenever the client is updated there might be some changes in rules. What is important here, however, is the expectation that the most important rules will never be changed or the network will be improved in a way that will be beneficial for you. For example, you expect that the number of ADA coins will never change. So there is a strong social contract between users and the team. On the other hand, you expect that capabilities and user experience will be constantly improved. Only improvements can attract more people and a higher adoption will have a positive effect on the price of ADA. Believing in the protocol is also partly related to the ability of the team to deliver new features that will bring new users.

How to enhance decentralization

There are rules in the base protocol which are the same and unchangeable for every user. Users either accept the rules and are happy with them or they can start using different protocols with the different rules and capabilities. These rules cannot be changed by smart contracts. They are implemented by the team in the Cardano protocol. Let’s call them basic rules. For example, rules related to monetary policy, network consensus, and staking are basic rules.

Let’s ask the question. Would it be possible to somehow extend the concept of defining rules and customize them for different problems or groups? Maybe you already know the answer. Yes. Smart contract technology is exactly that. This technology can be perceived as the extension of the concept “In code, we trust.”. Smart contracts allow users or rather smart contract programmers to build extra logic upon the functionalities of the protocol.

The key difference is that basic rules can be changed only by programmers that work on the protocol. These rules and algorithms change the protocol for all users. Changes in the source code that is available in GitHub. Smart contracts are also a set of rules but these rules can be defined by anybody and users of the protocol can decide whether they want to adopt or use these rules via decentralized services and applications. For example, a decentralized exchange can be created on the Cardano protocol. Users are not obliged to use the exchange. Actually, there can exist many similar exchanges and users decide which of them they will trust the most. It is important to mention that if one smart contract fails due to some bug that the developers have made then the protocol and all other smart contracts are not affected at all. The IOG team working on the protocol is responsible only for it and for the infrastructure that smart contract developers use. They are not responsible for the smart contracts that are made by other developers and they cannot even influence it. Cardano, as a smart contract platform, is open for everybody. Let’s use an analogy from the current IT sector to explain it. Java is a programming language from Oracle. Everybody can use Java and create a good or malicious program. Oracle takes no responsibility for the programs that are created by developers.

Smart contracts technology enhances the abilities of the base protocol. The Cardano protocol allows users to send value. Alice can send ADA coins to Bob. It is a simple and reliable scenario. Smart contracts utilize the abilities of the protocol and can add extra logic. It will see that it is actually very useful. Every transaction has a context. Alice actually wants to send 10,000 ADA coins to Bob and she expects that Bob will send her 0,1 BTC. They have arranged it in the physical world. Without smart contracts, they would have to rely on only two single transactions in two blockchains. Alice and Bob would face the typical problem of who should take the risk and send the transaction first. Is it possible to digitalize the context that Alice and Bob know in order to make the scenario more reliable? Definitely yes. Smart contracts are able to significantly improve the scenario and protect participants from losing money. A smart contract can be in the role of the middleman that provides custody service. Once the contract has both assets it just swaps them and sends BTC to Alice and ADA to Bob. If one of the participants or no one will not send the asset in time then the contract cancels the operation. Notice that the smart contract utilizes the Cardano transaction layer for sending ADA. Moreover, an infrastructure for the execution of the smart contract is used. In this scenario, the interconnection to the Bitcoin protocol would also be needed. In this scenario, the smart contract enhanced trust between two participants in a fully decentralized way. It would be possible to create a more complex smart contract that would serve as a decentralized exchange that would be available for all users. Cardano will be a multi-asset ledger. It means that it will be possible to create other digital assets besides the native ADA coins. For example, stocks, bonds, utility tokens, game items, and whatever comes to your mind. Smart contracts technology basically allows defining rules for exchanges of these assets. Users will be able to freely choose services and applications that they want to use.

Smart contracts have the same qualities as transactions

The blockchain technology has been adopted by cryptocurrencies enthusiasts for qualities like decentralization, censorship resistance, global availability, and the possibility to join the network without permission. Blockchain networks can have these qualities due to the rules in the source code and people utilize it mostly via transactions. Smart contracts have the same qualities as transactions. Dave is a smart contract programmer and developed a decentralized service for exchanging ADA and BTC. Alice and Bob trust Dave’s service as many other users and they will swap assets via it. Once Dave deployed the smart contract then nobody can stop the service. Nobody can prevent Alice and Bob from using it and the service is available in the whole world. It is not possible to stop it or censor it. The service is decentralized and the contract always behaves exactly in the same way as the source code of the contract dictates. Everybody can check the source code of the contract since it is publicly available.

As you can see, smart contracts extend the basic transactional functionality and they can be perceived as an extra trust layer that allows realizing more scenarios. The ability to send decentralized transactions is great but the usage can be limited or risky in some scenarios. Decentralization of the transaction network cannot ensure that the counterparty will act honestly. The transaction network just executes commands of users like Alice or Bob. For example, Alice signs a transaction to send ADA to Bob. If the transaction is valid then the network will add the transaction to the blockchain and Bob will receive the coins. The transaction network cannot somehow ensure that Bob will send Alice BTC coins. Alice must trust both the network and Bob. The network is nearly 100% reliable and it is easy for Alice to trust it. It is riskier to trust Bob and smart contract technology can enhance trust. Exchanging ADA and BTC can be made via a trusted middleman. The question is what does it mean to be a trusted middleman? Alice and Bob can use a centralized exchange, or they can ask a friend to help them to swap assets. Finding a friend or reliable middleman in the physical world can be difficult, expensive, and slow. Mainly in the case that Alice and Bob do not know each other and they do not have a common friend. The question is, why should they risk losing wealth or rely on a centralized middleman if they can use decentralized technology. They want to send assets via a decentralized transaction network. It is natural to use the abilities of the same network for custody service. A Cardano smart contract can protect the assets of Alice and Bob. The contract will contain exact rules for the exchange of assets. It is easy to define conditions and actions that will take place after the evaluation of the conditions. ADA and BTC coins will be exchanged only in the case that the contract has both of them in the expected value. If it is not the case after a defined period, then assets will be returned to the original owner. The contract cannot keep assets for itself, it cannot send them to another address than it is defined, or anything else. The contract will be executed in a decentralized way similar to a common transaction.

The smart contracts technology adds complexity to the simple transaction system. The complexity is always present since every transaction has a context. Users can decide whether they want to rely on the physical world, that is mostly centralized, or whether they rather use the decentralized smart contract. Both approaches have known advantages and disadvantages. We have described a very simple scenario where both assets are digital but it is not always the case. People live in the physical world, their wealth is at least partly physical. Our work is valuable for employers who decide about the reward. We communicate with other people to which we need to trust when we want to buy something or take a loan. Smart contract technology can significantly improve the usability of blockchain technology. The reason is simple. A smart contract can improve interactions between participants and digitalize the context that is needed for every single transaction. You do not need to use a smart contract in case you send coins to a centralized exchange in order to trade them or exchange them for other coins. You have already decided to trust the centralized service that is mostly somehow regulated and obliged to solve your issues. To do the same in a decentralized way requires a more complex logic. The transaction context must be digitalized since you do not want to rely on a centralized custody service and more transactions can be involved in the process.

A smart contract will be needed always when more transactions are needed to realize a complex scenario. Participants can send transactions at a different time and it is hard to predict when in which order the network will process them. It is difficult mainly when interaction with PoW networks is needed. These networks are slow and clogged so it can take a day when a transaction settles. But it is not only about time synchronization. Imagine a more complex scenario when more users have to send funds in order to take the next step. For example crowdfunding. Loaning and insurance industries will also definitely need smart contracts since funds are usually locked to be released under defined conditions. Custody service is also a strong use case for smart contracts. Every bank in the world provides a custody service. They hold bank accounts of the big part of the population. Do we want to have centralized banks that will hold crypto in a centralized way or do we rather want to have a decentralized bank? We believe that you now understand the difference. You can send a bank your crypto and the bank will hold private keys. It works similarly as a centralized exchange. Such a bank can be robbed, centralized authority can censor transactions, etc. Is not it better to define the behavior and rules of a decentralized bank in smart contracts? Such a bank would be unstoppable, nobody would censor transactions, it would be nearly impossible to hack the bank. The bank would be available for all people in the world. The same conditions and rules for everybody would be applied.

Conclusion

The adoption of technology needs time. So far, small minorities have adopted cryptocurrencies. Bitcoin, as the leader, is a pure transactional network and the adoption is not higher than 1% of the population after more than 10 years of existence. Smart contract technology is more complex and the user base is small. Maybe we will also need 10 years. The potential of smart contracts is huge and the impact on society will be significant. The number of transactions will increase since smart contracts enhance trust between users that would otherwise use centralized services. Once people learn how to utilize smart contracts, the number of use cases will also grow. We expect that Cardano will become a strong player in the next financial revolution.