An optimization tool for lowering your gas costs during Solidity contract instantiation.
Why TetriX?
There are three main concerns Ethereum developers have when designing smart contracts: security, accuracy, and cost. We sought to tackle the problem of cost by creating a tool that automates the reordering of state variables during contract instantiation in order to lower transaction costs. We ensured efficient memory allocation by reorganizing your state variables to take up the minimal amount of storage slots necessary.
Getting Started
Tetrix is available as the tetrix
package on npm
Tetrix can be used on any single-contract solidity file. You can optimize contract construction cost with it, but you can also view details about your contract such as ABI, bytecode, opcode and assembly.
Prerequisites
To install Tetrix, make sure package.json has been initiated in your project folder.
More info on how to initiate package.json go Here
Installing
To use latest stable version of Tetrix you can install it via npm:
$ npm install tetrix-sol
Usage on the Command-Line
Compile Contract and Deploy to Local Virtual Blockchain
To use Tetrix, execute:
$ Tetrix YOUR_SOL_FILE_PATH.sol
View Contract Detail
In package.json, include a new script in scripts:
"scripts": {
"tetrixGUI": "webpack --config node_modules/tetrix/webpack.config.js && node node_modules/tetrix/server/server.js"
},
then, execute:
$ npm run tetrixGUI
Key Features
Optimize Contract State Variables Memory Allocation
- Rearranges the Smart Contract state variables in order to allocate the least memory slot possible on the blockchain to optimize gas usage.
- Parse through user Smart Contract and detect state variables
- Arrange variables based on a 32Bytes memory slot.
Create Personal Blockchain Development Environment
- Compiles user's Smart Contract using Solidity Compiler for retrieving accurate contract information.
- Deploys user's Smart Contract with trufflesuite/ganache to avoid the need for paying for the main Ethereum Blockchain
Front-End Display of Smart Contract Information
- Client-side local hosted server (PORT 8080)
Built With
- React - Used for Front-end Single Page Application
- React-Router - Route Management in a Single Page Application
- Ganache - Local Personal Blockchain Environment
- Web3 - Ethereum Javascript API
- Solc - Javascript Solidity Compiler
- Express - Web Framework for node.
- Webpack - Bundler for javascripts/React
Contributing
Found a bug? Have a suggestion? Feel free to submit issues!
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License
Acknowledgments
- Support from other open source developers
- And the entire Ethereum developer community