Popular science: Bottom-up explanation of Optimistic Rollup
Editor's Note: This article comes fromEthereum enthusiasts (ID: ethfans)Editor's Note: This article comes from
Ethereum enthusiasts (ID: ethfans)
Ethereum enthusiasts (ID: ethfans)
, author: Ali Atiia, translation & proofreading: IAN LIU & A Jian, reprinted with authorization by Odaily.
This article will explain the operation of Optimistic Roll-Up (ORU) from bottom to top through simple examples; in order to allow us to "see and feel" all the meaning of the ORU chain, the examples cited in this article will also compare special.
ORU is the leader in the Ethereum layer 2 expansion scheme, which can not only make the scalability cake bigger, but also allow you to eat it—at least part of it. The reason why everyone is so excited about ORU is that it and its cousin, ZK-Rollup, have overcome layer 2 problems that have not been solved by solutions such as side chains, plasma, and state channels.
A certain high school was facing the problem that every few days, there would be incidents of quarrels between young couples, usually because one of them cheated.
Typical scenarios are as follows:
Alice is very angry when she sees her boyfriend Bob kissing Cathy. But Bob might say "I swear I didn't do that!" or "We broke up!"...but Alice doesn't listen, grabs a chair and throws it at Bob; The small theater staged is destroying the environment of the entire campus.
secondary title
Workaround v1
Jamal, the super nerd on campus, came up with a solution:
Each evening, all students are asked to choose one of the following messages and sign their cryptographic signature—
"I'm single, don't bother"
"I'm single, waiting to be paired"
"I'm dating X (and only X)"
"I'm dating multiple people (not yet settled down)"
The signature here is the same type of signature used for cryptocurrency transfers.
The school will post an announcement of "students and their corresponding public keys" on the bulletin board, so anyone can use the method of signature verification to confirm who signed what message.
For the convenience of students, Jamal developed an app. Each student only needs to select one of the four items on the app, and then click the "Sign & Send" button. After that, the signed message will be broadcast from the backend to the Ethereum P2P network— — In fact, these messages will be sent to the server at Jamal’s home first, and he will send messages to Ethereum on behalf of his classmates, so that students don’t need to worry about the settings of Ethereum Gas. Through some advanced smart contract skills (CREATE2 operation code), Jamal can pay the gas for his classmates first, and then reimburse the school for the gas fee on a monthly basis.
(1000 students) x (1 message/day/student) x( $.1 gas/message) x (30 days/month)
= $3000 gas/month.
My flesh hurts!
secondary title
Workaround v2
$3k a month is clearly not appropriate for a financially tight school.
This is where the ORU comes in handy. Jamal told the school that the use of ORU can reduce gas costs by about 99%. The following is an improved plan:
Like the v1 method, when each student clicks "Sign & Send", the information will first be sent to Jamal's home server. Then Jamal superimposed all the signatures into a string of data WiSWho (that is, "who is dating whom") information.
The information format of WiSWho is [Alice's ID, Alice's message, Alice's signature], [Bob's ID, Bob's message, Bob's signature] ...
Next, Jamal signs the transaction with his private key and broadcasts it. The transaction information is:
"I, Jamal, have checked the WiSWho data attached to this deal, WiSWho represents all student relationships as of dd/mm/yyyy, and I swear to God the data contains the complete facts without any artificial additions."
In jargon, Jamal acts as a layer 2 "executor".
Left: Simple transaction with no additional data. Right: Uniswap function with input parameters (e.g. min_tokens is the amount of Ethereum received) as additional data.
The ORU contract of Ethereum (layer 1) will only verify Jamal's signature, and the signatures of other students in the additional data WiSWho will only be regarded as the binary "cold data" of the block (note: it will not be accessed or retrieved) data).
This is the embodiment of scalability, because in this way, the full node of layer 1 only needs to verify the signature of the ORU executor and store additional data, instead of verifying all the signatures in WiSWho.
secondary title
suspense
You may have noticed the message Jamal signed, emphasizing two sentences:
Contains complete facts, and only facts.
The violation of rule 1 is called censorship, which means that Jamal is maliciously filtering information, such as Bob and Alice have a feud, so Bob bribes Jamal to censor Alice's information to destroy Alice's good life.
A violation of Rule 2 is called fraud and means Jamal adds one or more pieces of information to WiSWho that do not exist. For example, the data contains a statement from Alice - "I am dating 10 boys and 10 girls", but in fact Alice did not sign such a message at all, so the Alice signature Jamal put in WiSWho is illegal ( Maybe Bob bribed Jamal to slander Alice; or maybe Jamal was dissatisfied with Alice and wanted to embarrass her...).
Because the ORU contract will not check the correctness of WiSWho content, fraudulent behavior will seriously affect the original intention of using ORU, and will also increase gas costs (verifying signatures is not cheap), because fraudulent behavior will force everyone to retreat to use v1 Solution.
Although we believe that Jamal is a man of integrity, and he promises never to engage in censorship or fraud, from a security point of view, it is better to pin our hopes on Jamal's "cannot do evil" rather than "won't do evil".
Inspection rights reserved for Jamal
The school decided to adopt a management method of carrots and sticks (both soft and hard) for Jamal:
Carrot: Jamal provides services in exchange for considerable remuneration. After Jamal sends WiSWho transactions every day, the smart contract will authorize Jamal to withdraw $5 from the school. But Jamal can't get the $5 immediately, he can only withdraw it at the end of the month. Jamal is watching the withdrawal amount increase every day, and he will definitely be willing to continue to provide services.
A flexible means to avoid malicious censorship: If Jamal deliberately ignores the information submitted by Alice, she can submit the signing information to the smart contract that night (of course, she has to pay the gas fee herself). The next morning, Alice can go to the principal to complain, and other students will also be alert, and Jamal's reputation will decline due to his evil behavior.
For the school, it is easy to find a candidate who can replace Jamal's role: the smart contract has been deployed and run on layer 1, and Jamal's replacement only needs to run the AWS lambda service, and continue to monitor the messages sent by the students every day, package and sign, Just broadcast a single transaction to the ORU contract.
In fact, anyone who is willing to lock a deposit on the contract can become an executor (the difference is that they have to re-advertise themselves to students).
Strong means to avoid fraudulent behavior: Anyone can find out that Jamal has fraudulent behavior (if any), and prove the existence of fraud to the ORU contract of layer 1 through simple proof. In addition, Jamal must lock a security deposit in the smart contract in advance (everyone who wants to be an executor needs to lock it, and he will be fined if he does evil), and the security deposit increases Jamal's cost of fraud.
The smart contract will extract Alice's signature from the previously published data, and perform signature verification through Alice's public key (saved at the beginning of the ORU contract setup). If the signature is indeed invalid, then:
Clear Jamal's pending withdrawal rewards,
Reward half of Jamal's deposit to the whistleblower, and burn the other half.
secondary title
Further analysis of tough methods
Hardball is the most interesting and decisive part of the ORU contract; in fact, it is what makes ORU a core layer 2 solution.
The special thing about this method is that not just the school or the students, anyone can lift the big stick of supervision. As long as the WiSWho data is on the chain, the whistleblowers will be able to get all the materials they need to prove whether Jamal did evil. Everyone can question the Jamal transaction to the ORU contract and have the opportunity to be rewarded for successful reporting.
The design and operation of the brute force approach is the most important difference between different ORU implementations.
A call from the Ministry of Education
"When will mass acceptance be achieved?" This is the most common question in our circle. Assuming everyone starts to adopt blockchain technology, ORU can also be used to solve network congestion - but now another problem arises.
Assuming the Ministry of Education wants Jamal to handle the signatures of all schools nationwide, then our question will change from "how many students can you handle?" to "how many schools can you handle?".
You might say, "Since you can combine all the signatures of the entire school into one transaction, wouldn't it be nice to combine the signatures of the whole country into one transaction?"
This involves the upper limit of ORU scalability: the gas limit of the block. Although the Gas consumption of Jamal broadcast transactions is low, it is not non-existent. If you want to include all student data across the country in one transaction, it is likely to exceed the gas limit of the block. In other words, Jamal needs to split the data and broadcast it in batches.
Therefore, there is an upper limit to the scalability that can be obtained through ORU. If you need unlimited expansion, you can consider side chains or plasma, etc....but the security of funds is not so guaranteed.
In the optimistic case, full nodes of layer 1 do not need to execute additional data for transactions initiated by ORU operators, so that:
Execution costs at the layer 1 full node level are lower; because storing data is much cheaper than running any logic inside it.
The gas cost per transaction is lower; because it costs less gas to store data than to execute a transaction.
secondary title
What is the difference between ORU and Sidechain/Plasma/State Channel?
Assuming you are playing poker or trading tokens on the ORU chain, your asset transfers are as safe as transferring them on layer 1 (e.g. Ethereum mainnet). Although there may be some inconveniences when fraudulent situations occur - such as you need to wait a week or two for funds to be released, layer 1 can still guarantee the safety of funds.
Summarize
On the other hand, if you transact on a sidechain, miners (PoW) or validators (PoS) on the sidechain can steal your funds; because they can unilaterally tell layer 1 what is good for them if they want. story, but layer 1 cannot be verified.
Unlike plasma and state channels: ORU's fraud proof mechanism is so simple that anyone can submit a challenge. Whistleblowers have all the data available on layer 1, are able to detect and submit proofs of fraudulent behavior to the ORU contract, and are rewarded. If plasma or state channels are used, users must assume some or all of the security responsibility of their funds, and must always "monitor" the situation of layer 1 contracts to prevent executors or other users from engaging in fraud.
Summarize


