Toronet Portal API
v0/v1
3rd Edition
Toro Software Development Corp.
Date: May. 13, 2023
Updated May 17 2023
Contents
7.9 gettransactionfeepercentage
7.21 getallowselftransactionfee
7.22 getselftransactionfeefixed
7.23 getselftransactionfeepercentage
8.1 List
of supported currencies
8.11 gettransactionfeepercentage
8.21 getcurrencyimportfeefixed
8.22 getcurrencyimportfeepercentage
8.24 getcurrencyexportfeefixed
8.25 getcurrencyexportfeepercentage
8.35 getallowselftransactionfee
8.36 getselftransactionfeefixed
8.37 getselftransactionfeepercentage
8.43 getselftorobuyfeepercentage
8.47 getselftorosellfeepercentage
8.49 getallowselfcurrencyimportfee
8.50 getselfcurrencyimportfeefixed
8.51 getselfcurrencyimportfeepercentage
8.53 getallowselfcurrencyexportfee
8.54 getselfcurrencyexportfeefixed
8.55 getselfcurrencyexportfeepercentage
9.1 List
of all supported cryptocurrencies
9.11 gettransactionfeepercentage
9.22 getcryptoimportfeepercentage
9.25 getcryptoexportfeepercentage
9.35 getallowselftransactionfee
9.36 getselftransactionfeefixed
9.37 getselftransactionfeepercentage
9.43 getselftorobuyfeepercentage
9.47 getselftorosellfeepercentage
9.49 getallowselfcryptoimportfee
9.50 getselfcryptoimportfeefixed
9.51 getselfcryptoimportfeepercentage
9.53 getallowselfcryptoexportfee
9.54 getselfcryptoexportfeefixed
9.55 getselfcryptoexportfeepercentage
In this API, RESTful
https calls are provided to execute fundamental Tórónet tasks.
In this manual, both
signed (non-custodial) and unsigned (custodial) calls will be introduced:
The current base
access point for the RESTful API on the test portal is
https://testnet.toronet.org/api/
In this manual, the
syntax, arguments, and responses will be introduced.
There are two types
of blockchain calls:
1
Calls
that request information from the blockchain. Blockchain information is public
and transparent. There are several calls that is provided to access such data.
However, while data is publicly available, note that such data could also be
encrypted by process or smart contracts; which ensures that certain information
can still be made accessible only to owners of such data. Calls that request
information do not typically need to be signed to obtain such information.
2
Calls
that make changes to the blockchain. These calls add data to a block, and needs
to be added by the blockchain consensus algorithm. The process pf generating a
new block is sometimes called mining. All calls that generate data that needs
to be added to the blockchain needs to be signed by an account. The account
could be a user account, or a contract account. To sign an account, the account
owner needs to have access and ownership to the primary key of the account.
Only that primary key can encrypt the information corresponding to the public
key. There are two ways this can be accomplished, and they are described below.
For non-custodial
calls, the primary keys for the accounts are located on the device of the owner
of the account. The account owner accesses that primary key, utilizing software
on that device to encrypt the information. The encrypted information is then transmitted
to the blockchain network where is will be saved in a pool of potential new
transactions or data intended to be included in the next block. The blockchain
nodes then pick up that transaction or block of data, verifies that it is duly
signed, and if so will include it in a block and process the block as the next
block through the consensus procedure of the chain.
Sometimes, the
primary key itself is saved in a keyfile, which is then password-protected. The
user can then use the password to simply unlock and use it to sign the
transaction they intend to send. The primary key itself, in that situation,
does not need to be directly accessed or even known by the user – just the
password. Note that gaining access to the keyfile, without knowing the password
accomplishes absolutely nothing. What makes the process non-custodial is simply
the location of the primary key, or it’s representative keyfile.
For custodial calls,
the keyfile described above is saved on the API server. However, the password
to it is still only known to the user. To initiate a transaction, the API
software over a secure layer would request the user to use their password to
unlock the keyfile and then sign the intended transaction the same way as for
custodial transaction. Note that similarly, the keyfile itself is completely
useless without the password that can unlock it. This process is similar to the
overall blockchain principle which we term data in plain sight secured by
sovereign users. Blockchain data are available publicly made possible via
encryption, and only those who have ownership or authority over such data can
order, decrypt, or modify the data.
All Toronet API
calls use JSON format for the input, as well as the output. Much of the input
and output are also formatted as name/value pairs. This becomes clear after
reviewing a few examples. In the next few sections, we review all currently
available calls including their input, output, and in the case of an error, the
various error messages returned.
This call creates a
new blockchain address. The syntax of the call is as follows:
{ "op":
"createkey", "params": [ { "name": "password",
"value": “Toronet” } ] } |
The argument or
attribute of the call are:
Attributes |
Type |
Meaning |
op |
string |
Policy unique id |
name |
string constant |
Name of insurance company |
value |
string |
Insurance category / insurance class /
insurance type |
Policy insured item type |
The response for
this call is a new public address or account on the blockchain.
Response Attributes |
Type |
Meaning |
Address |
string/address |
Policy unique id |
Policy insured item type |
This call retrieves
the key of the blockchain address. The payload is as follows:
{
"op":
"getkey",
"params":
[
{
"name": "addr",
"value": “0x432c7294c152c4f4930373a79e833cd22b9925b3”
}
]
}
The arguments of the
call are:
Attributes |
Type |
Meaning |
op |
string |
Policy unique id |
name |
string constant |
Name of insurance company |
value |
string |
Insurance category / insurance class /
insurance type |
Policy insured item type |
The response for this call is the
keystoredata
{
"result": true,
"keystoredata": {
"address": "432c7294c152c4f4930373a79e833cd22b9925b3",
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "561a6c0998109babb828fa51a54e03557ca6620854ec41b9a99ca3e66d517b21",
"cipherparams": {
"iv": "ab4c9793b35edb7315c7cc851a29074e"
},
"mac": "17063e95e2b850c4f3714c30e3e5875705e4684b46fdeba0f48aa60167bcdc57",
"kdf": "pbkdf2",
"kdfparams": {
"c": 262144,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "beee530d83acaa730d4df6857148e83256125f79cf50da37f4a09e38b5ce4fb8"
}
},
"id": "01b9c4ea-8eeb-48f9-8d68-ddc88ed2942d",
"version": 3
},
"message": "keystore record has been
found"
}
This call is used to verify the validity of a cryptographic key stored in the keystore. The payload is as follows:
{
"op":
"verifykey",
"params":
[
{
"name": "addr",
"value": “0x432c7294c152c4f4930373a79e833cd22b9925b3”
}
{
"name": "pwd",
"value": “toronet”
}
]
}
The response for this call is the
result
{
"result":
true,
"message":
"keystore record is found and the password has been verified"
}
This call is used to update the key stored in the keystore. The payload is as follows:
{
"op":
"updatepwd",
"params":
[
{
"name": "addr",
"value": “0x432c7294c152c4f4930373a79e833cd22b9925b3”
}
{
"name": "oldpwd",
"value": “toronet2”
}
{
"name": "newpwd",
"value": “toronet”
}
]
}
The arguments of the
call are:
Attributes |
Type |
Meaning |
op |
string |
Policy unique id |
name |
string constant |
Name of insurance company |
value |
string |
Insurance category / insurance class /
insurance type |
oldpwd
& pwd |
string |
Old password and new
password Policy insured item type |
This is called to import a keystore record by private key and password, The payload is as follows:
{ "op":"importkey", "params":[{"name":"prvkey", "value":"8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f"}, {"name":"pwd", "value":"toronet"}] }
The response for this call is:
{
"result": true,
"address": "0x63fac9201494f0bd17b9892b9fae4d52fe3bd377",
"message": "keystore record has been
imported"
}
This call is used to delete key from the API server. The payload is as follows:
{ "op":"deletekey", "params":[{"name":"addr", "value":"63fac9201494f0bd17b9892b9fae4d52fe3bd377"}, {"name":"pwd", "value":"toronet"}] }
The response for this call is:
{
"result": true,
"message": "keystore record has been
deleted"
}
This call is used to get basic information about the Blockchain.
http://testnet.toronet.org/api/blockchain
The response for this call is:
{
"result": true,
"blockchaininfo": {
"chain": "testnet",
"chainid": 54321,
"latestblock": 11575975,
"datetime": "2023/05/17 10:09:54"
},
"message": "current blockchain status
has been updated"
}
This call is used to query the latest block on the Blockchain. The payload is as follows:
{ "op":"getblock", "params":[{"name":"id", "value":"latest"}] }
The response for this call is:
{
"result": true,
"block": {
"difficulty": "1",
"extraData": "0xd883010a03846765746888676f312e31352e37856c696e7578000000000000003dceef6a6945796b0800db6ca275925fb0477983ccfaa121d23f6af3e8082c8b5f55dc0b42fbd22f35b1831f79641a10c339135dcb61efc62b3bbd8ef303919401",
"gasLimit": 1000000000,
"gasUsed": 0,
"hash": "0xae2b664309d0b62f3afd9eebf54814169427193f636995e3d03dd9d7fb51a4d8",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x0000000000000000000000000000000000000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": 11575996,
"parentHash": "0x8ec9b7bff6a75df8a9e55c5ba6f4a252419db817df6675d7b886823e97604ea2",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": 610,
"stateRoot": "0xb90ffca291a40ed452566f7de3011526efffa81903c11bb6f0737e67f094a790",
"timestamp": 1684318298,
"totalDifficulty": "20277133",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
},
"message": "block 'latest' has been
queried"
}
This call is used to retrieve information about a specific transaction in the Blockchain. The payload is as follows:
{ "op":"gettransaction", "params":[{"name":"id", "value":"0xed23ba5f0e66ab2a0fec6cce2d91cbb8015b8de99b6ace976ef0d584791122f9"}] }
This call is used to get transaction receipt info by transaction hash
{ "op":"getreceipt", "params":[{"name":"id", "value":"0xed23ba5f0e66ab2a0fec6cce2d91cbb8015b8de99b6ace976ef0d584791122f9"}] }
This call is used to get revert reason with transaction hash. The payload for this request is as follows:
{ "op":"getrevertreason", "params":[{"name":"id", "value":"0xedd9369339b2b56c466b266df3c812359ba6bab1375f72dd8ae520522448808a"}] }
This call is used to retrieve the name associated with a specific address; the payload is as follows:
{ "op":"getname", "params":[{"name":"addr", "value":"0x43F78b342084e370f10e0Cd07d56d95c1728C9D4"}] }
The response for this call is:
This call is used to retrieve the address associated with a specific name. The payload is as follows:
{ "op":"getaddr", "params":[{"name":"name", "value":"owner"}] }
The response for this call is:
{
"result": true,
"address": "0x314EF41554Dc423C88836DCDce55b3f61d1804B1",
"message": "tns address for 'owner'
is '0x314EF41554Dc423C88836DCDce55b3f61d1804B1'"
}
This call is used to check if a specific name is already used in the TNS, the payload is as follows:
{ "op":"isnameused", "params":[{"name":"name", "value":"owner"}] }
The response for this call is:
{
"result": true,
"isused": true,
"message": "name 'owner' is used in
tns"
}
This call is used to check if a specific address has been assigned in the TNS. They payload for this request is as follows:
{ "op":"isaddrassigned", "params":[{"name":"addr", "value":"0x43F78b342084e370f10e0Cd07d56d95c1728C9D4"}] }
The response for this call is:
{
"result": true,
"isassigned": false,
"message": "address
'0x43F78b342084e370f10e0Cd07d56d95c1728C9D4' is not assigned in tns"
}
This call is used to check if the TNS is currently enabled
{ "op":"isseton", "params":[] }
The response for this call is:
{
"result": true,
"ison": false,
"message": "client tns name set is
off"
}
This call is used to check if the update functionality of the TNS is currently enabled
{ "op":"isupdateon", "params":[] }
The response of this call is:
{
"result": true,
"ison": false,
"message": "client tns name update is
off"
}
This call is used to check if the delete functionality of the TNS is currently enabled
{ "op":"isdeleteon", "params":[] }
The response for this call is:
{
"result": true,
"ison": false,
"message": "client tns name delete is
off"
}
The list of roles that are currently available on the blockchain are
- debugger
- superadmin
- admin
http://testnet.toronet.org/api/role/debugger
This call is used to check if the role of an address is debugger, the payload is as follows:
{ "op":"isdebugger", "params":[{"name":"addr", "value":"0x9d78cbc4d102bf38c825b3f6460fc2d89852486a"}] }
The sample response for this call is:
{
"result": true,
"isdebugger": true,
"message": "'0x9d78cbc4d102bf38c825b3f6460fc2d89852486a'
is a debugger"
}
This call is used to get the index of the debugger, the payload is as follows:
{ "op":"getdebuggerindex", "params":[{"name":"addr", "value":"0x9d78cbc4d102bf38c825b3f6460fc2d89852486a"}] }
The sample response for this call is:
{
"result": true,
"index": 0,
"message": "index of debugger
'0x9d78cbc4d102bf38c825b3f6460fc2d89852486a' is 0"
}
This call is used to get the total number of debuggers on the blockchain, the payload is as follows:
{ "op":"getnumberofdebugger", "params":[] }
The sample response for this call is:
{
"result": true,
"number": "2",
"message": "There are 2
debuggers"
}
This call is used to get a debugger by index, the payload is as follows:
{ "op":"getdebuggerbyindex", "params":[{"name":"index", "value":0}] }
The sample response for this call is:
{
"result": true,
"debugger": "0x9d78cBc4D102bf38c825B3f6460Fc2D89852486A",
"message": "debugger at index 0 is
'0x9d78cBc4D102bf38c825B3f6460Fc2D89852486A'"
}
http://testnet.toronet.org/api/role/superadmin
This call is used to check if the role of an address is superadmin, the payload is as follows:
{ "op":"issuperadmin", "params":[{"name":"addr", "value":"0xd81f3d3ec6eedbc1e1d6245d1adfff5e492bb787"}] }
The sample response for this call is:
{
"result": true,
"issuperadmin": true,
"message": "'0x9d78cbc4d102bf38c825b3f6460fc2d89852486a'
is not a superadmin"
}
This call is used to get the index of a superadmin, the payload is as follows:
{ "op":"getsuperadminindex", "params":[{"name":"addr", "value":"0xd81f3d3ec6eedbc1e1d6245d1adfff5e492bb787"}] }
This call is used to get the number of superadmins in the blockchain
{ "op":"getnumberofsuperadmin", "params":[] }
The sample response for this call is:
{
"result": true,
"number": "3",
"message": "There are 3 super
admins"
}
This call is used to get a superadmin by index, the payload is as follows:
{ "op":"getsuperadminbyindex", "params":[{"name":"index", "value":0}] }
http://testnet.toronet.org/api/role/admin
This call is used to check whether an address has the role of an admin, the payload is as follows:
{ "op":"isadmin", "params":[{"name":"addr", "value":"0xea45bcd1b04233f9240c01d52f773b832704fed0"}] }
This call is used to get the index of a specific admin in the blockchain, the payload is as follows:
{ "op":"getadminindex", "params":[{"name":"addr", "value":"0xea45bcd1b04233f9240c01d52f773b832704fed0"}] }
This call is used to get the total number of admins in the blockchain
{ "op":"getnumberofadmin", "params":[] }
This call is used to get an admin by index, the payload is as follows:
{ "op":"getadminbyindex", "params":[{"name":"index", "value":0}] }
This call is used to get The Tọ̀rọ̀ balance for an address, the payload is as follows:
{ "op":"getbalance", "params":[{"name":"addr", "value":"0x314ef41554dc423c88836dcdce55b3f61d1804b1"}] }
The response for this call is:
{
"result": true,
"balance": "400",
"message": "toro balance for '0x314ef41554dc423c88836dcdce55b3f61d1804b1'
is '400'"
}
This call is used to get the token’s name.
{ "op":"getname", "params":[] }
The response for this call is:
{
"result": true,
"name": "Toro",
"message": "token name is
'Toro'"
}
This call is used to get the token’s symbol
{ "op":"getsymbol", "params":[] }
The response for this call is:
{
"result": true,
"symbol": "TORO",
"message": "token symbol is
'TORO'"
}
This call is used to get the token’s decimal
{ "op":"getdecimal", "params":[] }
The response for this call is:
{
"result": true,
"decimal": "18",
"message": "token decimal is
'18'"
}
This call is used to get the token’s minimum transfer allowance
{ "op":"getminimumallowance", "params":[] }
The response for this call is:
{
"result": true,
"minimumallowance": "0",
"message": "toro minimum transfer allowance
is '0'"
}
This call is used to get the token’s maximum transfer allowance
{ "op":"getmaximumallowance", "params":[] }
The response for this call is:
{
"result": true,
"maximumallowance": "10000",
"message": "toro maximum transfer
allowance is '10000'"
}
This call is used to get the maximum / minimum transfer allowance
{ "op":"getallowance", "params":[] }
The response for this call is:
{
"result": true,
"minimumallowance": "0",
"maximumallowance": "10000",
"message": "toro maximum / minimum
transfer allowance are '10000 / 0'"
}
This call is used to get the transaction (this is fixed)
{ "op":"gettransactionfeefixed", "params":[] }
The response for this call is:
{
"result": true,
"txfeefixed": "0",
"message": "toro fixed transaction
fee is '0'"
}
This call is used to get the transaction fee in percentage (%)
{ "op":"gettransactionfeepercentage", "params":[] }
The sample response for this response is:
{
"result": true,
"txfeepercentage": "0",
"message": "toro percentage
transaction fee is '0%'"
}
This call is used to get the transaction fee
{ "op":"gettransactionfee", "params":[] }
The sample response for this call is:
{
"result": true,
"txfeefixed": "0",
"txfeepercentage": "0",
"message": "toro fixed / percentage
transfer fee are '0' / '0%'"
}
This call is used to get the commission address
{ "op":"getcommissionaddress", "params":[] }
The sample response for this call is:
{
"result": true,
"commissionaddress": "0xa231BB16803d8F7dcb6885B04183c9E71F4cdDF3",
"message": "commission address is
'0xa231BB16803d8F7dcb6885B04183c9E71F4cdDF3'"
}
This call is used to get the commission percentage (%)
{ "op":"getcommissionpercentage", "params":[] }
The response for this call is:
{
"result": true,
"commissionpercentage": "0",
"message": "commission percentage is
'0 %'"
}
This call is used to get the reserve address
{ "op":"getreserve", "params":[] }
The response for this call is:
{
"result": true,
"reserve": "0xf3CDfC4a1DCE2D98FF878971626B798279954c43",
"message": "reserve address is
'0xf3CDfC4a1DCE2D98FF878971626B798279954c43'"
}
This call is used to get the toller address
"op":"gettoller", "params":[] }
The sample response for this call is:
{
"result": true,
"toller": "0xa231BB16803d8F7dcb6885B04183c9E71F4cdDF3",
"message": "toller address is
'0xa231BB16803d8F7dcb6885B04183c9E71F4cdDF3'"
}
This call is used to get the token’s total cap
{ "op":"gettotalcap", "params":[] }
The sample response for this call is:
{
"result": true,
"totalcap": "0",
"message": "toro total cap is
'0'"
}
This call is used to get the total token that is currently in reserve
{ "op":"gettotalreserving", "params":[] }
The sample response for this call is:
{
"result": true,
"totalreserving": "71987.274205605201720169",