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.
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.
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
foundryupClone the repository:
git clone https://github.com/DCVglobalnetwork/HelloBlockchain.git
cd HelloBlockchainInstall dependencies:
forge installBuild the project:
forge build
The project includes a test file HelloBlockchainTest.sol to ensure the contract behaves as expected.
Running Tests To run the tests:
forge testThis will compile the contract and run the tests defined in HelloBlockchainTest.sol.
You can deploy the contract using Anvil (a local Ethereum node) and the deployment script DeployHelloBlockchain.s.sol.
Steps to Deploy Start Anvil:
anvilDeploy 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()"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) publicYou can interact with these functions using tools like cast or directly through your preferred Ethereum interface.
This project is licensed under the MIT License.
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
This article will provide you with a deeper understanding of the project and help you get started with your own blockchain development journey.

