This repository contains the codebase for the Assured Contract Farming Platform, a decentralized application (DApp) built on the Tezos blockchain using Next.js. The project was developed as part of the Hack7Days hackathon and aims to provide a secure, transparent, and automated platform for contract-based transactions between farmers and buyers.
- Project Overview
- Key Objectives
- Features
- Architecture
- Technology Stack
- Getting Started
- Smart Contract Overview
- License
The Assured Contract Farming Platform aims to bring transparency, fairness, and trust to agricultural transactions through the use of blockchain technology. By leveraging smart contracts on the Tezos blockchain, the platform ensures that both farmers and buyers are protected during transactions. The system automates payment processing, delivery confirmations, and contract enforcement, eliminating the need for intermediaries.
- Transparency: Build trust in agricultural transactions by recording them on an immutable blockchain ledger.
- Security: Ensure that payments are only made when goods are confirmed as delivered.
- Automation: Automate the payment and delivery processes using smart contracts.
- Decentralization: Remove intermediaries, giving farmers more control over their products and pricing.
- Contract-based Farming: Buyers can purchase goods under predefined contracts that ensure transparency and fairness.
- Product Catalog: Farmers can list a variety of agricultural products (such as rice, wheat, onions, etc.) with prices defined in the smart contract.
- Automated Payment Processing: Payments are securely processed via the Tezos blockchain, ensuring trust between farmers and buyers.
- Delivery Confirmation: Payments are only released once the buyer confirms receipt of goods.
- Decentralized System: Operates entirely on the blockchain, with no need for central authorities or intermediaries.
The platform is built on a combination of smart contract technology and a user-friendly Next.js frontend.
The core of the platform is a SmartPy smart contract that handles the transaction logic between the farmer and the buyer. The contract is designed to ensure transparency, security, and automation in every step of the buying process.
The frontend is built using Next.js, providing a modern and responsive interface for users to interact with the blockchain. The interface allows users to browse products, select items for purchase, and confirm deliveries, all while interacting with the Tezos blockchain.
- Blockchain: Tezos
- Smart Contracts: SmartPy
- Frontend: Next.js
- Backend: Next.js
- Wallet Integration: Tezos wallet for handling transactions
Ensure you have the following tools installed:
- Node.js: To run the Next.js application.
- SmartPy CLI: For compiling and testing smart contracts.
- Tezos Wallet: For managing Tezos accounts and interacting with the blockchain.
- Clone the Repository:
git clone https://github.com/your-repo/tezos-farming-platform.git cd tezos-farming-platform
#Install Dependencies:
bash
npm install Install the dependencies required for the Next.js application.
Install SmartPy Download and install SmartPy to compile and test the smart contracts.
Running the Project Start the Next.js Development Server:
To get the Next.js application running, first, install the necessary dependencies:
npm install
Install SmartPy Download and install SmartPy to compile and test the smart contracts. SmartPy is required for running the Tezos smart contracts in this project.
Running the Project
- Start the Next.js Development Server To start the development server, run the following command:
npm run dev
This will start the development server on your local machine. You can access the project by navigating to http://localhost:3000 in your browser.
- Deploy the Smart Contract Compile and deploy the smrtcntrct.py contract to the Tezos testnet or mainnet using the SmartPy CLI or IDE.
The Assured Contract smart contract ensures that payments between farmers and buyers are securely processed. The contract automatically verifies the delivery of goods before transferring funds, ensuring trust and transparency in transactions.
buy(byls)
: Allows buyers to purchase agricultural goods by selecting items from the product list.sendm(price, byls)
: Manages the transfer of payment to the farmer once delivery is confirmed.deliver(pr)
: Handles the delivery process and triggers payment upon successful receipt of goods.confrim_payment()
: Confirms that the payment has been made before goods are dispatched.
- Buy: The buyer selects goods from the available list and invokes the
buy
entry point. - Delivery Confirmation: Once the goods are delivered, the
deliver
entry point is triggered, verifying the total price. - Payment Transfer: The contract automatically transfers the agreed-upon payment to the farmer's address after confirmation of delivery.
How It Works Buy: The buyer selects goods from the available list and invokes the buy entry point. Delivery Confirmation: Once the goods are delivered, the deliver entry point is triggered, verifying the total price. Payment Transfer: The contract automatically transfers the agreed-upon payment to the farmer's address after confirmation of delivery.
This project is licensed under the MIT License.