{"id":21361131,"url":"https://github.com/kaymen99/decentralairbnb","last_synced_at":"2025-07-13T02:32:03.614Z","repository":{"id":38036425,"uuid":"491686757","full_name":"kaymen99/DecentralAirbnb","owner":"kaymen99","description":"This a decentralized web3.0 version of the AIRBNB renting website built on top of the Ethereum blockchain","archived":false,"fork":false,"pushed_at":"2023-02-01T16:40:37.000Z","size":9651,"stargazers_count":20,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-03-17T23:22:20.098Z","etag":null,"topics":["airbnb-clone","blockchain","dapps-development","ethereum","hardhat","react","reactjs","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaymen99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-12T22:33:50.000Z","updated_at":"2023-03-12T15:01:08.000Z","dependencies_parsed_at":"2023-02-09T17:31:32.924Z","dependency_job_id":null,"html_url":"https://github.com/kaymen99/DecentralAirbnb","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FDecentralAirbnb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FDecentralAirbnb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FDecentralAirbnb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaymen99%2FDecentralAirbnb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaymen99","download_url":"https://codeload.github.com/kaymen99/DecentralAirbnb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225850260,"owners_count":17534067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airbnb-clone","blockchain","dapps-development","ethereum","hardhat","react","reactjs","smart-contracts","solidity"],"created_at":"2024-11-22T06:08:42.338Z","updated_at":"2024-11-22T06:08:43.027Z","avatar_url":"https://github.com/kaymen99.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## Decentral AirBnb\n\nThis is a decentralized web3.0 version of the AirBnb renting website built for EVM compatible blockchains (Ethereum, Polygon,...), it was inspired by the Moralis project [\"Build Web 3.0 AirBNB Clone Using web3uikit, React, Moralis and Solidity - Full-Stack Blockchain App\"](https://www.youtube.com/watch?v=rj-Mb-xz1Os\u0026t=2443s)\n \u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Dark\" src=\"https://user-images.githubusercontent.com/83681204/204110853-5fa8dfe6-ea55-4eff-b818-4e69859beb5f.png\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n \n### Built With\n\n* [Solidity](https://docs.soliditylang.org/)\n* [Hardhat](https://hardhat.org/getting-started/)\n* [React.js](https://reactjs.org/)\n* [ethers.js](https://docs.ethers.io/v5/)\n* [web3modal](https://github.com/Web3Modal/web3modal)\n* [material ui](https://mui.com/getting-started/installation/)\n\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n       \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#project-structure\"\u003eProject structure\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#initial-setup\"\u003eInitial Setup\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#how-it-works\"\u003eHow it Works\u003c/a\u003e\n     \u003cul\u003e\n       \u003cli\u003e\u003ca href=\"#contracts\"\u003eContracts\u003c/a\u003e\u003c/li\u003e\n       \u003cli\u003e\u003ca href=\"#user-interface\"\u003eUser interface\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#how-to-use\"\u003eHow to Use\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#future-developements\"\u003eFuture developements\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\n### Prerequisites\n\nPlease install or have installed the following:\n* [nodejs](https://nodejs.org/en/download/) and [yarn](https://classic.yarnpkg.com/en/)\n* [MetaMask](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn) Chrome extension installed in your browser\n* [Ganache](https://trufflesuite.com/ganache/) for local smart contracts deployement and testing\n\n### Project structure\n\nThis a full stack web3 decentralized application built using Hardhat/React js, so the project is devided into 2 main parts:\n\u003cul\u003e\n \u003cli\u003e\u003cb\u003eSmart contract/backend side:\u003c/b\u003e\u003c/li\u003e\n Located in the hardhat folder, it contains the blockchain developement envirenment built using Hardhat, with all the smart contracts tests, deployement scripts and the plugins used (chainlink). \n  \u003cli\u003e\u003cb\u003efront-end side:\u003c/b\u003e\u003c/li\u003e\nThe code for the UI can be found in the src folder (as in all reactjs apps)\n\u003c/ul\u003e\n\n### Initial Setup\n1. Clone the repository and install all the required packages by running:\n   ```sh\n   git clone https://github.com/kaymen99/DecentralAirbnb.git\n   cd DecentralAirbnb\n   yarn\n   ```\n2. Start the ganache network and export the private key of the first account to the .env file in the hardhat folder, it will be used as admin for deploying the Airbnb contract:\n   ```sh\n   ETHERSCAN_API_KEY=\"your etherscan api key\"\n   POLYGON_RPC_URL=\"Your polygon RPC url from alchemy or infura\"\n   MUMBAI_RPC_URL=\"Your mumbai RPC url from alchemy or infura\"\n   PRIVATE_KEY=\"ganahce-private-key\"\n   ```\n   \n   * \u003cb\u003eNote :\u003c/b\u003e I used the ganache network just for testing, if you want to deploy directly to a real/test network you'll need to add your real private key in the .env file.\n   \n3. As infura recently removed its free IPFS gateway i used `web3.storage` api for storing rentals images into IPFS, this api is as simple as infura it requires the creation of a free account and a new api token which you can do [here](https://web3.storage), when you finish add your api token into the `src/utils/StoreContent.js` file:\n   ```js\n    const web3storage_key = \"YOUR-WEB3.STORAGE-API-TOKEN\";\n   ```\n   \n4. Get the Google maps api-key (it's free) [here](https://developers.google.com/maps/documentation/embed/get-api-key) and add it to the src/component/RentalsMap.js file:\n   ```sh\n    export default GoogleApiWrapper({\n          apiKey: \"api_key\",\n    })(RentalsMap);\n   ```\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- Working EXAMPLES --\u003e\n## How it Works\n\n### contracts\n\nThe dapp is built around the DecentralAirbnb.sol contract, which contains all the app logic and has the following features:\n\n\u003ch4\u003eCore functions:\u003c/h4\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eaddRental:\u003c/b\u003e allow any user to add it's property on the rentals listing by paying a small fee\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003ebookDates:\u003c/b\u003e given the vacation start and end dates, it book a reservation if the rantal is available\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003echackIfBooked:\u003c/b\u003e verify if a given rental is booked for the user dates\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch4\u003eAdmin functions: (admin is the only one that can call this functions)\u003c/h4\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003echangeListingFee:\u003c/b\u003e change the fee charged when adding new rental\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003ewithdrawBalance:\u003c/b\u003e the admin is able to withdraw th contract balance which is accumulated from the charged listing fee\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch4\u003eChainLink price feed:\u003c/h4\u003e\n\nAs ETH or MATIC are both volatile currencies, the user need to set the renting price in $ and this price is converted using chainlink price feeds when a user is excuting the booking transaction.\n\n\n### User interface\nThe app allows users to rent any place in the world and pay in crypto, it's structured in 4 pages:\n\n* The home page is the landing page of the app, By entering the city, the duration of the holiday and the number of guest the user is able to check all the available properties and can compare their prices, and the different facilities.\n\n* The Rentals page is where the user is redirected after entering the holiday information, it contains a list of all the properties that match the user \nrequirements, and also shows the location of these on a map provided by Google-maps\n\n![Capture d’écran 2022-05-12 à 23 16 45](https://user-images.githubusercontent.com/83681204/168185991-4dfd9476-e905-4ae0-bf85-cc84397db436.png)\n\n* Each user has their own Dashboard, it can be accessed by clicking on the account button in the top of the page, this dashboard shows all the user properites listed for renting and the reservations he has booked.\n\n![Capture d’écran 2022-05-12 à 23 18 10](https://user-images.githubusercontent.com/83681204/168186740-54ce2a06-8c8d-4a85-89dc-4c205ef2d33c.png)\n\n* In the Dashboard page there is a button \"Add rental\", which redirect the user to the AddRental page where he can list a new rental by providing a set of metadata (property name, city, latitude, longitude, description, maximum number of guests, rent price per day in $), note that it's really important to give the exact property (latitude, longitude) as they are later used to show the location on the Google map\n\n![Capture d’écran 2022-05-12 à 23 15 13](https://user-images.githubusercontent.com/83681204/168187290-846d2123-3bb0-49fb-90b1-74a96fec1b88.png)\n\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## How to Use\n\nAfter going through all the installation and setup steps, you'll need to deploy the smart contract to the ganache network by running: \n   ```sh\n   cd hardhat\n   npx hardhat run scripts/deploy-airbnb.js --network ganache\n   ```\nThis will create a config.js file and an artifacts folder and transfer them to the src folder to enable the interaction between the contract and the UI\n\nIf you want to test the functionnalities of the DecentralAirbnb contract you can do it by running:\n   ```sh\n   npx hardhat test\n   ```\nTo start the app you have to go back to the DecentralAirbnb folder and run the command:\n   ```sh\n   yarn start\n   ```\n   \n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- FUTURE DEVELOPEMENT --\u003e\n## Future developements\n\n* Currently the only way to get the listed rantals is through getRentalList function, which is really inconvenient if a user want to filter rentals by owner, number of guests or price. So it's better to \u003cb\u003ecreate a subgraph API based on the emitted events\u003c/b\u003e thus allowing quick access to the differnet requests.\n\n* Perfom contracts audit using known tools such as echidna \u0026 slither.\n   \n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- Contact --\u003e\n## Contact\n\nIf you have any question or problem running this project just contact me: aymenMir1001@gmail.com\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Fdecentralairbnb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaymen99%2Fdecentralairbnb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaymen99%2Fdecentralairbnb/lists"}