{"id":23390497,"url":"https://github.com/rootulp/ethernaut","last_synced_at":"2025-04-08T14:20:36.697Z","repository":{"id":77614909,"uuid":"467397020","full_name":"rootulp/ethernaut","owner":"rootulp","description":"Ethernaut solutions","archived":false,"fork":false,"pushed_at":"2022-03-11T05:28:09.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T10:43:42.778Z","etag":null,"topics":["ethernaut","solidity"],"latest_commit_sha":null,"homepage":"https://ethernaut.openzeppelin.com","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rootulp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-08T06:52:41.000Z","updated_at":"2022-03-09T04:31:34.000Z","dependencies_parsed_at":"2023-03-12T01:18:23.572Z","dependency_job_id":null,"html_url":"https://github.com/rootulp/ethernaut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootulp%2Fethernaut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootulp%2Fethernaut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootulp%2Fethernaut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootulp%2Fethernaut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootulp","download_url":"https://codeload.github.com/rootulp/ethernaut/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856550,"owners_count":21007621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethernaut","solidity"],"created_at":"2024-12-22T03:31:38.849Z","updated_at":"2025-04-08T14:20:36.666Z","avatar_url":"https://github.com/rootulp.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ethernaut\n\n[![License](https://img.shields.io/:license-mit-blue.svg)](https://rootulp.mit-license.org)\n\nSolutions to [Ethernaut](https://ethernaut.openzeppelin.com) exercises.\n\n## Getting Started\n\nIf you are new to [Ethernaut](https://ethernaut.openzeppelin.com), you can get started with [this video](https://www.youtube.com/watch?v=kZb6Qjlgybo).\nIf you are new to [Foundry](https://github.com/gakonst/foundry), you can get started with [foundry-book](https://onbjerg.github.io/foundry-book/).\n\n## Credits\n1. [ethernaut-x-foundry](https://github.com/ciaranmcveigh5/ethernaut-x-foundry)\n1. [Ethernaut x Foundry - 0x0 Hello Ethernaut](https://eval.hashnode.dev/ethernaut-x-foundry-0x0-hello-ethernaut)\n\n## Local Development\n\n1. [Install foundry](https://github.com/gakonst/foundry#installation)\n1. Clone this repo\n1. Create an Alchemy project for Rinkeby\n\n```bash\ncp .env .env.local\nvim .env.local # Populate ETH_RPC_URL with endpoint from Alchemy\nsource .env.local\n```\n\n### Helpful Commands\n\n```sh\nforge build\nforge test\n```\n\n## Contribute\n\nI'd appreciate any feedback via [issues](https://github.com/rootulp/exercism/issues/new).\n\n## Solutions\n\nLevel | Name              | Contract                                   | Solution                                                           |\n----- | ----------------- | ------------------------------------------ | ------------------------------------------------------------------ |\n0     | Hello Ethernaut   | 0x8A18f61202Bb364e6277B42669C123E32D5e2D2d | 0xe6351327acfbc8f8063711d13c9a066e1a135fb40ce1de2dda135fc9485fe3b7 |\n1     | Fallback          | 0x519AdEA92a0deE916489431c2f6473B44b570F3f | 0x706b0bf05a40a171461540f5eb96875a6f41d8a5ef79b10110cf600b43d95976 |\n2     | Fallout           | 0x4D341BF4bf10D415c0Ed61293629394546ca5670 | 0xb2909f15f72e8ec92d9419a2ac44afb9335ab41a6855424e62496ee64daf91d8 |\n3     | Coin Flip         | 0x4dF32584890A0026e56f7535d0f2C6486753624f | 0xd6d9aecd30a20ce8215e7befada0efd2c2f033e3 |\n\n## Notes\n\n### Hello Ethernaut\n\n```javascript\nawait contract.info(); // \"You will find what you need in info1().\"\nawait contract.info1(); // \"Try info2(), but with \\\"hello\\\" as a parameter.\"\nawait contract.info2(\"hello\"); // \"The property infoNum holds the number of the next info method to call.\"\nawait contract.infoNum();\nawait contract.info42(); // \"theMethodName is the name of the next method.\"\nawait contract.theMethodName(); // \"The method name is method7123949.\"\nawait contract.method7123949(); // \"If you know the password, submit it to authenticate().\"\nawait contract.password(); // \"ethernaut0\"\nawait contract.authenticate(\"ethernaut0\");\n```\n\n### Fallback\n- `0x7109709ECfa91a80626fF3989D68f67F5b1DD12D` is a special contract address. See [cheatcodes](https://onbjerg.github.io/foundry-book/forge/cheatcodes.html).\n- Used Remix to call contribute 1 wei, transact with 1 wei (triggers fallback), then withdraw\n- In Remix, replace `@openzepplin` prefix with URL to repo\n\n```diff\n-import '@openzeppelin/contracts/math/SafeMath.sol';\n+import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/math/SafeMath.sol';\n```\n\n### Fallout\n- Prefer `constructor()` over contract name constructor to avoid typos.\n\n### CoinFlip\n- Don't rely on blockhash as a source of randomness. Consider [VRF](https://docs.chain.link/docs/chainlink-vrf/) instead.\n\n#### Deploy contract with\n```bash\n$ RUST_BACKTRACE=1 forge create CoinFlipSolution --constructor-args $COIN_FLIP_LEVEL --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY\ncompiling...\nno files changed, compilation skipped.\nDeployer: 0x399a858c539db521231a4e776ffbe28a696df510\nDeployed to: 0xd6d9aecd30a20ce8215e7befada0efd2c2f033e3\nTransaction hash: 0xafedbec89e927f7695679e3263e57db98eace5c1c46caba0c89add1a0e26cd3b\n```\n\n#### Attempt to verify contract with\n\n```bash\n$ forge verify-contract --chain-id $CHAIN --constructor-args 0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a30783464463332353834383930413030323665353666373533356430663243363438363735333632346600000000000000000000000000000000000000000000 --compiler-version $COMPILER_VERSION $COIN_FLIP_SOLUTION src/CoinFlip/CoinFlipSolution.sol:CoinFlipSolution $ETHERSCAN_API_KEY\nSubmitted contract for verification:\n                Response: `OK`\n                GUID: `cjqrs7rprbiwxyudeeejvpq84jtwm2zyy1ygx34latrdcvpiyl`\n                url: https://rinkeby.etherscan.io//address/0xd6d9…33e3#code\n$ RUST_BACKTRACE=1 forge verify-check --chain-id $CHAIN cjqrs7rprbiwxyudeeejvpq84jtwm2zyy1ygx34latrdcvpiyl $ETHERSCAN_API_KEY\nVerification is pending...\n\n# Failed\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootulp%2Fethernaut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootulp%2Fethernaut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootulp%2Fethernaut/lists"}