SPT Exchange Integration
info
UPDATE: The Syscoin Core RPCs used in the example below, and other SPT-oriented RPCs, have been deprecated and removed as of Syscoin Core 4.4.
Now syscoinjs-lib and syscointx-js are used to create/manage digital assets, auxfees, and notaries on the UTXO chain.
Examples are available at https://github.com/syscoin/syscoinjs-lib-examples.
For a complete list of these deprecated RPCs, review the Syscoin Core 4.4 release notes.
This guide is a primer to help exchanges integrate Syscoin Platform Tokens (SPT's).
The Syscoin platform provides a UTXO-based token issuance system embedded in the Syscoin blockchain. Transactions of SPT's consume network fees paid in SYS and can provide token recipients an accompanying default "pass-forward" amount of SYS dust to enable them to transact the SPT without having to acquire or own SYS beforehand.
An SPT has several noteworthy properties. Most important is the asset_guid
, the deterministically-assigned unique identifier of the token on the Syscoin blockchain. Similar to Ethereum, anyone can create a token and make its symbol "AGX" but there can only ever be one official AGX token with the asset_guid
of 367794646. Several popular SPT's and their associated identifiers can be found in the table below.
SPT Symbol | SPT Description | SPT Asset Guid | Website |
---|---|---|---|
AGX | AGX Silver Token | 367794646 | |
AUX | Official Interfix Gold backed Token | 1358717298 | |
BTZC | BeatzCoin SPT | 315501466 |
There are two paths for integrating SPT assets.
- Interact with a syscoin daemon (syscoind) instance directly via RPC (you can optionally use syscoin-js for this)
- Interact with Syscoin via a Web 3.0 approach by using syscoinjs-lib which interacts with a running Syscoin Blockbook instance or a gateway of load-balanced Blockbook instances.
#
Set up for Interacting with Syscoin Directly via RPCThis walk-through assumes you are using the OS console.
- Ensure the following line is in your syscoin.conf (default path
~/.syscoin/syscoin.conf
)
- Launch syscoind
#
📘Reindexing to build local asset indexIf you previously launched syscoind without
assetindex=1
in syscoin.conf, use -reindex, e.g.syscoind -reindex
- Create a wallet
#
📘NoteWe strongly suggest creating two separate wallets, one strictly for SYS, and the other for SPT's with a smaller amount of SYS for transaction fees. This eliminates confusion and headaches related to coin control with SPT's.
From here on, all syscoin-cli calls will need to add the -rpcwallet "walletname"
argument.
If using http-rpc, the https url should be in the form of http://[ip]:[port]/wallet/[walletname]
You can also launch syscoind in a way that connects with a specific wallet by using the -wallet
argument with the path to the directory containing the wallet.dat file.
#
Commonly Used RPC Functions for Exchange IntegrationFor RPC documentation, please see https://syscoincore.org/en/doc/4.2.0/
You can also use use help <command>
for a full description of the RPC and its options and arguments
Function | SYS | SPT |
---|---|---|
Query address balances | addressbalance | assetallocationbalance |
Obtain the block height or other chain status info | getblockchaininfo | getblockchaininfo |
Obtain wallet transaction list | listtransactions or listunspent | listtransactions or listunspentasset |
Get transaction details | gettransaction | gettransaction |
Asset transfer | sendtoaddress | assetallocationsend |
Asset transfer (batch) | sendmany | assetallocationsendmany |
Query asset balances
assetallocationbalance <assetGUID> "[\"<address>\"]" <minimum#ofConfirmations (optional)>
You can query the sum balance of multiple addresses by listing more than one address, e.g.:
assetallocationbalance <assetGUID> "[\"<address>\",\"<address>\"]" <minimum#ofConfirmations (optional)>
Output: "amount": SYS gas balance supplied for this asset "asset_amount": SPT balance
Obtain the blockheight or other chain status info
Obtain wallet transaction list for assets
listtransactions
is general purpose. It covers all transaction types and its output is verbose.
listunspentasset <assetGuid> <minimum#ofConfirmations (optional)>
is more specific.
Get transaction details
#
Setup for using Blockbook API and syscoinjs-libSyscoin Blockbook uses its own syscoind instance as the backend, and indexes the blockchain data and tracks XPUB-based account balances to serve the API.
Please follow the readme in https://www.github.com/syscoin/blockbook if you want to implement your own Blockbook server instance. syscoinjs-lib is used to communicate with blockbook server and the documentation is located at https://www.github.com/syscoin/syscoinjs-lib
Examples for using syscoinjs-lib are located at https://www.github.com/syscoin/syscoinjs-lib-examples
A public Blockbook server instance for Syscoin is located at https://sys1.bcfn.ca