Coder Social home page Coder Social logo

devsammy22 / ethers-simple-storage-smart-contract-project Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 26 KB

In this project, I was able to deployed a contract to Goerli Blockchain using code. I used technologies like Solidity, Javascript, Ethers.js, Ganache, Prettier - Code formatter, Alchemy

Solidity 13.35% JavaScript 86.65%

ethers-simple-storage-smart-contract-project's Introduction

Ethers Simple Storage

Getting Started

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Nodejs
    • You'll know you've installed nodejs right if you can run:
      • node --version and get an ouput like: vx.x.x
  • Yarn instead of npm
    • You'll know you've installed yarn right if you can run:
      • yarn --version and get an output like: x.x.x
      • You might need to install it with npm
  • ganache
    • You'll know you did it right if you can run the application and see:
      ganache
    • You can alternatively use ganache-cli or hardhat

Setup

Clone this repo

git clone https://github.com/DevSammy22/ethers-simple-storage-smart-contract-project.git
cd ethers-simple-storage-smart-contract-project

Then install dependencies

yarn

Usage

  1. Run your ganache local chain, by hitting quickstart on your ganache application

Save the workspace. This way, next time you open ganache you can start the workspace you've created, otherwise you'll have to redo all the steps below.

  1. Copy the RPC SERVER sting in your ganache CLI, and place it into your .env file.

ganache

.env Example:

RPC_URL=http://0.0.0.0:8545
  1. Hit the key on one of the accounts, and copy the key you see and place it into your .env file, similar to what you see in .env.example.

ganache

ganache

.env Example:

PRIVATE_KEY=11ee3108a03081fe260ecdc106554d09d9d1209bcafd46942b10e02943effc4a

  1. Compile your code

Run

yarn compile

You'll see files SimpleStorage_sol_SimpleStorage.abi and SimpleStorage_sol_SimpleStorage.bin be created.

  1. Run your application
node deploy.js

For WSL users

  1. Run
yarn add ganache
  1. Change Server settings in Ganache

Settings > Server > Host Name

Change Host Name to vEthernet (WSL)

  1. Run your application
node deploy.js

Deploying to a testnet

Make sure you have a metamask or other wallet, and export the private key.

IMPORTANT

USE A METAMASK THAT DOESNT HAVE ANY REAL FUNDS IN IT. Just in case you accidentally push your private key to a public place. I highly recommend you use a different metamask or wallet when developing.

  1. Export your private key and place it in your .env file, as done above.

  2. Go to Alchemy and create a new project on the testnet of choice (ie, Goerli)

  3. Grab your URL associated with the testnet, and place it into your .env file.

  4. Make sure you have testnet ETH in your account. You can get some here. You should get testnet ETH for the same testnet that you made a project in Alchemy (ie, Goerli)

  5. Run

node deploy.js

Thank you!

ethers-simple-storage-smart-contract-project's People

Contributors

devsammy22 avatar

Stargazers

 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.