C 601: Capture the Ether Warmup: Call Me (15 pts.)

What You Need

Purpose

To learn Solidity hacking.

Preparation

You should already have the MetaMask browser extension, some Ropsten test Eth, and have completed the first Capture The Ether challenge.

Call Me

In your browser, go to: https://capturetheether.com/challenges/warmup/call-me/

You see the "Call Me" page, as shown below.

Look at the Solidity code at the bottom.

When this contract is deployed, the variable isComplete starts with the value false.

To change it to true, you need to execute the callme() function.

On the left side, click the "Begin Challenge" button.

A MetaMask box pops up. Click Confirm.

After a few seconds, the left side of the "Call Me" page shows your contract's address, as shown below.

Using Remix

Open a new browser tab and go to

http://remix.ethereum.org/

On the left side, in the FILE EXPLORERS pane, right-click the contracts folder and click "New File", as shown below.

Name the new file callme.sol

Paste in the code from the "Call Me" page, as shown below.

On the left side of the Remix page, click the Compile icon, outlined in green in the image above.

Click the "Compile callme.sol" button.

Then click the Deploy icon, outlined in red in the image above.

Connecting to the Deployed Contract

In the Remix page, on the left, in the "DEPLOY & RUN TRANSACTIONS" pane, change the ENVIRONMENT to "Injected Web3", outlined in green in the image below.

A Metamask box pops up. Click Next. Click Connect.

On the "Call me" page, copy the address your contract was deployed to.

In the Remix page, in the lower portion of the "DEPLOY & RUN TRANSACTIONS" pane, paste that address into the box next to the "At Address" button, outlined in red in the image below.

Click the "At Address button.

Calling the callme Function

In the Remix page, at the bottom of the "DEPLOY & RUN TRANSACTIONS" pane, expand the "CALLMECHALLENGE AT ..." container.

Click the orange callme button, outlined in green in the image below.

A Metamask box pops up. Click Confirm.

When the function call succeeds, you'll see a green check mark in the lower right pane of the Remix window, outlined in green in the image below.

Completing the Challenge

On the "Call me" page, on the left side, click the "Check Solution" button.

A MetaMask box pops up. Click Confirm. You win, and a little dancing figure appears on the lower left, as shown below.

Flag C 601.1 GIF Name (15 pts)

In your browser, right-click the little dancing figure and click Inspect.

The flag is the filename of this GIF image, covered by a green rectangle in the image below.

Sources

Ethereum Smart Contract Development | Capture the Ether Problem 1 & 2
Capture the Ether (Part 1 of 3): Exploring Ethereum Lottery Vulnerabilities
Capture The Ether: token sale
Capture The Ether: token whale
Solidity array overflow

Posted 5-20-22 by Sam Bowne