iBriz | Idol Token (ICON Foundation)
Deploying IdolToken to tbears
$ tbears deploy -t tbears idol_token -f hxe9d75191906ccc604fc1e45a9f3c59fb856c215f -k keystore1.json -c tbears_cli_config.json
Sample keystore.json file ( password is "p@ssword1 " )
{"address" :" hxe9d75191906ccc604fc1e45a9f3c59fb856c215f" ,"id" :" 2f19df35-9a11-4b24-a83d-11c8d5e903db" ,"coinType" :" icx" ,"version" :3 ,"crypto" :{"cipher" :" aes-128-ctr" ,"ciphertext" :" 469900238420d66b02dbbc1d6e978ef0e1f46321e8767cbc9f59bd93499166d4" ,"cipherparams" :{"iv" :" 432a04c7317d83e663e67f605befb326" },"kdf" :" scrypt" ,"kdfparams" :{"dklen" :32 ,"n" :4096 ,"p" :6 ,"r" :8 ,"salt" :" 66fad93a131f21c18c8c8bf08ca56641d984eaa20855bcfeac78dcb5264ce3fb" },"mac" :" 036ab5c07ec0060bf558010108c78c5427e4223047fd2cca3ae523c8e4d9e25e" }}
Grails 3.3
Gradle 4.x
JAVA 8
tbears 1.0.5.1
IPFS daemon
We will be using Intellij to open the project in.
1. Check profile of an Account
http://localhost:8080/iconmain/checkAccountPage?address=hxe9d75191906ccc604fc1e45a9f3c59fb856c215f&tokenType=IDOL
Key
Value
address
hxe9d75191906ccc604fc1e45a9f3c59fb856c215f
tokenType
IDOL
Example Request to retrieve profile information of Account A
Check profile of Account A
curl --request GET \
--url ' http://localhost:8080/iconmain/checkAccountPage?address=hxe9d75191906ccc604fc1e45a9f3c59fb856c215f&tokenType=IDOL'
{
"address" : " hxe9d75191906ccc604fc1e45a9f3c59fb856c215f" ,
"ICXbalance" : 0 ,
"scoreAddress" : " cx0bce5bfe899c4beec7ea93f2000e16351191017e" ,
"scoreMap" : " {IDOL=cx0bce5bfe899c4beec7ea93f2000e16351191017e}" ,
"accountList" : [
" hx65f6e18d378b57612a28f72acb97021eaa82aa5a" ,
" hx2a7c46497d99e64d7198c267b5ca7deca265a4f8" ,
" hx40ebd13225ed28f7e98be3cd833ebe555cba72ca"
],
"tokenType" : " IDOL" ,
"tokenList" : [
{
"owner" : " hx65f6e18d378b57612a28f72acb97021eaa82aa5a" ,
"gender" : " M" ,
"tokenId" : " f27cb376-af45-11e8-94b7-000c29be104e" ,
"name" : " Tom Hanks" ,
"age" : " 0x3e" ,
"ipfs_handle" : " 0xabcde12345"
}
],
"tokenBalance" : 1
}
http://localhost:8080/iconmain/checkTokenDetails?tokenType=IDOL&tokenId=0a55e0d0-af46-11e8-94b7-000c29be104e
Key
Value
tokenType
IDOL
tokenId
0a55e0d0-af46-11e8-94b7-000c29be104e
Check profile of Account A
curl --request GET \
--url ' http://localhost:8080/iconmain/checkTokenDetails?tokenType=IDOL&tokenId=0a55e0d0-af46-11e8-94b7-000c29be104e'
{
"address" : " hx40ebd13225ed28f7e98be3cd833ebe555cba72ca" ,
"scoreAddress" : " cx0bce5bfe899c4beec7ea93f2000e16351191017e" ,
"gender" : " F" ,
"scoreMap" : " {IDOL=cx0bce5bfe899c4beec7ea93f2000e16351191017e}" ,
"name" : " Jennifer Aniston" ,
"tokenType" : " IDOL" ,
"age" : " 0x31" ,
"ipfs_handle" : " 0xabcde12346"
}
http://localhost:8080/iconmain/createIdolToken
Key
Value
address
hx40ebd13225ed28f7e98be3cd833ebe555cba72ca
tokenType
IDOL
name
Jennifer Aniston
gender
F
ipfs_handle
0xsfalsdfjlk2
curl -X POST \
http://localhost:8081/iconmain/createIdolToken \
-H ' Content-Type: application/json' \
-d ' {
"address":"hx65f6e18d378b57612a28f72acb97021eaa82aa5a",
"tokenType":"IDOL",
"name":"Michelle Sussett",
"age":"22",
"gender":"F",
"ipfs_handle":"0xsfalsdfjlk29"
}'
{
"address" : " hx40ebd13225ed28f7e98be3cd833ebe555cba72ca" ,
"scoreAddress" : " cx0bce5bfe899c4beec7ea93f2000e16351191017e" ,
"gender" : " F" ,
"fullname" : " \" Jennifer Aniston\" " ,
"tokenType" : " IDOL" ,
"txHash" : " 0xf02ab1428b355b282323155538c3fb35aeb5f98a27bbbbc7eef335f4d6cf5538" ,
"age" : " 40" ,
"ipfs_handle" : " 0xsfalsdfjlk2"
}
http://localhost:8080/iconmain/transfer
Key
Value
fromAddress
hx65f6e18d378b57612a28f72acb97021eaa82aa5a
toAddress
hx40ebd13225ed28f7e98be3cd833ebe555cba72ca
tokenType
IDOL
tokenId
0a55e0d0-af46-11e8-94b7-000c29be104e
curl -X POST \
http://localhost:8081/iconmain/transfer \
-H ' Content-Type: application/json' \
-d ' {
"fromAddress": "hx65f6e18d378b57612a28f72acb97021eaa82aa5a",
"toAddress": "hx40ebd13225ed28f7e98be3cd833ebe555cba72ca",
"tokenType": "IDOL",
"tokenId": "0a55e0d0-af46-11e8-94b7-000c29be104e"
}'
{
"address" : " hx65f6e18d378b57612a28f72acb97021eaa82aa5a" ,
"scoreAddress" : " cx0bce5bfe899c4beec7ea93f2000e16351191017e" ,
"ICXbalance" : 0 ,
"transferAmount" : null ,
"remainingBalance" : 1 ,
"tokenType" : " IDOL" ,
"tokenList" : [
],
"toAddress" : " hx40ebd13225ed28f7e98be3cd833ebe555cba72ca" ,
"transactionHash" : " 0x9387d762562f0e95b09ea03efee8096f6900812df46d9ea905a4f232dcf502dd" ,
"tokenBalance" : 1
}
http://localhost:8080/iconmain/uploadImage
curl -X POST \
http://localhost:8081/iconmain/uploadImage \
-H ' content-type: multipart/form-data;' \
-F ' image=@C:\Users\user\Pictures\image.png'
{
"ipfsHash" : " QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR" ,
"name" : " QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR" ,
"size" : " 10490"
}
http://localhost:8080/iconmain/showImage?hash=QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR
Key
Value
ipfsHash
QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR
fileByte
iVBORw0KG...
fileContentType
image/png
curl -X GET \
' http://localhost:8081/iconmain/showImage?hash=QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR'
{
"ipfsHash" : " QmTdejDU8ixgiTa4f986zziGWgYabBeeGHZrEsinFBxmWR" ,
"fileByte" : " iVBORw0KG..." ,
"fileContentType" : " image/png"
}
TODO:
Create generic Account Linked to Wallet