Skip to main content

Story 1: AirBNB House

Real World Asset (RWA) on Cardano Blockchain

This document outlines the story of putting a real-world asset (a house) on the Cardano blockchain, along with the specific transaction types and smart contracts needed for each step of implementation.

The Story

Introduction

In a bustling city, three investors, Alice, Bob, and Charlie, saw an opportunity to invest in real estate. They decided to put a real-world asset (RWA) onto the blockchain to make the investment process more transparent and accessible.

The Vault Creation

They created a vault using smart contracts, allowing them to solicit investments from other investors. The vault was designed to manage the funds and the asset effectively.

Investment Round

Ten investors joined the project, each contributing 10 ADA, bringing the total investment to 100 ADA. The asset they purchased was a charming home that they planned to rent out via AirBNB.

Governance Decisions

As the house was prepared for rental, several governance decisions were made:

  1. Painting the House: The investors voted to give the house a fresh coat of paint to attract more guests.
  2. Upgrading Appliances: They decided to upgrade the kitchen appliances to modern, energy-efficient models.
  3. Purchasing Furniture: A vote was held to purchase stylish furniture to enhance the guest experience.

Revenue Generation

Once the house was ready, it was listed on AirBNB. The rental income started flowing in, and every quarter, the profits were poured into the vault. This increased the value of the vault for all investors.

Blockchain Implementation: Transaction Types and Smart Contracts

1. Vault Creation

Transaction Type: Minting Transaction

  • This transaction creates a new token representing the vault itself
  • The vault token acts as the identifier for all subsequent operations

Smart Contract Required: VaultContract (Contract Hash: ac2bb90a5a34ee1a7fe5340b73932132df67afb54d90605be6a8329f)

  • Responsible for creating and managing the vault structure
  • Sets up initial parameters including vault name, creator address, and governance rules
  • Establishes policy for token minting and asset management

Implementation:

deno run --env-file -A create_vault.ts

2. Asset Tokenization

Transaction Type: Minting Transaction

  • Creates a non-fungible token (NFT) that represents the house
  • Includes metadata about the property's details (location, size, features)
  • NOTE: We do not actually mint an NFT in production, the NFT will always be supplied by the user. We are only minting an NFT in this step for the purpose of conducting end to end testing.

Smart Contract Required: AssetTokenizationContract (Contract Hash: 479f356943df735488e8f6ce7dd7dd9e757b68b9e01175da42031111)

  • Mints NFT with proper metadata
  • Links legal documents to the asset (property deed, purchase agreement)
  • Creates verifiable link between physical asset and digital token

Implementation:

# Required functions from lib-assets.ts
createAsset("house", ["deed.pdf", "purchase_agreement.pdf"])

3. Investment Collection

Transaction Type: UTxO Transactions

  • Handles incoming ADA from investors
  • Associates investor addresses with ownership percentages

Smart Contract Required: InvestmentContract (utilizing VaultContract)

  • Validates investor contributions
  • Updates ownership registry
  • Enforces minimum investment requirements
  • Issues ownership tokens to investors proportional to their contribution

Implementation:

# Uses the getUtxos function from lib.ts to track contributions
getUtxos(investorAddress, minimumContribution)

4. Property Purchase

Transaction Type: Asset Transfer Transaction

  • Transfers funds from vault to property seller
  • Registers asset token to vault contract address

Smart Contract Required: VaultContract & AssetTransferContract

  • Validates sufficient funds in vault
  • Executes purchase according to predefined rules
  • Updates vault state with new asset ownership

Implementation:

# Uses the getVaultUtxo function from lib.ts
getVaultUtxo(vaultPolicyId, vaultAssetName)

5. Governance Decisions

Transaction Type: Voting Transactions

  • Records votes from stakeholders
  • Tallies results and executes decisions

Smart Contract Required: GovernanceContract (part of VaultContract)

  • Validates voter eligibility based on ownership tokens
  • Enforces voting timeframes
  • Requires minimum participation thresholds
  • Executes approved decisions automatically

Implementation:

# Function from lib.ts to create unique identifiers for governance proposals
generate_assetname_from_txhash_index(proposalTxHash, outputIndex)

6. Expense Execution

Transaction Type: Payment Transactions

  • Disburses funds from the vault for approved expenses
  • Updates vault accounting records

