
Decentralized Apartment Rentals: An Ethereum Smart Contract Solution
by Dung AIin JavaScript , Scripts & Code on August 20, 2024Choose Your Desired Option(s)
Decentralized Apartment Rentals: An Ethereum Smart Contract Solution
House Rental Marketplace
The DappBnb project is a decentralized application built on the Ethereum blockchain. It serves as a rental marketplace where users can list, book, and review apartments. The project is centered around a smart contract written in Solidity, known as DappBnb.sol. To ensure secure and standardized development, it utilizes the OpenZeppelin library.
The core functionality of the contract is structured around three primary components: ApartmentStruct, representing an apartment; BookingStruct, representing a booking; and ReviewStruct, representing a review.
Key Features
- createApartment: Enables a user to create a new apartment listing.
- updateApartment: Allows the apartment owner to update the details of an existing apartment.
- deleteApartment: Permits the apartment owner to remove an apartment listing.
- getApartments: Lets users retrieve a list of all available apartments.
- getApartment: Allows a user to view details of a specific apartment.
- bookApartment: Enables a user to book an apartment for selected dates.
- checkInApartment: Permits a tenant to check into an apartment and initiates the payment process.
- claimFunds: Allows the apartment owner to claim funds after a booking is finalized.
- refundBooking: Lets a tenant cancel a booking and receive a refund.
- getUnavailableDates: Enables a user to view all booked dates for a particular apartment.
- getBookings: Allows a user to retrieve all bookings for a specific apartment.
- getBooking: Provides a user with the details of a specific booking.
- addReview: Allows a tenant to leave a review for an apartment.
- getReviews: Enables a user to view all reviews for a particular apartment.
Supply the following keys in your .env variable:
NEXT_PUBLIC_ALCHEMY_ID=<YOUR_ALCHEMY_PROJECT_ID>
NEXT_PUBLIC_PROJECT_ID=<WALLET_CONNECT_PROJECT_ID>
NEXTAUTH_URL=http://localhost:3001
NEXTAUTH_SECRET=somereallysecretsecret
YOUR_ALCHEMY_PROJECT_ID: Get Key Here WALLET_CONNECT_PROJECT_ID: Get Key Here
Follow these steps to run the application:
- Install the package modules by running the command: yarn install
- Start the Hardhat server: yarn blockchain
- Run the contract deployment script: yarn deploy
- Run the contract seeding script: yarn seed
- Spin up the Next.js development server: yarn dev
Now, your application should be up and running.
- 🌐 Next.js: A React framework for building server-side rendered and static websites.
- 📘 TypeScript: A statically typed superset of JavaScript.
- 📦 Hardhat: A development environment for Ethereum smart contracts.
- 🌐 EthersJs: A library for interacting with Ethereum and Ethereum-like blockchains.
- 📚 Redux-Toolkit: A library for managing application state.
- 🎨 Tailwind CSS: A utility-first CSS framework.
Download Category | JavaScript, Scripts & Code |
Product Homepage URL→ | |
Product Version | |
File Type | JS |
File Size | 4.95 MB |
Developer | |
Documentation |