Agoric. Smart contracts with Zoe

Владимир Шульга
4 min readApr 21, 2021

Telegram — @godshunter Discord — GodsHunter#5319

Let’s first understand what a smart contract is. In fact, this is a prescribed algorithm of actions that begins to work when certain conditions are met. My favorite wording to explain this term is:

If then, then this

At the same time, the “If then, then this” chain can be either short or very long, depending on the task at hand. In the economy, the problem of the security of the transfer of funds and goods / services has long been formulated.
Those. buying, selling something or selling a product, you are not protected from the fact that the second person involved in the transaction does not hide without fulfilling its conditions. And if there are 3 participants? 10? Yes, of course, we usually resort to legal and criminal law in such a case. But what if we didn’t need it?

Imagine that you are going to buy a car. How it happens: you find a car on the Internet, come to the salon or to the owner, bargain over the price, go to the bank to get money for a purchase, stand in line, sign and provide a bunch of papers in order to eventually get the car in own. This whole process takes a lot of time. After all, what kind of person would make such a purchase, at least without drawing up a written contract?

Now imagine that you have a smart contract with a real car and the car is loaded onto the blockchain. It also contains information about the owner, a description of the car, its cost. You go online and make a purchase using cryptocurrency. And you don’t even need to have a cryptocurrency, it is enough to have a bank account to which the required cryptocurrency will be linked. Ownership and all information is in the smart contract. Now all this information is with you as a digital identification in the blockchain ledger. After that, everyone, every node, all computers, all parts of the blockchain ecosystem, update the ledger and all networks will know that this machine was just sold to you.

And here’s another cool example. Let’s say we are 10 people and we want to buy part of the property. For example real estate. We can make a purchase of several shares at the same time under a smart contract that does everything for us. Do you understand, yes? As a result, we do not need realtors, notaries, lawyers, as well as performing many actions. All this is done for us by a smart contract.

True, some smart contracts have one big drawback … They take your funds for storage.

Zoe

Agoric decided that the scenario in which the smart contract stores your money until its expiration is not safe. In addition, this is a completely unnecessary action. You give Zoe the right to use your funds in the event of a smart contract. Otherwise, the funds will remain in place, and the contract will be canceled.

Since we are talking about technologies in the crypto industry, let’s take an interesting example … Imagine that you participate in some kind of cryptocurrency sale on the Etherium network, usually the Metamask wallet is used for this. Remember yes, what is gas war? ) You send a transaction by charging a transaction fee in the hope that it will go through before the coins run out. At the same time, they often overestimate the commission in order to get ahead of other participants. In the best case, we get coins by overpaying extra funds for a transaction. And then we have two bad scenarios: in one, the money will be returned to you, but the commission will remain paid. In the second, you may be left without anything at all. What if you ended up on a fake sale

Now imagine that you would not need to send anything anywhere and risk your money. And would Zoe handle the transfer of funds for you? Zoe guarantees the security of the offer that he said he wanted, or will return (refund) what he uses the use and deposited.

When a user deposits Zoe, they will receive a JavaScript promise of a future payout. In Agoric this is defined as the security of the proposal. If the security of the offer is not respected, Zoya rejects this redeployment, protecting the parties from malicious behavior with a smart contract.

For users: Zoe guarantees that as a user of a smart contract, you will either get what you wanted or get a full refund, even if the smart contract is buggy or malicious. (In fact, the smart contract never has access to your digital assets.)

For developers: Zoe provides a safety net so you can focus on what your smart contract does best, without worrying about your users losing their assets due to a bug in the code that you wrote. Writing a smart contract on Zoe is easy: all of the Zoe smart contracts are written in the familiar language of JavaScript.

Zoe’s task is to make sure that we get what we want, and in the worst-case scenario stay the same. I have no doubt that smart contracts are the future of the economy and will soon become an integral part of our daily life.

Join the Agoric community on Twitter, Telegram, Discord, LinkedIn, and catch at upcoming events.

--

--