SCT uses write and get methods differently. In the case of recording, a generic transaction is generated to process the SCT and the stored contract can be confirmed via the next (# JSON-RPC SCT).
To offer these APIs over the Gsym RPC endpoints, please specify them with the --${interface}api command line argument (where ${interface} can be rpc for the HTTP endpoint, ws for the WebSocket endpoint and ipc for the unix socket (Unix) or named pipe (Windows) endpoint).
SCT30 is a template that implements the ERC721 Interface. (NFT) A non-fungible token that is used when using transactions for unique items.
SCT30_CREATE
Create an SCT30 contract.
Type : 30
Method : 0
Parameters :
Name: STRING - Contract(Token) Name
Symbol: STRING - Contract(Token) Symbol. The length should be from 3 to 10.
Owner: DATA, 10 Bytes - address of the contract owner.
Example
// Create SCT30 contract whose name is "SymContract" and
// symbol is "SCN" and
// contract owner is "0x00020000000000060002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x0", "params": {"name": "SymContract", "symbol": "SCN", "owner": "0x00020000000000060002"}})
// Result: RLP encoded SCT data
"0xde1e80db8b53796d436f6e74726163748353434e8a00020000000000060002"
// Send SCT Transaction
sym.sendTransaction({"from": "0x00020000000000060002", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x12", "type": "0x1", "input": "0xde1e80db8b53796d436f6e74726163748353434e8a00020000000000060002"})
// Result: Transaction Hash
"0xecec96d8849dc2e289fdf4cd701118995aaa236661ec8e3e2e678d1cf98a820e"
// Get Transaction Recipt from transaction hash
sym.getTransactionReceipt("0xecec96d8849dc2e289fdf4cd701118995aaa236661ec8e3e2e678d1cf98a820e").contractAddress
// Result: Transaction information with contractAddress.
"0x701b171444a16e8b86ca"
// Get Contract information from contract address.
sct.getContract("0x701b171444a16e8b86ca")
// Result: Contract information created with SCT20 create method.
{
creator: "0x00020000000000060002",
name: "SymContract",
owner: "0x00020000000000060002",
state: "active",
symbol: "SCN",
total: "0x0β¬",
type: "sct30"
}
SCT30_CREATE_ITEM
Generates N items of SCT30. It is a bulk-capable function that can generate up to tx-size 32kb calls in a single call. (Authorization: owner, creator)
Type : 30
Method : 1
Parameters :
Items: ARRAY, SCT30 items
Type: DATA, type of item
Name: STRING, name of item
Value: QUANTITY, the unique value of item
Category:DATA, category of item (search index value)
Property: DATA, unique attribute of item
Description: Additional explanation of DATA, item
Example
// Create two SCT30 items. Each item has following informations:
// [first item]: type is "A" and name is "dog" and value is "500(0x1f4)"
// and category is "animal" and property is "myFistPet"
// [second item]: type is "B" and name is "cat" and value is "500(0x1f4)"
// and category is "animal" and property is "myFirstCat"
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x1", "params": {"items": [{ "type": "A", "name": "dog", "value": "0x1f4", "category": "animal", "property": "myFistPet"}, { "type": "B", "name": "cat", "value": "0x1f4", "category": "animal", "property": "myFirstCat"}]}})
// Result
"0xf31e01f0d73183646f678201f486616e696d616c866d797065743180d732836361748201f486616e696d616c866d797065743280"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x13", "type": "0x1", "input": "0xf31e01f0d73183646f678201f486616e696d616c866d797065743180d732836361748201f486616e696d616c866d797065743280"})
// Result
"0x44588543af819fbf78ef97a05ba219568e7b81ecafe7488e9bda339c69d1fd0e"
SCT30_TRANSFER
SCT30 Item transfer (Authorization: all)
Type : 30
Method : 2
Parameters :
To: DATA, 10 Bytes - address to receive sct30 token.
Index: QUANTITY - index transferred in sct30 item.
Example
// Transfer SCT30 item via index (0x1) to "0x00020000000000040002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x2", "params": {"to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xcf1e02cc8a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x14", "type": "0x1", "input": "0xcf1e02cc8a0002000000000004000201"})
// Result
"0x765c060cdc172707fb3143e01bfbab0713fc1562b8643bfedb47047e063ba12c"
SCT30_TRANSFER_FROM
Send a delegated item via APPROVE (Authorization: all)
Type : 30
Method : 3
Parameters :
From: DATA, 10 Bytes - address of the from.
To: DATA, 10 Bytes - address to receive sct30 token.
Index: QUANTITY - index transferred in sct30 item.
Example
// Transfer SCT30 item via index (0x1) to "0x00020000000000040002".
// Before execute SCT30 Transfer From method,
// it is needed to be approved an index to transfer.
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x3", "params": {"from": "0x00020000000000060002", "to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xda1e03d78a000200000000000600028a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x15", "type": "0x1", "input": "0xda1e03d78a000200000000000400028a0002000000000003000201"})
// Result
"0x35cdd7009e4ef8a5357180bfbb5776c7a499654a7423cdc578f75bcc90f74874"
SCT30_APPROVE
Delegate some item to other users (Authorization: all)
Type : 30
Method : 4
Parameters :
To: DATA, 10 Bytes - address of the spender.
Index: QUANTITY - index transferred in sct30 item.
Example
// Approve item whose index is "0x1" to "0x00020000000000040002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x4", "params": {"to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xcf1e04cc8a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x16", "type": "0x1", "input": "0xcf1e04cc8a0002000000000004000201"})
// Result
"0x20ac6e573b515b3e0c6ed2ac79434a681ab08b58e7843066ec116f01551777d1"
SCT30_ITEM_PAUSE
SCT30 item pause (Authorization: owner, creator)
Type : 30
Method : 5
Parameters :
Index: QUANTITY - index pause in sct30 item.
Example
// Pause item whose index is "0x1".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x5", "params": {"index": "0x1"}})
// Result
"0xc41e05c101"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x17", "type": "0x1", "input": "0xc41e05c101"})
// Result
"0x134d4751bc161e88af3f90e698a37ffc00cb2cdd11cdb497d5342d34058dee16"
To: DATA, 10 Bytes - address to be the contract owner
Example
// Transfer contract ownership to "0x00020000000000040002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x1e", "method": "0x7", "params": {"to": "0x00020000000000040002"}})
// Result
"0xce1e07cb8a00020000000000040002"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000060002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x19", "type": "0x1", "input": "0xce1e07cb8a00020000000000040002"})
// Result
"0xcdc432cb7975bb8930ac5740948007b686973b5fdc9ae2c7d4e30e898480cb40"
SCT40
SCT40 is an agreement used for coupons with an improved contract through override of SCT30.
SCT40_CREATE
Create an SCT40 contract.
Type : 40
Method : 0
Parameters :
Name: STRING - Contract(Token) Name
Symbol: STRING - Contract(Token) Symbol. The length should be from 3 to 10.
CPoint : QUANTITY - Coupon Point
Owner: DATA, 10 Bytes - address of the contract owner.
Example
// Create SCT40 contract whose name is "SymContract" and
// symbol is "SCN" and
// contract owner is "0x00020000000000050002".
// Get SCT rlp encoded string.
> debug.getSCTRlp({"type": "0x1e", "method": "0x0", "params": {"name": "SymContract", "symbol": "SCN", "cpoint": "0xa", "owner": "0x00020000000000050002"}})
// Result: RLP encoded SCT data
"0xde1e80db8b53796d436f6e74726163748353434e8a00020000000000050002"
// Send SCT Transaction
sym.sendTransaction({"from": "0x00020000000000050002", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x0", "type": "0x1", "input": "0xde1e80db8b53796d436f6e74726163748353434e8a00020000000000050002"})
// Result: Transaction Hash
"0x6e5ec47d74d64a7f11b9921e610577fe3d958d96e7f50420415947c506355f69"
// Get Transaction Recipt from transaction hash
sym.getTransactionReceipt("0x6e5ec47d74d64a7f11b9921e610577fe3d958d96e7f50420415947c506355f69").contractAddress
// Result: Transaction information with contractAddress.
"0x152461a4284a938104ec"
// Get Contract information from contract address.
sct.getContract("0x152461a4284a938104ec")
// Result: Contract information created with SCT20 create method.
{
cpoint: 10,
creator: "0x00020000000000050002",
name: "SymContract",
owner: "0x00020000000000050002",
state: "active",
symbol: "SCN",
total: "0x0β¬",
type: "sct40"
}
SCT40_CREATE_COUPON
Generates N coupon items of SCT40. It is a bulk-capable function that can generate up to tx-size 32kb calls in a single call. (Authorization: owner, creator)
Type : 40
Method : 1
Parameters :
Coupons: ARRAY, SCT40 Coupon items
Type : DATA type of coupon item
Name: STRING name of coupon item
Point :QUANTITY point to be deducted when creating a Coupon item
GroupNo : DATA and group of couple items (search index value)
CouponNo : DATA, unique attribute of item
Etc : DATA and 'coupon item' additional explanation
Example
// Create two SCT40 coupons. Each coupon has following informations:
// [first coupon]: type is "A" and name is "hotdog" and point is "1(0x1)"
// and groupNo is "fastfood1" and couponNo is "discount1" and etc is "happybirthday"
// [second coupon]: type is "B" and name is "spaghetti" and value is "500(0x1f4)"
// and groupNo is "restaurant1" and couponNo is "discount1" and etc is "happybirthday"
// Get SCT rlp encoded string
// [itmes]: Items
> debug.getSCTRlp({"type": "0x28", "method": "0x1", "params": {"coupons": [{"type": "A", "name": "hotdog", "point": "0x1", "groupNo": "fastfood1", "couponNo": "discount1", "description": "happybirthday"}, {"type": "B", "name": "coupon2", "point": "0x1f4", "groupNo": "restaurant1", "couponNo": "discount1", "etc": "happybirthday"}]}})
// Result
"0xf8542801f850de4186686f74646f67018966617374666f6f643189646973636f756e743180f04287636f75706f6e328201f48b72657374617572616e743189646973636f756e74318d68617070796269727468646179"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x152461a4284a938104ec", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x1", "type": "0x1", "input": "0xf8542801f850de4186686f74646f67018966617374666f6f643189646973636f756e743180f04287636f75706f6e328201f48b72657374617572616e743189646973636f756e74318d68617070796269727468646179"})
// Result
"0xd5a9cbda4ea82c39dbe2c40c620ada6178130e9bc4ba2929645d7f63f8b23001"
SCT40_TRANSFER
SCT40 coupon Item transfer. (Authorization: all)
Type : 40
Method : 2
Parameters :
To: DATA, 10 Bytes - address to receive sct40 item.
Index: QUANTITY - index transferred in sct40 item.
Example
// Transfer SCT40 coupon via index (0x1) to "0x00020000000000040002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x28", "method": "0x2", "params": {"to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xcf2802cc8a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x2", "type": "0x1", "input": "0xcf2802cc8a0002000000000004000201"})
// Result
"0xe2fe1d2898431fa45d90db6b6c80dab8f192e3dd302e99466921312bc94cb191"
SCT40_TRANSFER_FROM
Send a delegated coupon item via APPROVE (Authorization: all)
Type : 40
Method : 3
Parameters :
From: DATA, 10 Bytes - address of the from.
To: DATA, 10 Bytes - address to receive sct40 token.
Index: QUANTITY - index transferred in sct40 item.
Example
// Transfer SCT40 coupon via index (0x1) to "0x00020000000000040002".
// Before execute SCT40 Transfer From method,
// it is needed to be approved an index to transfer.
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x28", "method": "0x3", "params": {"from": "0x00020000000000050002", "to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xda2803d78a000200000000000500028a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x3", "type": "0x1", "input": "0xda2803d78a000200000000000400028a0002000000000005000201"})
// Result
"0x957e00b8c7807c7482a62cedd9b24fd950c23a4002d97155499b099461f0c0ce"
SCT40_APPROVE
Delegate some item to other symid (Authorization: all)
Type : 40
Method : 4
Parameters :
To: DATA, 10 Bytes - address of the spender.
Index: QUANTITY - index transferred in sct40 item.
Example
// Approve coupon whose index is "0x1" to "0x00020000000000040002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x28", "method": "0x4", "params": {"to": "0x00020000000000040002", "index": "0x1"}})
// Result
"0xcf2804cc8a0002000000000004000201"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x4", "type": "0x1", "input": "0xcf2804cc8a0002000000000004000201"})
// Result
"0x64ea37a2061dd97ae26141c618aee47d6d3b86d574ce06ead8b05c4ffa939c24"
SCT40_COUPON_USE
SCT40 coupon item use (Authorization: owner, creator)
Type : 40
Method : 5
Parameters :
Index: QUANTITY - index pause in sct40 item.
Example
// Use coupon whose index is "0x1".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x28", "method": "0x5", "params": {"index": "0x1"}})
// Result
"0xc42805c101"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x5", "type": "0x1", "input": "0xc42805c101"})
// Result
"0xedfe1064f63209e87b5a4f96aff1c0b39ab5b28eaa058295a04bd23c6ecd2d5e"
To: DATA, 10 Bytes - address to be the contract owner
Example
// Transfer contract ownership to "0x00020000000000060002".
// Get SCT rlp encoded string
> debug.getSCTRlp({"type": "0x28", "method": "0x8", "params": {"to": "0x00020000000000060002"}})
// Result
"0xce2808cb8a00020000000000060002"
// Send SCT Transaction
sym.sendTransaction({ "from": "0x00020000000000050002", "to": "0x701b171444a16e8b86ca", "gas": "0x76cff0", "gasPrice": "0x5d21dba00", "nonce": "0x8", "type": "0x1", "input": "0xce2808cb8a00020000000000060002"})
// Result
"0x9c82fbb3f9072241e20782122b6b9113020e4d3c8cea37127371085f4126fca4"
SCT50 - VoteContract
SCT50 is a template that handles Vote contract. It has following functions:
SCT50_CREATE
sct50Create creates SCT50 Vote Contract. It is needed to use SCT20 token to make. Referring SCT20 token will be standard currency when users stake tokens to poll contract to vote.
Type : 50
Method : 0
Parameters: 1. Party Name: STRING - Digital Party name 2. SCT20 Token Address: DATA - SCT20 Token Address to use. 3. Owner: DATA - Owner SymId
sct51CreatePoll creates SCT51 Poll Contract. Only Poll Creators registered from SCT50 Vote Contract Creator(or Owner) can create. It is needed to use SCT50 Vote Contract to make. Created Poll Contract will handle about voting activity.
Type : 51
Method : 0
Parameters: 1. PollNumber: QUANTITY - Poll number 2. Category: QUANTITY - Agenda category (it defines voting rate, participation rate) 3. Agenda: STRING - Agenda name 4. Description: STRING - Description about Agenda 5. Owner: DATA - Owner of Poll to create 6. Start: QUANTITY - Poll start time (UNIX time stamp) 7. End: QUANTITY - Poll start time (UNIX time stamp) 8. VoteContract: DATA - SCT50 Vote Contract Address 9. SecretOption: QUANTITY - Secret option for the poll [0: public1: secret] 10. StakeOption: QUANTITY - Stake strict option for each voter to vote poll [0: free stake*: stake limit for each voter with given amount] 11. TotalVoters: QUANTITY - Allowed total voters for the poll. 12. Quorum: QUANTITY - Minimum rate of participants for the poll to pass. 13. PassRate: QUANTITY - Minimum rate of agree for the poll to pass.
sct51EmergencyStopPoll make poll inactive. Only SCT50 Vote Creator(or owner) can make it. Hence poll state turns to inactive, user can not stake and vote in poll.
sct51RevokePoll make poll expired. Only SCT50 Vote Creator can make it. Hence poll state turns to expired, the staked balance from users will be returned to them.
sct51WritePollResults write result to the poll contract. Only SCT50 Vote Creator can write it.
Type : 51
Method : 5
Parameters: 1. Result: QUANTITY - poll result code 2. Code: QUANTITY - extra poll result code 3. Agrees: QUANTITY - the number of stake voted as agree for the poll 4. Disagrees: QUANTITY - the number of stake voted as disagree for the poll 5. Nullities: QUANTITY - the number of stake holders not voted for the poll 6. TotalVoters: QUANTITY - the number of stake holders for the poll 7. VotingRate: QUANTITY - the rate of holders voted for the poll (unsigned integer value)