Smart Contract Required: ExpenseContract (utilizing VaultContract)

  • Requires governance approval
  • Validates expense recipients
  • Records expense categories and amounts
  • Updates vault financial records

Implementation:

# Uses assetsToValue function from lib.ts to calculate expense values
assetsToValue(expenseAssets)

7. Rental Income Collection

Transaction Type: Income Transactions

  • Records incoming rental payments
  • Updates vault balance

Smart Contract Required: IncomeContract (utilizing VaultContract)

  • Validates income sources
  • Updates vault balance
  • Records income categories and amounts
  • Prepares for distribution

Implementation:

# Uses utility functions from lib.ts
toHex(rentalAgreementHash)

8. Profit Distribution

Transaction Type: Distribution Transactions

  • Calculates proportional rewards
  • Disburses funds to stakeholders

Smart Contract Required: DistributionContract (part of VaultContract)

  • Calculates rewards based on ownership percentages
  • Validates distribution timeframes
  • Executes automatic transfers to stakeholders
  • Updates distribution records

Implementation:

# Implementation uses multiple functions from lib.ts
getUtxos(vaultAddress) + assetsToValue(vaultAssets)

Transaction Sequence Diagram

sequenceDiagram
    participant AW as Admin Wallet
    participant VSC as Vault Smart Contract
    participant AC as Asset Contract
    participant BR as Blockchain Registry
    participant INV as Investors
    participant VC as Vault Contract
    participant VC2 as Voting Contract
    participant HAM as House Asset Management
    participant IW as Investor Wallets

    AW->>VSC: Create Vault
    VSC-->>AW: Vault Token
    
    AW->>AC: Tokenize Asset
    AC->>BR: Asset Token
    
    AC->>INV: Collect Investments
    INV->>VC: Ownership Tokens
    VC-->>INV: Profit Shares
    
    INV->>VC2: Governance Votes
    VC2->>HAM: Execute Actions
    
    HAM->>VC: Rental Income
    VC->>IW: Distribution

Tracking Transactions for Troubleshooting

Step Transaction Hash Asset Name Smart Contract
Vault Creation 3c6d5eb6f750567c6766755e39ab1c16ffe30a588543ed26961f01dcd33a44bf 0aacb1763613dc2868497e42fa4bc08271c8ca401b5013605a547cf31c0d8228 VaultContract
Asset Tokenization e25fe2dfe2e082c461d0409b0eed30a8cb2008e98b68aa0e328eeaa34f641950 0aacb1763613dc2868497e42fa4bc08271c8ca401b5013605a547cf31c0d8228 AssetTokenizationContract
Investment 1 c81b496bcd2da6cd6a42a1b593c1c9ac0db34f4e2c88740246c08f35b374ec16 0aacb1763613dc2868497e42fa4bc08271c8ca401b5013605a547cf31c0d8228 InvestmentContract
Governance Vote 78db36a015a7df3db5d6595f7621a87a9d5fdbb598a7ea66532d9b55b4f479bc 0aacb1763613dc2868497e42fa4bc08271c8ca401b5013605a547cf31c0d8228 GovernanceContract
Expense Payment 1b4ccd8677e981bc53e2932699b205fb580f05f3fff427161a492b7b0eb85c04 0aacb1763613dc2868497e42fa4bc08271c8ca401b5013605a547cf31c0d8228 ExpenseContract
Income Distribution b4ccc591fe8e7b87967132b6de83aeaf18e806d886249cf25ea017f81a664375 773993aa3a212a28e18b3be3601f0164c4a6580868dea632fec02280e6d18715 DistributionContract

Implementation Workflow

This implementation demonstrates the power of blockchain technology for fractional ownership and management of real-world assets. By following the transaction sequence above, we create a fully transparent, auditable record of all activities related to the property, from purchase to governance to income distribution.

The Cardano blockchain provides the perfect platform for this use case due to its:

  1. Native token functionality (simplified asset creation)
  2. Plutus smart contract capability (secure governance)
  3. Low transaction fees (efficient operations)
  4. Strong consistency guarantees (reliable record-keeping)

To execute this implementation on the Cardano preprod network, we'll use the Blockfrost API (project ID: preprodGLOrJOlqUt1HBVbDhBTEh9oq7GVUBszv) and our custom scripts to interact with the smart contracts.