RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:9:30-18:00
你可能遇到了下面的问题
关闭右侧工具栏

技术支持

IPFS 轻量级客户端
  • 作者:井通至尚科技有限
  • 发表时间:2019-01-14 12:35
  • 来源:未知

客户端下载:      windows 版本 :skywell.node_win_v0.7.2

                                      mac版本:skywell.node_mac_v0.7.2

                                     linux版本:skywell.node_linux_v0.7.2

                                       arm版本:   skywell.node_arm_v0.7.2

井通区块链轻量节点使用手册:点击下载

说明:1、jt_issueToken 发⾏类erc721   收取from 地址 1000个SWTC 。(为了降低大家的使用测试成本,现在已经降为1000个SWTC)
           2、jt_createToken 创建具体每个唯一Token时 根据Token 属性中数据量的大小 收取from 地址 0.01 SWTC / KB  的SWTC。
           3、jt_uploadData  和  jt_uploadFile  上传的文件只临时存储 一天,如需同步到链上存储,则需添加到ERC721 Token 属性中去。
           4、jt_issueToken 和 jt_createToken 中的from 地址必须是 account list 能显示、管理的地址。所有使用的地址必须已激活。
           5、可在需要用到私钥的地方加上  "secret"  参数,与from 平行即可。(注意:此时secret将在网络上明文传输,存在安全隐患。钱包文件在轻客户端机器上,则不需要使用 "secret"  参数 无此安全隐患。
           6、memos 字段参数依然存在,使用和公链一样。



微信交流群  欢迎大家一起学习交流!






使用手册 For Jingtum Blockchain Light Node

JSON RPC API Reference


jt_syncing 同步

返回同步状态数据对象或false

Parameters 参数

Returns 返回值

Object|Boolean, 一个带有同步状态数据的对象。当未同步时,返回结果为FALSE:
startingBlockQUANTITY - import指令开始的区块(仅在同步信号到达其顶部时会被重置)
currentBlockQUANTITY - 当前区块, 同 jt_blockNumber
highestBlockQUANTITY - 预估最高区块

Example 举例
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_syncing","params":[],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id":1,
  "jsonrpc":"2.0",
  "result":
    {
      "currentBlock":4599,
      "highestBlock":850088,
      "startingBlock":20
    },
  "status":"success"
}

// Or when not syncing 未同步时的结果
{
  "id":1,
  "jsonrpc": "2.0",
  "result": false,
  "status": "success"
}

jt_blockNumber 区块编号

返回最新区块的编号

Parameters 参数

Returns 返回值

QUANTITY - 客户端运行的当前区块编号.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_blockNumber","params":[],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id":1,
  "jsonrpc": "2.0",
  "result": 112948,
  "status": "success"
}

jt_getBalance 获取余额

返回给定地址的帐户余额

Parameters 参数
  1. DATA - 所要查询余额的地址.
  2. QUANTITY|TAG - 区块编号, 区块哈希, 或者是字符串 "validated""current""closed"中的一个, 详见 default block parameter
params: [
   "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
   "validated"
]
Returns 返回值

OBJECT - 当前余额和货币列表

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getBalance","params":["j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E", "validated"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id":1,
  "jsonrpc":"2.0",
  "result":
{
    "account":"j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
    "balance":"82002267",
    "coins":[
        {
            "account":"jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or",
            "balance":"0.02",
            "currency":"CNY",
            "limit":"10000000000",
            "limit_peer":"0",
            "no_skywell":true,
            "quality_in":0,
            "quality_out":0
        }
    ],
  "ledger_hash":"6ACD74B8C7E0E9E9DE001BD98DCCA45F26CC47BE455C681CB32440BD1BF1991D",
  "ledger_index":10449036,
  "validated":true
  },
  "status":"success"
}

jt_getTransactionCount 获取交易数

返回某个地址sent(发起)的交易数

Parameters 参数
  1. DATA - 地址.
  2. QUANTITY|TAG - 区块编号, 区块哈希, 或者是字符串 "validated""current""closed"中的一个, 详见 default block parameter
params: [
   'j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E',
   '113199' // the block number 区块编号
]
Returns 返回值

QUANTITY - 该地址发起的交易数.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTransactionCount","params":["j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E", "113199"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id":1,
    "jsonrpc":"2.0","
    result":1,
    "status":"success"
}

jt_getBlockTransactionCountByHash 根据区块哈希获取交易数

返回给定哈希值所对应的区块的交易数

Parameters 参数
  1. DATA - 区块哈希
params: [
   '4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E'
]
Returns 返回值

QUANTITY - 这个区块的交易数.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getBlockTransactionCountByHash","params":["4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id":1,
    "jsonrpc":"2.0",
    "result":2,
    "status":"success"
}

jt_getBlockTransactionCountByNumber 根据区块编号获取交易数

返回给定编号所对应的区块的交易数

Parameters 参数
  1. QUANTITY|TAG - 区块编号
params: [
   '0xe8', // 232
]
Returns 返回值

QUANTITY - 这个区块的交易数.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getBlockTransactionCountByNumber","params":["113199"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id":1,
  "jsonrpc": "2.0",
  "result":0,
  "status":"success"
}

jt_getBlockByHash 根据区块哈希获取区块信息

返回哈希值所对应的区块信息

Parameters 参数
  1. DATA, 32 Bytes - 区块哈希
  2. Boolean - 如果参数为true,则返回整个交易对象,如果参数为false`则只返回交易哈希。
params: [
   "4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E",
   true
]
Returns 返回值

Object - 一个区块对象,当区块不存在时则返回null:

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getBlockByHash","params":["4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E", false],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "ledger": {
      "accepted": true,
      "account_hash": "63A773D95DA86938313CEB400ADC90A6AED4C087985755E1F3596041A5226258",
      "close_time": 587650500,
      "close_time_human": "2018-Aug-15 12:15:00",
      "close_time_resolution": 10,
      "closed": true,
      "hash": "4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E",
      "ledger_hash": "4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E",
      "ledger_index": "113199",
      "parent_hash": "144C61BA96372BA427DE2C1244BD8D8F6E18810E403999599F0AC9E111E8D220",
      "seqNum": "113199",
      "totalCoins": "600000000000000000",
      "total_coins": "600000000000000000",
      "transaction_hash": "0000000000000000000000000000000000000000000000000000000000000000",
      "transactions": [
          {
            "Account": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "Amount": "1",
            "Destination": "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
            "Fee": "12",
            "Flags": 2147483648,
            "Sequence": 362,
            "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
            "TransactionType": "Payment",
            "TxnSignature": "3045022100EAAE8B2E451D784CEE5406BBFE4FDA286152AC3395F672AF09689D2F85C4510D02202EF038B5DF3088A2AC097EF1617103BDDF2513FFA11D8E5E868C6465BDDADBCC",
            "date": 587199710,
            "hash": "0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55",
            "inLedger": 68120,
            "ledger_hash": "3B98F9DB9BA4A91A140C5ACC8E6FAA01746408938E89F7D1963AEB257228DBBA",
            "ledger_index": 68120,
            "validated": true
          }
      ]
    },
    "ledger_hash": "4F8040D0EF9A2360DFE5E715D3991B75340DA937F5ABA00C7686B76B1F84E26E",
    "ledger_index": 113199,
    "validated": true
  },
  "status": "success"
}

jt_getBlockByNumber 根据区块编号获取区块信息

返回区块编号所对应的区块信息

Parameters 参数
  1. QUANTITY|TAG - 区块编号,或者是字符串"earliest""latest""pending"中的一个, 正如在 default block parameter里的一样.
  2. Boolean - 如果参数为true,则返回整个交易对象,如果参数为false`则只返回交易哈希。
params: [
    "113199",
   true
]
Returns 返回值

详见 jt_getBlockByHash

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getBlockByNumber","params":["113199", false],"id":1}' http://localhost:7545/v1/jsonrpc

结果详见 jt_getBlockByHash


jt_getTransactionByHash 根据区块哈希获取交易信息

返回交易哈希请求的交易信息

Parameters 参数
  1. DATA, 32 Bytes - 交易哈希
params: [
   "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"
]
Returns 返回值

Object - 返回一个交易对象,当交易不存在时返回null

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTransactionByHash","params":["0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "Account": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
    "Amount": "1",
    "Destination": "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
    "Fee": "12",
    "Flags": 2147483648,
    "Sequence": 362,
    "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
    "TransactionType": "Payment",
    "TxnSignature": "3045022100EAAE8B2E451D784CEE5406BBFE4FDA286152AC3395F672AF09689D2F85C4510D02202EF038B5DF3088A2AC097EF1617103BDDF2513FFA11D8E5E868C6465BDDADBCC",
    "date": 587199710,
    "hash": "0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55",
    "inLedger": 68120,
    "ledger_hash": "3B98F9DB9BA4A91A140C5ACC8E6FAA01746408938E89F7D1963AEB257228DBBA",
    "ledger_index": 68120,
    "validated": true
  },
  "status": "success"
}

