Skip to main content

MB Academy

Upgradeable Contracts: An introductory guide

One of the first things we learn in Solidity/Ethereum is that contracts are immutable. If you upload a contract on the blockchain, you can’t change its source code and therefore you can’t change its logic.

We must be extremely careful with the code we use: if we make one simple mistake it could be extremely expensive. That’s why we consider alternatives as a way to avoid this limitation. Let’s see how we can use an upgradeable contracts.

Contracts Old School

The simplest thing we can do is upload a new version of the contract (and thus a new deploy and a new address). But this has its issues, for example let’s think about what it was like to have a shop a few years ago (before the internet). If we wanted to move to another address, we had no way of notifying all our clients and potential future clients of this change. The same thing happens in smart contracts, all users must know that the address has changed, but not having a user registry makes it very difficult.

Example no upgradeable contracts

Ways to create a upgradeable contracts

There are currently 4 ways to create an upgradeable contracts.

Using an interface / proxy

Taking advantage of inheritance and polymorphism, an interface with the contract structure can be exposed. So now we have two contracts: one with the contract definition (and external calls) and the other with the function’s implementation. The user interacts with the contract through the interface and if an update is required, the address of the contract is simply changed for the new version in a simple variable inside the contract.

Example upgradeable contracts

It is not possible to modify the contract’s structure since we MUST respect its interface, but its main disadvantage is that the stored values ​​will remain in the contract that has the logic, and if we want to update it with that of another contract, we will lose the storage state.

What is done to solve the storage issue is to have a “proxy” contract that has the same structure as the one with the logic, and it is accessed through the delegatecall instruction. It is SUPER IMPORTANT to keep the same variable structure in the contracts since we will be sharing the storage, and if both do not have the same variable structure, a collision could occur. A possible solution for this is that they both inherit from a base contract that sets the same variable-structure for all of the contract versions.

It seems to be a better alternative but in terms of gas it is expensive: we are always adding variables that we will most likely never use in every logic contract we implement. This can be improved if a third-party storage contract is used, for this, we can use solutions such as OpenZeppelin or combine it with an unstructured storage.

OpenZeppelin Transparent Proxy

If you are a user of the OpenZeppelin contracts you have noticed this plugin for sure. Inside, it uses a mechanism known as Transparent Proxy, which uses unstructured storage to avoid collisions (as long as we add the variables at the end and never at the beginning). This proxy is already integrated as a plugin and is compatible with Hardhat and Truffle.

Link here

Diamond Pattern

This is one of the most popular and most complex, since we have an intermediary contract, but instead of aiming for a single final contract, each function will be implemented in a different smart contract. In addition, each “Facet” contract (as they are called) will have a fixed memory space to avoid collisions. A major advantage is, a whole contract deployment is not required, just a contract with one function implementation. That’s cheaper than deploying a complete-structure contract with all of the functions and also as there is just one function per contract, the size limit is very hard to reach. It is undoubtedly the favoured solution for the complex scenarios that are created today and there is even an EIP that refers to it.

Link here

Syntethix Router Proxies

At ETH Latam event, Alejandro Santander (known as The Ethernaut) presented a solution called Router Proxies. It is quite similar to the Diamond Pattern, but simpler. I recommend watching this talk!

Link here

Video here

Metamorphosis Smart Contract

What? Well, we are not actually modifying the contract, but if we had the ability to remove the contract from storage, we could force a deployment to that same address, then replace one contract with another. And this is how this technique works. Through the selfdestruct() statement, it is possible to remove a contract from the blockchain storage, and using the create2 operation, a new version of the contract is deployed to THE SAME ADDRESS.

Link here

Ok, but… is it okay to modify a Smart Contract?

In centralized software, not only is this not a bad thing, it is a necessary thing. What happens in decentralized projects? Who should update the code? Is a DAO reliable enough? On the one hand, an immutable contract seems more reliable than an upgradeable contracts but it also makes it more vulnerable to attacks. In my opinion, it is good to consider all these alternatives and use them if the project requires a sophisticated architecture. Making a contract upgradeable makes its code much harder to understand and trace, but improves its resistance to attacks. If the strength of a project is its simplicity, I would not work on making the contract updatable, but I would do so in complex projects with multiple contracts.

