Blockchain Validated Asset Metadata (BVAM)

I’ve been working on a standard to securely attach metadata to numeric and non-numeric tokens…

Blockchain Validated Asset Metadata

Blockchain Validated Asset Metadata (BVAM) is a method which allows Counterparty Token metadata to be stored off-blockchain yet still be verifiable and inalterable.

http://xcp.ninja is a proof of concept server for creating and storing BVAM json files.

Example BVAM json, http://xcp.ninja/hash/TB2rTB5FdLtqYu31wTmKgy54TYeZSqJgr3.json

Referenced Counterparty Asset, https://counterpartychain.io/asset/A11161111624187815485

Method

  1. A third party service(s) hosts a JSON file with Enhanced Asset info (this is inline with the current protocol).

  2. When issuing a new asset in Counterparty, the asset description references the hash of the stringify’d enhanced asset JSON data (instead of referencing the URL of the JSON file in the asset description). To save space, the SHA256 hash is encoded, similar to a bitcoin public key but with the version numbered altered to display a “T” as the first character instead of a “1”.

    Example BVAM hash: TB2rTB5FdLtqYu31wTmKgy54TYeZSqJgr3

    var jsondata = '{"ownername":"ABC Inc.","ownertwitter":"@abcinc","owneraddress":"1GcFhAQGFZVDAr4jiR2tKwisHcgNUjhGNC","asset":"A11161111624187815485","assetname":"Widget","assetdescription":"Good for one widget.","assetwebsite":"http://abcwidgets.com"}'
    
    var firstSHA = Crypto.SHA256(jsondata)
    
    var hash160 = Crypto.RIPEMD160(Crypto.util.hexToBytes(firstSHA))
    var version = 0x41 // "T"
    var hashAndBytes = Crypto.util.hexToBytes(hash160)
    hashAndBytes.unshift(version)
    
    var doubleSHA = Crypto.SHA256(Crypto.util.hexToBytes(Crypto.SHA256(hashAndBytes)))
    var addressChecksum = doubleSHA.substr(0,8)
    
    var unencodedAddress = "41" + hash160 + addressChecksum
    
    var address = Bitcoin.Base58.encode(Crypto.util.hexToBytes(unencodedAddress))
    

    http://jsfiddle.net/k0jk49km/

  3. The hash is prefixed in the asset description with “TOKNID-” for wallet software to identify that an asset has associated BVAM. This represents a 41-byte asset description.

    Example Asset Description: TOKNID-TB2rTB5FdLtqYu31wTmKgy54TYeZSqJgr3

  4. Wallet software can query any third party service and trust that the data is valid without the need to trust the source. This is accomplished by independently verifying the data hash within the wallet using the method in Step 2.

  5. BVAM must define, at a minimum, the ‘asset’ element within the JSON data. This conforms to the current Counterparty Enhanced Asset Info documentation. Additional elements should be standardize to some extent but can also be customized to meet the needs of each wallet provider.

3 Likes

Fantastic!

Edit: By the way, does 5) mean that a BVAM could be unique to an asset, but (if more than the minimum is specified) to an individual token as well (so that, for example, one can have an asset with the circulation of 2 in which each token has a different BVAM property?)

The associated BVAM is linked by the hash in the asset description so it would apply equally to all individual tokens of an asset.

The latest update to the Tokenly Pockets repo incorporates enhanced numeric assets with BVAM. It also includes integration with http://xcp.ninja for streamlined asset issuance. It’s still in testing so it filters numeric assets to only display those beginning with “A111” that have BVAM stored at xcp.ninja.

2 Likes

Nice work as always Joe :slight_smile: