# 4-byte-gen
-Simple web app to generate optimized function signatures for Solidity.
+Simple web app to generate optimized function selectors for Solidity.
Similar projects:
- [jeffreyscholz/solidity-zero-finder-rust](https://github.com/jeffreyscholz/solidity-zero-finder-rust)
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).
+3. Click "Parse functions" and the tool will normalize the function definitions (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).
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="Simple web app to generate optimized function signatures for Solidity.">
+ <meta name="description" content="Simple web app to generate optimized function selectors for Solidity.">
<meta property="og:title" content="4-byte-gen">
- <meta property="og:description" content="Simple web app to generate optimized function signatures for Solidity.">
+ <meta property="og:description" content="Simple web app to generate optimized function selectors for Solidity.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://4bg.ardis.lu/">
<link rel="icon" href="data:,">
functionRegex = /^(function )(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<parameters>.*?)(?!.+\))/;
}
else {
- fn = fn.replaceAll(/[;'"]/g, ''); // Clean all characters that definitely do not affect the signature
+ fn = fn.replaceAll(/[;'"]/g, ''); // Clean all characters that definitely do not affect the selector
functionRegex = /^(function )?(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<parameters>.*?)(?!.+\))/;
}