Crypto is much more than DeFi and speculation

Mighty Block

Before writing this article I asked some people what crypto meant to them. I can divide their answers into two groups:

  1. The first one is from the people with knowledge and experience in crypto, they answered: “a decentralized technology able to remove middle-men,”
  2. and the second group has almost zero knowledge about topics like bitcoin, investments, and economy.

Their answers are biased. How much the price of cryptocurrencies falls is the only thing in the news and that is what people who are not related to the crypto world see.

Crypto is about the future and we need to talk about it.

Many people have heard about cryptocurrencies, speculate about them, and try to encourage more people to join the ecosystem. They have bought some cryptocurrency because they heard about it on social media and read the popular title “Buy this coin and you will be a millionaire tomorrow”.

I believe that Crypto is not just the Bitcoin price, finance, or people creating their own cryptocurrencies and convincing others to buy them.

Is not just about prices

There is a group of people who have deep knowledge about crypto, some are advanced users, others work full time on blockchain-related projects (also called web3 projects). Because this group has been building projects since the beginning of crypto and the first use cases were related to finance, there is one topic that most of their conversations are about: Decentralized Finance. DeFi is perhaps the most important topic both in our daily lives and for our future. But we should not stop talking about this, there are other reasons to pay attention to crypto and we need to start talking about those.

There are many industries where crypto (including blockchain and cryptography techniques) can be applied and talking only about one use case (DeFi) will make people focus only on that. It is necessary to show people that crypto is not just about prices, and discuss with them how the technology can be applied in their field. There will be more opportunities to leverage the tech in different fields.

Crypto is the future

Talking about decentralized finance is great, but it is not the future, it is already the present, it needs a lot of improvement, but it is here and helping people.

Crypto is here to help empower the users to have control over their assets, from money to data.

We need to encourage people to understand how to use crypto, and when I say “understand,” I am not talking about understanding how blockchain and cryptography work, because we drive cars and most of us don’t have any idea how they work, but we understand that transporting ourselves quickly is crucial to achieve more in our daily lives.

Many entrepreneurs and developers are building solutions with technologies related to blockchain, but it’s not even close to what is needed to improve our future. All of them (me included) believe that crypto is the future.

It is necessary to talk about technology and DeFi in different conversations. 

It’s essential to spread the seeds and help create conversations in many places. If we want to introduce the next billion users, we need to talk about how we are going to do it.

We need to start thinking and talking about how crypto can impact different fields. Without thinking too much, it is easy to imagine the technology applied in fields like:

  • Healthcare: the medical industry has suffered greatly from the inability to securely share and access sensitive patient data.
  • Security: when users own their assets and information, they will need to store their personal data securely and easily.
  • Law: as Kleros does using blockchain and crowd-sourcing to fairly arbitrate disputes. 
  • Social media: running away from centralized social apps and their censorship power, we will need decentralized social networks, like the ones Lens is helping to build.
  • Data storage: how much information do you save in centralized entities and how do you know what they do with your information?
  • Digital rights: piracy has brought incalculable losses to image creators, which is particularly prominent in areas such as news, design, photography, and e-commerce.

Just by thinking for a few seconds about it we realize that we are talking about years and years of work, but we need to start from somewhere, and speaking about how to implement it is the first step.

A single program is not enough

What makes me happier than ever is knowing that the Ethereum Foundation supports more things rather than just finance.

They launched the Fellowship Program that helps projects to “become a tool of and for the next billion – whether it is a decentralized application, a community-building initiative, or a piece of research”. I think it’s awesome to see one of the most influential foundations helping to improve the future.

But a single program is not enough. More people need to join the Ethereum Foundation and help them to reach the next billion in any way possible.

The first step to the future

We need to see beyond what it’s in front of us now.

We need to talk about other opportunities that crypto brings to the world, how this new technology can improve the lives of the future generations.

The world of crypto moves very fast. There are so many things going on at the same time that it’s hard to keep up. It’s important to understand what we are living through.

There are more opportunities in crypto than I talked about earlier and we need to find them and take them. Although, including blockchain in our lives won’t be easy, and it isn’t needed to apply it in everything.

We need to talk about crypto, the first step to the future.

How Product Managers need to re-invent to survive web3

Mighty Block web3.0

This is not a magical recipe of “10 things that you must know to be a successful product Manager in a decentralized environment” or “5 must-have skills to be a web3 product VP”. This article looks to summarize the main challenges that product managers are facing in the web3 product industry. 

example of a product manager meeting on the web2
Example of a product manager meeting on the web2

Product Managers are not part of the product conception

Web3 is full of technical founders, builders, and early-adopter users. Most of the products are created with a great idea but without a Go-to-market strategy and a conscious prioritization of problems to solve or value to deliver. 

We know that generally, start-ups do not start with teams that include product managers. CEOs and founders are the ones that help with the product definition. We have our first potential issue here. They are the visionaries, and the product is their baby. So, how can they be objective? 

This scenario makes it difficult for a PM to take ownership of the product when one finally arrives at the company.

Products are built full of bias 

As we mentioned before, all of them start with a great idea, but is that a great idea for the users as well? How is this hypothesis validated? As PMs, we have a mantra that says: “Always test your assumptions”. 

That is something that does not happen often in this ecosystem. New products are created based on the assumptions and desires of the founders. Web2 has taught us that in most cases that is not enough. Of course, there are exceptions, but are you going to risk your investors, your time, and your credibility because of them? 

New Dapps and new DeFi protocols sometimes get a bunch of new users when they are launched, and most of the time there is a community of web3 “influencers” being bullish about that. However, at that point, the problems start. Is the product strong enough to provide value to these users? Are they going to stay? This abrupt growth makes founders think that they are right and their path is the only valid one. Who needs hypothesis validation? I have 1M users!

Product Managers need to be able to discover where the real value is, test it quickly, to fail even more quickly. This is not only a new industry but a new era, so we are going to fail, but we need to be prepared to pivot the original idea if that is not what our community and users need. 

In web3, we have an extra bias that seems to be all over the place. Products are built for people that already know how this world works. If we want to achieve the vision of blockchain and web3, bring economic freedom, or decentralize the internet, we need to include a broader audience. We cannot think only of the users that are already here.

Products are community-driven

As Product Managers, we are used to taking care of our product metrics: is the conversion rate enough? Where is the drop-off in my funnel? What about the churn? Our DAU? 

From now on, if we want to succeed, we need to take care of our product and most importantly, our community: How many daily contributors do we have? And what is the retention rate of my community members? 

The challenge has increased, engagement is no longer with the product but with a community that we need to build, take care of, and maintain. 

Building a community is not a challenge that Product Managers are used to. We can do some analogies with the users, but it’s not the same, especially because communities are stronger actors in our product development cycle. We are talking about people that could participate in product decisions. So, we need to create a solid community, we need to be open to hearing what they have to say. 

Remember when we used to be data-informed when defining our roadmap? Well now we need to develop a new skill, which is one of being community informed.

Data vs Community desires: The priority Matrix increases

So now, communities are pretty well informed about what they want, the trends, and what we should build next to keep them engaged.

Nowadays, do communities handle the roadmap? No, it is not like that. As we mentioned earlier, they are important drivers of prioritization, but they are not the only ones. One thing that we need to consider is that communities are still immature, they probably give us solutions or new cool features that they would like to implement. On some rare occasions, they are going to come to us with problems. As Product Managers, we need to be able to understand the real issues, the impact, and the value that we could deliver if we work on those. 

If we have communities telling us what is next, do we need data or is it no longer relevant? In fact, data is more important than ever; the difference is that now we have more ingredients in the prioritization matrix: 

  • Business Impact: Even if we are talking about Decentralized Autonomous Organizations (DAOs), or any kind of company our product needs to be aligned with the vision and objectives.
  • User Impact: Not all users are part of a community, so, we cannot forget to bring them value. They keep the product alive!
  • Community value: Our star users, early adopters, and promotors are part of the trends. Are we keeping them engaged?  
  • Technical effort: How much does it imply? How long is it going to take us? 

The Go-To-Market strategy is not enough

Another important task as a Product Manager was taking care of the Go-To market strategy. We even thought that we had some kind of recipe for it. We were full of frameworks that we could use to define our MVP, we put our users at the center, we followed prioritization techniques, and we did experiments and AB testing. But, what about now? 

One trend is the Go-To Community strategy which implies defining (and building) our MVC: Minimum Viable Community. It is this minimum validation that we need to do as Product Managers, to understand if our product is going to succeed in the community.

And how can you formulate a Go-to Community strategy? Well, we will be seeing just that in the next chapter 🙂

As you can see, there are plenty of challenges that we need to deal with every day. The good news is that as Product Managers, we have developed skills that can help us with that: re-inventing ourselves, adapting to new environments, learning, and learning again. If we want to be part of this revolution, we need to evolve first. 

Chainlink CCIP: Cross Chain Interoperability Protocol


In this article, we will explore Chainlink CCIP and why we consider that this protocol will be fundamental for the blockchain ecosystem. Cross-Chain Interoperability Protocol (CCIP) provides a universal open standard for developers to build secure services and applications that can send messages, transfer tokens, as well as initiate actions across multiple blockchains.

Understanding the Cross Chain problem

Recently, we saw several vulnerabilities and exploits over different token bridges, with billions in losses. A blockchain bridge is a tool that lets you port assets from one blockchain to another, solving one of the main pain points within blockchains – a lack of interoperability. The problem is that, commonly, we try to move assets from L1 blockchains that don’t have a common protocol to communicate with each other.

We can understand this problem like that of two people who do not share the same language. To establish communication, these people will need a translator, a third party. The translator can lie, and you will not realize as you do not know the other language. The translator in this case is a single point of failure and can mislead all the communication.

Something pretty similar to this occurs in the blockchain bridges. There is no common communication protocol between L1 blockchains. There is no way to transfer value without an off-chain mechanism, out of the network consensus.

Chainlink CCIP

Chainlink and Cross-Chain Interoperability Protocol (CCIP)

Chainlink is a decentralized blockchain oracle network. Its purpose is to facilitate the transfer of tamper-proof data from off-chain sources to on-chain smart contracts. It can be used to verify whether the parameters of a smart contract are met in a manner independent from any of the contract’s stakeholders by connecting the contract directly to real-world data, events, payments, and other inputs.

Chainlink CCIP

Coming back to the human translator example, you can imagine the Chainlink consensus mechanism as a simultaneous request to several translators. You can discover if someone is not translating correctly by checking the difference between the translations. The correct translation will emerge as the most frequent answer. The good translators will be rewarded for doing the work correctly, and the bad ones are penalized.

This capacity to facilitate trustless off-chain processes is the one that allows the creation of cross-chain interoperability mechanisms. The network consensus mechanism can be used to act as a mediator between the two or more blockchains that want to establish a communication, in a similar way to our translator example.

Chainlink CCIP

In this way, Chainlink ensures a decentralized way of communication between different chains. This will allow the development of cross-chain smart contracts that can have different parts in different blockchains, establishing communication through CCIP.

Some use cases

CCIP for Bridges

Transfer assets from Blockchain A to Blockchain B implies an off-chain activity. At some point, we need to leave one blockchain and move to the other, moving out of the network’s consensus. This situation creates a single point of failure over the bridge process. To bypass this, we need to use a decentralized mechanism for the bridge too. Chainlink with CCIP is a possible solution, as a universal interface and provides a decentralized network.

On one side, this eliminates the need for developers to build separate bridges for inter-connectivity between individual chains. On the other side, Chainlink nodes can cryptographically sign and validate all cross-chain token transactions, mitigating any single point of failure.

Cross-chain smart contracts

Cross-chain smart contracts are decentralized applications that are composed of multiple different smart contracts deployed across multiple different blockchain networks which interoperate to create a single unified application. This new design paradigm is a key step in the evolution of the multi-chain ecosystem and has the potential to create entirely new categories of smart contract use cases that leverage the unique benefits of different blockchains, sidechains, and layer-2 networks.