jt_getTransactionByBlockHashAndIndex 根据区块哈希和索引获取交易信息

返回区块哈希和交易索引所对应的交易信息

Parameters 参数
  1. DATA, 32 Bytes - 区块哈希.
  2. QUANTITY - 交易索引.
params: [
   "3B98F9DB9BA4A91A140C5ACC8E6FAA01746408938E89F7D1963AEB257228DBBA",
   "0"
]
Returns 返回值

详见 jt_getTransactionByHash

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTransactionByBlockHashAndIndex","params":["3B98F9DB9BA4A91A140C5ACC8E6FAA01746408938E89F7D1963AEB257228DBBA", "0"],"id":1}' http://localhost:7545/v1/jsonrpc

结果详见 jt_getTransactionByHash


jt_getTransactionByBlockNumberAndIndex 根据区块编号和索引获取交易信息

返回区块编号和交易索引所对应的交易信息.

Parameters 参数
  1. QUANTITY|TAG - 区块编号,或者是字符串"earliest""latest""pending"中的一个, 正如在 default block parameter里的一样.
  2. QUANTITY - 交易索引.
params: [
   "68120",
   "0"
]
Returns 返回值

详见 jt_getTransactionByHash

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTransactionByBlockNumberAndIndex","params":["68120", "0"],"id":1}' http://localhost:7545/v1/jsonrpc

结果详见 jt_getTransactionByHash


jt_getTransactionReceipt 获取交易收据

返回交易哈希所对应的交易收据.

注意 无法获得正在进行中的交易的收据.

Parameters 参数
  1. DATA, 32 Bytes - 交易哈希
params: [
   "0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55"
]
Returns 返回值

Object - 返回一个交易收据对象,当收据不存在时返回null

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTransactionReceipt","params":["0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "AffectedNodes": [
      {
        "ModifiedNode": {
          "FinalFields": {
            "Account": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "Balance": "244499999099995309",
            "Flags": 0,
            "OwnerCount": 0,
            "Sequence": 363
          },
          "LedgerEntryType": "AccountRoot",
          "LedgerIndex": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8",
          "PreviousFields": {
            "Balance": "244499999099995322",
            "Sequence": 362
          },
          "PreviousTxnID": "79EA2CCE7B64AADCC02CB252AE3E2E375BBEEB11A61A16B2634C4CDE54EA74CE",
          "PreviousTxnLgrSeq": 68120
        }
      },
      {
        "ModifiedNode": {
          "FinalFields": {
            "Account": "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
            "Balance": "200000346",
            "Flags": 0,
            "OwnerCount": 0,
            "Sequence": 1
          },
          "LedgerEntryType": "AccountRoot",
          "LedgerIndex": "BA84D071F8AB10AA7FBA28E04EF1E75A2D36362B85BFC494FCF257C5960C8A09",
          "PreviousFields": {
            "Balance": "200000345"
          },
          "PreviousTxnID": "79EA2CCE7B64AADCC02CB252AE3E2E375BBEEB11A61A16B2634C4CDE54EA74CE",
          "PreviousTxnLgrSeq": 68120
        }
      },
      {
        "ModifiedNode": {
          "FinalFields": {
            "Account": "jBbRz4Erf7j4oBboXcChKWVgX5HhymygLT",
            "Balance": "4332",
            "Flags": 0,
            "OwnerCount": 0,
            "Sequence": 362
          },
          "LedgerEntryType": "AccountRoot",
          "LedgerIndex": "F88E3CB9279ED427BB4CF37D13840A0728489CC273AE92A5C05D5390B1FF5F2A",
          "PreviousFields": {
            "Balance": "4320",
            "Sequence": 361
          },
          "PreviousTxnID": "79EA2CCE7B64AADCC02CB252AE3E2E375BBEEB11A61A16B2634C4CDE54EA74CE",
          "PreviousTxnLgrSeq": 68120
        }
      }
    ],
    "TransactionIndex": 249,
    "TransactionResult": "tesSUCCESS",
    "hash": "0019A03D4D5CAC27A2B25F3E2BEBBE2B0FE68C758128481E7D50FFD2D12C6F55"
  },
  "status": "success"
}

jt_accounts 账户列表

返回客户端所拥有的地址列表.

Parameters 参数

Returns 返回值

Array of DATA, 20 Bytes - 客户端所拥有的所有地址

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_accounts","params":[],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    "jPtkTgG9o4Jfq6w5G6FaNGgEnVRsSNoUuB",
    "jfRiTK5t9uBcmfYp5B95q5k3oggdwGLcSv",
    "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E"
  ],
  "status": "success"
}

