Coding Smart Contracts is not for the faint of heart.
Very recently, I participated in making the Yield Protocol go live. For those that haven’t heard of it, it is a fixed-rate borrowing and lending platform in Ethereum. It also implements mathematical formulas that are at the edge of what it is possible for a smart contract.
The Yield Protocol is also a deploy-and-forget platform. Once we went public we had no way of stopping users interacting with our software, and no way to fix any bugs in the core contracts.
We could go up like a rocket, and then…
Everyone talks about “gas-less” Ethereum transactions because no one likes paying for gas. But the Ethereum network runs precisely because transactions are paid for. Then, how can you have “gas-less” anything? What is this sorcery?
In this article, I’m going to show how to use the patterns behind “gas-less” transactions. You will discover that although there is no such thing as a free lunch in Ethereum, you can shift gas costs in interesting ways.
By applying the knowledge from this article, your users will save on gas, will enjoy a better UX, and even build novel delegation patterns into your…
All but the simplest of Ethereum applications are composed of several smart contracts. This is because of a hard limit of 24KB in any deployed contract, and because your sanity will slip away as the complexity of a smart contract grows.
Once you break down your code into manageable contracts you will certainly find that one contract has a function that should only be called by another contract.
For example, in Uniswap v2, only the contract factory is supposed to initialize a Uniswap Pair.
When you vote for something, how do you know that anything will actually get done? How do you know that promises will be kept?
In this article, I’m going to offer a glimpse into how blockchain can change democracy. With a blockchain democratic process, promises become actions.
I’m not going to say that we can or should do away with politicians and install a technocracy, but I’m going to show how to run a voting system where the proposals get automatically enacted if the voting passes.
You could call it unstoppable democracy.
To start, please let me set…
Restricting access to authorized users is really important in smart contracts. With $1 Billion locked in DeFi applications, you would really hope everyone knows what they are doing.
Recently, I collaborated with OpenZeppelin to refactor the access control in their widely used openzeppelin-contracts repository. If you have ever coded a smart contract, most likely you have inherited from their code.
In this article, I’m going to give you a walkthrough of how to use the revamped AccessControl.sol to restrict access to your smart contracts. I’ll do this through three examples.
But first, let me tell you the story of how…
Anyone that is coding smart contracts as database tables is getting it wrong. That was me as well, until very recently.
Developing blockchain solutions requires you to think differently about data, about control and about privacy. Some of the details are easy to grasp, such as currency being little more than a table of balances and a few methods to operate on them. Some details are more complicated, such as the fact that you are building a solution that you might barely control.
One detail that eluded me until recently is what does exactly mean that data in a public…
In this article, I’m going to show you how to code Craigslist for the Ethereum blockchain.
Before Gumtree, eBay, and Craigslist, classified boards were mostly made of cork or paper. There were classifieds boards in school corridors, newspapers, streetlights, storefronts.
All that changed with the internet. The number of people that could see a specific classified board multiplied by many orders of magnitude. With that, the markets they represent became much more efficient and scaled to global size. eBay is a massive business that traces its origins to these physical classifieds boards.
With blockchain these markets are set to change…
A few months ago I implemented a Linked List in Solidity for a client. More recently I decided that I might take on implementing a Fast Limit Order Book in Solidity as a pet project (aren’t nerds fun!) and Linked Lists appeared again.
As I recently wrote in an article about when to use different data structures:
Linked Lists are your data structure of choice when you need to preserve the insertion order, and also when you want to insert in arbitrary positions.
I love coding basic building blocks and no one seemed to have done this one*, so I…
I am not afraid of storms for I am learning how to sail my ship.
— Louisa May Alcott
You have a product in mind which you want to build for your customers. But you have no experience building the product, and development will cost you a million dollars. How are you going to get the money? Will your customers love it? Will they buy it? You, of course, have no idea.
So, what will you do?
Like other established startups of the past (Dropbox, Uber, Slack), or like some of the people I’ve worked with, you should start by…
Including Solidity smart contracts to get you started.
People always fear change. People feared electricity when it was invented, didn’t they? People feared coal, they feared gas-powered engines… There will always be ignorance, and ignorance leads to fear. But with time, people will come to accept their silicon masters. — Bill Gates
The energy industry contains some of the most valuable use cases for blockchain technology. Blockchain works best when dealing with decentralized markets, and with the advent of renewable microgeneration, the energy markets are rapidly becoming just that. …