Skip to content

kunalsathe18/verifyX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

verifyX

A blockchain-based product authenticity verification system built on the Stellar network. Sellers register products on-chain and buyers verify genuineness using a unique Product ID — no middlemen, no central database.


Tech Stack

Layer Technology
Smart Contract Rust · Soroban SDK 21.x
Blockchain Stellar Testnet
Frontend React · Vite
Styling Plain CSS
Wallet Freighter Browser Extension

Project Structure

verifyX/
├── contract/
│   ├── Cargo.toml
│   └── src/
│       └── lib.rs
└── frontend/
    ├── index.html
    ├── vite.config.js
    ├── package.json
    ├── .env.example
    └── src/
        ├── App.jsx
        ├── components/
        │   ├── WalletConnect.jsx
        │   ├── AddProduct.jsx
        │   └── VerifyProduct.jsx
        ├── styles/
        │   └── App.css
        └── utils/
            ├── contract.js
            └── freighter.js

Deployed Contract

Value
Network Stellar Testnet
Contract ID CAZLH6BM7ZCQKJFQK65LMZ2JVKBNWPA322QK4UNNG4OGXBZVXCHYOHCW
Explorer View on Stellar Lab

This is the second deployment — the contract was intentionally redeployed after the initial deployment to demonstrate the full deploy lifecycle.

Previous contract ID (revoked): CBZFP5LCW7SCY5XOD5KMITXEMAJSUC3KNN3THM7OUEP2D6JIJSFRGLXI


Prerequisites

Install Stellar CLI:

cargo install --locked stellar-cli --features opt

Add the WebAssembly build target:

rustup target add wasm32v1-none

Smart Contract

Build

cd contract
stellar contract build

Output: contract/target/wasm32v1-none/release/verifyx.wasm

Test

cargo test

Deploy to Testnet

# Create and fund a testnet identity
stellar keys generate alice --network testnet
stellar keys fund alice --network testnet

# Deploy
stellar contract deploy \
  --wasm target/wasm32v1-none/release/verifyx.wasm \
  --source alice \
  --network testnet

Copy the Contract ID from the output — you will need it for the frontend.

Contract Functions

Function Parameters Returns Description
add_product manufacturer: Address, name: String, brand: String u64 Register a product, returns its ID
get_product id: u64 Product Returns product details or panics if not found
verify_product id: u64 bool Returns true if the product exists
get_product_count u64 Total number of registered products

Frontend

Setup

cd frontend
cp .env.example .env

Edit .env:

VITE_CONTRACT_ID=YOUR_CONTRACT_ID_HERE
VITE_RPC_URL=https://soroban-testnet.stellar.org

Install and Run

npm install
npm run dev

Open http://localhost:5173

Production Build

npm run build
# Output: frontend/dist/

Freighter Wallet Setup

  1. Install Freighter from freighter.app
  2. Create or import a wallet
  3. Switch network to Testnet inside the extension
  4. Fund your testnet address at Stellar Laboratory

How It Works

Seller                        Blockchain                      Buyer
  |                               |                             |
  |-- Connect wallet ------------>|                             |
  |-- Register product (name,     |                             |
  |   brand) ------------------->|                             |
  |<-- Product ID returned -------|                             |
  |                               |                             |
  |   (Product ID shared          |<-- Enter Product ID --------|
  |    with buyer)                |--- Lookup on-chain -------->|
  |                               |<-- Genuine / Not Found -----|

Troubleshooting

Issue Solution
wasm32v1-none target missing Run rustup target add wasm32v1-none
Freighter not detected Install the extension and refresh the page
Transaction fails Ensure your Freighter account is funded on Testnet
Contract ID not found Verify VITE_CONTRACT_ID in frontend/.env
Freighter on wrong network Switch to Testnet inside the Freighter extension

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors