• Brendan Lee

Tokenizing Assets [5/5]

Updated: Feb 13





Tokenizing Assets

Tokenized smart contracts are for the purpose of managing real-world assets in a way that reflects the real-world way in which that asset is being managed.

The first version of the Tokenized Smart Contract Agent supports the following asset types with the associated Asset Code in brackets:

  • Membership Tokens (MEM)

  • Common Shares (SHC)

  • Currency (CUR)

  • Coupons (COU)

  • Loyalty Points (LOY)

  • Admission Tickets (TIC)

  • Casino Chips (CHP)


While these 7 types are supported by the beta version of the agent, the Tokenized Protocol can support any need and the team have a list of over 50 different types of a token being prepared including coverage of all general financial products used in retail and enterprise banking, investment and more.


For more information on the asset types supported by the current Tokenized agent, please visit:

https://tokenized.com/docs/protocol/assets


For this example, I will create a set of 5 common shares to manage ownership rights for Coinstorage Pty. Ltd. Keep in mind, these are being created using the tokenized.test protocol identifier and as such should not be considered binding.


Asset Structure

Assets are defined using a structure held in the Asset Payload. The payload contains all the necessary information that an asset of this type would be likely to need. This can include information on what the tokens are, how they are to be used and more.


Creating the Asset Payload

Every different asset type has a payload that specifies fields that are specific to that type of asset. These can include any type of information relevant to the management of that asset.


To learn more about the payloads for established asset types, see:

https://tokenized.com/docs/protocol/assets#field-aliases


The Smart Contract tool can build the hex payload we need to create the asset.

First, we need a JSON file containing the necessary information. I created the following:


$ nano ~/coinstorage/csgru.json


The definition needs only the ticker and description, with the date and ISIN left blank:


{

"Ticker" : "CSGRU",

"Description" : "Founders shares in Coinstorage Guru"

}


Now use the Smart Contract tool to build the hexadecimal payload:


$ smartcontract build SHC coinstorage/csgru.json --hex

Asset : SHC

120543534752552223466f756e646572732073686172657320696e20436f696e73746f726167652047757275


This payload can now be inserted into the Asset Definition action.






Building the Asset Definition Action

The Asset Definition action is assembled in a JSON file. I created the following:


$ nano ~/coinstorage/A1_coinstorage.json


Assets are created by sending an Asset Definition action (A1) to the Smart Contract agent using an established smart contract. Learn more about this action here:

https://tokenized.com/docs/protocol/actions#action-asset-definition


Similarly, to the Contract Offer, the data must be contained in a .JSON file ready to be written into a tokenized transaction.


This is the layout of my JSON file:

{

"TransfersPermitted" : true,

"EnforcementOrdersPermitted" : true,

"VotingRights" : true,

"TokenQty" : 5,

"AssetType" : "SHC",

"AssetPayload" :

"120543534752552228466f756e646572732073686172657320696e20436f696e73746f7261676

5205074792e204c74642e"

}


Transfer Permitted allows this token to be transferred by third parties. This is good for transferable assets but should be set to FALSE for things such as memberships. Where transfers are not permitted, the token holders will always be able to send the token back to the contract’s administrative address.


EnforcementOrdersPermitted allows the issuer to execute enforcement orders such as freezing and confiscating the tokens.


VotingRights means that a holder of one of these tokens has a right to vote in company decisions.

TokenQty is set to 5 to create our 5 assets, with AssetType set to SHC for common share.


Creating the transaction

To define the Tokenized action, we must have access to the Tokenized Smart Contract utility via Putty.


Check the status of your Bitcoin node, and sync the Smart Contract tool.


$ smartcontract sync


Now, build the tx:


$ smartcontract build A1 coinstorage/a1_coinstorage.json --tx


The process asks how many voting systems there are in the contract, and for this there is just 1.

The TX builds correctly, so the hex is tried next:


$ smartcontract build A1 coinstorage/a1_coinstorage.json –-hex


As this looks good, our third command builds and sends the tx to the network:


$ smartcontract build A1 coinstorage/a1_coinstorage.json –-tx --send


Checking https://whatsonchain.com/address/1N9nJMPfJGnhcWrYAtY2DvsHb3cXfVmsTq we can see almost immediately that the Smart Contract Agent has responded with an A2 – Asset Creation action which means it has acknowledged our request as a correctly formatted request within the established ruleset of the Smart Contract and has created the assets.


Click on ‘Hex’ in the decode window and copy the text. Now use the parse command to see what the contract created:


$ smartcontract parse 006a02bd000e746573742e746f6b656e697a6564041a0241324c6d0a20bbf16c62ed650553330329f2db623bdb740f58d1bae21e6af3bf0e314e523d0620013001380160056a035348437231120543534752552228466f756e646572732073686172657320696e20436f696e73746f72616765205074792e204c74642e800193a6989e839181f115

Uses Test Protocol Signature

Action type : A2

```

{

"AssetCode":

"bbf16c62ed650553330329f2db623bdb740f58d1bae21e6af3bf0e314e523d06",

"TransfersPermitted": true,

"EnforcementOrdersPermitted": true,

"VotingRights": true,

"TokenQty": 5,

"AssetType": "SHC",

"AssetPayload":

"120543534752552228466f756e646572732073686172657320696e20436f696e73746f72616765205074792e204c74642e",

"Timestamp": 1576827802563777299

}

```

```

{

"Ticker": "CSGRU",

"Description": "Founders shares in Coinstorage Pty. Ltd."

}

```

The assets are handed to the issuer, which in this case is Coinstorage Pty Ltd.

In our next and final piece, we will look at how to transfer these assets between parties.


Transferring assets between parties

All Tokenized transfers are handled using the T1 – Transfer action which can manage transfers of all types with multiple parties and assets.

https://tokenized.com/docs/protocol/actions#action-transfer


I am going to transfer 1 of the 5 shares to an address I have created for the demo.

I created the following JSON file to build the transaction:


$ nano ~/coinstorage/T1_coinstorage.json


The file contains the following info:

{

"Assets" : [ {

"ContractIndex" : 0,

"AssetType" : "SHC",

"AssetCode" :

"bbf16c62ed650553330329f2db623bdb740f58d1bae21e6af3bf0e314e523d06",

"AssetRevision" : 0,

"AssetSenders" : [ {

"Index" : 0,

"Quantity" : 1

} ],

"AssetReceivers" : [ {

"Address" : "20c7bd4b65fb23514e3d80373b9828fdf13f01c90d",

"Quantity" : 1

} ]

} ]

}


This defines the transfer action by listing the asset code for our create asset. We are using asset revision 0 as we haven’t modified it yet. We are sending one token to an address, or eventually any valid Bitcoin locking script, I created to receive it.


We specify that the sender is sending 1 asset and the receiver is receiving 1 asset.


The address is converted to Hexadecimal using:


$ smartcontract convert YourAddressHere


Append 20 to the front of the hexadecimal string that is generated to create the address.

Now that the transfer action is built, test it with:


$ smartcontract build T1 coinstorage/T1_coinstorage.json –-tx


If the tx validates, send it using:


$ smartcontract build T1 coinstorage/T1_coinstorage.json –-tx –-send


The transfer action request transaction (348249e7ac0acae0b328730dafc63d6655d33f0e8b54371b29f8f47980637f87)

is immediately followed by the response (dfc4d02969e2812edfb79f262383bce09a2696ba41eb90b34fa60b8250a4144d)

which contains the settlement action which moves the token into my new wallet.


Note: This token can now be validated by looking at my receiving address.


RELATED ARTICLES

Blog 1

Blog 2

Blog 3

Blog 4

Blog 5: You are reading it



About the Author



Mr. Lee's career to date has been focused on increasingly senior roles within industrial design, automation, and control, focusing on software design and implementation. Most recently, Mr. Lee was the Bitcoin Engineering Lead for the Tokenized project team who developed the Tokenized protocol. The Tokenized protocol is a comprehensive, regulation-friendly solution for businesses to create tokens for real-world assets on the BSV blockchain.






Subscribe to our FREE weekly newsletter

139 views

Recent Posts

See All

Subscribe to our weekly newsletter to follow our journey into building a business at the intersection of community & technology. 

©2019 by Faiabrand Pte Ltd