Skip to content

Practical examples to deploy Smart Contracts in different public networks

Notifications You must be signed in to change notification settings

Alexander-Herranz/smart-contract-deployment-public-networks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smart Contract deployment on public EVM networks

This repository provides practical example to deploy Smart Contracts in different public EVM networks, following different approaches:

Prerequisites

Node JS installed: https://nodejs.org/

DESIRED_NETWORK variable can be:

  • ethereum_goerli_testnet
  • polygon_mumbai_testnet
  • binance_bsc_testnet

These networks are specified in networks section in both files (you can add new ones):

  • Truffle/truffle-config.js
  • Hardhat/hardhat.config.ts

If you have problems with RPC URLs (they change from time to time) check last ones here: https://rpc.info/

Testnet networks

Ethereum 2.0 (POS) testnet (Sepolia )

Polygon Mumbai (testnet)

More info here: https://wiki.polygon.technology/docs/develop/metamask/config-polygon-on-metamask/

Binance Smart Chain (testnet) information

More info here: https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain

Ethereum 1.0 Goerli (POW) testnet [To be deprecated]

Truffle

Installation

npm install -g truffle
cd Truffle
npm i

Deployment

truffle compile
truffle migrate --network DESIRED_NETWORK

Verification

truffle run verify DEPLOYED_CONTRACT_NAME@DEPLOYED_CONTRACT_ADDRESS --network DESIRED_NETWORK

Example with Goerli Network

truffle compile
truffle migrate --network ethereum_goerli_testnet
truffle run verify Notarization@0x... --network ethereum_goerli_testnet

Hardhat

Installation

cd Hardhat
npm install

Deployment

npx hardhat clean
npx hardhat compile
npx hardhat run ./scripts/deploy.ts --network DESIRED_NETWORK

Verification

npx hardhat verify --network DESIRED_NETWORK DEPLOYED_CONTRACT_ADDRESS

Example with Goerli Network

npx hardhat run ./scripts/deploy.ts --network ethereum_goerli_testnet
npx hardhat verify --network ethereum_goerli_testnet 0x...

Remix

Metamask: Network selection

You have to select your preffered network form Metamask.

Metamask1

Remix: Deployment (left side)

Just click on the "Deploy" button when your Smart Contract is ready.

Remix1

Metamask: Confirm transaction

You have to confirm the transaction of the Smart Contract deployment.

Metamask2

Functions overview in Remix (left side)

You will see an overview of the public/external functions of your already deployed Smart Contract.

Remix2

Functions execution in Remix (left side)

You can directly execute your Smart Contract functions from the Remix web IDE for test purposes.

Remix3

About

Practical examples to deploy Smart Contracts in different public networks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 65.3%
  • Solidity 21.5%
  • JavaScript 13.2%