You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attributes array often contains traits of the character.
The problem this setup is that the information contained in this metadata is not available on-chain.
The whole point of our work is to build on-chain games, which is why we have created things like the Inventory contract to represent attributes and items associated with an NFT in an on-chain registry.
That said, our contracts are not meant to be consumed only on-chain. We should make it easy for off-chain clients to read information related to our smart contract.
The Metadata Transformer is a server which will take the base metadata for an NFT (as returned by the tokenUri method on its ERC721 smart contract), modify the metadata JSON using on-chain data (such as what items are equipped in the inventory), and return this modified JSON as a response.
For example, if the character above (5p0rt5BEArD) had a hammer equipped in its weapon slot on an Inventory contract, the Metadata Transformer would transform the above metadata into:
This would be done dynamically at the time that metadata was requested from the Transformer based on the current state of the blockchain.
How do players interact with the Metadata Transformer?
Any user can make a request to the Transformer of the following form:
curl -X GET "https://api.moonstream.to/metadata?chain_id=1&contract_address=0x521f9C7505005CFA19A8E5786a9c3c9c9F5e6f42&token_id=5"
If this (chain_id, contract_address) pair has transformation logic registered on the Metadata transformer, it is applied, otherwise, the Metadata Transformer simply returns the tokens metadata URI as it is defined on the contract.
Why use the Metadata Transformer?
The Transformer would allow any game client to define modifications to an NFT collection's core metadata for the purposes of its consumption.
For example, a game developer could permissionlessly build a game for an NFT collection like Bored Apes, deploy a non-canonical Inventory contract for the collection, and transform the Bored Apes metadata to add in the equipped items on their non-canonical inventory for off-chain consumption.
Transformations do not need to only apply to textual attributes of the metadata json. For example, one could write a transformation that loaded the image from an NFT's image_url, converted it into an SVG, added layers onto it, and then returned a data URI for the new image to be served to clients consuming that transformation.
The metadata transformer makes it easier for games to move their metadata on-chain using tools like the Inventory contract by making it easy for this on-chain metadata to be consumed off-chain in the same way that all metadata is currently consumed off-chain.
The text was updated successfully, but these errors were encountered:
This fits in well with Ethereal NFT ERC721 relayers, as well.
Each ERC721 relayer would be a natural client of this service, with the Ethereal NFT metadata URI being the Metadata Transformer URI corresponding to the source collection.
Almost every NFT includes metadata accessible through the
tokenUri
view method, and the metadata looks like this:The
attributes
array often contains traits of the character.The problem this setup is that the information contained in this metadata is not available on-chain.
The whole point of our work is to build on-chain games, which is why we have created things like the Inventory contract to represent attributes and items associated with an NFT in an on-chain registry.
That said, our contracts are not meant to be consumed only on-chain. We should make it easy for off-chain clients to read information related to our smart contract.
The Metadata Transformer is a server which will take the base metadata for an NFT (as returned by the
tokenUri
method on its ERC721 smart contract), modify the metadata JSON using on-chain data (such as what items are equipped in the inventory), and return this modified JSON as a response.For example, if the character above (
5p0rt5BEArD
) had a hammer equipped in its weapon slot on an Inventory contract, the Metadata Transformer would transform the above metadata into:This would be done dynamically at the time that metadata was requested from the Transformer based on the current state of the blockchain.
How do players interact with the Metadata Transformer?
Any user can make a request to the Transformer of the following form:
curl -X GET "https://api.moonstream.to/metadata?chain_id=1&contract_address=0x521f9C7505005CFA19A8E5786a9c3c9c9F5e6f42&token_id=5"
If this
(chain_id, contract_address)
pair has transformation logic registered on the Metadata transformer, it is applied, otherwise, the Metadata Transformer simply returns the tokens metadata URI as it is defined on the contract.Why use the Metadata Transformer?
The Transformer would allow any game client to define modifications to an NFT collection's core metadata for the purposes of its consumption.
For example, a game developer could permissionlessly build a game for an NFT collection like Bored Apes, deploy a non-canonical Inventory contract for the collection, and transform the Bored Apes metadata to add in the equipped items on their non-canonical inventory for off-chain consumption.
Transformations do not need to only apply to textual attributes of the metadata json. For example, one could write a transformation that loaded the image from an NFT's
image_url
, converted it into an SVG, added layers onto it, and then returned a data URI for the new image to be served to clients consuming that transformation.The metadata transformer makes it easier for games to move their metadata on-chain using tools like the Inventory contract by making it easy for this on-chain metadata to be consumed off-chain in the same way that all metadata is currently consumed off-chain.
The text was updated successfully, but these errors were encountered: