From: Ardis Lu Date: Sun, 18 Feb 2024 05:33:44 +0000 (-0800) Subject: Add usage example X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=fe21084ce012882a975a5cf0da5f9e5171590683;p=4-byte-gen Add usage example --- diff --git a/.github/example-1.png b/.github/example-1.png new file mode 100644 index 0000000..48cc49c Binary files /dev/null and b/.github/example-1.png differ diff --git a/README.md b/README.md index ee5a7b6..6f42aa4 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,12 @@ Similar projects: - [jeffreyscholz/solidity-zero-finder-rust](https://github.com/jeffreyscholz/solidity-zero-finder-rust) - [emn178/solidity-optimize-name](https://github.com/emn178/solidity-optimize-name) - [quartz-technology/sigop](https://github.com/quartz-technology/sigop) + +## Example + +![Demonstration of the 4-byte-gen web UI finding optimized function names for standard ERC-20 functions.](./.github/example-1.png) + +1. Input the standard [ERC-20](https://ercs.ethereum.org/ERCS/erc-20) functions `transfer`, `transferFrom`, and `approve`. You can copy the function definition directly from your Solidity code without modification. +2. Adjust "Minimum number of zero bytes" to the desired number of zero bytes to mine for. Check out [`4-byte-gas-test`](https://4-byte-gas.ardis.lu/) for a comparison of gas costs between functions with zero bytes. +3. Click "Parse functions" and the tool will normalize the function signatures (i.e., remove spaces, input names, and extraneous keywords). +4. Click "Start all" and the tool will start mining for optimized function names (each function is mined using its own [web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API), so they are mined in parallel).