# RivETH Complete Technical Documentation (v1.7.4) Source Repository: https://github.com/Temi-Tade/RivETH Alchemy dApp Store: https://www.alchemy.com/dapps/riveth Documentation Site: https://temi-tade.github.io/RivETHDocs/ --- ## 1. Overview RivETH is a local, web-based, open-source Ethereum smart contract development toolkit featuring: - **RivETHScan Block Explorer**: Real-time local block/transaction feed and calldata decoder. - **Automated `.riveth` Scripting**: Declarative contract deployment and interaction workflows. - **Injected Wallet & Provider Support**: Toggle between 20 pre-funded Hardhat accounts and browser wallets (MetaMask, Frame). - **Multi-Tab Orchestration**: Run multiple contracts in separate browser tabs connected to `http://127.0.0.1:8545`. - **Zero-Friction Local Pipeline**: Compile Solidity (`solc` v0.8.36) via `./compile` or `make`, then reload ABI/bytecode in place. --- ## 2. Getting Started ### Prerequisites 1. **Node.js** (LTS or Current): https://nodejs.org/ 2. **VS Code Extensions**: Solidity (by Nomic Foundation) and Live Server (by Ritwick Dey). 3. **Terminal Access** (macOS, Linux, or Windows Git Bash). Note: `solc` (v0.8.36) and `hardhat` are installed automatically by `./setup`. ### Installation One-line installer: ```bash curl -L https://temi-tade.github.io/RivETHDocs/install.sh | bash ``` Manual setup: ```bash mkdir solidity-smart-contract-practice && cd solidity-smart-contract-practice curl -L -O https://github.com/Temi-Tade/RivETH/archive/refs/heads/main.zip --output RivETH.zip && unzip RivETH.zip -d temp && mv temp/RivETH-main/* . && rm -rf temp RivETH.zip cd RivETH && chmod +x setup && ./setup ``` Launch the RivETH dashboard by clicking **Go Live** in VS Code Live Server while keeping the Hardhat node terminal running. --- ## 3. Writing & Compiling Contracts - Place `.sol` files in `contracts/`. - Filename must match the contract name (e.g., `MyContract.sol` defines `contract MyContract { ... }`). - Sample contracts in `contracts/` are unaudited and for testing/learning only. - Compile in a separate terminal without the `.sol` extension: ```bash ./compile MyContract # OR make MyContract ``` - Compiled `.abi` and `.bin` files are written to `artifacts/`. Do not manually edit files in `artifacts/`. --- ## 4. Interacting & Keyboard Shortcuts - Click **Load** (`L`) to fetch ABI and bytecode from `artifacts/`. - Constructor arguments use a single comma-separated input field (wrap strings, bytes, and addresses in double quotes in constructors; arrays as `["0xAbc","0xDef"]`). - Since RivETH v1.6.0, individual function parameter fields do NOT require quote wrapping for strings, addresses, or bytes. - Function buttons are color-coded by state mutability: - **Blue**: `view` / `pure` read calls (no gas). - **Orange**: State-changing write calls (consumes gas). - **Red**: `payable` calls (attach ETH via the **Value** field). - Select any of the 20 pre-funded Hardhat accounts from the **Accounts** dropdown (never use these public keys on Mainnet). Keyboard Shortcuts: - `L`: Load compiled contract - `D`: Deploy loaded contract - `C`: Launch ETH / Wei unit converter - `A`: Switch active Hardhat account - `M`: Open RivETH main menu - `E`: Launch RivETHScan block explorer - `I`: Connect / disconnect Injected Web3 Provider --- ## 5. Rapid Redeployment & Debugging - **Fix-to-Test Loop**: Edit in VS Code -> `./compile [File]` or `make [File]` -> Click **Load** (`L`) -> Click **Deploy** (`D`). - Auto-refresh for `.sol` files is disabled in `.vscode/settings.json` so Live Server does not reload the browser tab on save. - **Debugging**: Check the Hardhat terminal for full stack traces, exact revert reasons, `eth_estimateGas` failures, and JSON-RPC calls (`eth_call`, `eth_sendTransaction`, `eth_getBalance`). --- ## 6. Cross-Contract Calls (Multi-Tab Orchestration) Open one browser tab per contract. Because all tabs share `http://127.0.0.1:8545`, copy a deployed contract address from Tab 1 and pass it as an argument to another contract in Tab 2. --- ## 7. RivETHScan Block Explorer Press `E` (or open Menu `M` -> Launch Explorer) to inspect mined blocks, timestamps, block hashes, transaction counts, and click **Decode** on a transaction's `data` row to inspect decoded calldata. --- ## 8. Automated Workflows (`.riveth`) Added in v1.7.0 (beta; runs with local Hardhat accounts, not browser wallets). Example `tests/ERC20.riveth`: ```text RivETH => workflow<= Run deploy => function: _ params: "My Token", "MTK" <= Run Mint => function: mintTokens params: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, 200 caller: value: <= Run ApproveSpender => function: approve params: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8, 100 caller: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 value: <= ``` --- ## 9. Injected Providers (MetaMask & Frame) Add a custom network in MetaMask or Frame: - Network Name: `Hardhat Local` - RPC URL: `http://127.0.0.1:8545` - Chain ID: `31337` - Currency Symbol: `ETH` Import a local Hardhat private key and press `I` in RivETH to toggle between internal Hardhat signers and your browser wallet. --- ## 10. Updating RivETH & Contributing Update to the latest release: ```bash make update # OR ./UpdateRivETH ``` Contributions: Fork `https://github.com/Temi-Tade/RivETH`, clone locally, open an issue, commit on a branch, and open a Pull Request.