6 <meta name="viewport" content="width=device-width">
7 <title>Bytom Node.js SDK Global</title>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
12 <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
14 <link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
20 <div class="navbar navbar-default navbar-fixed-top ">
21 <div class="container">
22 <div class="navbar-header">
23 <a class="navbar-brand" href="index.html">Bytom Node.js SDK</a>
24 <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
25 <span class="icon-bar"></span>
26 <span class="icon-bar"></span>
27 <span class="icon-bar"></span>
30 <div class="navbar-collapse collapse" id="topNavigation">
31 <ul class="nav navbar-nav">
34 <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
35 <ul class="dropdown-menu ">
36 <li><a href="module-AccessTokensApi.html">AccessTokensApi</a></li><li><a href="module-AccountsApi.html">AccountsApi</a></li><li><a href="module-AssetsApi.html">AssetsApi</a></li><li><a href="module-BalancesApi.html">BalancesApi</a></li><li><a href="module-KeysApi.html">KeysApi</a></li><li><a href="module-TransactionsApi.html">TransactionsApi</a></li><li><a href="module-UnspentOutputsApi.html">UnspentOutputsApi</a></li>
41 <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
42 <ul class="dropdown-menu ">
43 <li><a href="global.html">Global</a></li>
49 <div class="col-sm-3 col-md-3">
50 <form class="navbar-form" role="search">
51 <div class="input-group">
52 <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
53 <div class="input-group-btn">
54 <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
66 <div class="container" id="toc-content">
70 <div class="col-md-8">
75 <h1 class="page-title">Global</h1>
89 <div class="container-overview">
152 <h3 class="subsection-title">Type Definitions</h3>
157 <dt class="name" id="AccessToken">
158 <h4 id="AccessToken">AccessToken</h4>
164 <div class="description">
165 <p>Access tokens are <code>name:secret-token</code> pairs that are granted authorization for accessing Chain Core features.</p>
174 <span class="param-type">Object</span>
186 <h5 class="subsection-title">Properties:</h5>
190 <table class="props table table-striped">
203 <th class="last">Description</th>
212 <td class="name"><code>id</code></td>
218 <span class="param-type">String</span>
229 <td class="description last"><p>User specified, unique identifier.</p></td>
236 <td class="name"><code>token</code></td>
242 <span class="param-type">String</span>
253 <td class="description last"><p>Only returned in the response from AccessTokensApi~create.</p></td>
260 <td class="name"><code>created_at</code></td>
266 <span class="param-type">String</span>
277 <td class="description last"><p>Timestamp of token creation, RFC3339 formatted.</p></td>
329 <dt class="name" id="Account">
330 <h4 id="Account">Account</h4>
336 <div class="description">
337 <p>An account is an object in Bytom that tracks ownership of assets on a
347 <span class="param-type">Object</span>
359 <h5 class="subsection-title">Properties:</h5>
363 <table class="props table table-striped">
376 <th class="last">Description</th>
385 <td class="name"><code>id</code></td>
391 <span class="param-type">String</span>
402 <td class="description last"><p>Unique account identifier in one Bytom node.</p></td>
409 <td class="name"><code>alias</code></td>
415 <span class="param-type">String</span>
426 <td class="description last"><p>User specified, unique identifier in one Bytom node.</p></td>
433 <td class="name"><code>keys</code></td>
439 <span class="param-type">Array.<<a href="global.html#Key">Key</a>></span>
450 <td class="description last"><p>The list of keys used to create control programs under the account.
451 Signatures from these keys are required for spending funds held in the account.</p></td>
458 <td class="name"><code>key_index</code></td>
464 <span class="param-type">Number</span>
475 <td class="description last"><p>The index of keys.</p></td>
482 <td class="name"><code>quorum</code></td>
488 <span class="param-type">Number</span>
499 <td class="description last"><p>The number of keys required to sign transactions for the account.</p></td>
551 <dt class="name" id="Asset">
552 <h4 id="Asset">Asset</h4>
558 <div class="description">
559 <p>An asset is a type of value that can be issued on a blockchain. All units of
560 a given asset are fungible. Units of an asset can be transacted directly
561 between parties without the involvement of the issuer.</p>
570 <span class="param-type">Object</span>
582 <h5 class="subsection-title">Properties:</h5>
586 <table class="props table table-striped">
599 <th class="last">Description</th>
608 <td class="name"><code>id</code></td>
614 <span class="param-type">String</span>
625 <td class="description last"><p>Globally unique identifier of the asset.
626 Asset specifies the asset id as the hash of:</p>
628 <li>the asset's issuance program</li>
629 <li>the core's VM version</li>
630 <li>the hash of asset definition</li>
638 <td class="name"><code>alias</code></td>
644 <span class="param-type">String</span>
655 <td class="description last"><p>User specified, unique identifier in one Bytom node.</p></td>
662 <td class="name"><code>issuanceProgram</code></td>
668 <span class="param-type">String</span>
679 <td class="description last"></td>
686 <td class="name"><code>keys</code></td>
692 <span class="param-type">Array.<<a href="global.html#Key">Key</a>></span>
703 <td class="description last"><p>The list of keys used to issue units of the asset.</p></td>
710 <td class="name"><code>quorum</code></td>
716 <span class="param-type">Number</span>
727 <td class="description last"><p>The number of signatures required to issue new units of the asset.</p></td>
734 <td class="name"><code>defintion</code></td>
740 <span class="param-type">Object</span>
751 <td class="description last"><p>User-specified, arbitrary/unstructured data visible across Bytom
752 blockchain networks. assets specify the definition in their
753 issuance programs, rendering the definition immutable.</p></td>
805 <dt class="name" id="Balance">
806 <h4 id="Balance">Balance</h4>
812 <div class="description">
813 <p>Any balance on the blockchain is simply a summation of unspent outputs.</p>
822 <span class="param-type">Object</span>
834 <h5 class="subsection-title">Properties:</h5>
838 <table class="props table table-striped">
851 <th class="last">Description</th>
860 <td class="name"><code>amount</code></td>
866 <span class="param-type">Number</span>
877 <td class="description last"><p>Sum of the unspent outputs.</p></td>
884 <td class="name"><code>account_alias</code></td>
890 <span class="param-type">String</span>
901 <td class="description last"><p>Account alias.</p></td>
908 <td class="name"><code>account_id</code></td>
914 <span class="param-type">String</span>
925 <td class="description last"><p>Account id.</p></td>
932 <td class="name"><code>asset_id</code></td>
938 <span class="param-type">String</span>
949 <td class="description last"><p>Asset id.</p></td>
956 <td class="name"><code>asset_alias</code></td>
962 <span class="param-type">String</span>
973 <td class="description last"><p>Asset alias.</p></td>
980 <td class="name"><code>asset_definition</code></td>
986 <span class="param-type">Object</span>
997 <td class="description last"><p>Asset definition</p></td>
1049 <dt class="name" id="Key">
1050 <h4 id="Key">Key</h4>
1056 <div class="description">
1057 <p>Cryptographic private keys are the primary authorization mechanism on a
1067 <span class="param-type">Object</span>
1076 <dl class="details">
1079 <h5 class="subsection-title">Properties:</h5>
1083 <table class="props table table-striped">
1096 <th class="last">Description</th>
1105 <td class="name"><code>alias</code></td>
1111 <span class="param-type">String</span>
1122 <td class="description last"><p>User specified, unique identifier of the key.</p></td>
1129 <td class="name"><code>xpub</code></td>
1135 <span class="param-type">String</span>
1146 <td class="description last"><p>Hex-encoded string representation of the key.</p></td>
1198 <dt class="name" id="Receiver">
1199 <h4 id="Receiver">Receiver</h4>
1205 <div class="description">
1206 <p>A receiver is an object that wraps an account control program with the corresponding address.</p>
1215 <span class="param-type">Object</span>
1224 <dl class="details">
1227 <h5 class="subsection-title">Properties:</h5>
1231 <table class="props table table-striped">
1244 <th class="last">Description</th>
1253 <td class="name"><code>control_program</code></td>
1259 <span class="param-type">String</span>
1270 <td class="description last"><p>The underlying control program that will be used in transactions paying to the address.</p></td>
1277 <td class="name"><code>address</code></td>
1283 <span class="param-type">String</span>
1294 <td class="description last"><p>The target address one transaction can pay UTXO to.</p></td>
1346 <dt class="name" id="Transaction">
1347 <h4 id="Transaction">Transaction</h4>
1353 <div class="description">
1354 <p>A blockchain consists of an immutable set of cryptographically linked
1355 transactions. Each transaction contains one or more actions.</p>
1364 <span class="param-type">Object</span>
1373 <dl class="details">
1376 <h5 class="subsection-title">Properties:</h5>
1380 <table class="props table table-striped">
1393 <th class="last">Description</th>
1402 <td class="name"><code>tx_id</code></td>
1408 <span class="param-type">String</span>
1419 <td class="description last"><p>Unique transaction identifier.</p></td>
1426 <td class="name"><code>block_time</code></td>
1432 <span class="param-type">String</span>
1443 <td class="description last"><p>Time of transaction.</p></td>
1450 <td class="name"><code>inputs</code></td>
1456 <span class="param-type">Array.<<a href="global.html#TransactionInput">TransactionInput</a>></span>
1467 <td class="description last"><p>List of specified inputs for a transaction.</p></td>
1474 <td class="name"><code>outputs</code></td>
1480 <span class="param-type">Array.<<a href="global.html#TransactionOutput">TransactionOutput</a>></span>
1491 <td class="description last"><p>List of specified outputs for a transaction.</p></td>
1543 <dt class="name" id="TransactionInput">
1544 <h4 id="TransactionInput">TransactionInput</h4>
1556 <span class="param-type">Object</span>
1565 <dl class="details">
1568 <h5 class="subsection-title">Properties:</h5>
1572 <table class="props table table-striped">
1585 <th class="last">Description</th>
1594 <td class="name"><code>type</code></td>
1600 <span class="param-type">String</span>
1611 <td class="description last"><p>The type of the input. Possible values are "issue", "spend".</p></td>
1618 <td class="name"><code>asset_id</code></td>
1624 <span class="param-type">String</span>
1635 <td class="description last"><p>The id of the asset being issued or spent.</p></td>
1642 <td class="name"><code>asset_alias</code></td>
1648 <span class="param-type">String</span>
1659 <td class="description last"><p>The alias of the asset being issued or spent (possibly null).</p></td>
1666 <td class="name"><code>asset_definition</code></td>
1672 <span class="param-type">Hash</span>
1683 <td class="description last"><p>The definition of the asset being issued or spent (possibly null).</p></td>
1690 <td class="name"><code>amount</code></td>
1696 <span class="param-type">Integer</span>
1707 <td class="description last"><p>The number of units of the asset being issued or spent.</p></td>
1714 <td class="name"><code>spentOutputId</code></td>
1720 <span class="param-type">String</span>
1731 <td class="description last"><p>The id of the output consumed by this input. ID is nil if this is an issuance input.</p></td>
1738 <td class="name"><code>account_id</code></td>
1744 <span class="param-type">String</span>
1755 <td class="description last"><p>The id of the account transferring the asset (possibly null if the
1756 input is an issuance or an unspent output is specified).</p></td>
1763 <td class="name"><code>account_alias</code></td>
1769 <span class="param-type">String</span>
1780 <td class="description last"><p>The alias of the account transferring the asset (possibly null if the
1781 input is an issuance or an unspent output is specified).</p></td>
1788 <td class="name"><code>issuance_program</code></td>
1794 <span class="param-type">String</span>
1805 <td class="description last"><p>A program specifying a predicate for issuing an asset (possibly null
1806 if input is not an issuance).</p></td>
1813 <td class="name"><code>control_program</code></td>
1819 <span class="param-type">String</span>
1830 <td class="description last"><p>A UTXO control program.</p></td>
1837 <td class="name"><code>address</code></td>
1843 <span class="param-type">String</span>
1854 <td class="description last"><p>The UTXO address.</p></td>
1906 <dt class="name" id="TransactionOutput">
1907 <h4 id="TransactionOutput">TransactionOutput</h4>
1913 <div class="description">
1914 <p>Each new transaction in the blockchain consumes some unspent outputs and
1915 creates others. An output is considered unspent when it has not yet been used
1916 as an input to a new transaction. All asset units on a blockchain exist in
1917 the unspent output set.</p>
1926 <span class="param-type">Object</span>
1935 <dl class="details">
1938 <h5 class="subsection-title">Properties:</h5>
1942 <table class="props table table-striped">
1955 <th class="last">Description</th>
1964 <td class="name"><code>id</code></td>
1970 <span class="param-type">String</span>
1981 <td class="description last"><p>The id of the output.</p></td>
1988 <td class="name"><code>type</code></td>
1994 <span class="param-type">String</span>
2005 <td class="description last"><p>The type of the output. Possible values are "control" and "retire".</p></td>
2012 <td class="name"><code>transaction_id</code></td>
2018 <span class="param-type">String</span>
2029 <td class="description last"><p>Id of the transaction.</p></td>
2036 <td class="name"><code>position</code></td>
2042 <span class="param-type">Number</span>
2053 <td class="description last"><p>The output's position in a transaction's list of outputs.</p></td>
2060 <td class="name"><code>asset_id</code></td>
2066 <span class="param-type">String</span>
2077 <td class="description last"><p>The id of the asset being issued or spent.</p></td>
2084 <td class="name"><code>asset_alias</code></td>
2090 <span class="param-type">String</span>
2101 <td class="description last"><p>The alias of the asset being issued or spent (possibly null).</p></td>
2108 <td class="name"><code>asset_definition</code></td>
2114 <span class="param-type">Hash</span>
2125 <td class="description last"><p>The definition of the asset being issued or spent (possibly null).</p></td>
2132 <td class="name"><code>amount</code></td>
2138 <span class="param-type">Integer</span>
2149 <td class="description last"><p>The number of units of the asset being issued or spent.</p></td>
2156 <td class="name"><code>account_id</code></td>
2162 <span class="param-type">String</span>
2173 <td class="description last"><p>The id of the account transferring the asset (possibly null).</p></td>
2180 <td class="name"><code>account_alias</code></td>
2186 <span class="param-type">String</span>
2197 <td class="description last"><p>The alias of the account transferring the asset (possibly null).</p></td>
2204 <td class="name"><code>control_program</code></td>
2210 <span class="param-type">String</span>
2221 <td class="description last"><p>The control program which must be satisfied to transfer this output.</p></td>
2273 <dt class="name" id="UnspentOutput">
2274 <h4 id="UnspentOutput">UnspentOutput</h4>
2280 <div class="description">
2281 <p>Each new transaction in the blockchain consumes some unspent outputs and
2282 creates others. An output is considered unspent when it has not yet been used
2283 as an input to a new transaction. All asset units on a blockchain exist in
2284 the unspent output set.</p>
2293 <span class="param-type">Object</span>
2302 <dl class="details">
2305 <h5 class="subsection-title">Properties:</h5>
2309 <table class="props table table-striped">
2322 <th class="last">Description</th>
2331 <td class="name"><code>account_alias</code></td>
2337 <span class="param-type">String</span>
2348 <td class="description last"><p>The alias of the account transferring the asset (possibly null).</p></td>
2355 <td class="name"><code>account_id</code></td>
2361 <span class="param-type">String</span>
2372 <td class="description last"><p>The id of the account transferring the asset (possibly null).</p></td>
2379 <td class="name"><code>address</code></td>
2385 <span class="param-type">String</span>
2396 <td class="description last"><p>The output address.</p></td>
2403 <td class="name"><code>id</code></td>
2409 <span class="param-type">String</span>
2420 <td class="description last"><p>Unique transaction identifier.</p></td>
2427 <td class="name"><code>amount</code></td>
2433 <span class="param-type">Number</span>
2444 <td class="description last"><p>The number of units of the asset being issued or spent.</p></td>
2451 <td class="name"><code>asset_alias</code></td>
2457 <span class="param-type">String</span>
2468 <td class="description last"><p>The alias of the asset being issued or spent (possibly null).</p></td>
2475 <td class="name"><code>asset_id</code></td>
2481 <span class="param-type">String</span>
2492 <td class="description last"><p>The id of the asset being issued or spent.</p></td>
2499 <td class="name"><code>source_pos</code></td>
2505 <span class="param-type">Number</span>
2516 <td class="description last"><p>The output's position in a transaction's list of outputs.</p></td>
2523 <td class="name"><code>change</code></td>
2529 <span class="param-type">Boolean</span>
2540 <td class="description last"><p>Whether this output is asset change of one spend.</p></td>
2547 <td class="name"><code>control_program_index</code></td>
2553 <span class="param-type">Number</span>
2564 <td class="description last"><p>Control program index.</p></td>
2571 <td class="name"><code>program</code></td>
2577 <span class="param-type">String</span>
2588 <td class="description last"><p>The control program which must be satisfied to transfer this output.</p></td>
2595 <td class="name"><code>source_id</code></td>
2601 <span class="param-type">String</span>
2612 <td class="description last"><p>The source unspent output id.</p></td>
2619 <td class="name"><code>valid_height</code></td>
2625 <span class="param-type">Number</span>
2636 <td class="description last"><p>It means coinbase utxo if valid_height > 0.</p></td>
2699 <div class="clearfix"></div>
2702 <div class="col-md-3">
2703 <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
2711 <div class="modal fade" id="searchResults">
2712 <div class="modal-dialog">
2713 <div class="modal-content">
2714 <div class="modal-header">
2715 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
2716 <h4 class="modal-title">Search results</h4>
2718 <div class="modal-body"></div>
2719 <div class="modal-footer">
2720 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
2722 </div><!-- /.modal-content -->
2723 </div><!-- /.modal-dialog -->
2730 <span class="jsdoc-message">
2731 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
2733 on 2018-05-24T14:04:59+08:00
2735 using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
2739 <script src="scripts/docstrap.lib.js"></script>
2740 <script src="scripts/toc.js"></script>
2742 <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
2747 $( "[id*='$']" ).each( function () {
2748 var $this = $( this );
2750 $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
2753 $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
2754 var $this = $( this );
2756 var example = $this.find( "code" );
2757 exampleText = example.html();
2758 var lang = /{@lang (.*?)}/.exec( exampleText );
2759 if ( lang && lang[1] ) {
2760 exampleText = exampleText.replace( lang[0], "" );
2761 example.html( exampleText );
2764 var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
2765 lang = langClassMatch ? langClassMatch[1] : "javascript";
2771 .addClass( "sunlight-highlight-" + lang )
2772 .addClass( "linenums" )
2773 .html( example.html() );
2778 Sunlight.highlightAll( {
2781 enableDoclinks : true
2784 $.catchAnchorLinks( {
2788 anchorName : function ( i, heading, prefix ) {
2789 return $( heading ).attr( "id" ) || ( prefix + i );
2791 selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
2792 showAndHide : false,
2793 smoothScrolling: true
2796 $( "#main span[id^='toc']" ).addClass( "toc-shim" );
2797 $( '.dropdown-toggle' ).dropdown();
2799 $( "table" ).each( function () {
2800 var $this = $( this );
2801 $this.addClass('table');
2809 <!--Navigation and Symbol Display-->
2812 <!--Google Analytics-->
2816 <script type="text/javascript">
2817 $(document).ready(function() {
2818 SearcherDisplay.init();