Asset Management
Introduction
This guide will show you how to create and update assets on Syscoin 4.
Notable change since Syscoin 3 is that assets will be based off addresses now as aliases are removed in Syscoin 4. Specifically only witness programs are accepted as addresses owned by Assets. P2PWKH and P2WSH are the ones currently supported with future witness programs to extend functionality in the future according to Bitcoin and Syscoin core development enhancements.
Steps
$ syscoin-cli assetnew
error code: -1
error message:
assetnew "address" "symbol" "public_value" "contract" precision total_supply max_supply update_flags "witness"
Create a new asset
Arguments:
1. address (string, required) An address that you own.
2. symbol (string, required) Asset symbol (1-8 characters)
3. public_value (string, required) public data, 256 characters max.
4. contract (string, required) Ethereum token contract for SyscoinX bridge. Must be in hex and not include the '0x' format tag. For example contract '0xb060ddb93707d2bc2f8bcc39451a5a28852f8d1d' should be set as 'b060ddb93707d2bc2f8bcc39451a5a28852f8d1d'. Leave empty for no smart contract bridge.
5. precision (numeric, required) Precision of balances. Must be between 0 and 8. The lower it is the higher possible max_supply is available since the supply is represented as a 64 bit integer. With a precision of 8 the max supply is 10 billion.
6. total_supply (numeric or string, required) Initial supply of asset. Can mint more supply up to total_supply amount or if total_supply is -1 then minting is uncapped.
7. max_supply (numeric or string, required) Maximum supply of this asset. Set to -1 for uncapped. Depends on the precision value that is set, the lower the precision the higher max_supply can be.
8. update_flags (numeric, required) Ability to update certain fields. Must be decimal value which is a bitmask for certain rights to update. The bitmask represents 0x01(1) to give admin status (needed to update flags), 0x10(2) for updating public data field, 0x100(4) for updating the smart contract field, 0x1000(8) for updating supply, 0x10000(16) for being able to update flags (need admin access to update flags as well). 0x11111(31) for all.
9. witness (string, required) Witness address that will sign for web-of-trust notarization of this transaction.
Result:
{
"hex": "hexstring" (string) the unsigned transaction hexstring.
"assetguid": xxxx (numeric) The guid of asset to be created
}
Examples:
> syscoin-cli assetnew "myaddress" "CAT" "publicvalue" "contractaddr" 8 100 1000 31 ""
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "assetnew", "params": ["myaddress", "CAT", "publicvalue", "contractaddr", 8, 100, 1000, 31, ""] }' -H 'content-type: text/plain;' http://127.0.0.1:8370/
First generate a new address. Note that address must be in the new bech32 format (starts with sys)
$ syscoin-cli getnewaddress address_holder
sys1q0c6e4cusq4j4aynx0esv570qhhnwly3f2usyc2
$ syscoin-cli sendtoaddress sys1q0c6e4cusq4j4aynx0esv570qhhnwly3f2usyc2 100
4742c585728264a0be2da75c8f13c55e4f8aa03141d3c4661519f8d04f3c6f93
Create new asset, sign and send
$ syscoin-cli assetnew sys1q0c6e4cusq4j4aynx0esv570qhhnwly3f2usyc2 "BESTCOIN" "public value" "" 8 10000 10000000 31 ""
{
"hex": "0274000001936f3c4fd0f8191566c4d34131a08a4f5ec5138f5ca72dbea064827285c54247010000001600147e359ae39005655e92667e60ca79e0bde6ef9229ffffffff020000000000000000756a4c720c7075626c69632076616c75650000000000000000000000000000000000000000000000000000000000000000c5815d5b0842455354434f494e00147e359ae39005655e92667e60ca79e0bde6ef922900000010a5d4e80000000010a5d4e80000000080c6a47e8d030070f1013c1f08000018c70b54020000001600147e359ae39005655e92667e60ca79e0bde6ef922900000000",
"asset_guid": 1532854725
}
$ syscoin-cli signrawtransactionwithwallet 0274000001936f3c4fd0f8191566c4d34131a08a4f5ec5138f5ca72dbea064827285c54247010000001600147e359ae39005655e92667e60ca79e0bde6ef9229ffffffff020000000000000000756a4c720c7075626c69632076616c75650000000000000000000000000000000000000000000000000000000000000000c5815d5b0842455354434f494e00147e359ae39005655e92667e60ca79e0bde6ef922900000010a5d4e80000000010a5d4e80000000080c6a47e8d030070f1013c1f08000018c70b54020000001600147e359ae39005655e92667e60ca79e0bde6ef922900000000
{
"hex": "02740000000101936f3c4fd0f8191566c4d34131a08a4f5ec5138f5ca72dbea064827285c542470100000000ffffffff020000000000000000756a4c720c7075626c69632076616c75650000000000000000000000000000000000000000000000000000000000000000c5815d5b0842455354434f494e00147e359ae39005655e92667e60ca79e0bde6ef922900000010a5d4e80000000010a5d4e80000000080c6a47e8d030070f1013c1f08000018c70b54020000001600147e359ae39005655e92667e60ca79e0bde6ef92290247304402207468c740a7309e839b55541b21495f4c41d3818b9eb6b9030c2aa70fe1bb0e3f022047dfe13695af2c54f2f3c42c1724007e870f704dbf36d28957599ecc6524cd43012102b9d46254ba6c8885875e59c1a211b69d4824004a978bb7773d0431e7b2ab372300000000",
"complete": true
}
$ syscoin-cli sendrawtransaction 02740000000101936f3c4fd0f8191566c4d34131a08a4f5ec5138f5ca72dbea064827285c542470100000000ffffffff020000000000000000756a4c720c7075626c69632076616c75650000000000000000000000000000000000000000000000000000000000000000c5815d5b0842455354434f494e00147e359ae39005655e92667e60ca79e0bde6ef922900000010a5d4e80000000010a5d4e80000000080c6a47e8d030070f1013c1f08000018c70b54020000001600147e359ae39005655e92667e60ca79e0bde6ef92290247304402207468c740a7309e839b55541b21495f4c41d3818b9eb6b9030c2aa70fe1bb0e3f022047dfe13695af2c54f2f3c42c1724007e870f704dbf36d28957599ecc6524cd43012102b9d46254ba6c8885875e59c1a211b69d4824004a978bb7773d0431e7b2ab372300000000
42327e72bb80af34c49b382a2e81f2c3546a643d93a6671866978c16ecae09a2
The first command's output contains your guid. After confirmation, you should be able to find your asset created.
$ syscoin-cli assetinfo 1532854725
{
"asset_guid": 1532854725,
"symbol": "BESTCOIN",
"txid": "42327e72bb80af34c49b382a2e81f2c3546a643d93a6671866978c16ecae09a2",
"public_value": "public value",
"address": "sys1q0c6e4cusq4j4aynx0esv570qhhnwly3f2usyc2",
"contract": "",
"balance": 10000.00000000,
"total_supply": 10000.00000000,
"max_supply": 10000000.00000000,
"update_flags": 31,
"precision": 8
}
Now create another address for holding allocations
$ syscoin-cli getnewaddress allocationholder
sys1qt5svp74tvskr6care5zd05449x3ukctz9lattv
$ syscoin-cli assetsend 1532854725 sys1qt5svp74tvskr6care5zd05449x3ukctz9lattv 1000
{
"hex": "05740000019e5fb2a99b320f5ca626d1b49533c0a790d32da2e8173bdf6732c523fd89e175000000001600147e359ae39005655e92667e60ca79e0bde6ef9229ffffffff020000000000000000686a4c65c5815d5b00147e359ae39005655e92667e60ca79e0bde6ef92290100145d20c0faab642c3d63a3cd04d7d2b529a3cb616200e876481700000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff1cc5f505000000001600147e359ae39005655e92667e60ca79e0bde6ef922900000000"
}
$ syscoin-cli signrawtransactionwithwallet 05740000019e5fb2a99b320f5ca626d1b49533c0a790d32da2e8173bdf6732c523fd89e175000000001600147e359ae39005655e92667e60ca79e0bde6ef9229ffffffff020000000000000000686a4c65c5815d5b00147e359ae39005655e92667e60ca79e0bde6ef92290100145d20c0faab642c3d63a3cd04d7d2b529a3cb616200e876481700000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff1cc5f505000000001600147e359ae39005655e92667e60ca79e0bde6ef922900000000
{
"hex": "057400000001019e5fb2a99b320f5ca626d1b49533c0a790d32da2e8173bdf6732c523fd89e1750000000000ffffffff020000000000000000686a4c65c5815d5b00147e359ae39005655e92667e60ca79e0bde6ef92290100145d20c0faab642c3d63a3cd04d7d2b529a3cb616200e876481700000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff1cc5f505000000001600147e359ae39005655e92667e60ca79e0bde6ef922902473044022073af7071b39be35e198e47630f1f768c83501c976a794f50f62e5aec5b6e833502206a2f592458084b6fa252072e40d56cc15b8dd0dcc62b300b7e104166cf60aff4012102b9d46254ba6c8885875e59c1a211b69d4824004a978bb7773d0431e7b2ab372300000000",
"complete": true
}
$ syscoin-cli sendrawtransaction 057400000001019e5fb2a99b320f5ca626d1b49533c0a790d32da2e8173bdf6732c523fd89e1750000000000ffffffff020000000000000000686a4c65c5815d5b00147e359ae39005655e92667e60ca79e0bde6ef92290100145d20c0faab642c3d63a3cd04d7d2b529a3cb616200e876481700000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff1cc5f505000000001600147e359ae39005655e92667e60ca79e0bde6ef922902473044022073af7071b39be35e198e47630f1f768c83501c976a794f50f62e5aec5b6e833502206a2f592458084b6fa252072e40d56cc15b8dd0dcc62b300b7e104166cf60aff4012102b9d46254ba6c8885875e59c1a211b69d4824004a978bb7773d0431e7b2ab372300000000
84c909d2bea0e660e736421c7072ef26001e8e2d2c1cf052597934721b5bdbdb
Check that the address indeed received the allocation and that assetinfo shows the correct balance
$ syscoin-cli assetallocationinfo 1532854725 sys1qt5svp74tvskr6care5zd05449x3ukctz9lattv
{
"asset_allocation": "1532854725-sys1qt5svp74tvskr6care5zd05449x3ukctz9lattv",
"asset_guid": 1532854725,
"symbol": "BESTCOIN",
"address": "sys1qt5svp74tvskr6care5zd05449x3ukctz9lattv",
"balance": 1000.00000000,
"balance_zdag": 1000.00000000
}
$ syscoin-cli assetinfo 1532854725
{
"asset_guid": 1532854725,
"symbol": "BESTCOIN",
"txid": "84c909d2bea0e660e736421c7072ef26001e8e2d2c1cf052597934721b5bdbdb",
"public_value": "public value",
"address": "sys1q0c6e4cusq4j4aynx0esv570qhhnwly3f2usyc2",
"contract": "",
"balance": 9000.00000000,
"total_supply": 10000.00000000,
"max_supply": 10000000.00000000,
"update_flags": 31,
"precision": 8
}
Updated over 5 years ago