1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6613],{3905:(e,a,n)=>{n.d(a,{Zo:()=>o,kt:()=>m});var t=n(7294);function c(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?r(Object(n),!0).forEach((function(a){c(e,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))}))}return e}function d(e,a){if(null==e)return{};var n,t,c=function(e,a){if(null==e)return{};var n,t,c={},r=Object.keys(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||(c[n]=e[n]);return c}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)n=r[t],a.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var s=t.createContext({}),l=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},o=function(e){var a=l(e.components);return t.createElement(s.Provider,{value:a},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},b=t.forwardRef((function(e,a){var n=e.components,c=e.mdxType,r=e.originalType,s=e.parentName,o=d(e,["components","mdxType","originalType","parentName"]),p=l(n),b=c,m=p["".concat(s,".").concat(b)]||p[b]||f[b]||r;return n?t.createElement(m,i(i({ref:a},o),{},{components:n})):t.createElement(m,i({ref:a},o))}));function m(e,a){var n=arguments,c=a&&a.mdxType;if("string"==typeof e||c){var r=n.length,i=new Array(r);i[0]=b;var d={};for(var s in a)hasOwnProperty.call(a,s)&&(d[s]=a[s]);d.originalType=e,d[p]="string"==typeof e?e:c,i[1]=d;for(var l=2;l<r;l++)i[l]=n[l];return t.createElement.apply(null,i)}return t.createElement.apply(null,n)}b.displayName="MDXCreateElement"},1093:(e,a,n)=>{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>s,default:()=>m,frontMatter:()=>d,metadata:()=>l,toc:()=>p});var t=n(7462),c=n(3366),r=(n(7294),n(3905)),i=["components"],d={title:"Mainchain REST API"},s="Elastos Node Result API",l={unversionedId:"api/mainchain/rest",id:"api/mainchain/rest",title:"Mainchain REST API",description:"ELA Node uses the 2*334 port to provide the following interface services:",source:"@site/../docs/6.api/mainchain/rest.md",sourceDirName:"6.api/mainchain",slug:"/api/mainchain/rest",permalink:"/api/mainchain/rest",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/6.api/mainchain/rest.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1676175778,formattedLastUpdatedAt:"Feb 12, 2023",frontMatter:{title:"Mainchain REST API"},sidebar:"apiSidebar",previous:{title:"Mainchain JSON-RPC",permalink:"/api/mainchain/rpc"},next:{title:"Elastos Smart Chain CLI",permalink:"/api/sidechains/esc/cli"}},o={},p=[],f={toc:p},b="wrapper";function m(e){var a=e.components,n=(0,c.Z)(e,i);return(0,r.kt)(b,(0,t.Z)({},f,n,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"elastos-node-result-api"},"Elastos Node Result API"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ELA Node")," uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"2*334")," port to provide the following interface services:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/node/connectioncount")," : Returns the number of nodes to which the node is connected"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/node/connectioncount\n{\n "Desc": "Success",\n "Error": 0,\n "Result": 5\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/node/state")," : Returns status of the node"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/node/state\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "Compile": "v0.2.0",\n "ID": 557625380943624900,\n "HexID": "0x7bd15545ce2fac4",\n "Height": 188850,\n "Version": 0,\n "Services": 0,\n "Relay": true,\n "TxnCnt": 84511,\n "RxTxnCnt": 21119,\n "Port": 20338,\n "PRCPort": 20336,\n "RestPort": 20334,\n "WSPort": 20335,\n "OpenPort": 20866,\n "OpenService": false,\n "Neighbors": [{\n "ID": 5225904035618466119,\n "HexID": "0x488624084951a947",\n "Height": 188850,\n "Services": 0,\n "Relay": true,\n "External": false,\n "State": "ESTABLISH",\n "NetAddress": "13.229.159.128:20338"\n }, {\n "ID": 14490220742601427650,\n "HexID": "0xc9179afe2fc14ac2",\n "Height": 188850,\n "Services": 4,\n "Relay": true,\n "External": false,\n "State": "ESTABLISH",\n "NetAddress": "52.220.199.55:20338"\n }]\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/block/height")," : Returns the block height of the node"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/block/height\n{\n "Desc": "Success",\n "Error": 0,\n "Result": 1000\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/transactionpool")," : Returns various information about the TX mempool"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/transactionpool\n{\n "Desc": "Success",\n "Error": 0,\n "Result": [{\n "txid": "95d3bb263167581f2291de0ece4927ac8f5c2a9b10e448fa362e70cf6
1a11dfe5",\n "hash": "95d3bb263167581f2291de0ece4927ac8f5c2a9b10e448fa362e70cf6a11dfe5",\n "size": 368,\n "vsize": 368,\n "version": 0,\n "locktime": 173080,\n "vin": [{\n "txid": "1254a20e4a80274fdd477d13c7ebf8895b71ec6f2609c1f94f4e2601cfca019d",\n "vout": 0,\n "sequence": 0\n }],\n "vout": [{\n "value": "0.32300000",\n "n": 0,\n "address": "EeYC12CizLnApy9SDu9PW6jy2WCVZX5rHA",\n "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "outputlock": 0\n }],\n "blockhash": "",\n "confirmations": 0,\n "time": 0,\n "blocktime": 0,\n "type": 5,\n "payloadversion": 0,\n "payload": {\n "BlockHeight": 20970,\n "SideBlockHash": "8ed6fbbb389b70b01e028e624c37a834e2f012daa88b179a3b4451f0721f6122",\n "SideGenesisHash": "a3c455a90843db2acd22554f2768a8d4233fafbf8dd549e6b261c2786993be56",\n "SignedData": "3c5d48777fbaf995e74cf386729495238af2b2b6043ecb15ff3fdb241f08f77884cb5bdab7bb43d7a4b25245e5e940861948613443cd92246667143471514cfb"\n },\n "attributes": [{\n "usage": 0,\n "data": "313530333634353830373333383735373432"\n }],\n "programs": [{\n "code": "2102776f2ad3fc822caa976bf0a83eb33cf4047518c9b6d411603be4a864b24acb4bac",\n "parameter": "406ef85b364b2d57a1369516ff334b16560068ae2947b9c9baa1a1f756802cc0d0ec659ed14dd73ec9af1ae1c6706304072ae40551ba4bbe8c2473f0ed6a8182e0"\n }]\n }]\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/restart")," : Restart the restful service")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/block/hash/<height>")," : Returns the block ",(0,r.kt)("inlineCode",{parentName:"p"},"hash")," about the given block ",(0,r.kt)("inlineCode",{parentName:"p"},"height")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/block/hash/123\n{\n "Desc": "Success",\n "Error": 0,\n "Result": "b9450e180aba1a96a93003be1ba775499577f856bb17a82177e74ae4d94db3fb"\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/block/details/height/<height>")," : Returns information about the given block ",(0,r.kt)("inlineCode",{parentName:"p"},"height")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/block/details/height/123\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "hash": "b9450e180aba1a96a93003be1ba775499577f856bb17a82177e74ae4d94db3fb",\n "confirmations": 188784,\n "strippedsize": 498,\n "size": 498,\n "weight": 1992,\n "height": 123,\n "version": 0,\n "versionhex": "00000000",\n "merkleroot": "3ce4c09723a6c241749098d7416bad64f2439920a8a8afdf19dac895cb946634",\n "tx": [{\n "txid": "3ce4c09723a6c241749098d7416bad64f2439920a8a8afdf19dac895cb946634",\n "hash": "3ce4c09723a6c241749098d7416bad64f2439920a8a8afdf19dac895cb946634",\n "size": 192,\n "vsize": 192,\n "version": 0,\n "locktime": 123,\n "vin": [{\n "txid": "0000000000000000000000000000000000000000000000000000000000000000",\n "vout": 65535,\n "sequence": 4294967295\n }],\n "vout": [{\n "value": "1.50684931",\n "n": 0,\n "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",\n "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "outputlock": 0\n }, {\n "value": "3.51598174",\n "n": 1,\n "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",\n "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "outputlock": 0\n }
1],\n "blockhash": "b9450e180aba1a96a93003be1ba775499577f856bb17a82177e74ae4d94db3fb",\n "confirmations": 188784,\n "time": 1513940099,\n "blocktime": 1513940099,\n "type": 0,\n "payloadversion": 4,\n "payload": {\n "CoinbaseData": "ELA"\n },\n "attributes": [{\n "usage": 0,\n "data": "2a92922b60b3e537"\n }],\n "programs": []\n }],\n "time": 1513940099,\n "mediantime": 1513940099,\n "nonce": 0,\n "bits": 520095999,\n "difficulty": "1",\n "chainwork": "0002e16f",\n "previousblockhash": "7f6effc4e37b0a29e1079d32f6e373e6a962d6531a4e9e5310433dd97709b2a4",\n "nextblockhash": "7cc40920292d89be189e63112f0d4f1ffc0b48cd9e17df0181035f7f0a27b1ba",\n "auxpow": "01000000010000000000000000000000000000000000000000000000000000000000000000000000002cfabe6d6dfbb34dd9e44ae77721a817bb56f877954975a71bbe0330a9961aba0a180e45b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0000000000000000000000000000000000000000000000000000000000000000a0573af605f4d829e3b397e5bd2a8832787eb0f48793152b9f5e8915fae5cc5683e43c5a0000000014a00000"\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/block/details/hash/<hash>")," : Returns information about the given block ",(0,r.kt)("inlineCode",{parentName:"p"},"hash")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/block/details/hash/b9450e180aba1a96a93003be1ba775499577f856bb17a82177e74ae4d94db3fb\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "hash": "b9450e180aba1a96a93003be1ba775499577f856bb17a82177e74ae4d94db3fb",\n "confirmations": 188788,\n "strippedsize": 498,\n "size": 498,\n "weight": 1992,\n "height": 123,\n "version": 0,\n "versionhex": "00000000",\n "merkleroot": "3ce4c09723a6c241749098d7416bad64f2439920a8a8afdf19dac895cb946634",\n "tx": ["3ce4c09723a6c241749098d7416bad64f2439920a8a8afdf19dac895cb946634"],\n "time": 1513940099,\n "mediantime": 1513940099,\n "nonce": 0,\n "bits": 520095999,\n "difficulty": "1",\n "chainwork": "0002e173",\n "previousblockhash": "7f6effc4e37b0a29e1079d32f6e373e6a962d6531a4e9e5310433dd97709b2a4",\n "nextblockhash": "7cc40920292d89be189e63112f0d4f1ffc0b48cd9e17df0181035f7f0a27b1ba",\n "auxpow": "01000000010000000000000000000000000000000000000000000000000000000000000000000000002cfabe6d6dfbb34dd9e44ae77721a817bb56f877954975a71bbe0330a9961aba0a180e45b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0000000000000000000000000000000000000000000000000000000000000000a0573af605f4d829e3b397e5bd2a8832787eb0f48793152b9f5e8915fae5cc5683e43c5a0000000014a00000"\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/confirm/details/height/<height>")," : Returns information about the given confirm of block ",(0,r.kt)("inlineCode",{parentName:"p"},"height")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/confirm/details/height/123\n{\n "error": null,\n "id": null,\n "jsonrpc": "2.0",\n "result": {\n "blockhash": "65fd07f4069a1ca6833d38e0baa9b0b4a9bac35131feb5c363bd2fb99f8d06d8"\n "sponsor": "024ac1cdf73e3cbe88843b2d7279e6afdc26fc71d221f28cfbecbefb2a48d48304",\n "viewoffset": 0,\n "votes": [\n {\n "signer": "024babfecea0300971a6f0ad13b27519faff0ef595faf9490dc1f5f4d6e6d7f3fb",\n "accept": true\n },\n {\n "signer": "024ac1cdf73e3cbe88843b2d7279e6afdc26fc71d221f28cfbecbefb2a48d48304",\n "accept": true\n },\n {\n "signer": "0274fe9f165574791f74d5c4358415596e408b704be9003f51a25e90fd527660b5",\n "accept": true\n }\n ]\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/confirm/details/hash/<hash>")," : Returns information about the given confirm of block ",(0,r.kt)("inlineCode",{parentName:"p"},"hash")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/confirm/details/hash/65fd07f4069a1ca6833d38e0baa9b0b4a9bac35131feb5c363bd2fb99f8d06d8\n{\n "error": null,\n "id": null,\n "jsonrpc": "2.0",\n "result": {\n "blockhash": "65fd07f4069a1ca6833d38e0baa9b0b4a9bac35131feb5c363bd2fb99f8d06d8"\n "sponsor": "024ac1cdf73e3cbe88843b2d7279e6afdc26fc71d221f28cfbecbefb2a48d48304",\n "viewoffset": 0,\n "votes": [\n {\n "signer": "024babfecea0300971a6f0ad13b27519faff0ef595faf9490dc1f5f4d6e6d7f3fb",\n "accept": true\n },\n {\n "signer": "024ac1cdf73e3cbe88843b2d7279e6afdc26fc71d221f28cfbecbefb2a48d48304",\n "accept": true\n },\n {\n "signer": "0274fe9f165574791f74d5c4358415596e408b704be9003f51a25e90fd527660b5",\n "accept": true\n }\n ]\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/block/transactions/height/<height>")," : Returns all ",(0,r.kt)("inlineCode",{parentName:"p"},"hash"),"es of the transactions in the block according to the block ",(0,r.kt)("inlineCode",{parentName:"p"},"height")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/block/transactions/height/16000\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "Hash": "3fe8b94a27cccbbcd4a6675e1f3df62f0571fc847abf6488d7fff6e522d96862",\n "Height": 16000,\n "Transactions": ["5c0a30ad3764e6524803ac673d552af59acac910cea36f1678d5b0ae03c67078", "73d201de3cc1ccce92d6edff03cf4d1741c6ab99118dce37f7027eec4a5b3e93"]\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/transaction/<hash>")," : Returns information about the given transaction ",(0,r.kt)("inlineCode",{parentName:"p"},"hash")),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/transaction/5c0a30ad3764e6524803ac673d552af59acac910cea36f1678d5b0ae03c67078\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "txid": "5c0a30ad3764e6524803ac673d552af59acac910cea36f1678d5b0ae03c67078",\n "hash": "5c0a30ad3764e6524803ac673d552af59acac910cea36f1678d5b0ae03c67078",\n "size": 192,\n "vsize": 192,\n "version": 0,\n "locktime": 16000,\n "vin": [{\n "txid": "0000000000000000000000000000000000000000000000000000000000000000",\n "vout": 65535,\n "sequence": 4294967295\n }
1],\n "vout": [{\n "value": "1.50686389",\n "n": 0,\n "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",\n "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "outputlock": 0\n }, {\n "value": "3.51601576",\n "n": 1,\n "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",\n "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "outputlock": 0\n }],\n "blockhash": "3fe8b94a27cccbbcd4a6675e1f3df62f0571fc847abf6488d7fff6e522d96862",\n "confirmations": 172872,\n "time": 1515940214,\n "blocktime": 1515940214,\n "type": 0,\n "payloadversion": 4,\n "payload": {\n "CoinbaseData": "ELA"\n },\n "attributes": [{\n "usage": 0,\n "data": "c9a7a12d61c446d4"\n }],\n "programs": []\n }\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/asset/balances/<addr>")," : Returns the balance of the address"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/asset/balances/EgHPRhodCsDKuDBPApCK3KLayiBomrJrbH\n{\n "Desc": "Success",\n "Error": 0,\n "Result": "20.84298920"\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/asset/<hash>")," : Always return ELA asset information."))),(0,r.kt)("p",null,"Deprecated: May be removed in the next version."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'Example:\n\n```bash\ncurl http://localhost:20334/api/v1/asset/a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0\n{\n "Desc": "Success",\n "Error": 0,\n "Result": {\n "Name": "ELA",\n "Description": "",\n "Precision": 8,\n "AssetType": 0,\n "RecordType": 0\n }\n}\n```\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/asset/utxos/<addr>")," : Returns the ",(0,r.kt)("inlineCode",{parentName:"p"},"UTXO"),"s according to the given address"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl http://localhost:20334/api/v1/asset/utxos/EgHPRhodCsDKuDBPApCK3KLayiBomrJrbH\n{\n "Desc": "Success",\n "Error": 0,\n "Result": [{\n "AssetId": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",\n "AssetName": "ELA",\n "Utxo": [{\n "Txid": "c8d4dc984da78c878b9dab752c077b41a98f6e67e5ee6b04cc3d45cb4f42b81b",\n "Index": 1,\n "Value": "0.09956920"\n }, {\n "Txid": "0b219b2b5b836dfa6acb10fad653fadd384494df3f6710ce168c6055106d101b",\n "Index": 0,\n "Value": "20.74342000"\n }]\n }]\n}\n'))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/asset/balance/<addr>/<assetid>")," : Returns the balance about the given address and AssetID"))),(0,r.kt)("p",null,"Deprecated: May be removed in the next version."),(0,r.kt)("p",null,"Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'```bash\ncurl http://localhost:20334/api/v1/asset/balance/EgHPRhodCsDKuDBPApCK3KLayiBomrJrbH/a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0\n{\n "Desc": "Success",\n "Error": 0,\n "Result": "20.84298920"\n}\n```\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"/api/v1/asset/utxo/<addr>/<assetid>")," : Returns the UTXO(s) according to the given address and AssetID")),(0,r.kt)("p",null,"Deprecated: May be removed in the next version."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'Example:\n\n```bash\ncurl http://localhost:20334/api/v1/asset/utxo/EgHPRhodCsDKuDBPApCK3KLayiBomrJrbH/a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0\n{\n "Desc": "Success",\n "Error": 0,\n "Result": [{\n "Txid": "c8d4dc984da78c878b9dab752c077b41a98f6e67e5ee6b04cc3d45cb4f42b81b",\n "Index": 1,\n "Value": "0.09956920"\n }, {\n "Txid": "0b219b2b5b836dfa6acb10fad653fadd384494df3f6710ce168c6055106d101b",\n "Index": 0,\n "Value": "20.74342000"\n }]\n}\n```\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"/api/v1/transaction")," : Broadcasts the transaction data to the node"),(0,r.kt)("p",{parentName:"li"},"Example:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'curl -X POST http://localhost:21334/api/v1/transaction -H "Content-Type: application/json" -d \'{"Action": "sendrawtransaction", "data": "020001001335353737303036373931393437373739343130010faf7e6f2f43ebdc2723e50014280d4cdac1975f9f883dc57e60aa7e96047b5401000000000002b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a300e1f505000000000000000021132c86ebad33299ecc15dff410d4b0a76b4f9e17b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3a02bb459e4050000000000002136c6f2ad6785cef94fab1216b776add14bd756a850ab0100014140cbd0fb92a390dcd802ecef745091045ccb3033f097e6a42cc18822b000360e48d1a09388db077ca9c7cfc889c0eca427ca1f5f05490658a854f752ea1fb57b7c2321032f4540e915134f38ba24cdc08621a
1d7f5b8b62db36843ae8fa9422c047a04be8ac"}\'\n{\n "Desc": "Success",\n "Error": 0,\n "Result": "2e8d51bdbba82af7a7ed334cb0fb60ad9a5da7e5170f9d2509023f3ed3cce1d0"\n}\n')),(0,r.kt)("p",{parentName:"li"},"The generation of the data parameter value (the signed transaction data) in this interface can be done in two ways:"),(0,r.kt)("ol",{parentName:"li"},(0,r.kt)("li",{parentName:"ol"},"Use the ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/elastos/Elastos.ELA/blob/master/docs/cli_user_guide_CN.md"},"ela-cli")," command line tool, examples are as follows")),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"./ela-cli wallet buildtx --from EdAEC51BmmzJFHUdMJ6bR5fZB4oo919E8n --to EgKxcDE1kfEXbpXzwL8eavk6XxMyGEqXmC --amount 10 --fee 0.01\n")),(0,r.kt)("p",{parentName:"li"},"Please replace the parameter values of ",(0,r.kt)("inlineCode",{parentName:"p"},"--from")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"--to")," in the example with the actual ELA Address."),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"./ela-cli wallet signtx -f to_be_signed.txn\n")),(0,r.kt)("p",{parentName:"li"},"Here you need to enter the password of your local wallet. The long string of hexadecimal characters returned by this command is the signed transaction data."),(0,r.kt)("ol",{parentName:"li",start:2},(0,r.kt)("li",{parentName:"ol"},"Use the relevant tools provided by the ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/elastos/Elastos.ELA.Utilities.Java"},"Elastos.ELA.Utilities.Java")," tool library to generate specific reference to the documentation of the repository.")))))}m.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.