Syscoin

Syscoin Core Developer Portal

Comprehensive guides and documentation to help you start working with Syscoin as quickly as possible, and support if you get stuck.

Get Started

Using Syscoin 4 Tokens

Syscoin 4 introduced some significant changes to tokens.

Before Trading an Asset on Syscoin Platform

Obtain the correct Asset GUID.

An asset has several noteworthy properties. The most important is asset_guid which is the unique identifier of the token. For example, the asset_guid of the official SYSX token is "1045909988". Anyone can create a token named "SYSX" but there will only be one SYSX with asset_guid of "1045909988". We can inspect the asset information using assetinfo. We will be using this asset as an example for the rest of the guide.

$ syscoin-cli assetinfo 1045909988
{
  "asset_guid": 1045909988,
  "symbol": "SYSX",
  "txid": "bae2d8c36c6b8975fe888516ab9523c33c688dcb2210a759008a5cfcbe9b7e2f",
  "public_value": "{\"description\":\"Official SYSX SPT\"}",
  "address": "sys1qw8k5920xgy746mcs95c6p0tpyqwas27z8af9qe",
  "contract": "0x3a0d746b3ea1d8ccdf19ad915913bd68391133ca",
  "balance": 0.00000000,
  "total_supply": 888000000.00000000,
  "max_supply": 888000000.00000000,
  "update_flags": 31,
  "precision": 8
}

Querying Syscoin Assets

To see the balance of an asset at a specific address, use assetallocationinfo. This function allows you to see the balance of the asset of 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 functions can be used to query the asset allocation database

listassetallocationmempoolbalances ( count from {"addresses_array":["sender_address",...]} )
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

A quantity of Syscoin tokens can be allocated other addresses. This process is called "asset allocation", but in layman's term, it's just the transfer of an amount of asset from one address to another address. The RPC command assetallocationsend can be called to send an amount of an asset. Similar to other Syscoin services, the user will have to signrawtransactionwithwallet, then sendrawtransaction 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/

Updated 10 months ago

Using Syscoin 4 Tokens


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.