Git Product home page Git Product logo

sandbox--solidity's Introduction

Sandbox project: Solidity

A playground project I use to discover new techniques, tools or just to try things out.

Techstack

Available Scripts

In the project directory, you can run:

compile

Compiles the smart contracts using solc-js.

ts-node deploy.ts

Runs the deploy script.

Deploy on a local blockchain

  • Create a .env file in the root of the project
  • Add the following variables to the .env file
    • PRIVATE_KEY - Your private key from your wallet (e.g. Ganache)
    • RPC_URL - Your RPC SERVER URL (e.g. Ganache)
  • Run ts-node deploy.ts

Deploy on a testnet

  • Create a .env file in the root of the project
  • Add the following variables to the .env file
    • PRIVATE_KEY - Your private key from your wallet (e.g. Metamask)
    • RPC_URL - Your RPC / HTTPS URL (e.g. Alchemy)
  • Run ts-node deploy.ts

ts-node utils/encryptKey.ts

Launches the script to encrypt a private key. The values (privateKey and privateKeyPassword) are stored in the .env file, but can be removed after privatekey is encrypted. The password is used to decrypt the key when running the deploy.ts script, but for now the deploy script will look directly for the private key in the .env file.

If you want to make the deploy script use the encrypted key, you need to uncomment the following lines in the deploy.ts file.:

    // const privateKeyPassword = process.env.PRIVATE_KEY_PASSWORD!;
    
    // const encryptedJson = fs.readFileSync("./generated/.encryptedKey.json", "utf-8");
    // let wallet = new (ethers.Wallet.fromEncryptedJsonSync as any)(encryptedJson, privateKeyPassword);
    // wallet = await wallet.connect(provider);

Please note, if you don't want to have the password in the .env file, you can also call the script with the password as an argument: PRIVATE_KEY_PASSWORD=password ts-node deploy.ts.

Local environment file should have the following variables:

  • PRIVATE_KEY - Your private key from your wallet (e.g. Ganache) to deploy the contract
  • PRIVATE_KEY_PASSWORD - A password to decrypt the private key
  • RPC_URL - Your RPC / HTTPS URL (e.g. Alchemy)

sandbox--solidity's People

Contributors

rowinvanamsterdam avatar

Stargazers

Roman avatar

Watchers

 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.