Coder Social home page Coder Social logo

yousufalim / frontrunnable-contract Goto Github PK

View Code? Open in Web Editor NEW

This project forked from somejavaguy/frontrunnable-contract

0.0 0.0 0.0 4 KB

A simply smart contract built with Solidity, to test front running on Ethereum.

Solidity 18.85% JavaScript 81.15%

frontrunnable-contract's Introduction

Frontrunnable Contract

Simple Solidity smart contract to test frontruns on Ethereum.

How to Test

1. Generate a keccak256 hash

Using https://emn178.github.io/online-tools/keccak_256.html or similar.

2. Deploy the contract

Deploy the contract to a testnet or mainnet, and pass the hash output generated in step 1 as the first parameter in the contract constructor, along with an optional amount of Ether.

The amount has to be big enough to attract front runners (look at gas prices).

3. Attempt to retrieve the funds

Now we're ready to get front run. Call the smart contract's take() function, and pass the raw input you used to generate the hash as the parameter.

Send the transaction, and take a look at your smart contract on EtherScan.

Now you'll see multiple attempts to retrieve the funds and your contract should be drained of Ether, since your transaction has been front run by other peers.

frontrunnable-contract's People

Contributors

stoll 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.