{"id":"ERC-5219","name":"Contract Resource Requests","status":"Final","chain":"both","category":{"id":"comprehension","name":"Comprehension & Display","description":"Making blockchain data readable to humans"},"journeyStages":[{"id":"specialized","name":"Specialized Interactions","description":"Physical items, AI, social, gaming"}],"uxImpact":"Smart contracts serve web content directly — fully decentralized frontends without centralized hosting. Design implications: render contract-served HTML/CSS/JS in app frames, show content source (contract address), handle HTTP-like status codes and redirects from contracts. Design decisions: sandboxing/security for contract-served content, performance expectations vs traditional hosting, how to indicate decentralized vs centralized content to users, caching strategies for immutable content.","hasDetailedContent":true,"content":{"id":"ERC-5219","summary":"ERC-5219 defines how smart contracts can serve web resources like a traditional web server. A contract can respond to resource requests with HTML, CSS, JavaScript, images, or any content type. Combined with ERC-4804's web3:// URLs, this enables fully decentralized websites where the entire frontend lives on the blockchain, immune to takedowns and censorship.","applicability":{"whenToUse":["Your product addresses: smart contracts can't serve complex web content.","Your product addresses: no standard interface for contract-as-server.","The flow should deliver: contract serves complete HTML pages, CSS, JS, everything.","You are designing a decentralized static site experience with visible states and recovery paths."],"whenToAvoid":["Always return proper Content-Type with every response.","Return proper 404 with helpful \"resource not found\" page.","Chunk large resources, use SSTORE2/SSTORE3 patterns.","Users never see addresses, amounts, or signing payloads in your UI."]},"designerTakeaways":["You can design UI that delivers contract serves complete HTML pages.","You can standard request(path) interface all browsers/clients understand.","You can design UI that delivers route different paths to different resources: /about."],"problemsSolved":[{"problem":"Smart contracts can't serve complex web content","oldWay":"Contracts return raw data, external frontend interprets it","newWay":"Contract serves complete HTML pages, CSS, JS - everything","impact":"critical"},{"problem":"No standard interface for contract-as-server","oldWay":"Each project invents custom resource serving","newWay":"Standard request(path) interface all browsers/clients understand","impact":"high"},{"problem":"Can't host multiple pages/resources in one contract","oldWay":"Single response, single endpoint","newWay":"Route different paths to different resources: /about, /docs, /app","impact":"high"},{"problem":"No content type negotiation on-chain","oldWay":"Clients guess content type","newWay":"Contract specifies MIME type with each response","impact":"medium"}],"uxPatterns":[{"name":"Decentralized Static Site","description":"Multi-page website served from smart contract","mockup":"concept/physical-link","userFlow":["User visits web3:// URL","Browser requests / (home) from contract","Contract returns HTML with nav links","User clicks \"About\"","Browser requests /about from contract","Contract returns about page HTML"]},{"name":"Contract Resource Browser","description":"Explore available resources in a contract","mockup":"concept/physical-link","userFlow":["Developer opens explorer","Enter contract address or ENS","See all available resources","Preview each resource","Check MIME types and sizes","Link directly to any resource"]},{"name":"Decentralized App Interface","description":"Interactive dApp with on-chain UI","mockup":"concept/physical-link","userFlow":["User visits web3:// URL","Contract serves its own UI","UI shows real-time contract state","User enters action (deposit, etc)","Transaction goes to same contract","No frontend/backend trust gap"]},{"name":"Resource Upload Interface","description":"Developer tool to deploy resources to contract","mockup":"concept/physical-link","userFlow":["Developer connects wallet","Drop files to upload","Map files to URL paths","Review gas costs","Deploy to contract storage","Resources now served at web3:// URLs"]}],"uiComponents":[{"name":"ResourceRequest","description":"Makes and displays contract resource requests","states":["idle","loading","loaded","error","404"],"props":["contract","path","onLoad","onError"]},{"name":"ContentRenderer","description":"Renders content based on MIME type","states":["loading","rendered","unsupported"],"props":["content","mimeType","sandbox"]},{"name":"ResourceExplorer","description":"Browse contract's available resources","states":["loading","loaded","empty","error"],"props":["contract","onSelect"]},{"name":"DeploymentWizard","description":"Upload resources to ERC-5219 contract","states":["selecting","mapping","estimating","deploying","complete"],"props":["contract","files","onDeploy"]}],"antiPatterns":[{"pattern":"Not handling 404s gracefully","why":"Users see cryptic errors when resource doesn't exist","instead":"Return proper 404 with helpful \"resource not found\" page","severity":"high"},{"pattern":"Serving large resources without chunking","why":"Gas limits prevent loading large pages","instead":"Chunk large resources, use SSTORE2/SSTORE3 patterns","severity":"high"},{"pattern":"Missing MIME types in responses","why":"Browsers don't know how to render content","instead":"Always return proper Content-Type with every response","severity":"critical"},{"pattern":"No caching headers for static content","why":"Same content re-fetched on every visit","instead":"Include cache-control hints, content hashes for versioning","severity":"medium"},{"pattern":"Hardcoding external dependencies","why":"Defeats purpose if UI needs external CDN","instead":"Bundle all dependencies, or reference other on-chain resources","severity":"medium"}],"onMonad":[{"aspect":"Resource Loading","ethereum":"Large pages take 5-15 seconds to load","monad":"Sub-second page loads","designImplication":"On-chain websites feel as fast as traditional web"},{"aspect":"Storage Costs","ethereum":"Very expensive to store UI on-chain","monad":"Lower costs make larger sites practical","designImplication":"Can store more comprehensive UIs, more resources"},{"aspect":"Dynamic Content","ethereum":"Server-rendered dynamic content is slow","monad":"Dynamic contract responses remain fast","designImplication":"Can build more interactive, personalized on-chain UIs"},{"aspect":"Multi-Resource Pages","ethereum":"Page with 10 resources = 10 slow calls","monad":"Parallel resource fetching stays fast","designImplication":"Rich pages with many assets still load quickly"}],"keyTakeaways":["ERC-5219 = contracts serve web resources like servers","Combined with ERC-4804 enables fully decentralized frontends","Always return proper MIME types with responses","Handle missing resources with graceful 404 pages","On Monad: on-chain UIs load fast enough for real use"],"technicalNotes":"ERC-5219 defines the request(string[] memory resource) function that contracts implement to serve resources. It returns (uint16 statusCode, string memory body, KeyValue[] memory headers). Status codes follow HTTP conventions (200, 404, etc). Resources can be stored using efficient patterns like SSTORE2 for larger content. Works with ERC-4804 for the complete web3:// URL solution."},"sources":[{"label":"Official specification","url":"https://eips.ethereum.org/EIPS/eip-5219","type":"official-spec"},{"label":"Discussion","url":"https://ethereum-magicians.org/search?q=ERC-5219","type":"discussion"}],"urls":{"canonical":"https://www.eipsfordesigners.com/standards/ERC-5219","markdown":"https://www.eipsfordesigners.com/standards/ERC-5219/content.md","agent":"https://www.eipsfordesigners.com/standards/ERC-5219/agent.md","api":"https://www.eipsfordesigners.com/api/standards/ERC-5219","official":"https://eips.ethereum.org/EIPS/eip-5219","discussion":"https://ethereum-magicians.org/search?q=ERC-5219"},"freshness":{"lastReviewed":"2026-04-05","lastUpdated":"2026-04-05"}}