Giter Site home page Giter Site logo

whitehacks-kit's Introduction

Whitehacks Kit

A simple template to perform whitehacks safely in a single tx, leveraging Foundry and Flashbots.

Disclaimer

Provided AS-IS as educational content only, disclaim any liability for using it.

Usage

Whitehacks are hard and should be execute by professionals. If you are unsure reach-out ETHSecurity tg channel. Reach-out anyway.

This repo offers a guide to prepare them.

They must be executed in 1 shot and privately, hence one single transaction and the private mempool by Flashbots.

You prepare, you test in a fork, you don't change, you execute.

Setup

  1. Fork the repo
  2. Install Foundry
  3. Edit Whitehack.sol
  4. Adapt Whitehack.s.sol

Preparation

  1. Unset $ETH_RPC_URL
unset $ETH_RPC_URL
  1. Check no RPC port open on your computer, if so kill the processes
netstat -an | grep LISTEN | grep 8545

Test

  1. Run Anvil fork with
anvil --fork-url https://eth.llamarpc.com
  1. Impersonate your account 0xYOUR_WALLET_ADDRESS
cast rpc \
    anvil_impersonateAccount "0xYOUR_WALLET_ADDRESS" \
    --rpc-url "http://localhost:8545"
  1. Run the script
forge script \
  script/Whitehack.s.sol:WhitehackScript \
  --rpc-url "http://localhost:8545" \
  --sender "0xYOUR_WALLET_ADDRESS" \
  -vvv \
  --broadcast

Run

Do not change your script and contract after the test

forge script \
  script/Whitehack.s.sol:WhitehackScript \
  --rpc-url "https://rpc.flashbots.net?hint=hash" \
  --sender "0xYOUR_WALLET_ADDRESS" \
  --interactives 1 \
  -vvv \
  --broadcast

The rpc url is set for Full Privacy on Flashbots

Examples

whitehacks-kit's People

Contributors

emilianobonassi avatar banteg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.