AssetSupportNetwork

From Ravencoin Wiki
Revision as of 14:59, 12 December 2018 by TronBlack (talk | contribs)
Jump to navigation Jump to search

Asset Support in the Ravencoin Network

The Ravencoin network consists of nodes communicating on port 8767.

The asset information is available by request on the network. Specify a list of asset names to request information about each asset. Requests for information on up to 512 assets can be made per request. Return messages will be sent separately. Asset not found information may be grouped together for optimization.

Information about each asset is important for:

  • Asset creation because assets must be unique
  • Asset display because the asset information contains the number of decimal places to display.
  • Asset meta-data display - Requires the IPFS hash to show additional information about the asset.
  • Asset re-issue status to prevent reissuance attempts on a locked asset.
  • Asset qty issued to prevent reissuance attempts on a fully issued (21 billion) asset.

There are three networks:
Mainnet which uses a network identifier RAVN
Testnet which uses a network identifier RVNT
RegTest which uses a network identifier CROW

An additional command has been added to the network for asset support. This can be used by SPV nodes to get information about assets without interacting with a centralized API or a Remote Procedure Call.

getassetdata

The following is the specification for this new network call - available starting with network version 70018

Example 1: Request for asset name that doesn't exist

   Request -> getassetdata
   HEADER: 43524f5767657461737365746461746110000000571db430
   DATA: 010e4241445f41535345545f4e414d45
   Data Breakdown:
   01 - Varint size of the vector
   0e - Size of element = e.g. 14 Bytes
   4241445f41535345545f4e414d45 - Name of asset = e.g. "BAD_ASSET_NAME"
   --------------------------------------------------------------------
   Response -> asstnotfound
   HEADER: 43524f57617373746e6f74666f756e6410000000571db430
   DATA: 010e4241445f41535345545f4e414d45
   Data Breakdown:
   01 - Varint size of the vector
   Oe - Size of element = e.g. 14 Bytes
   4241445f41535345545f4e414d45 - Name of asset = e.g. "BAD_ASSET_NAME"

Example 2: Request for asset name that does exist, and an asset that doesn't exist

   Request -> getassetdata
   HEADER: 43524f576765746173736574646174611d0000004a54c291
   DATA: 020c41535345545f4a4552454d590e4241445f41535345545f4e414d45
   Data Breakdown:
   02 - Varint size of the vector
   0c - Size of element = e.g. 12 Bytes
   41535345545f4a4552454d59 - Name of asset = e.g. "ASSET_JEREMY"
   0e - Size of element = e.g. 14 Bytes
   4241445f41535345545f4e414d45 - Name of asset = e.g. "BAD_ASSET_NAME"
   --------------------------------------------------------------------
   

First Response -> assetdata

   HEADER: 43524f576173736574646174610000001d000000200a58aa
   DATA: 0c41535345545f4a4552454d5900e1f50500000000 00010000f5010000
   Data Breakdown:
   0c - Size of name = e.g. 12 Bytes
   41535345545f4a4552454d59 - Name of asset = e.g. "ASSET_JEREMY"
   00e1f50500000000 - Amount = e.g. 100000000
   00 - Units = e.g. 0
   01 - Reissuable = e.g. 1
   00 - hasIPFS = e.g. 0
   00 - Size of IPFS hash 
   f5010000 - Block height


Second Response -> asstnotfound

   HEADER: 43524f57617373746e6f74666f756e6410000000571db430
   DATA: 010e4241445f41535345545f4e414d45
   Data Breakdown:
   01 - Varint size of the vector
   Oe - Size of element = e.g. 14 Bytes
   4241445f41535345545f4e414d45 - Name of asset = e.g. "BAD_ASSET_NAME"

Examples 3: Request for asset name that contains an IPFS HASH

   Request -> getassetdata
   HEADER: 43524f5767657461737365746461746118000000e6218523
   DATA: 011641535345545f4a4552454d595f574954485f49504653
   Data Breakdown:
   01 - Varint size of the vector
   16 - Size of element = e.g. 22 Bytes
   41535345545f4a4552454d595f574954485f49504653 - Name of asset = e.g. "ASSET_JEREMY_WITH_IPFS"
   --------------------------------------------------------------------
   Response -> assetdata
   HEADER: 43524f5761737365746461746100000049000000cb345766
   DATA: 1641535345545f4a4552454d595f574954485f4950465300e1f50500000000000101221220da203afd5eda1f45deeafb70ae9d5c15907cd32ec2cd747c641fc1e9ab55b8e8f6010000
   Data Breakdown:
   16 - Size of name = e.g. 22 Bytes
   41535345545f4a4552454d595f574954485f49504653 - Name of asset = e.g. "ASSET_JEREMY_WITH_IPFS"
   00e1f50500000000 - Amount = e.g. 100000000
   00 - Units = e.g. 0
   01 - Reissuable = e.g. 1
   01 - hasIPFS = e.g. 0
   22 - Size of IPFS hash - 34 Bytes
   1220da203afd5eda1f45deeafb70ae9d5c15907cd32ec2cd747c641fc1e9ab55b8e8 - IPFS hash data
   f6010000 - Block height