jt_sign 签名

通过给消息添加前缀,使得计算出的签名可以被识别成Skywell特定签名.

Parameters 参数

账户,信息

  1. DATA - 地址
  2. DATA, N Bytes - 要签名的消息
Returns 返回值

DATA: 签名

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_sign","params":["j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E","0xdeadbeaf"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x30450221008D119BA6ABB97D5A541D0BD5649AA0DC35E00C19E5C381A15611CD38E933B18902201E76D713F7966A1F1BAC6EFB87D0953F8697EB6DFE485F434F34D959ACD74FED",
  "status": "success"
}

jt_sendTransaction 发起交易

创建一个新交易,签名,并提交交易.

Parameters 参数
  1. Object - 交易对象
    • fromDATA - 交易发起一方的地址
    • toDATA - (当创建新交易时可选) 交易所指向的地址。
    • feeQUANTITY - (可选,默认12) 执行交易所需提供的交易费用.
    • valueQUANTITY - (可选) 整数交易金额.
params: [
    {
        "from":"jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
        "to":"j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
        "value":"1"
    }
]
Returns 返回值

DATA, 32 Bytes - 返回交易哈希,当交易不存在时返回0哈希.

使用 jt_getTransactionReceipt 来获取交易收据

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_sendTransaction","params":[{"from":"jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh","to":"j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E","value":"1"}],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    "637FE35E7ECEDA862A1C51596945F69444C169796197CC174F449C176116395D"
  ],
  "status": "success"
}

jt_signTransaction 签名交易

创建并签署一个交易

Parameters 参数
  1. Object - 交易对象
    • fromDATA - 交易发起一方的地址
    • toDATA - (当创建新交易时可选) 交易所指向的地址。
    • feeQUANTITY - (可选,默认12) 执行交易所需提供的交易费用.
    • valueQUANTITY - (可选) 整数交易金额.
params: [
    {
        "from":"jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
        "to":"j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
        "value":"1"
    }
]
Returns 返回值

DATA - 十六进制的签名交易.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_signTransaction","params":[{"from":"jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh","to":"j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E","value":"1"}],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    "120000228000000024000003FB61400000000000000168400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402207268AD2FC68CD6AB8157F5BD0B0884F37DFF18D01E5414D6A277E33D4328D2BD02205502FDFFF00B7F1F9D7EB75329F65B50E619B6E1F9D24BE0D65F862419398A178114B5F762798A53D543A014CAF8B297CFF8F2F937E883145D2221763934C9380F43168B760199AC8C4DC074"
  ],
  "status": "success"
}

jt_sendRawTransaction 发起原始交易

提交十六进制格式的原始交易

Parameters 参数
  1. DATA, 签署后的交易数据.
params: ["120000228000000024000003FB61400000000000000168400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402207268AD2FC68CD6AB8157F5BD0B0884F37DFF18D01E5414D6A277E33D4328D2BD02205502FDFFF00B7F1F9D7EB75329F65B50E619B6E1F9D24BE0D65F862419398A178114B5F762798A53D543A014CAF8B297CFF8F2F937E883145D2221763934C9380F43168B760199AC8C4DC074"]
Returns 返回值

DATA - 返回交易哈希,当交易不存在时返回0哈希.

在交易生效后,使用 jt_getTransactionReceipt 来获取交易收据

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_sendRawTransaction","params":["120000228000000024000003FB61400000000000000168400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402207268AD2FC68CD6AB8157F5BD0B0884F37DFF18D01E5414D6A277E33D4328D2BD02205502FDFFF00B7F1F9D7EB75329F65B50E619B6E1F9D24BE0D65F862419398A178114B5F762798A53D543A014CAF8B297CFF8F2F937E883145D2221763934C9380F43168B760199AC8C4DC074"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    "15392C8703C7141F3604C6DF251E5FB361FA3DF7B835843EF007EA51508FF77D"
  ],
  "status": "success"
}

jt_account 查询帐户历史交易

查询帐户历史交易

Parameters 参数
  1. STRING - 所要查询余额的地址.
  2. INT - 起始页号,可省略,默认为0
  3. INT - 每页交易数, 可省略,默认为所有
  4. BOOL - 是否最新的交易在前边,可省略,默认为true
  5. STRING - 交易方向,可省略,默认为'both',有'in', 'out'可选
params: ["j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E", 0, 2, true, "in"]
Returns 返回值

LIST - 交易列表

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_account","params":["j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E", 0, 2, true, "in"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "amount": "1",
            "date": "2018-09-27T12:49:00+08:00",
            "from_address": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "hash": "2EBDD99F0030C42127A7EB151F4852CC45F0CBADE7AB3A9B0321845C7EDCA826",
            "to_address": "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
            "type": "Payment"
        },
        {
            "amount": "1000000000000",
            "date": "2018-09-27T12:30:40+08:00",
            "from_address": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh",
            "hash": "6E7751B22E630888C89AFF087D8A0197BA84704F19E7865611A2124C1CE8DE01",
            "to_address": "j9VSrHSiZPiJBPUS6iwYiT8yfy8iFbeR4E",
            "type": "Payment"
        }
    ],
    "status": "success"
}

jt_issueToken 发行类erc721的Token

发行类似erc721的token

Parameters 参数
  • from:ADDRESS: 发行token的帐户地址
  • to:ADDRESS:创建token的帐户地址
  • token_info:OBJECT: token的定义信息

    • name:STRING: 类erc721的token的名称
    • symbol:STRING: 类erc721的token的简称
    • total_supply:INT: 该token的总供应量
    • items:LIST:定义该token的属性
      • name:STRING: 该属性的名称
      • type:STRING: 该属性的类型,现支持三种类型,boolean, integer, string, number, binary, file, list, map, 示例如下见Token属性数据类型示例
      • desc:STRING: 该属性描述, 可以为空
  1. DATA, 所发行Token的哈希字符串
"params":[
    {
        "from":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
        "to":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR", 
        "token_info":{
            "name":"TEST", 
            "symbol":"test", 
            "total_supply":100,
            "items":[
                {
                    "name":"code",
                    "type":"string",
                    "desc":"the code of the token"
                },
                {
                    "name":"quality",
                    "type":"string",
                    "desc":"the quality of the token"
                },
                {
                    "name":"weight",
                    "type":"number",
                    "desc":"the weight of the token"
                }
            ]
        }
    }
]
Returns 返回值
  • transaction:HASH - 返回区块链上的交易哈希,当交易不存在时返回0哈希
  • hash:HASH - 返回该token定义的hash, 后续jt_createToken的时候要用到
  • gasOBJECT - 对于需要消耗gas的调用,返回消耗的gas数量及对应的交易哈希
Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_issueToken",
    "params":[
        {
            "from":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
            "to":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR", 
            "token_info":{
                "name":"TEST", 
                "symbol":"test", 
                "total_supply":100,
                "items":[
                    {
                        "name":"code",
                        "type":"string",
                        "desc":"the code of the token"
                    },
                    {
                        "name":"quality",
                        "type":"string",
                        "desc":"the quality of the token"
                    },
                    {
                        "name":"weight",
                        "type":"string",
                        "desc":"the weight of the token"
                    }
                ]
            }
        }
    ],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "1684C9321EA993D0C6AA558C5E0DD855F66A67C944AD1C4A7BD2CB3A59B24C69",
            "hash": "1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A"
        }
    ],
    "status": "success"
}

// 如果是需要消耗gas的话,返回结果如下
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "1684C9321EA993D0C6AA558C5E0DD855F66A67C944AD1C4A7BD2CB3A59B24C69",
            "hash": "1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A",
            "gas": {
                "gas": 1000000000,
                "transaction": "815333EAD19B4E7D839BC8B73F72E7EF148F461A1CB09BEADFCDFFAA3A18C494"
            }
        }
    ],
    "status": "success"
}

jt_createToken 根据发行的Token种类,创建具体每一个唯一的Token

创建类似erc721的token

Parameters 参数
  • from:ADDRESS: 创建token的帐户地址[建议为jt_issueToken的to]
  • to:ADDRESS:接收token的帐户地址
  • token:OBJECT: token的定义信息
    • info:HASH: 类erc721的定义token的hash, 见jt_issueToken返回值
    • uri:STRING: 类erc721的token的uri, erc721标准属性
    • items:LIST:该token的属性
      • name:STRING: 该属性的名称
      • value:STRING: 该属性的值,要符合jt_issueToken中的定义
params: [
  {
        "from":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
        "to":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR",
        "token":{
            "info":"1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A", 
            "uri":"http://www.jingtum.com", 
            "items":[
                {
                    "name":"code",
                    "value":"002"
                },
                {
                    "name":"quality",
                    "value":"99.99999%"
                },
                {
                    "name":"weight",
                    "value":"10"
                }
            ]
        }
    }
]
Returns 返回值
  • transaction:HASH - 返回在区块链上的交易哈希,当交易不存在时返回0哈希
  • hash:HASH - 返回该token的唯一的哈希
  • gasOBJECT - 对于需要消耗gas的调用,返回消耗的gas数量及对应的交易哈希
Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_createToken",
    "params":[
        {
            "from":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
            "to":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR",
            "token":{
                "info":"1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A", 
                "uri":"http://www.jingtum.com", 
                "items":[
                    {
                        "name":"code",
                        "value":"002"
                    },
                    {
                        "name":"quality",
                        "value":"99.99999%"
                    },
                    {
                        "name":"weight",
                        "value":"10"
                    }
                ]
            }
        }
    ],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "2424716B3F000B2DC6698D8FC17DDC569E78500B27DF839C88576735DE1CCC3F",
            "hash": "8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68"
        }
    ],
    "status": "success"
}

// 如果是需要消耗gas的话,返回结果如下
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "2424716B3F000B2DC6698D8FC17DDC569E78500B27DF839C88576735DE1CCC3F",
            "hash": "8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68",
            "gas": {
                "gas": 1000000000,
                "transaction": "815333EAD19B4E7D839BC8B73F72E7EF148F461A1CB09BEADFCDFFAA3A18C494"
            }
        }
    ],
    "status": "success"
}

jt_transferToken 转移token

转移类似erc721的token

Parameters 参数
  • from:ADDRESS: 发行token的帐户地址
  • to:ADDRESS:创建token的帐户地址
  • token:OBJECT: token的定义信息
params: [
  {
        "from":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR", 
        "to":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
        "token":"8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68"
    }
]
Returns 返回值

同 jt_createToken 返回值定义

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_transferToken",
    "params":[
        {
            "from":"jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR", 
            "to":"jw27f8oUXpJtM4YeATNE9ozSrzFRRxG6R5",
            "token":"8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68"
        }
    ],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "F1EA1514085AECDA49F592E9A85C21A624A9B6C902D4A8189793370BA65A53E5",
            "hash": "8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68"
        }
    ],
    "status": "success"
}

// 如果是需要消耗gas的话,返回结果如下
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "transaction": "F1EA1514085AECDA49F592E9A85C21A624A9B6C902D4A8189793370BA65A53E5",
            "hash": "8C6B700771D452DD89158FF498E2114763055B1F7C0FBCE01D10BB24FF86FC68",
            "gas": {
                "gas": 1000000000,
                "transaction": "815333EAD19B4E7D839BC8B73F72E7EF148F461A1CB09BEADFCDFFAA3A18C494"
            }
        }
    ],
    "status": "success"
}

jt_ownerOf 查询token的拥有者

查询token的拥有者

Parameters 参数
  1. HASH, 代表token的唯一哈希,同jtcreateToken或者jttransferToken返回的hash
params: ["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D"]
Returns 返回值

ADDRESS - 该token的拥有者的地址

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_ownerOf",
    "params":["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D"],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": "jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR",
    "status": "success"
}

jt_tokensOf 查询某个地址拥有哪些token

查询某个地址拥有哪些token

Parameters 参数
  1. ADDRESS, 要查询的帐户的地址
params: ["jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR"]
Returns 返回值

LIST - 返回token的概要信息列表 - dateSTRING token的创建的日期 - infoHASH token的定义的哈希 - invoiceHASH token的指纹信息 - symbolSTRING token所属的token类型的简称 - tokenHASH token的唯一的哈希, 可在jt_getToken中用来查询token详细信息 - txHASH token生成所有的区块链的交易的哈希

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_tokensOf",
    "params":["jQfvETFtVeQGXQZbMTxUm5VHgSA145ucPR"],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "date": "2018-09-30T22:54:20+08:00",
            "info": "1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A",
            "invoice": "F8F0B74598FD1E512C846697680EEA12A33EDAB618296B87D5C87CBDEBACBED9",
            "symbol": "test",
            "token": "C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D",
            "tx": "032276039CD21A826D9728537B44CDBFC05719C7BB909136A670366625190C77"
        }
    ],
    "status": "success"
}

jt_getTokenByHash 通过Token的哈希查询token的具体信息

查询token的具体信息

Parameters 参数
  1. HASH, token的唯一哈希,见jtcreateToken, jttransferToken或者jt_tokensOf中返回的hash值
params: ["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D"]
Returns 返回值

