Intro to ETH
Last updated
Last updated
Author: Chovid99 Welcome to the world of Ethereum smart contracts! This warmup challenge is designed to introduce newcomers to the basics of interacting with Ethereum blockchain technology. You'll get hands-on experience with a simple smart contract, learning how to read and interact with it. No prior blockchain knowledge is required – just bring your curiosity and problem-solving skills. Are you ready to take your first steps into the exciting realm of decentralized applications?
We are given a file Setup.sol
Looking at the source code above, there are some functions we can interact with.
This function takes a bytes
parameter called secret. Then it uses the keccak256
hash to match the hash of secret with the hash of the string CJ_INTERNATIONAL_2024-CHOVID99
, if it matches, then it flips the variable solved
to true.
This function will return a true/false boolean value. If it returns true, then the challenge is solved and otherwise if it returns false, the challenge is not solved.
We were also given a web to launch our private blockchain server.
To solve this, it is very straightforward. We just need to do cast send
(because we are altering the blockchain state and we need our private key to do that) to the solve
function with the parameter CJ_INTERNATIONAL_2024-CHOVID99
converted to hex.
We can use the help of foundry to do that.
First we call the solve function.
And we check if our challenge is solved by calling the isSolved()
function.
And with that, our challenge is solved!
Flag: CJ{m0mMy_I_s0lv3d_bL0cKch41n_ch4ll3ng3zZ}