or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Verify Deployment of Proof Verifier Smart Contract
In order to verify the smart contract, you will need a machine with at least 256GB of RAM and 16 cores.
In this tutorial we will give instructions for a r6a.8xlarge aws instance. This instance has 16 cores 32 threads, 512GB of SSD. The instance will use Ubuntu 22.04 LTS and the cost of the instance is about 1.82 $/h. This process is quite long, it takes approximately 5-6 hours.
So lets start by launching and instance.
Basic OS preparation
Tweeking the OS to accept high amount of memory.
Install version of node and npm
The version of node should be: 18 (e.g. 18.14.0 )
Download and prepare circom
To compile circuits, we need circom installed.
The hash of the commit should be: 127414e9088cc017a357233f30f3fd7d91a8906c
Install and compile circom (RUST)
The version of circom should be: 2.1.5
Prepare fast build constant tree tool
this step takes less than 5 minutes.
Prepare and launch setup (zkevm-proverjs)
This step is quite long, it takes approximately 4.5 hours. 2 out of 4.5 hours are for the powersOfTau28_hez_final.ptau download, a file of 288GB that it's loaded only once.
Compile generated verifier smartcontract (solidity)
As a final result of the previous steps, the smart contract that verifies the test has been generated. This file is final.fflonk.verifier.sol. At this point, it is possible to verify the smart contract using the source code or verify that the bytecode is the same. To verify the bytecode, you must compile with the precisely same version, compiler, and parameters to be sure that even the metadata hash contained in the bytecode is exactly the same. The following instructions generate a project to build using the hardhat tool.
Once the project structure is created, we proceed to copy the smart contract generated in the previous step. This smart contract was saved on ~/zkevm-proverjs/build/proof, and must be copied to contracts/verifiers with exactly the name Verifier.sol. If the name or the path changes, the hash of metadata changes too, for this reason, is essential to respect the name and the path. To do it could execute these commands
The result should be:
To compile smartcontract execute following command:
Bytecode of smartcontract was on bytecode property of json file Verifier.json generated on path artifacts/contracts/verifiers/FflonkVerifier.sol
To extract bytecode on file in one line. If you prefer do it , you cold copy and paste in a file.
Verify bytecode compiled:
The result should be:
Download bytecode of deployed smartcontract
To download bytecode of deployed smartcontract, need the address of smart contract, in this case it's 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9. Go to Etherscan, Blockscout or Beaconcha to get transaction bytecode.
Associated with address 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9 found the transacction 0x3ed835c4a7677dae8e7a22b981be03a86540c10fec7953eaa1f979355513adbc.
Etherscan (https://etherscan.io)
https://etherscan.io/address/0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9
https://etherscan.io/tx/0x3ed835c4a7677dae8e7a22b981be03a86540c10fec7953eaa1f979355513adbc
Click to see more > Input Data > Select all data and copy to clipboard.
Blockscout (https://blockscout.com/eth/mainnet)
https://blockscout.com/eth/mainnet/address/0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9
https://blockscout.com/eth/mainnet/tx/0x3ed835c4a7677dae8e7a22b981be03a86540c10fec7953eaa1f979355513adbc
View details > Raw input > Copy to clipboard
Beacocha (https://beaconcha.in)
https://beaconcha.in/address/0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9
https://beaconcha.in/tx/0x3ed835c4a7677dae8e7a22b981be03a86540c10fec7953eaa1f979355513adbc
Advanced Info > Call Data > Select all data and copy to clipboard.
NOTE: Don't use button "Copy Raw Data" because it generated non compatible format.
Some applications running on the terminal may limit the amount of input they will accept before their input buffers overflow. To avoid this situation create file FflonkVerifier.sol.explorer.bytecode with editor as nano or vi.
In nano, to paste the clipboard to the file use CTRL+P, save content using CTRL+X, and finally press Y. To compare if two files are the same, you could use diff.
Alternatively, you could check content using sha256sum:
The result should be:
Generated files hash