Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions blockchain/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
node_modules
.env

# Hardhat files
/cache
/artifacts
# Foundry
out
cache
cache_forge
broadcast
artifacts

# TypeChain files
/typechain
/typechain-types
# Environment
.env

# solidity-coverage files
/coverage
/coverage.json
# Dependencies
node_modules
forge_std

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
# Misc
.DS_Store
25 changes: 13 additions & 12 deletions blockchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
FROM node:20-slim
FROM ghcr.io/foundry-rs/foundry:latest

WORKDIR /app/blockchain
WORKDIR /app

# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js and npm
RUN apk add --no-cache nodejs npm

# Set Python path for node-gyp
ENV PYTHON=/usr/bin/python3
# Copy package files
COPY package.json package-lock.json ./

COPY package*.json ./
# Install dependencies
RUN npm install

# Copy source code
COPY . .

CMD ["npx", "hardhat", "node"]
# Build the project
RUN forge build

# Set the entrypoint to anvil (local testnet) or forge
CMD ["anvil", "--host", "0.0.0.0"]
77 changes: 52 additions & 25 deletions blockchain/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,71 @@
# Sample Hardhat Project
# Agora Blockchain Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract.
This project contains the smart contracts for Agora Blockchain, built using **Foundry**.

Try running some of the following tasks:
## Getting Started

### Prerequisites

- [Foundry](https://book.getfoundry.sh/getting-started/installation)

### Build

```shell
forge build
```

### Test

```shell
forge test
```

### Format

```shell
forge fmt
```

### Local Node

Start a local testnet:

```shell
anvil
```

### Deploy

To deploy contracts, use `forge create` or `forge script`.

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/Lock.js
forge script script/MyScript.s.sol --rpc-url <your_rpc_url> --private-key <your_private_key>
```

Live Code at
## Live Code

- Election Factory - https://sepolia.etherscan.io/address/0x64c720eBD5227bba57a5E8282893e71087cCcBb8#code
- CCIP Sender :-
- Fuji - https://testnet.snowtrace.io//address/0xf267f0603672E791779E52B153BD9A39C9928767#code

Gas Comparision :
## Gas Comparison (Historical)

Create Election :
**Create Election:**

0.011334162446332343 - Before
0.002298823499424792 - After
- 0.011334162446332343 - Before
- 0.002298823499424792 - After

Add Candidate:
**Add Candidate:**

0.000716409329167840 - Before
0.000256279986480672 - After
- 0.000716409329167840 - Before
- 0.000256279986480672 - After

Vote:
0.00027771 - Before
0.00050715 - After
**Vote:**

Before IPFS
- 0.00027771 - Before
- 0.00050715 - After

Medium Description : 0.00197243 SepoliaETH
Large Description : 0.00537738 SepoliaETH
**IPFS Optimization:**

After IPFS
Medium Description : 0.00035482 SepoliaETH
Large Description : 0.00035595 SepoliaETH
- Medium Description: 0.00197243 -> 0.00035482 SepoliaETH
- Large Description: 0.00537738 -> 0.00035595 SepoliaETH
Loading