Skip to content

Instantly share code, notes, and snippets.

@MizukiSonoko
Last active January 21, 2017 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MizukiSonoko/8498cac720959dec52162021d3013593 to your computer and use it in GitHub Desktop.
Save MizukiSonoko/8498cac720959dec52162021d3013593 to your computer and use it in GitHub Desktop.

I think blow api ( If use REST API)

Transaction API

Find account's transaction history by account-uuid

/history/transaction?uuid=aaaa

Params

  • account-uuid (Reason for account-uuid is url param can not use base64 in default, And accout-uuid is sha3-256(publicKey) )
  • limit

Return

{
  "status": 200,
  "history" : [
    {
      "domainName" : "hyperledger", 
      "assetName":  "iroha",
      "assetUuid" : "f806c37c88c6d099d1b342cc5e5783c4f6a11e7b63a5103f3799ce2a7468105e",
      "params" : {
        "type": "transfer",
        "value": "39",
        "sender" : "base64_public_key",
        "receiver" : "base64_public_key"
      },
      "signature" : "b64encoded_signature",
      "timestamp" : 1234567
    }
    ]
}

Account API

Account register

/account/register
curl -X POST http://$API_IP:1204/account/register -d "{
  \"publicKey\":\"DFA5dG/Va7hJCCP1FGsmdwLCuVy3MW5cVg97rQlDuY4=\",
  \"alias\":\"iori\",
  \"timestamp\":1481880628
}"

Get account's information

/account?uuid=aaaa

Params

  • account-uuid

Return

{
   "accountUuid": "sha3hash",
   "publicKey":"b64encoded",
   "alias":"mizuki_sonoko",
   "timestamp": 1234567,
   "assets": [
       {
         "domain": "hyperledger",
         "belong" : {
            "assetName":"iroha",
            "assetUuid" :"f806c37c88c6d099d1b342cc5e5783c4f6a11e7b63a5103f3799ce2a7468105e"
           }
        }
     ]
}

Asset operation.

/asset/operation

送金の例

curl -X POST http://$API_IP:1204/asset/operation -d"{
  \"asset-uuid\" : \"60f4a396b520d6c54e33634d060751814e0c4bf103a81c58da704bba82461c32\",
  \"params\" : {
    \"command\": \"transfer\",
    \"value\": \"23\",
    \"sender\" : \"DFA5dG/Va7hJCCP1FGsmdwLCuVy3MW5cVg97rQlDuY4=\",
    \"receiver\" : \"nNHtLmz7vJrva2kb5jXLIfn30qbAHjrLB80KQxThyls=\"
  },
  \"signature\" : \"qBjd51tn7+V4b3eRGL7wHzEMyBvtMQHFQ/zXBBu6PG4PyQ/5VY0Kg4DYxOmuv3mmSPm4XZYHtWOuA5iEFf+Sow==\",
  \"timestamp\" : 1481885628
}"

Relation

+--------------+  has  +---------+
|    Domain    |<------| Account |
+--------------+       +---------+
    |       | belong        |         
    v       v               | has
+------+ +------+           |
|Asset1| |Asset2|<----------+
+------+ +------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment