HomeGuidesChangelog
GuidesDiscussions & SupportGitHubLog In
These docs are for v4.1.0. Click to read the latest docs for v4.4.2.

Using Syscoin 4.0 Tokens

Introduction to Syscoin Assets

There has been some significant changes to Syscoin Assets in Syscoin 4.0. Please take a look below.

Requirements

Running a Syscoin Full Node with the following extra lines in the syscoin.conf file.
Changing syscoin.conf will require a restart with the argument "-reindex".

assetindex=1

Before Trading an Asset on Syscoin Platform

  1. Obtain the correct asset GUID.
    An asset has several properties to take note of. The most important one is the GUID of the asset.
    GUID is the unique ID of the asset. For example, the SYSX's official GUID is "719610612". This is unique. Anyone can create asset named SYSX", but there will only be one "SYSX" with GUID of "719610612". We can inspect the asset information with "assetinfo". We will be using this asset as an example for the rest of the guide.
$ syscoin-cli assetinfo 719610612
{
  "asset_guid": 719610612,
  "symbol": "SYSX",
  "txid": "96c19bddfe2275f62f776040775f5aa661ee52b7351a4b16750182369944c2ab",
  "public_value": "",
  "address": "tsys1qkctvxme3jwhx8ckxj8htpfyfnk8wa32vej9l0f",
  "contract": "0x2e80da144b22ac10517df6ca64fec1c843215255",
  "balance": 0.00000000,
  "total_supply": 888000000.00000000,
  "max_supply": 888000000.00000000,
  "update_flags": 20,
  "precision": 8,
  "total_supply_bridge": 0.00000000,
  "total_supply_spt": 0.00000000
}

Querying Syscoin Assets

To see the balance of an asset of an alias or an address, use assetallocationinfo. This function allows you to see the balance of the asset of ANY alias or ANY address. When you send an asset it becomes an asset allocation. As an exchange you will likely be working with asset allocations and not assets themselves. An asset is only update-able by the asset owner while asset allocations are portions of that asset given to an address which can then transfer to another alias.

$ syscoin-cli help assetallocationinfo
assetallocationinfo asset_guid "address"

Show stored values of a single asset allocation.

Arguments:
1. asset_guid    (numeric, required) The guid of the asset
2. address       (string, required) The address of the owner

Result:
{
    "asset_allocation":   (string) The unique key for this allocation
    "asset_guid":         (string) The guid of the asset
    "symbol":             (string) The asset symbol
    "address":            (string) The address of the owner of this allocation
    "balance":            (numeric) The current balance
    "balance_zdag":       (numeric) The zdag balance
    "locked_outpoint":    (string) The locked UTXO if applicable for this allocation
}

Examples:
> syscoin-cli assetallocationinfo "assetguid" "address"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "assetallocationinfo", "params": ["assetguid", "address"] }' -H 'content-type: text/plain;' http://127.0.0.1:8370/

The following listing functions can be used to query the asset allocation database

listassetallocations ( count from {"asset_guid":n,"addresses":["address",...]} )
listassetindex ( page ) [asset_guid,"address",...]
listassetindexallocations address
listassetindexassets address
listassets ( count from {"txid":"str","asset_guid":n,"addresses":["address",...]} )

Sending Syscoin Assets

Syscoin assets can be allocated to another address. The process is called "asset allocation", but in layman's term, it's just the transfer of an amount of asset from an address to another address.
RPC command "assetallocationsend" can be called to send an amount of an asset. Similar to other Syscoin services, the user will have to signrawtransaction the hex, then syscoinsendrawtransaction to broadcast it to the network.

$ syscoin-cli help assetallocationsend
assetallocationsend asset_guid "address_sender" "address_receiver" amount

Send an asset allocation you own to another address.

Arguments:
1. asset_guid          (numeric, required) The asset guid
2. address_sender      (string, required) The address to send the allocation from
3. address_receiver    (string, required) The address to send the allocation to
4. amount              (numeric or string, required) The quantity of asset to send

Result:
{
  "hex": "hexstring"       (string) the unsigned transaction hexstring.
}

Examples:
> syscoin-cli assetallocationsend "assetguid" "addressfrom" "address" "amount"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "assetallocationsend", "params": ["assetguid", "addressfrom", "address", "amount"] }' -H 'content-type: text/plain;' http://127.0.0.1:8370/