There have been a handful of attempts to create standards around SLP token icons. All approaches prior to the PSF specifications relied on centralized services. The PS002 and PS007 specifications define the use of mutable (changable) data in SLP tokens. Inside this mutable data, a URL to the token icon can be placed. The big advantage of these specifications is that the token icon can be changed at any time by the token creator. It is permissionless, secure, and the process does not rely on any centralized services.
- This NFT Collector App shows examples of NFTs created using SLP tokens and mutable data (including token icons).
- You can make your own NFT with a token icon using this NFT Creator App
- The Token Explorer will retrieve data for a token.
- This video shows how to create tokens and NFTs with the psf-bch-wallet command-line application.
Below are examples of REST APIs and JavaScript libraries that can be used to easily implement token icons into your own application.
Token data (including icons) can be retrieved from a REST API server in the Web 3 Cash Stack array of back-end servers. Here is a list of redundent servers. The example below will work on any of those servers.
The big advantage of using a REST API is that it's programming-language agnostic. Every programming language can make a REST API call. Here is an example of retrieving token data with the curl
command line tool:
curl -H "Content-Type: application/json" -X POST -d '{ "tokenId": "4540a1abe8fc1cdcd92c199c454e6f67391e312de11d7b17f4f0ef3dcaf11e25" }' https://free-bch.fullstack.cash/bch/getTokenData2
The minimal-slp-wallet npm package can be used in JavaScript applications.
- Here is an example using it in the Browser
- Here is an example using it in node.js
- More sophisticated token usage examples are available for use with bch-js npm library.