github.com/shyftnetwork/go-empyrean@v1.8.3-0.20191127201940-fbfca9338f04/shyft_documentation/index.html (about) 1 2 <!doctype html> 3 <html> 4 <head> 5 <meta charset="utf-8"> 6 <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> 7 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 8 <title>Shyft Block Explorer Documentation</title> 9 <link href="images/shyftlogo.png" rel="icon" type="image/png" /> 10 <style> 11 .highlight table td { padding: 5px; } 12 .highlight table pre { margin: 0; } 13 .highlight .gh { 14 color: #999999; 15 } 16 .highlight .sr { 17 color: #f6aa11; 18 } 19 .highlight .go { 20 color: #888888; 21 } 22 .highlight .gp { 23 color: #555555; 24 } 25 .highlight .gs { 26 } 27 .highlight .gu { 28 color: #aaaaaa; 29 } 30 .highlight .nb { 31 color: #f6aa11; 32 } 33 .highlight .cm { 34 color: #75715e; 35 } 36 .highlight .cp { 37 color: #75715e; 38 } 39 .highlight .c1 { 40 color: #75715e; 41 } 42 .highlight .cs { 43 color: #75715e; 44 } 45 .highlight .c, .highlight .cd { 46 color: #75715e; 47 } 48 .highlight .err { 49 color: #960050; 50 } 51 .highlight .gr { 52 color: #960050; 53 } 54 .highlight .gt { 55 color: #960050; 56 } 57 .highlight .gd { 58 color: #49483e; 59 } 60 .highlight .gi { 61 color: #49483e; 62 } 63 .highlight .ge { 64 color: #49483e; 65 } 66 .highlight .kc { 67 color: #66d9ef; 68 } 69 .highlight .kd { 70 color: #66d9ef; 71 } 72 .highlight .kr { 73 color: #66d9ef; 74 } 75 .highlight .no { 76 color: #66d9ef; 77 } 78 .highlight .kt { 79 color: #66d9ef; 80 } 81 .highlight .mf { 82 color: #ae81ff; 83 } 84 .highlight .mh { 85 color: #ae81ff; 86 } 87 .highlight .il { 88 color: #ae81ff; 89 } 90 .highlight .mi { 91 color: #ae81ff; 92 } 93 .highlight .mo { 94 color: #ae81ff; 95 } 96 .highlight .m, .highlight .mb, .highlight .mx { 97 color: #ae81ff; 98 } 99 .highlight .sc { 100 color: #ae81ff; 101 } 102 .highlight .se { 103 color: #ae81ff; 104 } 105 .highlight .ss { 106 color: #ae81ff; 107 } 108 .highlight .sd { 109 color: #e6db74; 110 } 111 .highlight .s2 { 112 color: #e6db74; 113 } 114 .highlight .sb { 115 color: #e6db74; 116 } 117 .highlight .sh { 118 color: #e6db74; 119 } 120 .highlight .si { 121 color: #e6db74; 122 } 123 .highlight .sx { 124 color: #e6db74; 125 } 126 .highlight .s1 { 127 color: #e6db74; 128 } 129 .highlight .s { 130 color: #e6db74; 131 } 132 .highlight .na { 133 color: #a6e22e; 134 } 135 .highlight .nc { 136 color: #a6e22e; 137 } 138 .highlight .nd { 139 color: #a6e22e; 140 } 141 .highlight .ne { 142 color: #a6e22e; 143 } 144 .highlight .nf { 145 color: #a6e22e; 146 } 147 .highlight .vc { 148 color: #ffffff; 149 } 150 .highlight .nn { 151 color: #ffffff; 152 } 153 .highlight .nl { 154 color: #ffffff; 155 } 156 .highlight .ni { 157 color: #ffffff; 158 } 159 .highlight .bp { 160 color: #ffffff; 161 } 162 .highlight .vg { 163 color: #ffffff; 164 } 165 .highlight .vi { 166 color: #ffffff; 167 } 168 .highlight .nv { 169 color: #ffffff; 170 } 171 .highlight .w { 172 color: #ffffff; 173 } 174 .highlight { 175 color: #ffffff; 176 } 177 .highlight .n, .highlight .py, .highlight .nx { 178 color: #ffffff; 179 } 180 .highlight .ow { 181 color: #f92672; 182 } 183 .highlight .nt { 184 color: #f92672; 185 } 186 .highlight .k, .highlight .kv { 187 color: #f92672; 188 } 189 .highlight .kn { 190 color: #f92672; 191 } 192 .highlight .kp { 193 color: #f92672; 194 } 195 .highlight .o { 196 color: #f92672; 197 } 198 </style> 199 <link href="stylesheets/screen.css" rel="stylesheet" media="screen" /> 200 <link href="stylesheets/print.css" rel="stylesheet" media="print" /> 201 <script src="javascripts/all.js"></script> 202 </head> 203 204 <body class="index" data-languages="["shell"]"> 205 <a href="#" id="nav-button"> 206 <span> 207 NAV 208 <img src="images/navbar.png" alt="Navbar" /> 209 </span> 210 </a> 211 <div class="toc-wrapper"> 212 <img src="images/logo.png" class="logo" alt="Logo" /> 213 <div class="lang-selector"> 214 <a href="#" data-language-name="shell">cURL</a> 215 </div> 216 <div class="search"> 217 <input type="text" class="search" id="input-search" placeholder="Search"> 218 </div> 219 <ul class="search-results"></ul> 220 <div id="toc" class="toc-list-h1"> 221 <li> 222 <a href="#introduction" class="toc-h1 toc-link" data-title="introduction">Introduction</a> 223 <ul class="toc-list-h2"> 224 <li> 225 <a href="#a-note-from-the-developers" class="toc-h2 toc-link" data-title="a-note-from-the-developers">A Note From The Developers</a> 226 </li> 227 <li> 228 <a href="#contributing-to-shyft-geth" class="toc-h2 toc-link" data-title="contributing-to-shyft-geth">Contributing To Shyft Geth</a> 229 </li> 230 </ul> 231 </li> 232 <li> 233 <a href="#setup" class="toc-h1 toc-link" data-title="setup">Setup</a> 234 <ul class="toc-list-h2"> 235 <li> 236 <a href="#dependencies" class="toc-h2 toc-link" data-title="dependencies">Dependencies</a> 237 </li> 238 <li> 239 <a href="#govendor-and-packages-dependencies" class="toc-h2 toc-link" data-title="govendor-and-packages-dependencies">Govendor and Packages/Dependencies</a> 240 </li> 241 <li> 242 <a href="#running-locally" class="toc-h2 toc-link" data-title="running-locally">Running Locally</a> 243 </li> 244 <li> 245 <a href="#docker-images" class="toc-h2 toc-link" data-title="docker-images">Docker Images</a> 246 </li> 247 <li> 248 <a href="#docker-postgresql-db-connection" class="toc-h2 toc-link" data-title="docker-postgresql-db-connection">Docker Postgresql - DB Connection</a> 249 </li> 250 <li> 251 <a href="#docker-block-explorer-api" class="toc-h2 toc-link" data-title="docker-block-explorer-api">Docker Block Explorer Api</a> 252 </li> 253 </ul> 254 </li> 255 <li> 256 <a href="#shyft-blockexplorer-api" class="toc-h1 toc-link" data-title="shyft-blockexplorer-api">Shyft BlockExplorer API</a> 257 <ul class="toc-list-h2"> 258 <li> 259 <a href="#blocks" class="toc-h2 toc-link" data-title="blocks">Blocks</a> 260 </li> 261 <li> 262 <a href="#transactions" class="toc-h2 toc-link" data-title="transactions">Transactions</a> 263 </li> 264 <li> 265 <a href="#accounts" class="toc-h2 toc-link" data-title="accounts">Accounts</a> 266 </li> 267 </ul> 268 </li> 269 <li> 270 <a href="#shyft-block-explorer-ui" class="toc-h1 toc-link" data-title="shyft-block-explorer-ui">Shyft Block Explorer UI</a> 271 </li> 272 <li> 273 <a href="#command-line-options" class="toc-h1 toc-link" data-title="command-line-options">Command Line Options</a> 274 </li> 275 <li> 276 <a href="#custom-shyft-constants" class="toc-h1 toc-link" data-title="custom-shyft-constants">Custom Shyft Constants</a> 277 <ul class="toc-list-h2"> 278 <li> 279 <a href="#block-rewards" class="toc-h2 toc-link" data-title="block-rewards">Block Rewards</a> 280 </li> 281 </ul> 282 </li> 283 <li> 284 <a href="#shyft-extended-functionality" class="toc-h1 toc-link" data-title="shyft-extended-functionality">Shyft Extended Functionality</a> 285 <ul class="toc-list-h2"> 286 <li> 287 <a href="#database-functions" class="toc-h2 toc-link" data-title="database-functions">Database Functions</a> 288 </li> 289 <li> 290 <a href="#database-instanitation" class="toc-h2 toc-link" data-title="database-instanitation">Database instanitation</a> 291 </li> 292 <li> 293 <a href="#writing-blocks" class="toc-h2 toc-link" data-title="writing-blocks">Writing Blocks</a> 294 </li> 295 <li> 296 <a href="#transaction-types-functions" class="toc-h2 toc-link" data-title="transaction-types-functions">Transaction Types Functions</a> 297 </li> 298 <li> 299 <a href="#chain-rollbacks" class="toc-h2 toc-link" data-title="chain-rollbacks">Chain Rollbacks</a> 300 </li> 301 </ul> 302 </li> 303 <li> 304 <a href="#errors" class="toc-h1 toc-link" data-title="errors">Errors</a> 305 </li> 306 </div> 307 <ul class="toc-footer"> 308 <li><a href='https://github.com/lord/slate'>Documentation Powered by Slate</a></li> 309 </ul> 310 </div> 311 <div class="page-wrapper"> 312 <div class="dark-box"></div> 313 <div class="content"> 314 <h1 id='introduction'>Introduction</h1><h3 id='a-note-from-the-developers'>A Note From The Developers</h3> 315 <p>Our goal was to avoid compromising the integrity of Geth and simply extend existing functionality to meet the specific needs of the Shyft Network. To our utmost ability we have documented, within the codebase, exactly where we have extended our functionality using the following notation: NOTE:SHYFT. This document is meant to provide a high level overview of the changes made to Geth and to provide explanations, where needed, on the changes that were made. Another benefit of this document is to allow others to quickly see the changes that were made in order to get quicker feedback on a compromising line of code.</p> 316 <h3 id='contributing-to-shyft-geth'>Contributing To Shyft Geth</h3> 317 <p>In order to successfully accept a PR the maintainers of the Shyft repositories require that this document must be updated, reflecting the changes made in the PR. Along with the documentation, we ask that contributors provide the NOTE:SHYFT. The tag could should contain a brief on the modified code. This will help with releases further down the road as we document what breaking changes have been made along the journey.</p> 318 <h1 id='setup'>Setup</h1><h3 id='dependencies'>Dependencies</h3> 319 <ul> 320 <li>go 1.10</li> 321 <li>postgres 10</li> 322 </ul> 323 324 <p>To install go please review the installation docs <a href="https://golang.org/doc/install">here</a>, but ensure you download version 1.10. If you would like to install go with a script please check out this repo <a href="https://github.com/canha/golang-tools-install-script">here</a>.</p> 325 326 <p>To install postgres please review the installation docs <a href="https://www.postgresql.org/docs/10/static/tutorial-install.html">here</a>.</p> 327 <h3 id='govendor-and-packages-dependencies'>Govendor and Packages/Dependencies</h3> 328 <blockquote> 329 <p>Download Go Vendor</p> 330 </blockquote> 331 <pre class="highlight shell tab-shell"><code>go get -u github.com/kardianos/govendor 332 </code></pre> 333 <blockquote> 334 <p>To run govendor globally, have this in your bash_profile file:</p> 335 </blockquote> 336 <pre class="highlight shell tab-shell"><code><span class="nb">export </span><span class="nv">GOPATH</span><span class="o">=</span><span class="nv">$HOME</span>/go 337 <span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:<span class="nv">$HOME</span>/go/bin 338 </code></pre> 339 <blockquote> 340 <p>Then go_empyrean will need to be cloned to this directory:</p> 341 </blockquote> 342 <pre class="highlight shell tab-shell"><code><span class="nv">$GOPATH</span>/src/github.com/ShyftNetwork/ 343 </code></pre> 344 <p>Geth uses govendor to manage packages/dependencies: <a href="https://github.com/kardianos/govendor">Go Vendor</a></p> 345 346 <p>This has some more information: <a href="https://github.com/ShyftNetwork/go-empyrean/wiki/Developers'-Guide">Ethereum Wiki</a></p> 347 348 <p>To add a new dependency, run govendor fetch <import-path> , and commit the changes to git. Then the deps will be accessible on other machines that pull from git.</p> 349 350 <aside class="notice"> 351 GOPATH is not strictly necessary however, for govendor it is much easier to use gopath as go will look for binaries in this directory ($GOPATH/bin). To set up GOPATH, read the govendor section. 352 </aside> 353 <h3 id='running-locally'>Running Locally</h3> 354 <p>To begin running locally, please ensure you have correctly installed go 1.10 and postgres (make sure postgres is running). 355 Once cloned, in a terminal window run the following command:</p> 356 357 <p>Before running any CLI options ensure you run <strong><code>make geth</code></strong> in the root directory.</p> 358 359 <p><code>.shyft-geth.sh --setup</code> This sets up postgres and the shyft chain db</p> 360 361 <p><code>./shyft-geth.sh --start</code> This starts GETH</p> 362 363 <p>At this point you should see GETH running in the terminal and if you opened your postgres instance you should see data being populated into the tables. It might look something similiar to the image below.</p> 364 365 <p><img src="./images/geth.png" alt="Geth example"></p> 366 367 <p>To stop Geth, <strong><code>crtl+C</code></strong> in the terminal window, if you proceed with the start script mentioned above the Shyft chain will begin from the last block height, if you wish to start the chain fresh from genesis follow the below steps:</p> 368 369 <p><code>./shyft-geth.sh --reset</code> This drops postgres and chaindb data</p> 370 371 <p><code>./shyft-geth.sh --start</code> Starts GETH</p> 372 373 <p>To see transactions being submitted on the network see the sendTransactions command in the CLI section of this readme.</p> 374 <h3 id='docker-images'>Docker Images</h3> 375 <p>Docker Images are available for ShyftGeth and the Postgresql Database which can be used for development and testing. To launch these containers you will need to have docker-compose installed on your computer. Installation instructions for docker-compose are available <a href="https://docs.docker.com/install/">here</a>.</p> 376 377 <p><strong>To build the images for the first time please run the following command:</strong></p> 378 379 <p><code>./shyft-geth.sh --setup # clears persisted directories prior to docker build</code></p> 380 381 <p><code>docker-compose up --build</code></p> 382 383 <p>If you would like to reinitialize/rebuild the docker images you can run the above mentioned command as well.</p> 384 385 <p>To launch ShyftGeth, PG, the ShyftBlock Explorer Api and UI anytime after initial build - issue the following commands from the root of the project directory:</p> 386 387 <p><code>./shyft-geth.sh --setup # clears persisted directories prior to docker build</code></p> 388 389 <p><strong><code>docker-compose up</code></strong></p> 390 391 <p>To stop/pause mining - enter:</p> 392 393 <p><strong><code>docker-compose stop</code></strong></p> 394 395 <p>And then just issue <code>docker-compose up</code> to continue mining.</p> 396 <h3 id='docker-postgresql-db-connection'>Docker Postgresql - DB Connection</h3> 397 <p>From your local machine you can view the database by connecting to the database in the container at 398 <strong><code>127.0.0.1:8001</code></strong></p> 399 400 <p>Use User: 'postgres' Password: 'docker' Database: 'shyftdb'</p> 401 <h3 id='docker-block-explorer-api'>Docker Block Explorer Api</h3> 402 <p>To access the shyftBlockExplorer open a browser and visit </p> 403 404 <p><strong><code>http://localhost:3000</code></strong></p> 405 406 <p>To rebuild any one of the services- issue the following commands:</p> 407 408 <p>Services:</p> 409 410 <ul> 411 <li>ShyftGeth</li> 412 <li>Postgres Instance</li> 413 <li>Shyft Explorer API</li> 414 <li>Shyft Example Explorer UI</li> 415 </ul> 416 417 <p><strong><code> 418 docker-compose up -d --no-deps --build <docker compose file service name> 419 </code></strong></p> 420 421 <p>ie. for shyftBlockExplorerApi:</p> 422 423 <p><strong><code>docker-compose up -d --no-deps --build shyft_block_api</code></strong></p> 424 425 <p>The Postgresql Database Container will persist the database data to the directory <code>./pg-data</code> _. So if you do want to reinitialize the database you should delete this directory as well as the blockchain data directories <code>(./shyftData ./privatenet)</code> prior to launching the docker containers. There is a shell script available to delete these folders to run it execute the following command:</p> 426 427 <p><strong><code>./shyft-cli/resetShyftGeth.sh</code></strong></p> 428 429 <p>Blockchain data is persisted to <strong><code>./ethash/.ethash and ./shyftData__</code></strong>. If you would like to reset the test blockchain you will need to delete the <strong><code>__./ethash ./shyftData & ./privatenet__</code></strong> directories.</p> 430 431 <p>The docker container for the ShyftBlockExplorerApi utilizes govendor to minimize its image size. <strong>If you would like the docker image for this container to reflect any uncommitted changes which may have occurred in the go-empyrean repository, ie. changes with respect to go-empyrean core (ie. cryptographic functions and database). Prior to launching the docker containers you should rebuild the vendor directory for the shyftBlockExplorerApi - by executing the following steps:</strong></p> 432 433 <p>Remove existing shyftBlockExplorerApi vendor.json and vendored components:</p> 434 435 <p><strong><code>rm -rf shyftBlockExplorerApi/vendor</code></strong></p> 436 437 <p>reinitialize vendor.json</p> 438 439 <p><strong><code>cd shyftBlockExplorerApi && govendor init</code></strong></p> 440 441 <p>rebuild vendor.json using latest uncommitted changes</p> 442 443 <p><strong><code>govendor add +external</code></strong></p> 444 445 <p>Due to a bug in govendor and it not being able to pull in some dependencies that are c-header files 446 you should execute the following commands - see these issues - which whilst closed 447 appears to have not been fixed: https://github.com/kardianos/govendor/issues/124 && https://github.com/kardianos/govendor/issues/61</p> 448 449 <p><strong><code>govendor remove github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^</code></strong></p> 450 451 <p><strong><code>govendor fetch github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^</code></strong></p> 452 453 <p>NB: The Shyft Geth docker image size is 1+ GB so make sure you have adequate space on your disk drive/</p> 454 <h1 id='shyft-blockexplorer-api'>Shyft BlockExplorer API</h1> 455 <p>In order to store the block explorer database, a custom folder was created <code>./shyft_schema</code> that contains all the necessary functions to read and write to the explorer database.</p> 456 457 <p>The main functions exist in <code>./core/shyft_database_util.go</code> and <code>./core/shyft_get_utils.go</code></p> 458 459 <p>To run the block explorer rest api that queries the postgres instance and returns a json body, open a new terminal window, navigate to the root directory of the project and run the following command:</p> 460 461 <p><strong><code>go run blockExplorerApi/*.go</code></strong></p> 462 463 <p>This will start a go server on port 8080 and allow you to either run the pre-existing block explorer or query the api endpoints. Its important to note, that if you have nothing in your postgres database the API will return nothing.</p> 464 <h2 id='blocks'>Blocks</h2> 465 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_block/{blockNumber}</code> </p> 466 467 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 468 469 <p><strong>Description</strong></p> 470 <pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> 471 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x72590ac6e7626b9b1f77452d83297c0361e6ff7fa011872289224ee02b9acc8f"</span><span class="p">,</span><span class="w"> 472 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 473 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:54Z"</span><span class="p">,</span><span class="w"> 474 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 475 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 476 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"135005"</span><span class="p">,</span><span class="w"> 477 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 478 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 479 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">63</span><span class="p">,</span><span class="w"> 480 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 481 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25534458</span><span class="p">,</span><span class="w"> 482 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">7333650700872754740</span><span class="p">,</span><span class="w"> 483 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 484 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 485 </span><span class="p">}</span><span class="w"> 486 </span></code></pre> 487 <p>The above endpoint will respond with a the block data for that specific block number. The table below lists the attributes that will be included in the response from this endpoint.</p> 488 489 <table><thead> 490 <tr> 491 <th>Parameter</th> 492 <th>Description</th> 493 </tr> 494 </thead><tbody> 495 <tr> 496 <td><code>blockNumber</code></td> 497 <td>The block height or block number</td> 498 </tr> 499 </tbody></table> 500 501 <table><thead> 502 <tr> 503 <th style="text-align: left">Attributes</th> 504 <th style="text-align: center">Description</th> 505 <th style="text-align: right">Type</th> 506 </tr> 507 </thead><tbody> 508 <tr> 509 <td style="text-align: left"><code>Hash</code></td> 510 <td style="text-align: center">Block hash</td> 511 <td style="text-align: right">string</td> 512 </tr> 513 <tr> 514 <td style="text-align: left"><code>Coinbase</code></td> 515 <td style="text-align: center">Address of miner</td> 516 <td style="text-align: right">string</td> 517 </tr> 518 <tr> 519 <td style="text-align: left"><code>Number</code></td> 520 <td style="text-align: center">Block height</td> 521 <td style="text-align: right">number</td> 522 </tr> 523 <tr> 524 <td style="text-align: left"><code>GasUsed</code></td> 525 <td style="text-align: center">Amount of gas used</td> 526 <td style="text-align: right">number</td> 527 </tr> 528 <tr> 529 <td style="text-align: left"><code>GasLimit</code></td> 530 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 531 <td style="text-align: right">number</td> 532 </tr> 533 <tr> 534 <td style="text-align: left"><code>TxCount</code></td> 535 <td style="text-align: center">Amount of transactions included in the block</td> 536 <td style="text-align: right">number</td> 537 </tr> 538 <tr> 539 <td style="text-align: left"><code>UncleCount</code></td> 540 <td style="text-align: center">Amount of uncle blocks</td> 541 <td style="text-align: right">number</td> 542 </tr> 543 <tr> 544 <td style="text-align: left"><code>Age</code></td> 545 <td style="text-align: center">Time stamp of block creation</td> 546 <td style="text-align: right">Timestamp</td> 547 </tr> 548 <tr> 549 <td style="text-align: left"><code>ParentHash</code></td> 550 <td style="text-align: center">Hash of the prior block</td> 551 <td style="text-align: right">string</td> 552 </tr> 553 <tr> 554 <td style="text-align: left"><code>UncleHash</code></td> 555 <td style="text-align: center">Hash of a the uncle block</td> 556 <td style="text-align: right">string</td> 557 </tr> 558 <tr> 559 <td style="text-align: left"><code>Size</code></td> 560 <td style="text-align: center">Size of block measured in Bytes</td> 561 <td style="text-align: right">string</td> 562 </tr> 563 <tr> 564 <td style="text-align: left"><code>Rewards</code></td> 565 <td style="text-align: center">Block reward</td> 566 <td style="text-align: right">string</td> 567 </tr> 568 <tr> 569 <td style="text-align: left"><code>Nonce</code></td> 570 <td style="text-align: center">Value used for PoW</td> 571 <td style="text-align: right">number</td> 572 </tr> 573 <tr> 574 <td style="text-align: left"><code>Difficulty</code></td> 575 <td style="text-align: center">The difficulty for this block</td> 576 <td style="text-align: right">string</td> 577 </tr> 578 </tbody></table> 579 580 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_all_blocks</code> </p> 581 582 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 583 584 <p><strong>Description</strong></p> 585 <pre class="highlight json tab-json"><code><span class="p">[{</span><span class="w"> 586 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 587 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 588 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:53Z"</span><span class="p">,</span><span class="w"> 589 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0xb0437e25e7cfb113bbea0f014883e8f441d5465bb628f9a112eb372e43055f1a"</span><span class="p">,</span><span class="w"> 590 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 591 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"134940"</span><span class="p">,</span><span class="w"> 592 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 593 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 594 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">62</span><span class="p">,</span><span class="w"> 595 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 596 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25509548</span><span class="p">,</span><span class="w"> 597 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">2307164919004664188</span><span class="p">,</span><span class="w"> 598 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 599 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 600 </span><span class="p">},</span><span class="w"> 601 </span><span class="p">{</span><span class="w"> 602 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x72590ac6e7626b9b1f77452d83297c0361e6ff7fa011872289224ee02b9acc8f"</span><span class="p">,</span><span class="w"> 603 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 604 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:54Z"</span><span class="p">,</span><span class="w"> 605 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 606 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 607 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"135005"</span><span class="p">,</span><span class="w"> 608 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 609 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 610 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">63</span><span class="p">,</span><span class="w"> 611 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 612 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25534458</span><span class="p">,</span><span class="w"> 613 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">7333650700872754740</span><span class="p">,</span><span class="w"> 614 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 615 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 616 </span><span class="p">}]</span><span class="w"> 617 </span></code></pre> 618 <p>The above endpoint will respond with a the block data for all blocks in the postgres db. The table below lists the attributes that will be included in the response from this endpoint.</p> 619 620 <p><em>No Parameter requirement</em></p> 621 622 <table><thead> 623 <tr> 624 <th style="text-align: left">Attributes</th> 625 <th style="text-align: center">Description</th> 626 <th style="text-align: right">Type</th> 627 </tr> 628 </thead><tbody> 629 <tr> 630 <td style="text-align: left"><code>Hash</code></td> 631 <td style="text-align: center">Block hash</td> 632 <td style="text-align: right">string</td> 633 </tr> 634 <tr> 635 <td style="text-align: left"><code>Coinbase</code></td> 636 <td style="text-align: center">Address of miner</td> 637 <td style="text-align: right">string</td> 638 </tr> 639 <tr> 640 <td style="text-align: left"><code>Number</code></td> 641 <td style="text-align: center">Block height</td> 642 <td style="text-align: right">number</td> 643 </tr> 644 <tr> 645 <td style="text-align: left"><code>GasUsed</code></td> 646 <td style="text-align: center">Amount of gas used</td> 647 <td style="text-align: right">number</td> 648 </tr> 649 <tr> 650 <td style="text-align: left"><code>GasLimit</code></td> 651 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 652 <td style="text-align: right">number</td> 653 </tr> 654 <tr> 655 <td style="text-align: left"><code>TxCount</code></td> 656 <td style="text-align: center">Amount of transactions included in the block</td> 657 <td style="text-align: right">number</td> 658 </tr> 659 <tr> 660 <td style="text-align: left"><code>UncleCount</code></td> 661 <td style="text-align: center">Amount of uncle blocks</td> 662 <td style="text-align: right">number</td> 663 </tr> 664 <tr> 665 <td style="text-align: left"><code>Age</code></td> 666 <td style="text-align: center">Time stamp of block creation</td> 667 <td style="text-align: right">Timestamp</td> 668 </tr> 669 <tr> 670 <td style="text-align: left"><code>ParentHash</code></td> 671 <td style="text-align: center">Hash of the prior block</td> 672 <td style="text-align: right">string</td> 673 </tr> 674 <tr> 675 <td style="text-align: left"><code>UncleHash</code></td> 676 <td style="text-align: center">Hash of a the uncle block</td> 677 <td style="text-align: right">string</td> 678 </tr> 679 <tr> 680 <td style="text-align: left"><code>Size</code></td> 681 <td style="text-align: center">Size of block measured in Bytes</td> 682 <td style="text-align: right">string</td> 683 </tr> 684 <tr> 685 <td style="text-align: left"><code>Rewards</code></td> 686 <td style="text-align: center">Block reward</td> 687 <td style="text-align: right">string</td> 688 </tr> 689 <tr> 690 <td style="text-align: left"><code>Nonce</code></td> 691 <td style="text-align: center">Value used for PoW</td> 692 <td style="text-align: right">number</td> 693 </tr> 694 <tr> 695 <td style="text-align: left"><code>Difficulty</code></td> 696 <td style="text-align: center">The difficulty for this block</td> 697 <td style="text-align: right">string</td> 698 </tr> 699 </tbody></table> 700 701 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_recent_block</code> </p> 702 703 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 704 705 <p><strong>Description</strong></p> 706 <pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> 707 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x72590ac6e7626b9b1f77452d83297c0361e6ff7fa011872289224ee02b9acc8f"</span><span class="p">,</span><span class="w"> 708 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 709 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:54Z"</span><span class="p">,</span><span class="w"> 710 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 711 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 712 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"135005"</span><span class="p">,</span><span class="w"> 713 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 714 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 715 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">63</span><span class="p">,</span><span class="w"> 716 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 717 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25534458</span><span class="p">,</span><span class="w"> 718 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">7333650700872754740</span><span class="p">,</span><span class="w"> 719 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 720 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 721 </span><span class="p">}</span><span class="w"> 722 </span></code></pre> 723 <p>The above endpoint will respond with the block data from the highest block height. The table below lists the attributes that will be included in the response from this endpoint.</p> 724 725 <p><em>No Parameter requirement</em></p> 726 727 <table><thead> 728 <tr> 729 <th style="text-align: left">Attributes</th> 730 <th style="text-align: center">Description</th> 731 <th style="text-align: right">Type</th> 732 </tr> 733 </thead><tbody> 734 <tr> 735 <td style="text-align: left"><code>Hash</code></td> 736 <td style="text-align: center">Block hash</td> 737 <td style="text-align: right">string</td> 738 </tr> 739 <tr> 740 <td style="text-align: left"><code>Coinbase</code></td> 741 <td style="text-align: center">Address of miner</td> 742 <td style="text-align: right">string</td> 743 </tr> 744 <tr> 745 <td style="text-align: left"><code>Number</code></td> 746 <td style="text-align: center">Block height</td> 747 <td style="text-align: right">number</td> 748 </tr> 749 <tr> 750 <td style="text-align: left"><code>GasUsed</code></td> 751 <td style="text-align: center">Amount of gas used</td> 752 <td style="text-align: right">number</td> 753 </tr> 754 <tr> 755 <td style="text-align: left"><code>GasLimit</code></td> 756 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 757 <td style="text-align: right">number</td> 758 </tr> 759 <tr> 760 <td style="text-align: left"><code>TxCount</code></td> 761 <td style="text-align: center">Amount of transactions included in the block</td> 762 <td style="text-align: right">number</td> 763 </tr> 764 <tr> 765 <td style="text-align: left"><code>UncleCount</code></td> 766 <td style="text-align: center">Amount of uncle blocks</td> 767 <td style="text-align: right">number</td> 768 </tr> 769 <tr> 770 <td style="text-align: left"><code>Age</code></td> 771 <td style="text-align: center">Time stamp of block creation</td> 772 <td style="text-align: right">Timestamp</td> 773 </tr> 774 <tr> 775 <td style="text-align: left"><code>ParentHash</code></td> 776 <td style="text-align: center">Hash of the prior block</td> 777 <td style="text-align: right">string</td> 778 </tr> 779 <tr> 780 <td style="text-align: left"><code>UncleHash</code></td> 781 <td style="text-align: center">Hash of a the uncle block</td> 782 <td style="text-align: right">string</td> 783 </tr> 784 <tr> 785 <td style="text-align: left"><code>Size</code></td> 786 <td style="text-align: center">Size of block measured in Bytes</td> 787 <td style="text-align: right">string</td> 788 </tr> 789 <tr> 790 <td style="text-align: left"><code>Rewards</code></td> 791 <td style="text-align: center">Block reward</td> 792 <td style="text-align: right">string</td> 793 </tr> 794 <tr> 795 <td style="text-align: left"><code>Nonce</code></td> 796 <td style="text-align: center">Value used for PoW</td> 797 <td style="text-align: right">number</td> 798 </tr> 799 <tr> 800 <td style="text-align: left"><code>Difficulty</code></td> 801 <td style="text-align: center">The difficulty for this block</td> 802 <td style="text-align: right">string</td> 803 </tr> 804 </tbody></table> 805 806 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_blocks_mined/{coinbase}</code> </p> 807 808 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 809 810 <p><strong>Description</strong></p> 811 <pre class="highlight json tab-json"><code><span class="p">[{</span><span class="w"> 812 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 813 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 814 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:53Z"</span><span class="p">,</span><span class="w"> 815 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0xb0437e25e7cfb113bbea0f014883e8f441d5465bb628f9a112eb372e43055f1a"</span><span class="p">,</span><span class="w"> 816 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 817 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"134940"</span><span class="p">,</span><span class="w"> 818 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 819 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 820 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">62</span><span class="p">,</span><span class="w"> 821 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 822 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25509548</span><span class="p">,</span><span class="w"> 823 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">2307164919004664188</span><span class="p">,</span><span class="w"> 824 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 825 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 826 </span><span class="p">},</span><span class="w"> 827 </span><span class="p">{</span><span class="w"> 828 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x72590ac6e7626b9b1f77452d83297c0361e6ff7fa011872289224ee02b9acc8f"</span><span class="p">,</span><span class="w"> 829 </span><span class="s2">"Coinbase"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 830 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-01T11:15:54Z"</span><span class="p">,</span><span class="w"> 831 </span><span class="s2">"ParentHash"</span><span class="p">:</span><span class="s2">"0x5c1aa0559093d9e1e128b6d8ae63d5bf9a5fbf273f704afad9adac88e734c3cc"</span><span class="p">,</span><span class="w"> 832 </span><span class="s2">"UncleHash"</span><span class="p">:</span><span class="s2">"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"</span><span class="p">,</span><span class="w"> 833 </span><span class="s2">"Difficulty"</span><span class="p">:</span><span class="s2">"135005"</span><span class="p">,</span><span class="w"> 834 </span><span class="s2">"Size"</span><span class="p">:</span><span class="s2">"538.00 B"</span><span class="p">,</span><span class="w"> 835 </span><span class="s2">"Rewards"</span><span class="p">:</span><span class="s2">"5000000000000000000"</span><span class="p">,</span><span class="w"> 836 </span><span class="s2">"Number"</span><span class="p">:</span><span class="mi">63</span><span class="p">,</span><span class="w"> 837 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 838 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">25534458</span><span class="p">,</span><span class="w"> 839 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">7333650700872754740</span><span class="p">,</span><span class="w"> 840 </span><span class="s2">"TxCount"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 841 </span><span class="s2">"UncleCount"</span><span class="p">:</span><span class="mi">0</span><span class="w"> 842 </span><span class="p">}]</span><span class="w"> 843 </span></code></pre> 844 <p>The above endpoint will respond with a the block data for all blocks which have been mined by the provided address. The table below lists the attributes that will be included in the response from this endpoint.</p> 845 846 <table><thead> 847 <tr> 848 <th>Parameter</th> 849 <th>Description</th> 850 </tr> 851 </thead><tbody> 852 <tr> 853 <td><code>coinbase</code></td> 854 <td>The miners address</td> 855 </tr> 856 </tbody></table> 857 858 <table><thead> 859 <tr> 860 <th style="text-align: left">Attributes</th> 861 <th style="text-align: center">Description</th> 862 <th style="text-align: right">Type</th> 863 </tr> 864 </thead><tbody> 865 <tr> 866 <td style="text-align: left"><code>Hash</code></td> 867 <td style="text-align: center">Block hash</td> 868 <td style="text-align: right">string</td> 869 </tr> 870 <tr> 871 <td style="text-align: left"><code>Coinbase</code></td> 872 <td style="text-align: center">Address of miner</td> 873 <td style="text-align: right">string</td> 874 </tr> 875 <tr> 876 <td style="text-align: left"><code>Number</code></td> 877 <td style="text-align: center">Block height</td> 878 <td style="text-align: right">number</td> 879 </tr> 880 <tr> 881 <td style="text-align: left"><code>GasUsed</code></td> 882 <td style="text-align: center">Amount of gas used</td> 883 <td style="text-align: right">number</td> 884 </tr> 885 <tr> 886 <td style="text-align: left"><code>GasLimit</code></td> 887 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 888 <td style="text-align: right">number</td> 889 </tr> 890 <tr> 891 <td style="text-align: left"><code>TxCount</code></td> 892 <td style="text-align: center">Amount of transactions included in the block</td> 893 <td style="text-align: right">number</td> 894 </tr> 895 <tr> 896 <td style="text-align: left"><code>UncleCount</code></td> 897 <td style="text-align: center">Amount of uncle blocks</td> 898 <td style="text-align: right">number</td> 899 </tr> 900 <tr> 901 <td style="text-align: left"><code>Age</code></td> 902 <td style="text-align: center">Time stamp of block creation</td> 903 <td style="text-align: right">Timestamp</td> 904 </tr> 905 <tr> 906 <td style="text-align: left"><code>ParentHash</code></td> 907 <td style="text-align: center">Hash of the prior block</td> 908 <td style="text-align: right">string</td> 909 </tr> 910 <tr> 911 <td style="text-align: left"><code>UncleHash</code></td> 912 <td style="text-align: center">Hash of a the uncle block</td> 913 <td style="text-align: right">string</td> 914 </tr> 915 <tr> 916 <td style="text-align: left"><code>Size</code></td> 917 <td style="text-align: center">Size of block measured in Bytes</td> 918 <td style="text-align: right">string</td> 919 </tr> 920 <tr> 921 <td style="text-align: left"><code>Rewards</code></td> 922 <td style="text-align: center">Block reward</td> 923 <td style="text-align: right">string</td> 924 </tr> 925 <tr> 926 <td style="text-align: left"><code>Nonce</code></td> 927 <td style="text-align: center">Value used for PoW</td> 928 <td style="text-align: right">number</td> 929 </tr> 930 <tr> 931 <td style="text-align: left"><code>Difficulty</code></td> 932 <td style="text-align: center">The difficulty for this block</td> 933 <td style="text-align: right">string</td> 934 </tr> 935 </tbody></table> 936 <h2 id='transactions'>Transactions</h2> 937 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_transaction/{txHash}</code> </p> 938 939 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 940 941 <p><strong>Description</strong></p> 942 <pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> 943 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 944 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 945 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x007622d84a234bb8b078230fcf84b67ae9a8acae"</span><span class="p">,</span><span class="w"> 946 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xfa01942529ef3a4e543ef8c061c6e0cb69a61c489d3bb6891bb65651c02dafd4"</span><span class="p">,</span><span class="w"> 947 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"2"</span><span class="p">,</span><span class="w"> 948 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"400000000000000000000"</span><span class="p">,</span><span class="w"> 949 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">1253</span><span class="p">,</span><span class="w"> 950 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">12124</span><span class="p">,</span><span class="w"> 951 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24011655</span><span class="p">,</span><span class="w"> 952 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"53002"</span><span class="p">,</span><span class="w"> 953 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w"> 954 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 955 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 956 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-03-18T19:38:41Z"</span><span class="p">,</span><span class="w"> 957 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">""</span><span class="w"> 958 </span><span class="p">}</span><span class="w"> 959 </span></code></pre> 960 <p>The above endpoint will respond with transaction data from the provided transaction hash. The table below lists the attributes that will be included in the response from this endpoint.</p> 961 962 <table><thead> 963 <tr> 964 <th>Parameter</th> 965 <th>Description</th> 966 </tr> 967 </thead><tbody> 968 <tr> 969 <td><code>txHash</code></td> 970 <td>The hash for that particular transaction</td> 971 </tr> 972 </tbody></table> 973 974 <table><thead> 975 <tr> 976 <th style="text-align: left">Attributes</th> 977 <th style="text-align: center">Description</th> 978 <th style="text-align: right">Type</th> 979 </tr> 980 </thead><tbody> 981 <tr> 982 <td style="text-align: left"><code>TxHash</code></td> 983 <td style="text-align: center">Transaction hash</td> 984 <td style="text-align: right">string</td> 985 </tr> 986 <tr> 987 <td style="text-align: left"><code>To</code></td> 988 <td style="text-align: center">Address of transaction receiver</td> 989 <td style="text-align: right">string</td> 990 </tr> 991 <tr> 992 <td style="text-align: left"><code>From</code></td> 993 <td style="text-align: center">Address of transaction sender</td> 994 <td style="text-align: right">string</td> 995 </tr> 996 <tr> 997 <td style="text-align: left"><code>BlockHash</code></td> 998 <td style="text-align: center">Hash of block</td> 999 <td style="text-align: right">string</td> 1000 </tr> 1001 <tr> 1002 <td style="text-align: left"><code>BlockNumber</code></td> 1003 <td style="text-align: center">Block height</td> 1004 <td style="text-align: right">string</td> 1005 </tr> 1006 <tr> 1007 <td style="text-align: left"><code>Amount</code></td> 1008 <td style="text-align: center">Amount of value being transferred</td> 1009 <td style="text-align: right">string</td> 1010 </tr> 1011 <tr> 1012 <td style="text-align: left"><code>GasPrice</code></td> 1013 <td style="text-align: center">Price of required gas</td> 1014 <td style="text-align: right">number</td> 1015 </tr> 1016 <tr> 1017 <td style="text-align: left"><code>Gas</code></td> 1018 <td style="text-align: center">Required pricing value to process transaction</td> 1019 <td style="text-align: right">number</td> 1020 </tr> 1021 <tr> 1022 <td style="text-align: left"><code>GasLimit</code></td> 1023 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 1024 <td style="text-align: right">number</td> 1025 </tr> 1026 <tr> 1027 <td style="text-align: left"><code>Cost</code></td> 1028 <td style="text-align: center">Hash of a the uncle block</td> 1029 <td style="text-align: right">string</td> 1030 </tr> 1031 <tr> 1032 <td style="text-align: left"><code>Nonce</code></td> 1033 <td style="text-align: center">Number of transactions sent from a given address</td> 1034 <td style="text-align: right">number</td> 1035 </tr> 1036 <tr> 1037 <td style="text-align: left"><code>Status</code></td> 1038 <td style="text-align: center">Whether the transaction was success or fail</td> 1039 <td style="text-align: right">string</td> 1040 </tr> 1041 <tr> 1042 <td style="text-align: left"><code>IsContract</code></td> 1043 <td style="text-align: center">Whether the transaction was from a contract</td> 1044 <td style="text-align: right">bool</td> 1045 </tr> 1046 <tr> 1047 <td style="text-align: left"><code>Age</code></td> 1048 <td style="text-align: center">Time stamp of transaction creation</td> 1049 <td style="text-align: right">timestamp</td> 1050 </tr> 1051 <tr> 1052 <td style="text-align: left"><code>Data</code></td> 1053 <td style="text-align: center">Contract data in byte code</td> 1054 <td style="text-align: right">byteArray</td> 1055 </tr> 1056 </tbody></table> 1057 1058 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_all_transactions</code> </p> 1059 1060 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1061 1062 <p><strong>Description</strong></p> 1063 <pre class="highlight json tab-json"><code><span class="p">[{</span><span class="w"> 1064 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1065 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1066 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x007622d84a234bb8b078230fcf84b67ae9a8acae"</span><span class="p">,</span><span class="w"> 1067 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xfa01942529ef3a4e543ef8c061c6e0cb69a61c489d3bb6891bb65651c02dafd4"</span><span class="p">,</span><span class="w"> 1068 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"2"</span><span class="p">,</span><span class="w"> 1069 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"400000000000000000000"</span><span class="p">,</span><span class="w"> 1070 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">1253</span><span class="p">,</span><span class="w"> 1071 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">12124</span><span class="p">,</span><span class="w"> 1072 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24011655</span><span class="p">,</span><span class="w"> 1073 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"53002"</span><span class="p">,</span><span class="w"> 1074 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w"> 1075 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1076 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 1077 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-03-18T19:38:41Z"</span><span class="p">,</span><span class="w"> 1078 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">""</span><span class="w"> 1079 </span><span class="p">},</span><span class="w"> 1080 </span><span class="p">{</span><span class="w"> 1081 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x2f56g38164c634550eb12e222146cbaef2de965aa0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1082 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1083 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x007622d84a234bb8b078230fcf84b67ae9a8acae"</span><span class="p">,</span><span class="w"> 1084 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xbg01234529ef3a4e543q23061c6e0cb69a61c489d3bb6891bb65651c02dafd4"</span><span class="p">,</span><span class="w"> 1085 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"3"</span><span class="p">,</span><span class="w"> 1086 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"100000000000000000000"</span><span class="p">,</span><span class="w"> 1087 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">1253</span><span class="p">,</span><span class="w"> 1088 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">12124</span><span class="p">,</span><span class="w"> 1089 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24011655</span><span class="p">,</span><span class="w"> 1090 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"53002"</span><span class="p">,</span><span class="w"> 1091 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span><span class="w"> 1092 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1093 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 1094 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-03-18T19:40:41Z"</span><span class="p">,</span><span class="w"> 1095 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">""</span><span class="w"> 1096 </span><span class="p">}]</span><span class="w"> 1097 1098 </span></code></pre> 1099 <p>The above endpoint will respond with transaction data for all transactions in the postgres database. The table below lists the attributes that will be included in the response from this endpoint.</p> 1100 1101 <p><em>No parameters required</em></p> 1102 1103 <table><thead> 1104 <tr> 1105 <th style="text-align: left">Attributes</th> 1106 <th style="text-align: center">Description</th> 1107 <th style="text-align: right">Type</th> 1108 </tr> 1109 </thead><tbody> 1110 <tr> 1111 <td style="text-align: left"><code>TxHash</code></td> 1112 <td style="text-align: center">Transaction hash</td> 1113 <td style="text-align: right">string</td> 1114 </tr> 1115 <tr> 1116 <td style="text-align: left"><code>To</code></td> 1117 <td style="text-align: center">Address of transaction receiver</td> 1118 <td style="text-align: right">string</td> 1119 </tr> 1120 <tr> 1121 <td style="text-align: left"><code>From</code></td> 1122 <td style="text-align: center">Address of transaction sender</td> 1123 <td style="text-align: right">string</td> 1124 </tr> 1125 <tr> 1126 <td style="text-align: left"><code>BlockHash</code></td> 1127 <td style="text-align: center">Hash of block</td> 1128 <td style="text-align: right">string</td> 1129 </tr> 1130 <tr> 1131 <td style="text-align: left"><code>BlockNumber</code></td> 1132 <td style="text-align: center">Block height</td> 1133 <td style="text-align: right">string</td> 1134 </tr> 1135 <tr> 1136 <td style="text-align: left"><code>Amount</code></td> 1137 <td style="text-align: center">Amount of value being transferred</td> 1138 <td style="text-align: right">string</td> 1139 </tr> 1140 <tr> 1141 <td style="text-align: left"><code>GasPrice</code></td> 1142 <td style="text-align: center">Price of required gas</td> 1143 <td style="text-align: right">number</td> 1144 </tr> 1145 <tr> 1146 <td style="text-align: left"><code>Gas</code></td> 1147 <td style="text-align: center">Required pricing value to process transaction</td> 1148 <td style="text-align: right">number</td> 1149 </tr> 1150 <tr> 1151 <td style="text-align: left"><code>GasLimit</code></td> 1152 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 1153 <td style="text-align: right">number</td> 1154 </tr> 1155 <tr> 1156 <td style="text-align: left"><code>Cost</code></td> 1157 <td style="text-align: center">Hash of a the uncle block</td> 1158 <td style="text-align: right">string</td> 1159 </tr> 1160 <tr> 1161 <td style="text-align: left"><code>Nonce</code></td> 1162 <td style="text-align: center">Number of transactions sent from a given address</td> 1163 <td style="text-align: right">number</td> 1164 </tr> 1165 <tr> 1166 <td style="text-align: left"><code>Status</code></td> 1167 <td style="text-align: center">Whether the transaction was success or fail</td> 1168 <td style="text-align: right">string</td> 1169 </tr> 1170 <tr> 1171 <td style="text-align: left"><code>IsContract</code></td> 1172 <td style="text-align: center">Whether the transaction was from a contract</td> 1173 <td style="text-align: right">bool</td> 1174 </tr> 1175 <tr> 1176 <td style="text-align: left"><code>Age</code></td> 1177 <td style="text-align: center">Time stamp of transaction creation</td> 1178 <td style="text-align: right">timestamp</td> 1179 </tr> 1180 <tr> 1181 <td style="text-align: left"><code>Data</code></td> 1182 <td style="text-align: center">Contract data in byte code</td> 1183 <td style="text-align: right">byteArray</td> 1184 </tr> 1185 </tbody></table> 1186 1187 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_all_transactions_from_block/{blockNumber}</code> </p> 1188 1189 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1190 1191 <p><strong>Description</strong></p> 1192 <pre class="highlight json tab-json"><code><span class="p">[{</span><span class="w"> 1193 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1194 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1195 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x007622d84a234bb8b078230fcf84b67ae9a8acae"</span><span class="p">,</span><span class="w"> 1196 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xfa01942529ef3a4e543ef8c061c6e0cb69a61c489d3bb6891bb65651c02dafd4"</span><span class="p">,</span><span class="w"> 1197 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"3"</span><span class="p">,</span><span class="w"> 1198 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"400000000000000000000"</span><span class="p">,</span><span class="w"> 1199 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">1253</span><span class="p">,</span><span class="w"> 1200 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">12124</span><span class="p">,</span><span class="w"> 1201 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24011655</span><span class="p">,</span><span class="w"> 1202 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"53002"</span><span class="p">,</span><span class="w"> 1203 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span><span class="w"> 1204 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1205 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 1206 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-03-18T19:38:41Z"</span><span class="p">,</span><span class="w"> 1207 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">""</span><span class="w"> 1208 </span><span class="p">},</span><span class="w"> 1209 </span><span class="p">{</span><span class="w"> 1210 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x2f56g38164c634550eb12e222146cbaef2de965aa0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1211 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1212 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x007622d84a234bb8b078230fcf84b67ae9a8acae"</span><span class="p">,</span><span class="w"> 1213 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xbg01234529ef3a4e543q23061c6e0cb69a61c489d3bb6891bb65651c02dafd4"</span><span class="p">,</span><span class="w"> 1214 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"3"</span><span class="p">,</span><span class="w"> 1215 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"100000000000000000000"</span><span class="p">,</span><span class="w"> 1216 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">1253</span><span class="p">,</span><span class="w"> 1217 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">12124</span><span class="p">,</span><span class="w"> 1218 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24011655</span><span class="p">,</span><span class="w"> 1219 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"53002"</span><span class="p">,</span><span class="w"> 1220 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">4</span><span class="p">,</span><span class="w"> 1221 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1222 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 1223 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-03-18T19:40:41Z"</span><span class="p">,</span><span class="w"> 1224 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">""</span><span class="w"> 1225 </span><span class="p">}]</span><span class="w"> 1226 1227 </span></code></pre> 1228 <p>The above endpoint will respond with transaction data for all transactions in the postgres database. The table below lists the attributes that will be included in the response from this endpoint.</p> 1229 1230 <table><thead> 1231 <tr> 1232 <th>Parameter</th> 1233 <th>Description</th> 1234 </tr> 1235 </thead><tbody> 1236 <tr> 1237 <td><code>blockNumber</code></td> 1238 <td>The block height or block number</td> 1239 </tr> 1240 </tbody></table> 1241 1242 <table><thead> 1243 <tr> 1244 <th style="text-align: left">Attributes</th> 1245 <th style="text-align: center">Description</th> 1246 <th style="text-align: right">Type</th> 1247 </tr> 1248 </thead><tbody> 1249 <tr> 1250 <td style="text-align: left"><code>TxHash</code></td> 1251 <td style="text-align: center">Transaction hash</td> 1252 <td style="text-align: right">string</td> 1253 </tr> 1254 <tr> 1255 <td style="text-align: left"><code>To</code></td> 1256 <td style="text-align: center">Address of transaction receiver</td> 1257 <td style="text-align: right">string</td> 1258 </tr> 1259 <tr> 1260 <td style="text-align: left"><code>From</code></td> 1261 <td style="text-align: center">Address of transaction sender</td> 1262 <td style="text-align: right">string</td> 1263 </tr> 1264 <tr> 1265 <td style="text-align: left"><code>BlockHash</code></td> 1266 <td style="text-align: center">Hash of block</td> 1267 <td style="text-align: right">string</td> 1268 </tr> 1269 <tr> 1270 <td style="text-align: left"><code>BlockNumber</code></td> 1271 <td style="text-align: center">Block height</td> 1272 <td style="text-align: right">string</td> 1273 </tr> 1274 <tr> 1275 <td style="text-align: left"><code>Amount</code></td> 1276 <td style="text-align: center">Amount of value being transferred</td> 1277 <td style="text-align: right">string</td> 1278 </tr> 1279 <tr> 1280 <td style="text-align: left"><code>GasPrice</code></td> 1281 <td style="text-align: center">Price of required gas</td> 1282 <td style="text-align: right">number</td> 1283 </tr> 1284 <tr> 1285 <td style="text-align: left"><code>Gas</code></td> 1286 <td style="text-align: center">Required pricing value to process transaction</td> 1287 <td style="text-align: right">number</td> 1288 </tr> 1289 <tr> 1290 <td style="text-align: left"><code>GasLimit</code></td> 1291 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 1292 <td style="text-align: right">number</td> 1293 </tr> 1294 <tr> 1295 <td style="text-align: left"><code>Cost</code></td> 1296 <td style="text-align: center">Hash of a the uncle block</td> 1297 <td style="text-align: right">string</td> 1298 </tr> 1299 <tr> 1300 <td style="text-align: left"><code>Nonce</code></td> 1301 <td style="text-align: center">Number of transactions sent from a given address</td> 1302 <td style="text-align: right">number</td> 1303 </tr> 1304 <tr> 1305 <td style="text-align: left"><code>Status</code></td> 1306 <td style="text-align: center">Whether the transaction was success or fail</td> 1307 <td style="text-align: right">string</td> 1308 </tr> 1309 <tr> 1310 <td style="text-align: left"><code>IsContract</code></td> 1311 <td style="text-align: center">Whether the transaction was from a contract</td> 1312 <td style="text-align: right">bool</td> 1313 </tr> 1314 <tr> 1315 <td style="text-align: left"><code>Age</code></td> 1316 <td style="text-align: center">Time stamp of transaction creation</td> 1317 <td style="text-align: right">timestamp</td> 1318 </tr> 1319 <tr> 1320 <td style="text-align: left"><code>Data</code></td> 1321 <td style="text-align: center">Contract data in byte code</td> 1322 <td style="text-align: right">byteArray</td> 1323 </tr> 1324 </tbody></table> 1325 1326 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_account_txs/{address}</code> </p> 1327 1328 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1329 1330 <p><strong>Description</strong></p> 1331 <pre class="highlight json tab-json"><code><span class="p">[</span><span class="w"> 1332 </span><span class="p">{</span><span class="w"> 1333 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x7da80aaf6f7e382735310c725b81f790f84c75a541a5360ecba30eb2d7965395"</span><span class="p">,</span><span class="w"> 1334 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1335 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 1336 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0x894459a52417bcf3e0eec81fce6cc0858813cbd2202711031e8c5185d9aa4d38"</span><span class="p">,</span><span class="w"> 1337 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"2"</span><span class="p">,</span><span class="w"> 1338 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w"> 1339 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">100000000000</span><span class="p">,</span><span class="w"> 1340 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">6721975</span><span class="p">,</span><span class="w"> 1341 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24058572</span><span class="p">,</span><span class="w"> 1342 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"672197500000000000"</span><span class="p">,</span><span class="w"> 1343 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w"> 1344 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1345 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="w"> 1346 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-02T13:21:02Z"</span><span class="p">,</span><span class="w"> 1347 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">"YIBgQFI0gBVhABBXYAGCY/////8WfAEAAAAAAAAAAAAAAAAAAAAAAAYQVienpyMFS8PtYkAKQ=="</span><span class="w"> 1348 </span><span class="p">},</span><span class="w"> 1349 </span><span class="p">{</span><span class="w"> 1350 </span><span class="s2">"TxHash"</span><span class="p">:</span><span class="s2">"0x2f49282ff117dd4d28f4b5a59a71fc0c3ab1cd595f6d503cd82caa88d1cc4897"</span><span class="p">,</span><span class="w"> 1351 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1352 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 1353 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0x12b73a2ae27cb32193e8570c275b24d6a9aa9d637c61582e63afe589535f075a"</span><span class="p">,</span><span class="w"> 1354 </span><span class="s2">"BlockNumber"</span><span class="p">:</span><span class="s2">"4"</span><span class="p">,</span><span class="w"> 1355 </span><span class="s2">"Amount"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w"> 1356 </span><span class="s2">"GasPrice"</span><span class="p">:</span><span class="mi">100000000000</span><span class="p">,</span><span class="w"> 1357 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">6721975</span><span class="p">,</span><span class="w"> 1358 </span><span class="s2">"GasLimit"</span><span class="p">:</span><span class="mi">24105581</span><span class="p">,</span><span class="w"> 1359 </span><span class="s2">"Cost"</span><span class="p">:</span><span class="s2">"672197500000000000"</span><span class="p">,</span><span class="w"> 1360 </span><span class="s2">"Nonce"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="w"> 1361 </span><span class="s2">"Status"</span><span class="p">:</span><span class="s2">"SUCCESS"</span><span class="p">,</span><span class="w"> 1362 </span><span class="s2">"IsContract"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="w"> 1363 </span><span class="s2">"Age"</span><span class="p">:</span><span class="s2">"2018-10-02T13:21:05Z"</span><span class="p">,</span><span class="w"> 1364 </span><span class="s2">"Data"</span><span class="p">:</span><span class="s2">"/azVdgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB"</span><span class="w"> 1365 </span><span class="p">}</span><span class="w"> 1366 </span><span class="p">]</span><span class="w"> 1367 1368 </span></code></pre> 1369 <p>The above endpoint will respond with transaction data for all transactions conducted by the provided address. The table below lists the attributes that will be included in the response from this endpoint.</p> 1370 1371 <table><thead> 1372 <tr> 1373 <th>Parameter</th> 1374 <th>Description</th> 1375 </tr> 1376 </thead><tbody> 1377 <tr> 1378 <td><code>address</code></td> 1379 <td>The address of an account</td> 1380 </tr> 1381 </tbody></table> 1382 1383 <table><thead> 1384 <tr> 1385 <th style="text-align: left">Attributes</th> 1386 <th style="text-align: center">Description</th> 1387 <th style="text-align: right">Type</th> 1388 </tr> 1389 </thead><tbody> 1390 <tr> 1391 <td style="text-align: left"><code>TxHash</code></td> 1392 <td style="text-align: center">Transaction hash</td> 1393 <td style="text-align: right">string</td> 1394 </tr> 1395 <tr> 1396 <td style="text-align: left"><code>To</code></td> 1397 <td style="text-align: center">Address of transaction receiver</td> 1398 <td style="text-align: right">string</td> 1399 </tr> 1400 <tr> 1401 <td style="text-align: left"><code>From</code></td> 1402 <td style="text-align: center">Address of transaction sender</td> 1403 <td style="text-align: right">string</td> 1404 </tr> 1405 <tr> 1406 <td style="text-align: left"><code>BlockHash</code></td> 1407 <td style="text-align: center">Hash of block</td> 1408 <td style="text-align: right">string</td> 1409 </tr> 1410 <tr> 1411 <td style="text-align: left"><code>BlockNumber</code></td> 1412 <td style="text-align: center">Block height</td> 1413 <td style="text-align: right">string</td> 1414 </tr> 1415 <tr> 1416 <td style="text-align: left"><code>Amount</code></td> 1417 <td style="text-align: center">Amount of value being transferred</td> 1418 <td style="text-align: right">string</td> 1419 </tr> 1420 <tr> 1421 <td style="text-align: left"><code>GasPrice</code></td> 1422 <td style="text-align: center">Price of required gas</td> 1423 <td style="text-align: right">number</td> 1424 </tr> 1425 <tr> 1426 <td style="text-align: left"><code>Gas</code></td> 1427 <td style="text-align: center">Required pricing value to process transaction</td> 1428 <td style="text-align: right">number</td> 1429 </tr> 1430 <tr> 1431 <td style="text-align: left"><code>GasLimit</code></td> 1432 <td style="text-align: center">Maximum amount of gas willing to be spent</td> 1433 <td style="text-align: right">number</td> 1434 </tr> 1435 <tr> 1436 <td style="text-align: left"><code>Cost</code></td> 1437 <td style="text-align: center">Hash of a the uncle block</td> 1438 <td style="text-align: right">string</td> 1439 </tr> 1440 <tr> 1441 <td style="text-align: left"><code>Nonce</code></td> 1442 <td style="text-align: center">Number of transactions sent from a given address</td> 1443 <td style="text-align: right">number</td> 1444 </tr> 1445 <tr> 1446 <td style="text-align: left"><code>Status</code></td> 1447 <td style="text-align: center">Whether the transaction was success or fail</td> 1448 <td style="text-align: right">string</td> 1449 </tr> 1450 <tr> 1451 <td style="text-align: left"><code>IsContract</code></td> 1452 <td style="text-align: center">Whether the transaction was from a contract</td> 1453 <td style="text-align: right">bool</td> 1454 </tr> 1455 <tr> 1456 <td style="text-align: left"><code>Age</code></td> 1457 <td style="text-align: center">Time stamp of transaction creation</td> 1458 <td style="text-align: right">timestamp</td> 1459 </tr> 1460 <tr> 1461 <td style="text-align: left"><code>Data</code></td> 1462 <td style="text-align: center">Contract data in byte code</td> 1463 <td style="text-align: right">byteArray</td> 1464 </tr> 1465 </tbody></table> 1466 1467 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_internal_transactions/{hash}</code> </p> 1468 1469 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1470 1471 <p><strong>Description</strong></p> 1472 <pre class="highlight json tab-json"><code><span class="p">[</span><span class="w"> 1473 </span><span class="p">{</span><span class="w"> 1474 </span><span class="s2">"ID"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="w"> 1475 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x2f49282ff117dd4d28f4b5a59a71fc0c3ab1cd595f6d503cd82caa88d1cc4897"</span><span class="p">,</span><span class="w"> 1476 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0x12b73a2ae27cb32193e8570c275b24d6a9aa9d637c61582e63afe589535f075a"</span><span class="p">,</span><span class="w"> 1477 </span><span class="s2">"Action"</span><span class="p">:</span><span class="s2">"CALL"</span><span class="p">,</span><span class="w"> 1478 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 1479 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1480 </span><span class="s2">"Value"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w"> 1481 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">6700511</span><span class="p">,</span><span class="w"> 1482 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">20544</span><span class="p">,</span><span class="w"> 1483 </span><span class="s2">"Input"</span><span class="p">:</span><span class="s2">"0xfdacd5760000000000000000000000000000000000000000000000000000000000000001"</span><span class="p">,</span><span class="w"> 1484 </span><span class="s2">"Output"</span><span class="p">:</span><span class="s2">"0x"</span><span class="p">,</span><span class="w"> 1485 </span><span class="s2">"Time"</span><span class="p">:</span><span class="s2">"6.950856ms"</span><span class="w"> 1486 </span><span class="p">}</span><span class="w"> 1487 </span><span class="p">]</span><span class="w"> 1488 </span></code></pre> 1489 <p>The above endpoint will respond with transaction data from the provided transaction hash. The table below lists the attributes that will be included in the response from this endpoint.</p> 1490 1491 <table><thead> 1492 <tr> 1493 <th>Parameter</th> 1494 <th>Description</th> 1495 </tr> 1496 </thead><tbody> 1497 <tr> 1498 <td><code>hash</code></td> 1499 <td>The transaction hash of the particular record</td> 1500 </tr> 1501 </tbody></table> 1502 1503 <table><thead> 1504 <tr> 1505 <th style="text-align: left">Attributes</th> 1506 <th style="text-align: center">Description</th> 1507 <th style="text-align: right">Type</th> 1508 </tr> 1509 </thead><tbody> 1510 <tr> 1511 <td style="text-align: left"><code>ID</code></td> 1512 <td style="text-align: center">Incrementing integer for unique db record</td> 1513 <td style="text-align: right">number</td> 1514 </tr> 1515 <tr> 1516 <td style="text-align: left"><code>Hash</code></td> 1517 <td style="text-align: center">Transaction hash</td> 1518 <td style="text-align: right">string</td> 1519 </tr> 1520 <tr> 1521 <td style="text-align: left"><code>BlockHash</code></td> 1522 <td style="text-align: center">Hash of block</td> 1523 <td style="text-align: right">string</td> 1524 </tr> 1525 <tr> 1526 <td style="text-align: left"><code>Action</code></td> 1527 <td style="text-align: center">Contract type, can be Call or Create</td> 1528 <td style="text-align: right">string</td> 1529 </tr> 1530 <tr> 1531 <td style="text-align: left"><code>To</code></td> 1532 <td style="text-align: center">Address of transaction receiver</td> 1533 <td style="text-align: right">string</td> 1534 </tr> 1535 <tr> 1536 <td style="text-align: left"><code>From</code></td> 1537 <td style="text-align: center">Address of transaction sender</td> 1538 <td style="text-align: right">string</td> 1539 </tr> 1540 <tr> 1541 <td style="text-align: left"><code>Value</code></td> 1542 <td style="text-align: center">Amount of value being transferred</td> 1543 <td style="text-align: right">string</td> 1544 </tr> 1545 <tr> 1546 <td style="text-align: left"><code>Gas</code></td> 1547 <td style="text-align: center">Required pricing value to process transaction</td> 1548 <td style="text-align: right">number</td> 1549 </tr> 1550 <tr> 1551 <td style="text-align: left"><code>GasUsed</code></td> 1552 <td style="text-align: center">Amount of gas used</td> 1553 <td style="text-align: right">number</td> 1554 </tr> 1555 <tr> 1556 <td style="text-align: left"><code>Input</code></td> 1557 <td style="text-align: center">Parameters passed into contract in bytecode</td> 1558 <td style="text-align: right">string</td> 1559 </tr> 1560 <tr> 1561 <td style="text-align: left"><code>Output</code></td> 1562 <td style="text-align: center">Return values from contract in bytecode</td> 1563 <td style="text-align: right">string</td> 1564 </tr> 1565 <tr> 1566 <td style="text-align: left"><code>Time</code></td> 1567 <td style="text-align: center">Amount of time to trace transaction</td> 1568 <td style="text-align: right">string</td> 1569 </tr> 1570 </tbody></table> 1571 1572 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_internal_transactions</code> </p> 1573 1574 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1575 1576 <p><strong>Description</strong></p> 1577 <pre class="highlight json tab-json"><code><span class="p">[</span><span class="w"> 1578 </span><span class="p">{</span><span class="w"> 1579 </span><span class="s2">"ID"</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span><span class="w"> 1580 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x2f49282ff117dd4d28f4b5a59a71fc0c3ab1cd595f6d503cd82caa88d1cc4897"</span><span class="p">,</span><span class="w"> 1581 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0x12b73a2ae27cb32193e8570c275b24d6a9aa9d637c61582e63afe589535f075a"</span><span class="p">,</span><span class="w"> 1582 </span><span class="s2">"Action"</span><span class="p">:</span><span class="s2">"CALL"</span><span class="p">,</span><span class="w"> 1583 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 1584 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1585 </span><span class="s2">"Value"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w"> 1586 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">6700511</span><span class="p">,</span><span class="w"> 1587 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">20544</span><span class="p">,</span><span class="w"> 1588 </span><span class="s2">"Input"</span><span class="p">:</span><span class="s2">"0xfdacd5760000000000000000000000000000000000000000000000000000000000000001"</span><span class="p">,</span><span class="w"> 1589 </span><span class="s2">"Output"</span><span class="p">:</span><span class="s2">"0x"</span><span class="p">,</span><span class="w"> 1590 </span><span class="s2">"Time"</span><span class="p">:</span><span class="s2">"6.950856ms"</span><span class="w"> 1591 </span><span class="p">},</span><span class="w"> 1592 </span><span class="p">{</span><span class="w"> 1593 </span><span class="s2">"ID"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="w"> 1594 </span><span class="s2">"Hash"</span><span class="p">:</span><span class="s2">"0x16b218a28d48c5ef54cf09ce836e285cb23ba9c179b3c88269d61cb5bd5473db"</span><span class="p">,</span><span class="w"> 1595 </span><span class="s2">"BlockHash"</span><span class="p">:</span><span class="s2">"0xbdb1aca7c9aeee9f9723ea84cb8d47ff46f49e29a85d41a92b7950a0970b1d25"</span><span class="p">,</span><span class="w"> 1596 </span><span class="s2">"Action"</span><span class="p">:</span><span class="s2">"CALL"</span><span class="p">,</span><span class="w"> 1597 </span><span class="s2">"From"</span><span class="p">:</span><span class="s2">"0x43ec6d0942f7faef069f7f63d0384a27f529b062"</span><span class="p">,</span><span class="w"> 1598 </span><span class="s2">"To"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1599 </span><span class="s2">"Value"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w"> 1600 </span><span class="s2">"Gas"</span><span class="p">:</span><span class="mi">6700511</span><span class="p">,</span><span class="w"> 1601 </span><span class="s2">"GasUsed"</span><span class="p">:</span><span class="mi">5544</span><span class="p">,</span><span class="w"> 1602 </span><span class="s2">"Input"</span><span class="p">:</span><span class="s2">"0xfdacd5760000000000000000000000000000000000000000000000000000000000000002"</span><span class="p">,</span><span class="w"> 1603 </span><span class="s2">"Output"</span><span class="p">:</span><span class="s2">"0x"</span><span class="p">,</span><span class="w"> 1604 </span><span class="s2">"Time"</span><span class="p">:</span><span class="s2">"1.370835ms"</span><span class="w"> 1605 </span><span class="p">}</span><span class="w"> 1606 </span><span class="p">]</span><span class="w"> 1607 </span></code></pre> 1608 <p>The above endpoint will respond with all internal transaction data from the postgres database. The table below lists the attributes that will be included in the response from this endpoint.</p> 1609 1610 <p><em>No parameters requirements</em></p> 1611 1612 <table><thead> 1613 <tr> 1614 <th style="text-align: left">Attributes</th> 1615 <th style="text-align: center">Description</th> 1616 <th style="text-align: right">Type</th> 1617 </tr> 1618 </thead><tbody> 1619 <tr> 1620 <td style="text-align: left"><code>ID</code></td> 1621 <td style="text-align: center">Incrementing integer for unique db record</td> 1622 <td style="text-align: right">number</td> 1623 </tr> 1624 <tr> 1625 <td style="text-align: left"><code>Hash</code></td> 1626 <td style="text-align: center">Transaction hash</td> 1627 <td style="text-align: right">string</td> 1628 </tr> 1629 <tr> 1630 <td style="text-align: left"><code>BlockHash</code></td> 1631 <td style="text-align: center">Hash of block</td> 1632 <td style="text-align: right">string</td> 1633 </tr> 1634 <tr> 1635 <td style="text-align: left"><code>Action</code></td> 1636 <td style="text-align: center">Contract type, can be Call or Create</td> 1637 <td style="text-align: right">string</td> 1638 </tr> 1639 <tr> 1640 <td style="text-align: left"><code>To</code></td> 1641 <td style="text-align: center">Address of transaction receiver</td> 1642 <td style="text-align: right">string</td> 1643 </tr> 1644 <tr> 1645 <td style="text-align: left"><code>From</code></td> 1646 <td style="text-align: center">Address of transaction sender</td> 1647 <td style="text-align: right">string</td> 1648 </tr> 1649 <tr> 1650 <td style="text-align: left"><code>Value</code></td> 1651 <td style="text-align: center">Amount of value being transferred</td> 1652 <td style="text-align: right">string</td> 1653 </tr> 1654 <tr> 1655 <td style="text-align: left"><code>Gas</code></td> 1656 <td style="text-align: center">Required pricing value to process transaction</td> 1657 <td style="text-align: right">number</td> 1658 </tr> 1659 <tr> 1660 <td style="text-align: left"><code>GasUsed</code></td> 1661 <td style="text-align: center">Amount of gas used</td> 1662 <td style="text-align: right">number</td> 1663 </tr> 1664 <tr> 1665 <td style="text-align: left"><code>Input</code></td> 1666 <td style="text-align: center">Parameters passed into contract in bytecode</td> 1667 <td style="text-align: right">string</td> 1668 </tr> 1669 <tr> 1670 <td style="text-align: left"><code>Output</code></td> 1671 <td style="text-align: center">Return values from contract in bytecode</td> 1672 <td style="text-align: right">string</td> 1673 </tr> 1674 <tr> 1675 <td style="text-align: left"><code>Time</code></td> 1676 <td style="text-align: center">Amount of time to trace transaction</td> 1677 <td style="text-align: right">string</td> 1678 </tr> 1679 </tbody></table> 1680 <h2 id='accounts'>Accounts</h2> 1681 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_account/{address}</code> </p> 1682 1683 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1684 1685 <p><strong>Description</strong></p> 1686 <pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> 1687 </span><span class="s2">"Addr"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1688 </span><span class="s2">"Balance"</span><span class="p">:</span><span class="s2">"100000000"</span><span class="p">,</span><span class="w"> 1689 </span><span class="s2">"AccountNonce"</span><span class="p">:</span><span class="s2">"5"</span><span class="w"> 1690 </span><span class="p">}</span><span class="w"> 1691 </span></code></pre> 1692 <p>The above endpoint will respond with account data from the provided address. The table below lists the attributes that will be included in the response from this endpoint.</p> 1693 1694 <table><thead> 1695 <tr> 1696 <th>Parameter</th> 1697 <th>Description</th> 1698 </tr> 1699 </thead><tbody> 1700 <tr> 1701 <td><code>address</code></td> 1702 <td>The address of an account to query</td> 1703 </tr> 1704 </tbody></table> 1705 1706 <table><thead> 1707 <tr> 1708 <th style="text-align: left">Attributes</th> 1709 <th style="text-align: center">Description</th> 1710 <th style="text-align: right">Type</th> 1711 </tr> 1712 </thead><tbody> 1713 <tr> 1714 <td style="text-align: left"><code>Addr</code></td> 1715 <td style="text-align: center">Account address</td> 1716 <td style="text-align: right">string</td> 1717 </tr> 1718 <tr> 1719 <td style="text-align: left"><code>Balance</code></td> 1720 <td style="text-align: center">Address balance in wei</td> 1721 <td style="text-align: right">string</td> 1722 </tr> 1723 <tr> 1724 <td style="text-align: left"><code>AccountNonce</code></td> 1725 <td style="text-align: center">Number of transactions sent from a given address</td> 1726 <td style="text-align: right">string</td> 1727 </tr> 1728 </tbody></table> 1729 1730 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_account/{address}</code> </p> 1731 1732 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1733 1734 <p><strong>Description</strong></p> 1735 <pre class="highlight json tab-json"><code><span class="p">{</span><span class="w"> 1736 </span><span class="s2">"Addr"</span><span class="p">:</span><span class="s2">"0xfaeccae8c1af6bdfd71095e1b6a2f61c61c8a7e7"</span><span class="p">,</span><span class="w"> 1737 </span><span class="s2">"Balance"</span><span class="p">:</span><span class="s2">"100000000"</span><span class="p">,</span><span class="w"> 1738 </span><span class="s2">"AccountNonce"</span><span class="p">:</span><span class="s2">"5"</span><span class="w"> 1739 </span><span class="p">}</span><span class="w"> 1740 </span></code></pre> 1741 <p>The above endpoint will respond with account data from the provided address. The table below lists the attributes that will be included in the response from this endpoint.</p> 1742 1743 <table><thead> 1744 <tr> 1745 <th>Parameter</th> 1746 <th>Description</th> 1747 </tr> 1748 </thead><tbody> 1749 <tr> 1750 <td><code>address</code></td> 1751 <td>The address of an account to query</td> 1752 </tr> 1753 </tbody></table> 1754 1755 <table><thead> 1756 <tr> 1757 <th style="text-align: left">Attributes</th> 1758 <th style="text-align: center">Description</th> 1759 <th style="text-align: right">Type</th> 1760 </tr> 1761 </thead><tbody> 1762 <tr> 1763 <td style="text-align: left"><code>Addr</code></td> 1764 <td style="text-align: center">Account address</td> 1765 <td style="text-align: right">string</td> 1766 </tr> 1767 <tr> 1768 <td style="text-align: left"><code>Balance</code></td> 1769 <td style="text-align: center">Address balance in wei</td> 1770 <td style="text-align: right">string</td> 1771 </tr> 1772 <tr> 1773 <td style="text-align: left"><code>AccountNonce</code></td> 1774 <td style="text-align: center">Number of transactions sent from a given address</td> 1775 <td style="text-align: right">string</td> 1776 </tr> 1777 </tbody></table> 1778 1779 <p><span style="color:#fff; height: 25px; width: 30px; background: blue; padding: 7px; margin-right: 5px;"><strong>GET</strong></span> <code>/api/get_all_accounts</code> </p> 1780 1781 <p><span style="color:#fff; height: 25px; width: 30px; background: red; padding: 7px; margin-right: 5px;"><strong>Headers</strong></span> <code>Content-Type: application/json</code></p> 1782 1783 <p><strong>Description</strong></p> 1784 <pre class="highlight json tab-json"><code><span class="p">[</span><span class="w"> 1785 </span><span class="p">{</span><span class="w"> 1786 </span><span class="s2">"Addr"</span><span class="p">:</span><span class="s2">"0xc04ee4131895f1d0c294d508af65d94060aa42bb"</span><span class="p">,</span><span class="w"> 1787 </span><span class="s2">"Balance"</span><span class="p">:</span><span class="s2">"500000000000000000000"</span><span class="p">,</span><span class="w"> 1788 </span><span class="s2">"AccountNonce"</span><span class="p">:</span><span class="s2">"1"</span><span class="w"> 1789 </span><span class="p">},</span><span class="w"> 1790 </span><span class="p">{</span><span class="w"> 1791 </span><span class="s2">"Addr"</span><span class="p">:</span><span class="s2">"0x07d899c4ac0c1725c35c5f816e60273b33a964f7"</span><span class="p">,</span><span class="w"> 1792 </span><span class="s2">"Balance"</span><span class="p">:</span><span class="s2">"100000000000000000000"</span><span class="p">,</span><span class="w"> 1793 </span><span class="s2">"AccountNonce"</span><span class="p">:</span><span class="s2">"1"</span><span class="w"> 1794 </span><span class="p">},</span><span class="w"> 1795 </span><span class="p">{</span><span class="w"> 1796 </span><span class="s2">"Addr"</span><span class="p">:</span><span class="s2">"0x5bd738164c61fb50eb12e227846cbaef2de965aa"</span><span class="p">,</span><span class="w"> 1797 </span><span class="s2">"Balance"</span><span class="p">:</span><span class="s2">"400000000000000000000"</span><span class="p">,</span><span class="w"> 1798 </span><span class="s2">"AccountNonce"</span><span class="p">:</span><span class="s2">"1"</span><span class="w"> 1799 </span><span class="p">}</span><span class="w"> 1800 </span><span class="p">]</span><span class="w"> 1801 </span></code></pre> 1802 <p>The above endpoint will respond with account data for all accounts in the postgres database. The table below lists the attributes that will be included in the response from this endpoint.</p> 1803 1804 <table><thead> 1805 <tr> 1806 <th>Parameter</th> 1807 <th>Description</th> 1808 </tr> 1809 </thead><tbody> 1810 <tr> 1811 <td><code>address</code></td> 1812 <td>The address of an account to query</td> 1813 </tr> 1814 </tbody></table> 1815 1816 <table><thead> 1817 <tr> 1818 <th style="text-align: left">Attributes</th> 1819 <th style="text-align: center">Description</th> 1820 <th style="text-align: right">Type</th> 1821 </tr> 1822 </thead><tbody> 1823 <tr> 1824 <td style="text-align: left"><code>Addr</code></td> 1825 <td style="text-align: center">Account address</td> 1826 <td style="text-align: right">string</td> 1827 </tr> 1828 <tr> 1829 <td style="text-align: left"><code>Balance</code></td> 1830 <td style="text-align: center">Address balance in wei</td> 1831 <td style="text-align: right">string</td> 1832 </tr> 1833 <tr> 1834 <td style="text-align: left"><code>AccountNonce</code></td> 1835 <td style="text-align: center">Number of transactions sent from a given address</td> 1836 <td style="text-align: right">string</td> 1837 </tr> 1838 </tbody></table> 1839 1840 <p><strong>The above endpoints will respond with a json payload for the given request, each of these endpoints are subject to change in the future.</strong></p> 1841 <h1 id='shyft-block-explorer-ui'>Shyft Block Explorer UI</h1> 1842 <p>To demonstrate the ability to create your own block explorer, a custom folder was created <code>./shyftBlockExplorerUI</code> that contains an example block explorer using react!</p> 1843 1844 <p>To run the Block Explorer UI, ensure that you have the API running as mentioned above. Then run the following command in a terminal:</p> 1845 1846 <p><code>cd shyftBlockExplorerUI</code></p> 1847 1848 <p><code>npm install</code></p> 1849 1850 <p><code>npm run start</code></p> 1851 1852 <p>This will start a development server on <code>port 3000</code> and spin up an example block explorer that uses the API to query the postgres database.</p> 1853 1854 <p>It should look like the below image.</p> 1855 1856 <p><img src="./images/explorerUI.png" alt="Block Explorer Example"></p> 1857 <h1 id='command-line-options'>Command Line Options</h1> 1858 <p>Before running any CLI options ensure you run <code>make geth</code> in the root directory.</p> 1859 1860 <blockquote> 1861 <p>In the root directory run <code>./shyft-geth.sh</code> with any of the following flags:</p> 1862 </blockquote> 1863 <pre class="highlight shell tab-shell"><code>--setup - Setups postgres and the shyft chain db. 1864 --start - Starts geth. 1865 --reset - Drops postgres and chain db, and instantiates both. 1866 --js <web3 filename> - Executes web3 calls with a passed file name. 1867 If the file name is sendTransactions.js: 1868 ./shyft-geth.sh --js sendTransactions 1869 </code></pre> 1870 <p>For convenience a simple CLI was built using <code>shyft-geth.sh</code> as the executable file with some basic commands to get your environment setup.</p> 1871 1872 <p>This will create a new database for geth to use as well as all the necessary tables for the shyft blockexplorer.</p> 1873 <h1 id='custom-shyft-constants'>Custom Shyft Constants</h1><h3 id='block-rewards'>Block Rewards</h3> 1874 <p><code>./consensus/ethash/consensus.go</code></p> 1875 1876 <p>Shyft inflation is different than that of Ethereum, therefore the constants were changed in order to support this.</p> 1877 <h1 id='shyft-extended-functionality'>Shyft Extended Functionality</h1><h3 id='database-functions'>Database Functions</h3> 1878 <p><code>./core/db.go</code></p> 1879 1880 <p><code>./shyft_schema</code></p> 1881 <h3 id='database-instanitation'>Database instanitation</h3> 1882 <p>The local database is instantiated where Geth generates and writes the genesis state/block. 1883 <code>./core/genesis.go</code></p> 1884 1885 <p>Specifically, the local database configuration and set up takes place in a custom database file 1886 <code>./core/db.go</code></p> 1887 <h3 id='writing-blocks'>Writing Blocks</h3> 1888 <p>In our case, we use <code>SWriteBlock()</code> for writing all our data. So far, it contains all the data that we need to store to our local block explorer database. It invokes the <code>SWriteTransaction()</code> which writes the transactions and updates accounts in the local database. This may change in the future. This function is invoked in: 1889 <code>./core/blockchain.go</code></p> 1890 1891 <p><code>SWriteBlock()</code> and <code>SWriteTransaction()</code> exist within: 1892 <code>./core/shyft_database_util.go</code></p> 1893 <h3 id='transaction-types-functions'>Transaction Types Functions</h3> 1894 <p><code>./core/types/transaction.go</code></p> 1895 1896 <p>The existing transaction type in Geth did not allow the evm to call a helper function to retrieve the from address, essentially the sender. Therefore, we extended the functionality of the Transaction type to generate the from address through <code>*Transaction.From()</code>.</p> 1897 1898 <p><code>./core/shyft_database_util.go</code></p> 1899 <h3 id='chain-rollbacks'>Chain Rollbacks</h3> 1900 <p>For development and testing purposes only, until a formal messaging system has been incorporated within go-empyrean, an endpoint is available and freely accessible to trigger a chain and postgresql database rollback.</p> 1901 1902 <p>To trigger a chain/pg database rollback the following command should be executed:</p> 1903 <pre class="highlight plaintext"><code>curl <node ip address>:8081/rollback_blocks/<block hashheader to rollback to> 1904 1905 ie. curl localhost:8081/rollback_blocks/0x6c7db5b09bda0277b480aece97d2efac70838cad4fe6ae45f68410c8cd7cd640 1906 </code></pre><h1 id='errors'>Errors</h1> 1907 <aside class="notice"> 1908 This error section is stored in a separate file in <code>includes/_errors.md</code>. Slate allows you to optionally separate out your docs into many files...just save them to the <code>includes</code> folder and add them to the top of your <code>index.md</code>'s frontmatter. Files are included in the order listed. 1909 </aside> 1910 1911 <p>The Shyft Block Explorer API uses the following error codes:</p> 1912 1913 <table><thead> 1914 <tr> 1915 <th>Error Code</th> 1916 <th>Meaning</th> 1917 </tr> 1918 </thead><tbody> 1919 <tr> 1920 <td>400</td> 1921 <td>Bad Request -- Your request is invalid.</td> 1922 </tr> 1923 <tr> 1924 <td>404</td> 1925 <td>Not Found -- The specified request endpoint could not be found.</td> 1926 </tr> 1927 <tr> 1928 <td>406</td> 1929 <td>Not Acceptable -- You requested a format that isn't json.</td> 1930 </tr> 1931 <tr> 1932 <td>429</td> 1933 <td>Too Many Requests -- You're requesting too much data! Slow down!</td> 1934 </tr> 1935 <tr> 1936 <td>500</td> 1937 <td>Internal Server Error -- We had a problem with our server. Try again later.</td> 1938 </tr> 1939 <tr> 1940 <td>503</td> 1941 <td>Service Unavailable -- We're temporarily offline for maintenance. Please try again later.</td> 1942 </tr> 1943 </tbody></table> 1944 1945 </div> 1946 <div class="dark-box"> 1947 <div class="lang-selector"> 1948 <a href="#" data-language-name="shell">cURL</a> 1949 </div> 1950 </div> 1951 </div> 1952 </body> 1953 </html>