Blockchain doesn’t know time. There’s need for a change.
Cryptocurrencies aspire to ultimately crash banks. Although, for it to become a reality, the functionality of crypto wallets shouldn’t give way to banking systems. One of the most basic finance functionalities is scheduling transactions. Unfortunately, blockchain doesn’t know the concept of time and we need to change it.
Common case — we need to pay tax. The deadline is th 10th day of each month. We don’t want to transfer money earlier, but exactly on the last day. Second example, each month we can pay rent for a house. We want to automate transactions for the next year. Banking systems enable us to do so, in both cases. What about cryptocurrency wallets?
What’s the cryptocurrency answer to this? Two of the most popular cryptocurrencies are Bitcoin and Ethereum. When it comes to the technological advancement level of both platforms, Ethereum is more powerful because of smart-contracts. What does that mean? In Bitcoin, we can only transfer value between addresses. In Ethereum though, we can create programs and setup logic in the blockchain. In this manner, decentralized applications are created. An example application could be a decentralized music site.
Back to scheduling transactions… in Bitcoin it’s a “no go”. The concept of time doesn’t exist, there are only blocks. Of course, you can start a so called “CRON”, which means, that at certain point in time, the computer process will start. It will attempt to execute a transaction using, for example, a console client. It’s a centralized way, so all machine or internet problems can stop the execution. You don’t want that, right?
The CRON idea is as (in)effective in the Ethereum world as it is in Bitcoin. However, Ethereum has more to offer. Actually, it gives an opportunity to create a working, decentralized solution… I’ve already mentioned smart-contracts. In their logic, we can access both the current block number, as well as… UNIX time. This implies that we can save details of the transaction, we want to execute, in a smart-contract. This smart-contract will allow for execution, only in a window set by yourself, it can be five minutes.
A solution to scheduling transactions in Ethereum hasn’t been implemented natively, but the platform itself allows for creating a protocol one level above — in smart-contracts.
Ethereum Alarm Clock
The protocol which allows for scheduling transactions is the Ethereum Alarm Clock. It was created in 2015 by Piper Merriam, member of the Ethereum Foundation. Users can choose time or block, when the transaction will be executed. Because there’s no 100% guarantee of exact time/block execution, we ask users to set a time window for execution. Say user A wants to send 1 ETH to user B at 5:15. So he or she chooses 5:15 as a window start and sets the time window to 5 minutes. This means that the latest time the transaction can be executed is 5:20.
The execution of transactions are secured by the network of TimeNodes. When scheduling a transaction, a user needs to set a small bounty, that he or she is ready to pay someone for executing the transaction. This creates a market and second actor in the network…a “TimeNode” is incentivized to execute transactions.
Practically, being a TimeNode comes down to having an open tab in the browser with an imported Ethereum wallet. This wallet will be used for executing scheduled transactions and collecting bounties. The site, which allows for scheduling and acting as a TimeNode is: https://app.chronologic.network. To test the functionalities described here, you should install MetaMask (only for scheduling) and use the Kovan testnet. The protocol will soon be running on the Ethereum mainnet. Currently, the protocol is undergoing an audit by ZK Labs. It will make sure users’ funds are safe.
Technicalities
Lets analyze the path from scheduling a transaction to its execution. Transactions can be scheduled using eac.js-cli, a JavaScript console client or the web application: https://app.chronologic.network. Both the console client and application are using the same library under the hood — eac.js-lib.
Either way (console client or web app), we end up calling method schedule
in TimestampScheduler
smart-contract (if we chose time scheduling) or BlockScheduler
. Next, for each scheduled transaction new smart-contract is created — TransactionRequest
. Its creation is registered in RequestFactory
contract, which is observed by the network of nodes. In this network, each TimeNode is running a console client or browser tab, which allows for capturing RequestCreated
events emitted by RequestFactory
. A TimeNode is saving all transactions in the cache and waits for the moment when it will be able to execute the transaction and get the bounty.
An interesting mechanism is the possibility to “claim” a transaction. It gives a node priority to execute a transaction. Sometimes it implies that an ETH deposit is required. If a node claims a transaction and doesn’t execute it, the deposit will be lost.
All of the Ethereum Alarm Clock smart-contracts have been written in Solidity, the Ethereum platform’s language.
Integrations
We’ve conducted more than 60 interviews in Paris at the Ethereum Community Conference. The conclusion is that both developers and Ethereum users truly lack the ability to schedule transactions. In the Ethereum world, crowdsales happen on a daily basis. They can start in the night — depending on our timezone. Instead of waiting to buy tokens, you can use the Ethereum Alarm Clock protocol and use saved time for something else.
The first Ethereum wallet to give you the possibility to schedule transactions is MyCrypto.
Thanks to this integration, users can use the “Send Later” switch and choose the comfortable time for them to send a transaction. The next integrations are coming, but first — we wait for the audit. When talking to the Ethereum’s creator — Vitalik Buterin, we’ve found out that the Ethereum Foundation planned to include scheduling natively into Ethereum. The reason for not implementing that was lack of time, and implementing scheduling has been postponed.
Future
When you’re an Ethereum user, in a few months you’ll be able to schedule transactions while using your favorite wallet. On the other side, if you’re interested in being a TimeNode and winning ETH bounties for executing transactions, maybe it’s time for you to start testing.