OBJECT - token的详细信息

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_getTokenByHash",
    "params":["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D"],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "Hash": "C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D",
        "Id":"857DDB5EBFEBE2A92DB38D95E6F7649AD846D61F249AB7AE81D9EDD890C07041",
        "Index":2,
        "Info": "1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A",
        "Items": [
            {
                "Name": "code",
                "Value": "001"
            },
            {
                "Name": "quality",
                "Value": "99.99999%"
            },
            {
                "Name": "weight",
                "Value": "10"
            }
        ],
        "Parent":"857DDB5EBFEBE2A92DB38D95E6F7649AD846D61F249AB7AE81D9EDD890C07041",
        "TokenURI": "http://www.jingtum.com"
    },
    "status": "success"
}

jt_getTokenByIndex 通过Info的Hash及Index查询token的具体信息

查询token的具体信息

Parameters 参数
  1. HASH, Token Info的唯一哈希,见jt_issueToken中返回的hash值
  2. INT, Token在所在的Token Info中Index(与创建顺序一致)
params: ["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D", 2]
Returns 返回值

OBJECT - token的详细信息

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_getTokenByIndex",
    "params":["C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D", 2],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "Hash": "C0CA0215D1530B2A138FB069DB4B9593F2A6D8F98087EA12959A51DF05ADD03D",
        "Id":"857DDB5EBFEBE2A92DB38D95E6F7649AD846D61F249AB7AE81D9EDD890C07041",
        "Index":2,
        "Info": "1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A",
        "Items": [
            {
                "Name": "code",
                "Value": "001"
            },
            {
                "Name": "quality",
                "Value": "99.99999%"
            },
            {
                "Name": "weight",
                "Value": "10"
            }
        ],
        "Parent":"857DDB5EBFEBE2A92DB38D95E6F7649AD846D61F249AB7AE81D9EDD890C07041",
        "TokenURI": "http://www.jingtum.com"
    },
    "status": "success"
}

 jt_getTokenCount 获取某种Token当前数量

返回某种Token的当前数量

Parameters 参数
  1. HASH - Token Info的哈希
params: [
“5FBA28FF069A25509B71ADA3CF2B3A22E00867FC54186B878117986B57509534”
]
Returns 返回值

QUANTITY - 该地址发起的交易数.

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_getTokenCount","params":["5FBA28FF069A25509B71ADA3CF2B3A22E00867FC54186B878117986B57509534"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id":1,
    "jsonrpc":"2.0",
    "result":5,
    "status":"success"
}

jt_getTokenInfoByHash 查询token定义的具体信息

查询token定义的具体信息

Parameters 参数
  1. HASH, Token定义的Info信息,见jtissueToken或者jttokensOf中返回的hash值
params: ["1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A"]
Returns 返回值

OBJECT - token的具体定义信息

Example 例子
// Request 请求
curl -X POST --data '{
    "jsonrpc":"2.0",
    "method":"jt_getTokenInfoByHash",
    "params":["1414C09094153EAE9C1D3FB255EEDC7090167DD461F413BCA1DD5C9706283A5A"],
    "id":1
}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "Name": "TEST",
        "Symbol": "test",
        "TotalSupply": 100,
        "Items": [
            {
                "Name": "code",
                "Type": "string",
                "Desc": "the code of the token"
            },
            {
                "Name": "quality",
                "Type": "string",
                "Desc": "the quality of the token"
            },
            {
                "Name": "weight",
                "Type": "number",
                "Desc": "the weight of the token"
            }
        ]
    },
    "status": "success"
}

jt_uploadData 上传数据

上传数据至数据缓存区,并返回数据的Hash256, 可以在jt_createToken中的file类型使用

Parameters 参数
  1. DATA - 十六进制字符串
Returns 返回值

HASH: 数据对应的Hash256的字符串 INT: 数据对应的字节数

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_uploadData","params":["0294535FEE309F280DC4CF9F4134ECC909F8521CF51FEB7D72454E77F929DCB8C9","3044022026F2ABED3AFF2D28F1A5E5AF93C8B4FE8DF771406AF5B746F4A057582303BDC8022061A0D542BF670EF5175F084F66275561C3263A77F37E847297ED7FAE89534214"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
        [
            "A4F6FEFB87AAEA5FF83D3671130C51F7F23E73612430C53EE116526275C9BE47",
            "00A3A563873C2CBE4AE003ED09B74BDCD91A32DA1C93FB24E05BD5DBC9CB6680"
        ],
        [
            33,
            70
        ]
    ],
  "status": "success"
}

jt_downloadData 下载数据

下载数据

Parameters 参数
  1. HASH - 十六进制字符串
