Giter VIP home page Giter VIP logo

salt-bae's Introduction

salt-bae

Background

Ever wanted to deploy a smart contract that had a cool address like 0xDEADBEEF... in it? This is possible with the CREATE2 EVM opcode.

The formula follows:

address = keccak256( 0xff ++ address ++ salt ++ keccak256(init_code))[12:]

address - deployer factory contract address
salt - random 32 byte string (what this code finds for you
init code - bytecode of contract to be deployed by factory

Usage

node index.js [deployAddress] [byteCodeHash] [start] [target]

[deployAddress] - deployer factory contract address
[byteCodeHash] - hashed bytecode
[start] - target start index
[target] - hex substring the address should contain

Example

node index.js 0xEd2cf286D2DaA16cE4B34b6029F805647309426C 0x3d62012120f6a3aa34878aa91e0c7cf72d5ffc0e8f46cceebef78f45d05844f2 0 c0de42

This will generate address 0xc0De423eA0845A6a4216A4462C89CFb7e7C6345e with a salt of 0x0000000000000000000000000000000000000000000000000000000001b5ac6b at the 28683371th iteration

salt-bae's People

Contributors

gmchad avatar

Stargazers

 avatar

Watchers

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