{"id":15606,"date":"2025-04-01T12:54:00","date_gmt":"2025-04-01T12:54:00","guid":{"rendered":"https:\/\/hederav2stg.wpenginepowered.com\/blog\/how-can-we-model-a-building-in-web3\/"},"modified":"2025-12-08T18:08:03","modified_gmt":"2025-12-08T18:08:03","slug":"how-can-we-model-a-building-in-web3","status":"publish","type":"post","link":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/","title":{"rendered":"How Can We Model a Building in Web3?"},"content":{"rendered":"<div class=\"body-text BodyCopy mb-40 style-1\">\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><em>REITs in Web3<\/em><\/h4>\n<p><em>Part 1: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/how-would-we-build-a-reit-today-using-web3-technologies\" href=\"https:\/\/hedera.com\/blog\/how-would-we-build-a-reit-today-using-web3-technologies\" rel=\"noopener noreferrer\" target=\"_blank\">How Would We Build a REIT Today Using Web3 Technologies?<\/a><br \/>Part 2: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/how-is-tokenization-changing-the-way-we-invest\" href=\"https:\/\/hedera.com\/blog\/how-is-tokenization-changing-the-way-we-invest\" rel=\"noopener noreferrer\" target=\"_blank\">How Is Tokenization Changing The Way We Invest?<\/a><strong><br \/>Part 3: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\" href=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\" rel=\"noopener noreferrer\" target=\"_blank\">How Can We Model a Building in Web3?<\/a><\/strong><br \/>Part 4: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3-continued\" href=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3-continued\" rel=\"noopener noreferrer\" target=\"_blank\">How Can We Model a Building in Web3? (Continued)<\/a><br \/>Part 5: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/reimagining-reit-cashflows\" href=\"https:\/\/hedera.com\/blog\/reimagining-reit-cashflows\" rel=\"noopener noreferrer\" target=\"_blank\">Reimagining REIT Cashflows: Managing Revenue and Expenses in Web3<\/a><br \/>Part 6: <a data-sk=\"tooltip_parent\" data-stringify-link=\"https:\/\/hedera.com\/blog\/governance-jurisdiction-in-tokenized-real-estate\" href=\"https:\/\/hedera.com\/blog\/governance-jurisdiction-in-tokenized-real-estate\" rel=\"noopener noreferrer\" target=\"_blank\">Governance &amp; Jurisdiction in Tokenized Real Estate<\/a><\/em><br \/><em><em>Part 7: <\/em><a href=\"https:\/\/hedera.com\/blog\/slices-building-the-web3-real-estate-index-fund\">Slices: Building The Web3 Real Estate Index Fund<\/a><\/em><\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\">REITs in Web3: Part 3<\/h4>\n<p>In our <a href=\"https:\/\/hedera.com\/blog\/how-would-we-build-a-reit-today-using-web3-technologies\"><strong>first post<\/strong><\/a> in this series, we explored how Web3 technologies could be used to build a modern REIT with tokenized real estate assets. In our <a href=\"https:\/\/hedera.com\/blog\/how-is-tokenization-changing-the-way-we-invest\"><strong>second post<\/strong><\/a>, we discussed tokenization in general and how both non-fungible tokens (NFTs) and fungible tokens can each play a role in real estate.<\/p>\n<p dir=\"ltr\">Today, let\u2019s focus on a single question:<\/p>\n<p dir=\"ltr\"><strong><em>How do we actually model an individual building on-chain?<\/em><\/strong><\/p>\n<p dir=\"ltr\">In our implementation, a building would &#8211; at a high level &#8211; be represented by a custom contract that would be the \u2018owner\u2019 of connected, supporting contracts that enable the functionalities of the building itself and its stakeholders.<\/p>\n<p dir=\"ltr\">Each building would be a set of contracts that would allow it to independently manage itself in a decentralized fashion. We decided that a NFT should be used to specify all the metadata about the building, so that standard NFT tools could use that data in a common way. Therefore, each building could be thought of as a NFT in a NFT collection. A Building NFT in such a collection will have its assigned metadata, but a building will also have at least one assigned vault, a treasury, building tokens representing shares for this building, and a related governance contract to make the entire solution work.<\/p>\n<p dir=\"ltr\">So while many of the fundamentals are already familiar from the first and second posts in this series, here we introduce the nitty-gritty of \u201cbuilding deployment.\u201d We\u2019ll discuss three key pieces:<\/p>\n<ol>\n<li dir=\"ltr\">\n<p dir=\"ltr\"><strong>Representing the physical building on chain<\/strong><\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\"><strong>Representing real-world property data<\/strong> &#8211; For example: a pinned JSON file in IPFS (via <a href=\"https:\/\/pinata.cloud\/\">Pinata<\/a>, Filecoin, or other decentralized storage solutions) and the on-chain references to that data.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\"><strong>Deploying the building<\/strong> &#8211; Using a \u201cbuilding factory\u201d contract that automatically creates the building\u2019s metadata NFT (and other parts to be discussed in later articles).<\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\">\n<p dir=\"ltr\">We\u2019ll walk through code snippets drawn from the<a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\"> Hedera Accelerator DeFi EIP repository<\/a> to show how these ideas come to life, especially <a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\/blob\/main\/contracts\/erc721\/ERC721Metadata.sol\">ERC721Metadata.sol<\/a> &amp; everything in the <a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\/tree\/main\/contracts\/buildings\">buildings contract <\/a>subdirectory.<\/p>\n<p dir=\"ltr\">\n<p dir=\"ltr\">This codebase is still in progress and therefore unaudited, but the logic of how to deploy a building is there and ready to be examined. As we move on in this series, this repository will grow and be polished on a rolling basis, and we will also introduce the frontend in the coming weeks.<\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>1.<\/strong> <strong>Modeling the Building NFT (ERC-721)<\/strong><\/h4>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><\/h4>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>A Physical Asset, Off-Chain<\/strong><\/h4>\n<p dir=\"ltr\">At the core of this entire process is a physical property: the actual building sitting at some address in the real world. This building has a certain location and size in square feet, has been built in a certain year, and can be in a residential or urban area.<\/p>\n<p dir=\"ltr\">All these attributes matter tremendously in real estate investments, but the challenge is making them discoverable and provable in the context of the blockchain. That\u2019s where the NFT comes in.<\/p>\n<p dir=\"ltr\">Each property is represented by a NFT<strong>.<\/strong> We issue one NFT per building, so each NFT is truly unique, just like the real-world building it represents.<\/p>\n<p dir=\"ltr\">This NFT is more than a collectible image, and serves multiple purposes:<\/p>\n<ul>\n<li><strong>Represents ownership\/management<\/strong>: The address that holds the NFT can be considered the \u201cmanager\u201d or \u201cowner\u201d of the building\u2019s on-chain identity.<\/li>\n<li><strong>Enforces permissions<\/strong>: For example, only the NFT holder might be allowed to update the building\u2019s metadata or freeze certain fields.<\/li>\n<li><strong>Links to deeper data<\/strong>: The NFT can store small bits of on-chain metadata or reference large documents in decentralized storage like IPFS.<\/li>\n<\/ul>\n<p dir=\"ltr\">Hence, the NFT acts as a digital title that can be transferred or traded, bridging the physical asset with the programmable world of smart contracts.<\/p>\n<p dir=\"ltr\">\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>2.<\/strong> <strong>Modeling the Buildings Metadata<\/strong><\/h4>\n<p dir=\"ltr\">When we talk about \u201cmodeling a building\u201d, we\u2019re not talking about 3D graphics. We\u2019re talking about capturing the property\u2019s essential details &#8211; location, year built, local regulations, or even high-res images &#8211; and representing them on-chain in a consistent way.<\/p>\n<p dir=\"ltr\">They will most probably be key\/value pairs, for instance:<\/p>\n<ul>\n<li><strong>location<\/strong>: &#8220;123 Main Street&#8221;<\/li>\n<li><strong>size<\/strong>: &#8220;850 sqft&#8221;<\/li>\n<li><strong>yearBuilt<\/strong>: &#8220;2010&#8221;<\/li>\n<li><strong>status<\/strong>: &#8220;UnderConstruction&#8221; or &#8220;Completed&#8221;<\/li>\n<\/ul>\n<p dir=\"ltr\">If we look into our codebase, we can see that the<a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\/blob\/main\/contracts\/erc721\/ERC721Metadata.sol\"> <strong>ERC721Metadata<\/strong><\/a> contract exposes the following function:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function setMetadata(uint256 tokenId, string memory key, string memory value)\n\texternal\n\tonlyTokenOwner(tokenId)\n\twhenUnfrozen(tokenId)\n{\n\t_setMetadata(tokenId, key, value);\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">onlyTokenOwner(tokenId) ensures that whoever sets or updates metadata controls the building\u2019s NFT, and whenUnfrozen(tokenId) means that if the metadata is \u201cfrozen,\u201d no further edits can be made, guaranteeing immutability for certain fields once finalized.<\/p>\n<p dir=\"ltr\">From then on, any contract or frontend can query those fields like this:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function getMetadata(\n\tuint256 tokenId,\n\tstring memory key\n)\n\tpublic\n\tview\n\treturns (string memory)\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">And retrieve exactly what was stored.<\/p>\n<p dir=\"ltr\">There may actually be multiple NFT collections being created:<\/p>\n<ol>\n<li dir=\"ltr\">\n<p dir=\"ltr\">The NFT containing the demographics (name\/title\/size)<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">The NFT containing the insurance information (also called <a href=\"https:\/\/www.investopedia.com\/terms\/c\/cope-insurance.asp\"><strong>COPE<\/strong><\/a> data).<\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\">ERC-721 is flexible enough to represent different categories of metadata. You can mint as many NFTs as needed, some purely for \u201clegal doc references,\u201d others for \u201cdemographic info,\u201d etc.<\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>Off-Chain Storage (IPFS)<\/strong><\/h4>\n<p dir=\"ltr\">In most scenarios, you don\u2019t want to store large documents or images directly on-chain (that can get expensive, fast). Instead, we use InterPlanetary File System (IPFS) or a pinning service like Pinata to store those bigger files. Then, the on-chain contract keeps track of the IPFS \u201ccontent identifier\u201d (CID).<\/p>\n<p dir=\"ltr\">The diagram below (imagine Diagram #1) shows how a typical flow might work: <\/p>\n<ol><\/ol>\n<\/div>\n<figure class=\"blog-image mb-40\"><img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60061_BlogIllustrations_REIT1.png\" alt=\"\"\/><\/figure>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<ol>\n<li dir=\"ltr\">\n<p dir=\"ltr\">You upload your building\u2019s JSON file, perhaps including an address, square footage, images, and any compliance docs, to IPFS\/Pinata.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">Pinata returns a CID or gateway URL, e.g. ipfs:\/\/Qm1234&#8230;.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">Your smart contract stores that CID or URL in a mapping (tokenID \u2192 string) so that the building\u2019s NFT can always reference it.<\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\">In the repo, the<a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\/blob\/main\/contracts\/erc721\/ERC721Metadata.sol\"> ERC721Metadata<\/a> examples show how an NFT can have a tokenURI or a metadata K\/V store that points off-chain. A snippet might look like this:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function setTokenURI(uint256 tokenId, string memory uri) external onlyOwner {\n\trequire(_exists(tokenId), \"ERC721: URI set of nonexistent token\");\n\t_tokenURIs[tokenId] = uri;\n\temit MetadataUpdated(tokenId, uri);\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">Then, when minting the building NFT, you can provide a tokenURI (e.g., ipfs:\/\/Qm123abc&#8230;) that points to a JSON document in IPFS. For example:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">{\n  \"name\": \"Building at 123 Main Street\",\n  \"description\": \"A multi-unit residential property built in 2010\",\n  \"image\": \"ipfs:\/\/QmSomeHashForThePhoto\",\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">The NFT\u2019s contract can store just the tokenURI, while the heavy lifting (the actual file or JSON) resides off-chain. This is cost-effective and ensures large data can still be accessed via decentralized means.<\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>A Note on Dynamic vs. Immutable Metadata<\/strong><\/h4>\n<p dir=\"ltr\">Buildings in the real world change. They might undergo renovations or expansions; occupancy might vary over time. The NFT\u2019s metadata should be able to reflect that. In many systems, you might have:<\/p>\n<ul>\n<li><strong>Mutable metadata<\/strong>: Fields like \u201cstatus\u201d or \u201coccupancy\u201d that can be updated by the NFT owner. <\/li>\n<li><strong>Immutable fields<\/strong>: Some data (like \u201cyearBuilt\u201d) doesn\u2019t really change. You can \u201cfreeze\u201d them so the historical record remains intact.<\/li>\n<\/ul>\n<p dir=\"ltr\">This balance ensures your on-chain building identity remains accurate over time while preserving critical historical facts.<\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>The Power of Indexed Metadata<\/strong><\/h4>\n<p>A real estate platform with <em>thousands<\/em> of building NFTs needs a way to find properties by certain attributes. Our demo application\u2019s approach can support:<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">function filterTokens(string memory key, string memory value) external view returns (TokenDetails[] memory)\n{\n\tuint256[] memory tokenIds = metadataIndex[_keyValueHash(key, value)];\n\treturn _getTokenDetails(tokenIds);\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">This means if you\u2019re building a frontend, you can easily run queries like \u201cShow me all buildings where status=UnderConstruction\u201d or \u201cFind all buildings with size &gt;= 1,000 sq ft.\u201d<\/p>\n<p dir=\"ltr\"><em>Note:<\/em> Real on-chain filtering may require a bit of indexing or an off-chain indexer. The method above is a simplified example showing how to store references for more advanced filtering in your UI.<\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>Practical Example: Minting, Updating, and Freezing<\/strong><\/h4>\n<p>Let\u2019s say you\u2019re onboarding a new property:<\/p>\n<p><strong>1. Mint the Building NFT<\/strong>:<\/p>\n<ol><\/ol>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">buildingFactory.newBuilding(\"ipfs:\/\/QmXYZ...\")\n\/\/ Deploys building contract + mints tokenId=1 for that property\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p><strong>2. Set Basic Metadata:<\/strong><\/p>\n<ol><\/ol>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">building.setMetadata(1, \"location\", \"123 Main Street\");\nbuilding.setMetadata(1, \"yearBuilt\", \"2010\");\nbuilding.setMetadata(1, \"status\", \"UnderConstruction\");\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p><strong>3. Later Update<\/strong> (e.g. construction completed):<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">building.setMetadata(1, \"status\", \"Completed\");\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\"><strong>4. Freeze<\/strong> (once you want to lock something):<\/p>\n<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">building.freezeMetadata(1);\n\/\/ \"yearBuilt\" can no longer be changed, ensuring historical integrity\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<p dir=\"ltr\">Meanwhile, the tokenURI might point to an IPFS JSON with pictures and additional off-chain data &#8211; like the insurance binder or scanned floor plans. <\/p>\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>3. Deploying the Building (and Its Tokens)<\/strong><\/h4>\n<p>Storing metadata is just half the story. We also need to mint a &#8220;building token&#8221; that investors can buy, sell, or hold to represent partial ownership of that property, as well as contracts to receive yield, pay expenses and govern the day to day activities of the properties like spending and policy changes.<\/p>\n<p>Instead of manually deploying each building&#8217;s contracts by hand, we can automate the whole process with a &#8220;factory&#8221; contract. Conceptually, for our building NFT, it might look like this:<\/p>\n<\/div>\n<figure class=\"blog-image mb-40\"><img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60061_BlogIllustrations_REIT2_V2.png\" alt=\"\"\/><\/figure>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<ol>\n<li dir=\"ltr\">\n<p dir=\"ltr\"><strong><\/strong>The admin (or DAO) calls the factory contract with info such as the building name, the IPFS CID, and desired token parameters (total supply, share token name, etc.)<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\"><strong><\/strong>The factory mints an ERC-721 building NFT that references the building\u2019s metadata in IPFS.<\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\">At a high level, each building now has an unique NFT that identifies it, with pointers to real-world data.<\/p>\n<p dir=\"ltr\">From a coding standpoint, you can see how we piece it together in the <a href=\"https:\/\/github.com\/hashgraph\/hedera-accelerator-defi-eip\/blob\/main\/contracts\/buildings\/BuildingFactory.sol\">Hedera Accelerator DeFi EIP repo<\/a>. The building factory is just one example of how to orchestrate multiple contracts behind a single, user-friendly function call.<\/p>\n<p dir=\"ltr\">When looking through the repository, you will see references to the vault, as well as the treasury and governance and other pieces. Don\u2019t worry &#8211; as this series progresses, more and more will be explained. For the purpose of this week\u2019s blog post, however, we will solely focus on one function of the BuildingFactory contract:<\/p>\n<p dir=\"ltr\"><strong>newBuilding(tokenURI),<\/strong> which deploys a new \u201cBuilding\u201d contract (via BeaconProxy, for instance), and mints an ERC-721 NFT that references tokenURI for IPFS metadata.<\/p>\n<\/div>\n<div class=\"hedera-code-window\" style=\"background-image:url('https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg');padding:24px;border-radius:8px;margin:24px 0;\">\n<p>  <!-- Hidden image so WP All Import downloads this background image into Media Library --><br \/>\n  <img decoding=\"async\" src=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/CodeSnippetBackground-scaled.jpg\" alt=\"code window background\" style=\"display:none;\" \/><\/p>\n<div class=\"code-window-header\">\n<div class=\"code-window-title\"><\/div>\n<div class=\"code-window-body\"><\/div>\n<\/p><\/div>\n<pre><code class=\"language-javascript\">\/**\n * newBuilding Creates new building with create2, mints NFT and store it.\n * @param tokenURI metadata location\n *\/\nfunction newBuilding(string memory tokenURI) public virtual {\n\tBuildingFactoryStorage storage $ = _getBuildingFactoryStorage();\n\tBeaconProxy buildingProxy = new BeaconProxy(\n    \t$.buildingBeacon,\n    \tabi.encodeWithSelector(Building.initialize.selector, $.uniswapRouter, $.uniswapFactory, $.nft)\n\t);\n\n\tuint256 tokenId = IERC721Metadata($.nft).mint(address(buildingProxy), tokenURI);\n\taddress identity = IdentityGateway($.onchainIdGateway).deployIdentityForWallet(address(buildingProxy));\n\n\t$.buildingDetails[address(buildingProxy)] = BuildingInfo(\n    \taddress(buildingProxy),\n    \ttokenId,\n    \ttokenURI,\n    \tidentity,\n    \taddress(0) \/\/ ERC3643 token lazy deploy\n\t);\n\n\t$.buildingsList.push($.buildingDetails[address(buildingProxy)]);   \n\n\temit NewBuilding(address(buildingProxy));\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"body-text BodyCopy mb-40 style-1\">\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>Building Creation at a Glance<\/strong><\/h4>\n<\/p>\n<ul>\n<li dir=\"ltr\">\n<p dir=\"ltr\">A proxy contract is deployed for the new building.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">A unique NFT is minted and owned by that building contract, linking real-world property metadata to this on-chain representation.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">An optional identity is established for compliance or identity checks.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">All these details are stored in the factory\u2019s state and logged via an event.<\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\">That\u2019s the entire \u201cbirth\u201d process of a new on-chain building in your system!<\/p>\n<p dir=\"ltr\">\n<h4 class=\"color-ultraviolet\" dir=\"ltr\"><strong>The Bigger Picture<\/strong><\/h4>\n<p dir=\"ltr\">After reading this post, you should see how:<\/p>\n<ul>\n<li><strong>Physical attributes<\/strong> map to on-chain metadata (small, crucial fields).<\/li>\n<li><strong>Large documents<\/strong> (floor plans, insurance, COPE data) or even the entire metadata sit in IPFS or similar.<\/li>\n<li><strong>An NFT<\/strong> ties it all together, acting as the building\u2019s \u201cdigital identity.\u201d<\/li>\n<li><strong>A Building Factory<\/strong> automates the heavy lifting &#8211; deploying a building contract, minting the NFT, and more<\/li>\n<\/ul>\n<p dir=\"ltr\">In future posts, we\u2019ll cover more capabilities of the building factory and see how these NFTs connect to vaults that distribute rental income, how governance can let token holders vote on renovations, and how composability unlocks DeFi-style possibilities.<\/p>\n<p dir=\"ltr\"><strong>Happy Building!<\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p dir=\"ltr\">In our first post in this series, we explored how Web3 technologies could be used to build a modern REIT with tokenized real estate assets. In our second post, we discussed tokenization in general and how both non-fungible tokens (NFTs) and fungible tokens can each play a role in real estate. Today, let\u2019s focus on a single question: How do we actually model an individual building on-chain?<\/p>\n","protected":false},"author":10,"featured_media":16690,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[1],"tags":[],"ppma_author":[43],"class_list":["post-15606","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Can We Model a Building in Web3? | Hedera<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Can We Model a Building in Web3? | Hedera\" \/>\n<meta property=\"og:description\" content=\"In our first post in this series, we explored how Web3 technologies could be used to build a modern REIT with tokenized real estate assets. In our second post, we discussed tokenization in general and how both non-fungible tokens (NFTs) and fungible tokens can each play a role in real estate. Today, let\u2019s focus on a single question: How do we actually model an individual building on-chain?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\" \/>\n<meta property=\"og:site_name\" content=\"Hedera\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-01T12:54:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-08T18:08:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hedera Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\"},\"author\":{\"name\":\"Hedera Team\",\"@id\":\"https:\/\/hedera.com\/#\/schema\/person\/2dc6146f9f20a44d3de58c834d52e9f4\"},\"headline\":\"How Can We Model a Building in Web3?\",\"datePublished\":\"2025-04-01T12:54:00+00:00\",\"dateModified\":\"2025-12-08T18:08:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\"},\"wordCount\":1788,\"publisher\":{\"@id\":\"https:\/\/hedera.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\",\"url\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\",\"name\":\"How Can We Model a Building in Web3? | Hedera\",\"isPartOf\":{\"@id\":\"https:\/\/hedera.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png\",\"datePublished\":\"2025-04-01T12:54:00+00:00\",\"dateModified\":\"2025-12-08T18:08:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage\",\"url\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png\",\"contentUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hedera.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Can We Model a Building in Web3?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hedera.com\/#website\",\"url\":\"https:\/\/hedera.com\/\",\"name\":\"Hedera\",\"description\":\"Hello future\",\"publisher\":{\"@id\":\"https:\/\/hedera.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hedera.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/hedera.com\/#organization\",\"name\":\"Hedera\",\"url\":\"https:\/\/hedera.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hedera.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png\",\"contentUrl\":\"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png\",\"width\":500,\"height\":375,\"caption\":\"Hedera\"},\"image\":{\"@id\":\"https:\/\/hedera.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Can We Model a Building in Web3? | Hedera","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/","og_locale":"en_US","og_type":"article","og_title":"How Can We Model a Building in Web3? | Hedera","og_description":"In our first post in this series, we explored how Web3 technologies could be used to build a modern REIT with tokenized real estate assets. In our second post, we discussed tokenization in general and how both non-fungible tokens (NFTs) and fungible tokens can each play a role in real estate. Today, let\u2019s focus on a single question: How do we actually model an individual building on-chain?","og_url":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/","og_site_name":"Hedera","article_published_time":"2025-04-01T12:54:00+00:00","article_modified_time":"2025-12-08T18:08:03+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png","type":"image\/png"}],"author":"Hedera Team","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#article","isPartOf":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/"},"author":{"name":"Hedera Team","@id":"https:\/\/hedera.com\/#\/schema\/person\/2dc6146f9f20a44d3de58c834d52e9f4"},"headline":"How Can We Model a Building in Web3?","datePublished":"2025-04-01T12:54:00+00:00","dateModified":"2025-12-08T18:08:03+00:00","mainEntityOfPage":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/"},"wordCount":1788,"publisher":{"@id":"https:\/\/hedera.com\/#organization"},"image":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage"},"thumbnailUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/","url":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/","name":"How Can We Model a Building in Web3? | Hedera","isPartOf":{"@id":"https:\/\/hedera.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage"},"image":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage"},"thumbnailUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png","datePublished":"2025-04-01T12:54:00+00:00","dateModified":"2025-12-08T18:08:03+00:00","breadcrumb":{"@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#primaryimage","url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png","contentUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1.png","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/hedera.com\/blog\/how-can-we-model-a-building-in-web3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hedera.com\/"},{"@type":"ListItem","position":2,"name":"How Can We Model a Building in Web3?"}]},{"@type":"WebSite","@id":"https:\/\/hedera.com\/#website","url":"https:\/\/hedera.com\/","name":"Hedera","description":"Hello future","publisher":{"@id":"https:\/\/hedera.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hedera.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/hedera.com\/#organization","name":"Hedera","url":"https:\/\/hedera.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hedera.com\/#\/schema\/logo\/image\/","url":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png","contentUrl":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/09\/hedera_logo.png","width":500,"height":375,"caption":"Hedera"},"image":{"@id":"https:\/\/hedera.com\/#\/schema\/logo\/image\/"}}]}},"featured_image_src":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1-600x400.png","featured_image_src_square":"https:\/\/hedera.com\/wp-content\/uploads\/2025\/12\/HH60074_How-CanWeModelABuildingInWeb3-v1.1-600x600.png","author_info":{"display_name":"Hedera Team","author_link":"https:\/\/hedera.com\/blog\/author\/hedera-team\/"},"authors":[{"term_id":43,"user_id":10,"is_guest":0,"slug":"hedera-team","display_name":"Hedera Team","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/7ed01931dc9498365746508c4ca49ed0507ef65e04e0b82ffe88c50ef9242b1d?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":""}],"_links":{"self":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts\/15606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/comments?post=15606"}],"version-history":[{"count":0,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/posts\/15606\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/media\/16690"}],"wp:attachment":[{"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/media?parent=15606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/categories?post=15606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/tags?post=15606"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/hedera.com\/wp-json\/wp\/v2\/ppma_author?post=15606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}