达世币全节点


以太坊api文档

<p>[[toc]]</p> <h2>1 总体说明</h2> <p>所有方法均返回JSON数据,所有调用应先检查status code,若不是<strong>200</strong>,则调用出错,返回的HTTP body中包含具体错误信息,如</p> <pre><code> { "error" : "some error message" } </code></pre> <h2>2 创建账户</h2> <p><strong>简要描述:</strong> </p> <ul> <li>创建账户</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost/ethereum/account</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> 无</p> <p><strong>调用示例</strong></p> <pre><code> http://localhost/ethereum/account </code></pre> <p><strong>返回示例</strong></p> <pre><code>{ "address": "0xBE2C0368D79e877C7C7743bF77975ACa5c8279c8", "privakeKey": "0x1e4b5edc0a1a43c50733197f351f13a9ffa17147bf5596e60b7206aa76a6826a " }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">privateKey</td> <td style="text-align: left;">string</td> <td>私钥</td> </tr> </tbody> </table> <h2>3 导入私钥</h2> <p><strong>简要描述:</strong> </p> <ul> <li>导入私钥</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost/ethereum/account/import</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>POST </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">priv</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>要导入的私钥</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>//POST body { "priv": "0x7f1b51210ca97f3b41c7457c072f8fa3b77016edfd82aade84f16f37d280e3f1" }</code></pre> <p><strong>返回示例</strong></p> <pre><code>{ "address": "0xBE2C0368D79e877C7C7743bF77975ACa5c8279c8", "privateKey": "0x7f1b51210ca97f3b41c7457c072f8fa3b77016edfd82aade84f16f37d280e3f1" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">privateKey</td> <td style="text-align: left;">string</td> <td>私钥</td> </tr> </tbody> </table> <h2>4 查询余额</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询指定地址的余额</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/account/[:address]/balance/[:lastnumber?]</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">lastnumber</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>截至区块高度,默认为当前最高区块</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>curl http://localhost:8080/ethereum/account/0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763/balance curl http://localhost:8080/ethereum/account/0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763/balance/540000 </code></pre> <p><strong>返回示例</strong></p> <pre><code> { "address": "0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763", "balance": "123" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">balance</td> <td style="text-align: left;">string</td> <td>余额</td> </tr> </tbody> </table> <h2>5 查询交易历史</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询指定地址的历史交易记录</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/account/[:address]/history?page=1&amp;pagesize=10</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">page</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>分页,默认为1</td> </tr> <tr> <td style="text-align: left;">pagesize</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>每页数量,默认为10</td> </tr> </tbody> </table> <p><strong>调用示例</strong> <code>curl http://localhost:8080/ethereum/account/0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763/history</code></p> <p><strong>返回示例</strong></p> <pre><code> { "address": "0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763", "transactions": [ "0x972b58d8331ad4bca2d6fd565ce1754bd4c35be40d29940c1b3cc5d4270be803", "0x4c07834618eb6b45107981f239a2858194b9649c97ff420c52bf5c2ea7ef6f1b" ] }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">transactions</td> <td style="text-align: left;">array</td> <td>交易ID</td> </tr> </tbody> </table> <h2>6 查询详细交易历史</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询指定地址的详细交易记录,除了交易ID,还附带from,to,value,timestamp</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/account/[:address]/history.detail?page=1&amp;pagesize=10</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">page</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>分页,默认为1</td> </tr> <tr> <td style="text-align: left;">pagesize</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>每页数量,默认为10</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>curl http://localhost:8080/ethereum/account/0xeca692E0E5E118705988E499F09b4B579edDa0e6/history.detail</code></pre> <p><strong>返回示例</strong></p> <pre><code> { "address" : "0xeca692E0E5E118705988E499F09b4B579edDa0e6", "transactions" : [ { "from" : "0xeca692e0e5e118705988e499f09b4b579edda0e6", "to" : "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "value" : "107080370000000000", "hash" : "0x972b58d8331ad4bca2d6fd565ce1754bd4c35be40d29940c1b3cc5d4270be803", "timestamp":"1524456115" }, { "from" : "0xd10a67dc1322a7dc13bffe704d2de7fb97e3598b", "to" : "0xeca692e0e5e118705988e499f09b4b579edda0e6", "value" : "31000000000000000", "hash" : "0x4c07834618eb6b45107981f239a2858194b9649c97ff420c52bf5c2ea7ef6f1b", "timestamp":"1515792141" }, { "from" : "0x5baeac0a0417a05733884852aa068b706967e790", "to" : "0xeca692e0e5e118705988e499f09b4b579edda0e6", "value" : "59619930000000000", "hash" : "0x9e4080772d7b4b2f2a1325bdf02e29a33754cbda300c477469de35fe627df080", "timestamp":"1515733229" } ] } </code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> <tr> <td style="text-align: left;">transactions</td> <td style="text-align: left;">array</td> <td>交易记录</td> </tr> <tr> <td style="text-align: left;">transactions.from</td> <td style="text-align: left;">string</td> <td>交易发起者</td> </tr> <tr> <td style="text-align: left;">transactions.to</td> <td style="text-align: left;">string</td> <td>交易目标</td> </tr> <tr> <td style="text-align: left;">transactions.value</td> <td style="text-align: left;">string</td> <td>交易金额</td> </tr> <tr> <td style="text-align: left;">transactions.hash</td> <td style="text-align: left;">string</td> <td>交易ID</td> </tr> <tr> <td style="text-align: left;">transactions.timestamp</td> <td style="text-align: left;">unix time</td> <td>时间戳</td> </tr> </tbody> </table> <h2>7 发起交易</h2> <p><strong>简要描述:</strong> </p> <ul> <li>发起一笔交易</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost/ethereum/transaction</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>POST </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">privateKey</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>私钥</td> </tr> <tr> <td style="text-align: left;">to</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>目的地址</td> </tr> <tr> <td style="text-align: left;">amount</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>转账金额</td> </tr> <tr> <td style="text-align: left;">gas</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>gas数量,未花费的gas会退回</td> </tr> <tr> <td style="text-align: left;">fee</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>手续费</td> </tr> <tr> <td style="text-align: left;">uuid</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>通用唯一识别码,请确保每次交易uuid不同</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>curl --cacert=./ROOT.crt -H "Content-Type:application/json" -X POST –data \ '{"privateKey": "0x965da9d169db3da5b81f4d02a76eb2b403a0e505836050e250e947c4345df89b", \ "to": "0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763", "amount":"50000000", "gas":"21000", \ "fee":"21001"}' http://localhost/ethereum/transaction </code></pre> <p><strong>返回示例</strong></p> <pre><code> { "transactionHash": "0x972b58d8331ad4bca2d6fd565ce1754bd4c35be40d29940c1b3cc5d4270be803" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">transactionHash</td> <td style="text-align: left;">string</td> <td>交易ID</td> </tr> </tbody> </table> <h2>8 发送已签名交易</h2> <p><strong>简要描述:</strong> </p> <ul> <li>发送一笔已经用私钥签名了的交易</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/transaction/sendsigned/[:rawTransaction]</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">rawTransaction</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>已签名交易的hex string</td> </tr> </tbody> </table> <p><strong>调用示例</strong> <code>curl http://localhost:8080/ethereum/transaction/sendsigned/789abcd</code></p> <p><strong>返回示例</strong></p> <pre><code> { "transactionHash": "0x972b58d8331ad4bca2d6fd565ce1754bd4c35be40d29940c1b3cc5d4270be803" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">transactionHash</td> <td style="text-align: left;">string</td> <td>交易ID</td> </tr> </tbody> </table> <h2>9 查看交易确认次数</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查看一笔交易的确认次数</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/transaction/[:hash]/confirmation</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">hash</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>transactionHash</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>curl http://localhost:8080/ethereum/transaction/0x4c07834618eb6b45107981f239a2858194b9649c97ff420c52bf5c2ea7ef6f1b/confirmation </code></pre> <p><strong>返回示例</strong></p> <pre><code> { "number": "564678" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">number</td> <td style="text-align: left;">string</td> <td>交易确认次数</td> </tr> </tbody> </table> <h2>10 查询交易打包信息</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询一个交易的信息</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/transaction/[:txhash]/info</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">txhash</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>交易哈希</td> </tr> </tbody> </table> <p><strong>调用示例</strong> <code>curl http://localhost:8080/ethereum/transaction/0x5a2847137d05f744f67cf3265034089a2ea4a40f557f2ea1b2eaacf55d9ca267/info</code></p> <p><strong>返回示例</strong></p> <pre><code>{ "blockHash": "0xca06f5d50466b786d1c85a7062bc4bdda7983f2ff8da3a6dc75e963481d00ffa", "blockNumber": "5400000", "from": "0x88a80b35014fe7c33b4568cb818f2e16ba799b23", "to": "0x574b55d84e70d092920fAd9C4Cc001a2276C78c2", "fee": "133020", "status": "success", "timestamp": "1523144644" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">blockHash</td> <td style="text-align: left;">string</td> <td>交易所在区块的哈希</td> </tr> <tr> <td style="text-align: left;">blockNumber</td> <td style="text-align: left;">string</td> <td>交易所在区块的序号</td> </tr> <tr> <td style="text-align: left;">from</td> <td style="text-align: left;">string</td> <td>交易发起地址</td> </tr> <tr> <td style="text-align: left;">to</td> <td style="text-align: left;">string</td> <td>交易目的地址</td> </tr> <tr> <td style="text-align: left;">fee</td> <td style="text-align: left;">string</td> <td>实际手续费</td> </tr> <tr> <td style="text-align: left;">status</td> <td style="text-align: left;">string</td> <td>交易执行状态,为“success”或者“fail”</td> </tr> <tr> <td style="text-align: left;">timestamp</td> <td style="text-align: left;">uinx time</td> <td>交易所在区块的时间戳</td> </tr> </tbody> </table> <h2>11 估计手续费</h2> <p><strong>简要描述:</strong> </p> <ul> <li>获取手续费的估计值,这个值取决于最近几个区块中的所有交易的Gas Price的中位数</li> <li>此值仅供参考</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/transaction/fee</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <ul> <li> <p>None</p> <p><strong>返回示例</strong></p> </li> </ul> <pre><code> { "fee": "21001" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">fee</td> <td style="text-align: left;">string</td> <td>手续费</td> </tr> </tbody> </table> <h2>12 查询指定区块中的交易</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询指定区块中的交易,可指定地址</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/block/[:blockHashOrNumber]/[:address?]</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">blockHashOrNumber</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>要查询区块的hash或者number</td> </tr> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">否</td> <td style="text-align: left;">string</td> <td>如果指定地址,则只返回该地址的交易记录,不指定则返回所有交易</td> </tr> </tbody> </table> <p><strong>调用示例</strong> <code>curl http://localhost:8080/ethereum/block/5823165/0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe</code></p> <p><strong>返回示例</strong></p> <pre><code> { "number": "5823165", "hash": "0x9a73b54871ebc9ecd83449cdeefe6de865b88e54fd2f7bacaaaca5d41fdb233f", "transactions": [ { "from": "0x4fc338b5B6234c61DCcC52b71FE5910F25aad772", "to": "0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe", "amout": "19445080000000000000" }, { "from": "0x4fe15e23406DD93469082cc4F8E78c45062F8D37", "to": "0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe", "amout": "4699580000000000000" }, { "from": "0x504aa7958d09E0344D7D609CD9C9ac93d6c3A1EB", "to": "0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe", "amout": "12454080000000000000" }, { "from": "0x5154783c913fc384f84d6A0412bFfa8592521149", "to": "0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe", "amout": "15643880000000000000" }, { "from": "0xE9b651a522253e7e9a597DAFB4b69aB972cf6dAe", "to": "0x1C1bA876eEc36550C15c7C9960Ce103d1670712e", "amout": "21036800000000000000" } ], "timestamp": "1525824705" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">number</td> <td style="text-align: left;">string</td> <td>区块number</td> </tr> <tr> <td style="text-align: left;">hash</td> <td style="text-align: left;">string</td> <td>区块hash</td> </tr> <tr> <td style="text-align: left;">transactions</td> <td style="text-align: left;">array</td> <td>交易数组(若查询不到指定地址的交易,则为空数组)</td> </tr> <tr> <td style="text-align: left;">timestamp</td> <td style="text-align: left;">unix time</td> <td>区块时间戳</td> </tr> </tbody> </table> <h2>13 批量查询余额</h2> <p><strong>简要描述:</strong> </p> <ul> <li>查询多个地址的余额</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/balances</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>POST </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">addr</td> <td style="text-align: left;">是</td> <td style="text-align: left;">array</td> <td>地址数组</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>// POST BODY { "addrs":["0x007821b9a9d1ADe9ed44Ac32A61b2DBB44337cbb", "0xa1dacb7d193259724c59a3e497e881089af2decd","0xf230b790e05390fc8295f4d3f60332c93bed42e2","0x915d7915f2b469bb654A7D903A5d4417Cb8eA7Df"] }</code></pre> <p><strong>返回示例</strong></p> <pre><code> [ { "address": "0x007821b9a9d1ADe9ed44Ac32A61b2DBB44337cbb", "balance": "0" }, { "address": "0xa1dacb7d193259724c59a3e497e881089af2decd", "balance": "0" }, { "address": "0xf230b790e05390fc8295f4d3f60332c93bed42e2", "balance": "0" }, { "address": "0x915d7915f2b469bb654A7D903A5d4417Cb8eA7Df", "balance": "1114399565749" } ]</code></pre> <p><strong>返回参数说明</strong> </p> <p>结果数组</p> <h2>14 检查地址是否合法</h2> <p><strong>简要描述:</strong> </p> <ul> <li>检验地址是否正确,如果地址为全小写或者全大写,将会跳过校验和检查</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/account/:address/check</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">address</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>地址</td> </tr> </tbody> </table> <p><strong>调用示例</strong></p> <pre><code>curl localhost:8080/ethereum/account/0x915d7915f2b469bb654A7D903A5d4417Cb8eA7Df/check</code></pre> <p><strong>返回示例</strong></p> <pre><code>{ "result": true }</code></pre> <table> <thead> <tr> <th style="text-align: left;"><strong>返回参数说明</strong></th> <th style="text-align: left;">参数名</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">result</td> <td style="text-align: left;">bool</td> <td>结果</td> </tr> </tbody> </table> <h2>15 私钥发起交易</h2> <p><strong>简要描述:</strong> </p> <ul> <li>使用私钥发起一笔交易,而不是助记词</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost/ethereum/transaction/admin</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>POST </li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">privateKey</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>私钥</td> </tr> <tr> <td style="text-align: left;">to</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>目的地址</td> </tr> <tr> <td style="text-align: left;">amount</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>转账金额</td> </tr> <tr> <td style="text-align: left;">gas</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>gas数量,未花费的gas会退回</td> </tr> <tr> <td style="text-align: left;">fee</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>手续费</td> </tr> <tr> <td style="text-align: left;">uuid</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>通用唯一识别码,请确保每次交易uuid不同</td> </tr> </tbody> </table> <p><em>交易手续费为:实际使用的gas数量乘以gasPrice</em></p> <p><strong>调用示例</strong></p> <pre><code>curl --cacert ROOT.crt -H "Content-Type:application/json" -X POST –data \ '{"privateKey": "0x965da9d169db3da5b81f4d02a76eb2b403a0e505836050e250e947c4345df89b", \ "to": "0x1dbe35dB279c0e0Ce0d0e1b92173d2216606d763", "amount":"50000000", "gas":"21000", \ "fee":"21001", "uuid":"abc"}' http://localhost:8080/ethereum/transaction/admin </code></pre> <p><strong>返回示例</strong></p> <pre><code> { "transactionHash": "0x972b58d8331ad4bca2d6fd565ce1754bd4c35be40d29940c1b3cc5d4270be803" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">transactionHash</td> <td style="text-align: left;">string</td> <td>交易ID</td> </tr> </tbody> </table> <h2>16 获取当前区块高度</h2> <p><strong>简要描述:</strong> </p> <ul> <li>获取当前区块高度</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/block</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> -None</p> <p><strong>调用示例</strong> <code>curl http://localhost:8080/block</code></p> <p><strong>返回示例</strong></p> <pre><code>{ "blockHeight": 6058994 }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">blockHeight</td> <td style="text-align: left;">number</td> <td>节点当前区块高度</td> </tr> </tbody> </table> <h2>17 获取gasPrice估计值</h2> <p><strong>简要描述:</strong> </p> <ul> <li>获取gasPrice估计值(前若干区块中的gasPrice的中位数)</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>http://localhost:8080/ethereum/transaction/gasprice</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>GET </li> </ul> <p><strong>参数:</strong> -None</p> <p><strong>调用示例</strong> <code>curl http://localhost:8080/ethereum/transaction/gasprice</code></p> <p><strong>返回示例</strong></p> <pre><code>{ "gasPrice": "2875000000" }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">gasPrice</td> <td style="text-align: left;">string</td> <td>建议的gasPrice</td> </tr> </tbody> </table>

页面列表

ITEM_HTML