1/5
_Follow along with this video:_ --- ### An Introduction to Chisel `Chisel` is one of the 4 components of Foundry alongside `forge`, `cast` and `anvil`. It's a tool that allows users to quickly test the behavior of Solidity code on a local (anvil) or forked network. Usually, when you want to test a small Solidity code snippet you go to Remix. But why do that when you have what you need right in the terminal of your Foundry project. Type `chisel` in your terminal and press Enter. This opens up a shell that awaits your next command. Call `!help` to find out more about what commands are available. Basically, you can simply write solidity in the shell then play around and see how it behaves. For example: 1. Type `uint256 cat = 1`; 2. Type cat; ``` ➜ cat Type: uint256 ├ Hex: 0x0000000000000000000000000000000000000000000000000000000000000001 ├ Hex (full word): 0x0000000000000000000000000000000000000000000000000000000000000001 └ Decimal: 1 ➜ ``` 3. Type `uint256 dog = 2;` 4. Type `cat + dog` ``` Type: uint256 ├ Hex: 0x0000000000000000000000000000000000000000000000000000000000000003 ├ Hex (full word): 0x0000000000000000000000000000000000000000000000000000000000000003 └ Decimal: 3 ➜ ``` 5. Type `uint256 frog = 10;` 6. Type `require(frog > cat);` - If nothing happens it means it passed, now try it the other way 7. Type `require(cat > frog);` ``` ➜ require(frog > cat); ➜ require(cat > frog); Traces: [197] 0xBd770416a3345F91E4B34576cb804a576fa48EB1::run() └─ ← [Revert] EvmError: Revert ⚒️ Chisel Error: Failed to execute REPL contract! ➜ ``` It reverts! Press `Ctrl + C` twice to exit and return to your normal terminal. To find more about other Chisel functionality, please click [here](https://book.getfoundry.sh/reference/chisel/).
This lesson introduces Chisel, a tool for testing and debugging Solidity code directly in the terminal. It covers the basics of using Chisel, including launching the interactive shell, executing Solidity code, and exploring its functionalities. The lesson is a step-by-step guide to efficient Solidity testing.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Foundryup, Foundry Forge, and Anvil
Blockchain Oracles
How to create local Blockchain testnets
How to verify a smart contract
How to write and run smart contract tests
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on November 29, 2024
Solidity Developer
Foundry FundamentalsDuration: 2h 52min
Duration: 2h 56min
Duration: 26min
Duration: 5h 22min
Course Overview
About the course
Foundryup, Foundry Forge, and Anvil
Blockchain Oracles
How to create local Blockchain testnets
How to verify a smart contract
How to write and run smart contract tests
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on November 29, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar