Skip to content

DCVglobalnetwork/HelloBlockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HelloBlockchain

Welcome to the HelloBlockchain project! This repository contains a simple Ethereum smart contract, along with scripts for deployment, testing, and interaction using the Foundry toolkit.

image

Table of Contents

Project Overview

HelloBlockchain is a simple Ethereum smart contract that stores a greeting message on the blockchain. The project demonstrates how to create, test, and deploy a smart contract using Foundry and Anvil.

Prerequisites

Before getting started, make sure you have the following installed:

You can install Foundry and Anvil by running:

curl -L https://foundry.paradigm.xyz | bash
foundryup

Installation

Clone the repository:

git clone https://github.com/DCVglobalnetwork/HelloBlockchain.git
cd HelloBlockchain

Install dependencies:

forge install

Build the project:

forge build

Testing

The project includes a test file HelloBlockchainTest.sol to ensure the contract behaves as expected.

Running Tests To run the tests:

forge test

This will compile the contract and run the tests defined in HelloBlockchainTest.sol.

Deployment

You can deploy the contract using Anvil (a local Ethereum node) and the deployment script DeployHelloBlockchain.s.sol.

Steps to Deploy Start Anvil:

anvil

Deploy the contract:

forge script script/DeployHelloBlockchain.s.sol:DeployHelloBlockchain --rpc-url http://127.0.0.1:8545 --broadcast --private-key <YOUR_PRIVATE_KEY>

Replace <YOUR_PRIVATE_KEY> with the private key of one of the accounts provided by Anvil.

Check Deployment You can verify the deployment by calling the getGreetings() function:

cast call <CONTRACT_ADDRESS> "getGreetings()"

Usage

After deployment, you can interact with the contract using the following functions:

Get the current greetings:

function getGreetings() public view returns (string memory)

Set a new greeting:

function setGreetings(string memory _greetings) public

You can interact with these functions using tools like cast or directly through your preferred Ethereum interface.

License

This project is licensed under the MIT License.

Detailed Walkthrough on Medium

If you're interested in a step-by-step guide on how this project was built, including explanations of the code, testing, and deployment process, check out the detailed walkthrough on Medium:

👉 Read the HelloBlockchain Walkthrough on Medium

image

This article will provide you with a deeper understanding of the project and help you get started with your own blockchain development journey.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors