Skip to content

Solidity Smart Contract: Community Land Trust (CLT)

License

CC-BY-SA-4.0, Apache-2.0 licenses found

Licenses found

CC-BY-SA-4.0
LICENSE
Apache-2.0
LICENSE-CODE
Notifications You must be signed in to change notification settings

block-foundation/solidity-community-land-trust

GitHub License devContainer


Block Foundation Logo

Community Land Trust

Block Foundation Smart Contract Series [Solidity]

---

Block Foundation Brand

Contents

  1. Introduction
  2. Features
  3. Quick start
  4. Setup and Installation
  5. Usage
  6. Contribution
  7. License
  8. Colophon


Report a Bug Request a Feature Ask a Question Make a Suggestion Start a Discussion

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.

Introduction

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.

Features

  • 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.

Functions

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.

Quick Start

Install

npm i

Compile

npm run compile

Setup and Installation

Prerequisites

Steps

  1. Clone this repository:

    git clone [Repository Link]
  2. Change into the directory:

    cd CommunityLandTrustContract
  3. Install dependencies:

    npm install
  4. Compile the contract:

    truffle compile
  5. 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:


Usage

  1. Buying Land:

    contractInstance.purchaseLand({value: etherAmount});
  2. Selling Land:

    contractInstance.sellLand(parcelId);
  3. Transferring Land:

    contractInstance.transferLand(parcelId, recipientAddress);
  4. Setting Land Price (Trustees only):

    contractInstance.setLandPrice(newPrice);
  5. Fetching Land Parcels Owned by an Address:

    let parcelsOwned = await contractInstance.getLandParcels(ownerAddress);
    console.log("Land Parcels:", parcelsOwned);
  6. Adding a Trustee (Owner only):

    contractInstance.addTrustee(newTrusteeAddress);
  7. Removing a Trustee (Owner only):

    contractInstance.removeTrustee(trusteeAddress);
  8. Withdrawing Contract Balance (Owner only):

    contractInstance.withdraw();
  9. Fetching Land Details by Parcel ID:

    let landParcel = await contractInstance.landParcels(parcelId);
    console.log("Land Owner:", landParcel.owner);
  10. Checking Trustee Status:

let isTrustee = await contractInstance.trustees(addressToCheck);
console.log("Is Trustee:", isTrustee);

Colophon

Authors

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

Development Resources

Other Repositories

Block Foundation Smart Contract Series

Solidity Teal
Template >>> >>>
Architectural Design >>> >>>
Architecture Competition >>> >>>
Housing Cooporative >>> >>>
Land Registry >>> >>>
Real-Estate Crowdfunding >>> >>>
Rent-to-Own >>> >>>
Self-Owning Building >>> >>>
Smart Home >>> >>>

Contributing

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.

Legal Information

Copyright

Copyright © 2023 Stichting Block Foundation. All Rights Reserved.

License

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.

Disclaimer

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.