---
The CommunityLandTrust
smart contract facilitates the management and operations of land parcels within a decentralized land trust community. It allows users to buy and sell land parcels, transfer ownership, and provides an administrative interface for trustees and the contract owner.
In this community land trust smart contract, we explore a sophisticated example of land management on the Ethereum blockchain. The CLT contract encapsulates multiple unique aspects of a trust, including land as unique parcels rather than indistinguishable units, trustees who have special privileges, dynamic pricing, and operations like land purchase, sale, and transfer among users.
The Community Land Trust contract models the sale and purchase of land as transactions on the Ethereum blockchain. Instead of treating land as indistinguishable units, the contract recognizes each land parcel as a unique entity, with an ID and an owner. This allows for more realistic representation and tracking of land ownership.
The contract recognizes the role of trustees in a land trust. Trustees have the power to change the price of land parcels. The owner of the contract, usually the trust, has the power to add or remove trustees. All these operations trigger events that provide transparency and traceability.
Users can buy available land parcels from the trust. When a land parcel is purchased, it is assigned to the buyer and can no longer be bought by others. Owners of land parcels have the flexibility to sell the parcels back to the trust or transfer ownership to other users. This allows for dynamic changes in the distribution of land ownership within the community land trust.
While this contract offers a robust and realistic representation of a community land trust, it serves as a starting point and should be customized according to the specific needs of the trust. As with any blockchain contract, it is critical to thoroughly test and audit the contract code before deploying it on the mainnet.
In summary, the Community Land Trust contract provides a sophisticated example of using Ethereum for managing real-world assets and transactions, demonstrating the immense potential of blockchain technology in revolutionizing how we handle and exchange value.
- Purchase Land: Users can purchase available land parcels by sending the specified Ether amount.
- Sell Land: Landowners can sell their parcels back to the trust.
- Transfer Ownership: Landowners can transfer their land parcels to another Ethereum address.
- Admin Functions: The contract owner and trustees have special permissions:
- Set the price of land parcels.
- Add or remove trustees.
- Withdraw contract balance.
This contract includes:
LandParcel
: A struct that represents a unique land parcel with an ID and owner.landParcels
: A mapping from a land parcel ID to the LandParcel struct.landOwners
: A mapping from an address to an array of land parcel IDs owned by that address.purchaseLand
: A function for buying land parcels from the trust.sellLand
: A function for selling land parcels back to the trust.transferLand
: A function for transferring ownership of a land parcel to another user.getLandParcels
: A function that returns all land parcel IDs owned by a user.
Install
npm i
Compile
npm run compile
- Node.js
- Truffle Framework
- MetaMask or similar Ethereum web3 provider
-
Clone this repository:
git clone [Repository Link]
-
Change into the directory:
cd CommunityLandTrustContract
-
Install dependencies:
npm install
-
Compile the contract:
truffle compile
-
Deploy the contract to a local Ethereum network using Truffle:
truffle migrate --reset
Of course! Here's an expanded "Usage" section for the README.md
detailing more function calls:
-
Buying Land:
contractInstance.purchaseLand({value: etherAmount});
-
Selling Land:
contractInstance.sellLand(parcelId);
-
Transferring Land:
contractInstance.transferLand(parcelId, recipientAddress);
-
Setting Land Price (Trustees only):
contractInstance.setLandPrice(newPrice);
-
Fetching Land Parcels Owned by an Address:
let parcelsOwned = await contractInstance.getLandParcels(ownerAddress); console.log("Land Parcels:", parcelsOwned);
-
Adding a Trustee (Owner only):
contractInstance.addTrustee(newTrusteeAddress);
-
Removing a Trustee (Owner only):
contractInstance.removeTrustee(trusteeAddress);
-
Withdrawing Contract Balance (Owner only):
contractInstance.withdraw();
-
Fetching Land Details by Parcel ID:
let landParcel = await contractInstance.landParcels(parcelId); console.log("Land Owner:", landParcel.owner);
-
Checking Trustee Status:
let isTrustee = await contractInstance.trustees(addressToCheck);
console.log("Is Trustee:", isTrustee);
This is an open-source project by the Block Foundation.
The Block Foundation mission is enabling architects to take back initiative and contribute in solving the mismatch in housing through blockchain technology. Therefore the Block Foundation seeks to unschackle the traditional constraints and construct middle ground between rent and the rigidity of traditional mortgages.
website: www.blockfoundation.io
Solidity |
Teal |
|
---|---|---|
Template | >>> | >>> |
Architectural Design | >>> | >>> |
Architecture Competition | >>> | >>> |
Housing Cooporative | >>> | >>> |
Land Registry | >>> | >>> |
Real-Estate Crowdfunding | >>> | >>> |
Rent-to-Own | >>> | >>> |
Self-Owning Building | >>> | >>> |
Smart Home | >>> | >>> |
We'd love for you to contribute and to make this project even better than it is today! Please refer to the contribution guidelines for information.
Copyright © 2023 Stichting Block Foundation. All Rights Reserved.
Except as otherwise noted, the content in this repository is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License, and code samples are licensed under the Apache 2.0 License.
Also see LICENSE and LICENSE-CODE.
THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.