Returns 返回值

DATA: Hash256对应的原始数据

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_downloadData","params":["A4F6FEFB87AAEA5FF83D3671130C51F7F23E73612430C53EE116526275C9BE47",
        "00A3A563873C2CBE4AE003ED09B74BDCD91A32DA1C93FB24E05BD5DBC9CB6680"],"id":1}' http://localhost:7545/v1/jsonrpc

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
        [
            "0294535FEE309F280DC4CF9F4134ECC909F8521CF51FEB7D72454E77F929DCB8C9",
        "3044022026F2ABED3AFF2D28F1A5E5AF93C8B4FE8DF771406AF5B746F4A057582303BDC8022061A0D542BF670EF5175F084F66275561C3263A77F37E847297ED7FAE89534214"
        ]
    ],
  "status": "success"
}

jt_uploadFile 上传文件

上传文件至数据缓存区,并返回数据的Hash256, 可以在jt_createToken中的file类型使用

Parameters 参数
  1. 与网络浏览器中多文件上传接口兼容
<form enctype="multipart/form-data" action="/v1/jsonrpc/jt_uploadFile" method="post">
 <input type="file" name="file" multiple="multiple">
 <input type="submit" value="upload">
</form>

或通过访问API接口http://localhost:7544/v1/jsonrpc/jtuploadFile有简单页面,访问路径是/v1/jsonrpc/jtuploadFile

Returns 返回值

HASH: 文件对应的Hash256的字符串 STRING: 文件对应的文件名 INT: 文件对应的字节数

Example 例子
// Request 请求
curl -X POST http://localhost:8545/v1/jsonrpc/jt_uploadFile -F "file=@/Think.pdf"

// Result 结果
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    [
        "FED6711D6963EB09EFE10561D26D0C6875443A1C283A41C1674C6489F2F8ED84",
        2837592,
        "Think.pdf"
    ]
],
  "status": "success"
}

jt_downloadFile 下载文件

下载文件

Parameters 参数
  1. HASH - 十六进制字符串
  2. NAME - 下载后的文件名(可选,默认为HASH值)
Returns 返回值

FILE: 文件

Example 例子
// Request 请求
curl -X POST --data '{"jsonrpc":"2.0","method":"jt_downloadFile","params":["FED6711D6963EB09EFE10561D26D0C6875443A1C283A41C1674C6489F2F8ED84"],"id":1}' http://localhost:7545/v1/jsonrpc > /Think.pdf

// Result 结果
Think.pdf文件

JSON REST API Reference JSON格式的API引用

POST or GET, /v1/jsonrpc/JSON-RPC methods?params=xxxx

比如 ```js curl -g http://localhost:7544/v1/jsonrpc/jt_getBalance?params=[%22jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh%22,%22validated%22]

或者

curl -X POST --data '{"params":["jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh","validated"]}' http://localhost:7544/v1/jsonrpc/jt_getBalance

{ "id": 1, "jsonrpc": "2.0", "result": { "account": "jHb9CJAWyB4jr91VRWn96DkukG4bwdtyTh", "balance": "244499999099986768", "coins": [], "ledgerhash": "443AADF864838F4F1C62C93F9BCA5721F987851CE1D4DB19F9CF28CB226AFE33", "ledgerindex": 113996, "validated": true }, "status": "success" } ```

默认区块参数

以下方法有额外的默认区块参数

当请求以太的状态时,最后一个默认区块参数决定区块的高度.

以下可能是默认区块参数:

  • Block Number String - 区块编号,整数
  • Block Hash String - 区块哈希,字符串
  • String "current" - 表示当前区块
  • String "validated" - 最新生效的区块
  • String "closed" - 最近关闭的区块

Token属性类型示例

  • boolean
true or false
  • integer
24, 32, ...
  • string
"name", "example", ...
  • number
2.0, 7.2, 24, ...
  • binary
"4723949fa8fffa60cff74028af14aba97fcc65312b"

16进制字符串

  • file:
"EB9403C9DBBDBDFB3F44524723949FA8FFFA60CFF74028AF14ABA97FCC65312B"

HASH256字符串, 通过接口 jt_uploadData

或者 jt_uploadFile 调用获得

  • list:
[
"EB9403C9DBBDBDFB3F44524723949FA8FFFA60CFF74028AF14ABA97FCC65312B",                    
"548D40B2B87314EC1705F4E6D27C6247C63C4E8C5946A011D9A57F671F012041"
]
  • map:
{
    "age": 18,
    "name": "name"
}