Skip to content

ShineYeti/SimpleStorage-solidity

Repository files navigation

SimpleStorage with ethers.js

This project shows how to interact with a simple smart contract in Ethereum blockchain using the ether.js library.

🚀 Technologies and Tools

  • Solidity: Programming language for writing smart contratcs.

  • ethers.js: JavaScript library used to interact with Ethereum blockchain.

  • Ganache: Local Ethereum Network to development and tests.

  • Node.js: JavaScript runtime environment.

  • fs-extra: Library to file management.

  • dotenv: For securely managing environment variables.

🛠️ How the Project Works

This project consists of a simple Solidity smart contract that lets you store and retrieve a single number. The JavaScript script, written with ethers.js, performs the following operations:

  • Connects to a local Ethereum network (Ganache).

  • Loads the contract's ABI and bytecode.

  • Deploys the contract to the blockchain.

  • Interacts with the contract by calling the store function to update the number.

  • Retrieves the updated number to verify that the transaction was successful.

📦 Installation and Execution

Node.js installed.

Ganache Desktop installed and running on the default port (or a port you configure).

A .env file in the project's root directory with your private key: PRIVATE_KEY=your-private-key-here.

Steps 1 - Clone this repository or create the file structure.

2- Install the dependencies:

npm install

Compile the SimpleStorage.sol contract (using solc or Hardhat, for example) to generate the .abi and .bin files.

Run the deploy script:

node deploy.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published