{"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":"ERC-5219 defines an HTTP-like request interface for contract resources. Supporting clients pass a resource path and query parameters, then interpret the status, body and headers. A response can refer to off-chain resources, so contract hosting alone does not guarantee availability, browser compatibility or safe content.","officialUrl":"https://ercs.ethereum.org/ERCS/erc-5219","lastReviewed":"2026-09-18","lastUpdated":"2026-09-18","kind":"proposal","hasDetailedContent":true,"content":{"id":"ERC-5219","summary":"ERC-5219 defines an HTTP-like request interface for contract resources. Supporting clients pass a resource path and query parameters, then interpret the status, body and headers. A response can refer to off-chain resources, so contract hosting alone does not guarantee availability, browser compatibility or safe content.","applicability":{"whenToUse":["A contract implements request(resource, params) and a compatible client interprets its response.","Your resource UI needs status, content-type and missing-resource handling."],"whenToAvoid":["The client or target contract does not implement the required interface.","You need permanent, fully on-chain content or universal browser support from this interface alone."]},"designerTakeaways":["Design loading, HTTP-style status and unsupported-client states.","Show whether a body is served directly or refers to an external resource.","Keep content type, source and trust boundaries visible."],"problemsSolved":[{"problem":"Contract resource interfaces are inconsistent","oldWay":"Every contract needs custom request and response parsing","newWay":"Supporting clients use a standard resource path, parameters, status, body and headers","impact":"high"},{"problem":"Users cannot recover when a resource is missing","oldWay":"A failed read leaves an unexplained blank page","newWay":"Use the returned status and headers to explain missing, external or unsupported resources","impact":"high"}],"uxPatterns":[{"name":"Decentralized Static Site","description":"Multi-page website served from smart contract","userFlow":["User opens a resource in a compatible client","Client calls request with the resource path and query parameters","Contract returns a status code, body and headers","Client interprets Content-Type and any external-body reference","Show the content safely or explain why it cannot load"]},{"name":"Contract Resource Browser","description":"Explore available resources in a contract","userFlow":["Developer opens explorer","Enter contract address or ENS","Browse resources exposed by this application’s index, if it provides one","Preview each resource","Check MIME types and sizes","Link directly to any resource"]},{"name":"Decentralized App Interface","description":"Interactive dApp with contract-served UI","userFlow":["User visits web3:// URL","Contract returns a resource body or an external-body reference","UI shows real-time contract state","User enters action (deposit, etc)","Transaction goes to same contract","Display resource origin and retain independent content and transaction checks"]},{"name":"Resource Upload Interface","description":"Developer tool to deploy resources to contract","userFlow":["Developer connects wallet","Drop files to upload","Map files to URL paths","Review gas costs","Deploy to contract storage","A compatible client can request the resources through an appropriate URL mapping"]}],"uiComponents":[{"name":"ResourceRequest","description":"Makes and displays contract resource requests","states":["idle","loading","loaded","error","404"],"props":["contract","resource","params","onLoad","onError"]},{"name":"ContentRenderer","description":"Renders content based on MIME type","states":["loading","rendered","unsupported"],"props":["content","mimeType","sandbox"]},{"name":"ResourceExplorer","description":"Browse resources using an optional application-provided index; enumeration is not part of ERC-5219","states":["loading","loaded","empty","error"],"props":["contract","onSelect"]},{"name":"DeploymentWizard","description":"Application-specific uploader for a contract that supports storing resources","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":"Return Content-Type when known and render unknown or missing types under a safe fallback","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"}],"keyTakeaways":["Use the full request(resource, params) interface.","Render according to status, body and headers in a compatible client.","External-body responses can depend on off-chain resources.","Resource retrieval is not proof of safe content or trusted transaction behavior."],"technicalNotes":"ERC-5219 requires request(string[] memory resource, KeyValue[] memory params) external view returns (uint16 statusCode, string memory body, KeyValue[] memory headers). Each KeyValue has a key and value. Clients interpret HTTP-style status and headers, including Content-Type. A message/external-body response may refer to IPFS or other off-chain data. The standard does not require all content to live on-chain, provide resource enumeration, or guarantee browser/name-resolution support. Use a compatible client and apply content isolation and source checks.","lastUpdated":"2026-09-18","lastReviewed":"2026-09-18","specConstraints":[{"id":"url-resolution-privacy","constraint":"Following URL redirects can leak privacy-sensitive information when using decentralized-app URL resolution.","appliesTo":"application","normativity":"security-considerations","specQuote":"potential privacy leakage by following `3XX` redirects.","specSection":"Security Considerations","specUrl":"https://ercs.ethereum.org/ERCS/erc-5219#security-considerations","designImplication":"Warn before following external redirects and make the resolved destination visible before loading or sharing it."}],"sources":[{"label":"ERC-5219 official specification","url":"https://ercs.ethereum.org/ERCS/erc-5219","type":"official-spec"}]},"sources":[{"label":"Official specification","url":"https://ercs.ethereum.org/ERCS/erc-5219","type":"official-spec"},{"label":"Discussion search","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://ercs.ethereum.org/ERCS/erc-5219","discussion":"https://ethereum-magicians.org/search?q=ERC-5219"},"freshness":{"lastReviewed":"2026-09-18","lastUpdated":"2026-09-18"}}