# PocketBank - cryptoAPIs ## BTC ### Address #### Get Confirmed Transactions By Address _syncAddressTransactions() GET ```/v1/bc/btc/${NETWORK}/address/${ADDRESS}/transactions?index=0&limit=50``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": [ { "txid": "af176117c26241433946ec967433bbf34e8297446a64553f827c52314eea96a7", "hash": "af176117c26241433946ec967433bbf34e8297446a64553f827c52314eea96a7", "index": 19, "version": 2, "size": 587, "vsize": 587, "locktime": 0, "time": "2019-02-25 12:04:54 UTC", //deprecated "datetime": "2019-02-25 12:04:54 UTC", "blockhash": "00000000000001a8489e34bd83b180bf6f030fe9ccf57d4ef5fb9713ff05741c", "blockheight": 1481535, "blocktime": "2019-02-25 12:04:54 UTC", "timestamp": 1551096294, "confirmations": 27, "txins": [ { "txout": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826", "vout": 1, "amount": "0.00075333", "addresses": [ "mtFYoSowT3i649wnBDYjCjewenh8AuofQb" ], "script": { "asm": "3044022072ffc0d6ba2acbf11de33d7bf2723d667a166eeadad1920d98732ce29593e5310220605de47003debe7580ee85b3c877f04b311b391ee3381bb0a0c71ed43c023c06[ALL] 02275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469", "hex": "473044022072ffc0d6ba2acbf11de33d7bf2723d667a166eeadad1920d98732ce29593e5310220605de47003debe7580ee85b3c877f04b311b391ee3381bb0a0c71ed43c023c06012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469" }, "votype": "pubkeyhash" }, ... { "txout": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826", "vout": 2, "amount": "0.00071338", "addresses": [ "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9" ], "script": { "asm": "304402200c6e7995f478b629472c86fba4493b403a9fb1822813d2d2ac6d613f45d520fc022036ee5dbedcae9bcd9d86cea34999b0c0d081f340d33aa696a63f151ae3022f8c[ALL] 0378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f", "hex": "47304402200c6e7995f478b629472c86fba4493b403a9fb1822813d2d2ac6d613f45d520fc022036ee5dbedcae9bcd9d86cea34999b0c0d081f340d33aa696a63f151ae3022f8c01210378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f" }, "votype": "pubkeyhash" } ], "txouts": [ { "amount": "0.00018", "type": "pubkeyhash", "spent": false, "addresses": [ "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz" ], "script": { "asm": "OP_DUP OP_HASH160 45bfa6143f69be3475e17724397f1146a60a81f3 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a91445bfa6143f69be3475e17724397f1146a60a81f388ac", "reqsigs": 1 } }, ... { "amount": "0.00059909", "type": "pubkeyhash", "spent": false, "addresses": [ "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9" ], "script": { "asm": "OP_DUP OP_HASH160 7b9a627a184897f10d31d73d87c2eea191d8f501 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac", "reqsigs": 1 } } ] }, { "txid": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826", "hash": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826", "index": 3, "version": 2, "size": 406, "vsize": 406, "locktime": 0, "time": "2019-02-25 11:47:50 UTC", //deprecated "datetime": "2019-02-25 11:47:50 UTC", "blockhash": "000000000000019cb1dbf81c08d53b106bbb2f00952102ba5287505b19a9281c", "blockheight": 1481533, "blocktime": "2019-02-25 11:47:50 UTC", "timestamp": 1551095270, "confirmations": 29, "txins": [ { "txout": "ba559f7866d714328165f95b446268458a179b06f680ed788146db76614977cd", "vout": 1, "amount": "0.00161544", "addresses": [ "mtFYoSowT3i649wnBDYjCjewenh8AuofQb" ], "script": { "asm": "304402202c0a4c2edf30feb367d358f537aa0ffcf620c38d82c6a8735652c7329430fd11022051d549a4955884c3cff92c5236b3adfd739a45b365bf436fc870375d659c026b[ALL] 02275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469", "hex": "47304402202c0a4c2edf30feb367d358f537aa0ffcf620c38d82c6a8735652c7329430fd11022051d549a4955884c3cff92c5236b3adfd739a45b365bf436fc870375d659c026b012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469" }, "votype": "pubkeyhash" }, { "txout": "ba559f7866d714328165f95b446268458a179b06f680ed788146db76614977cd", "vout": 2, "amount": "0.00092537", "addresses": [ "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9" ], "script": { "asm": "304402205ce86d13e347c3dc9d02b88c77ad0c30364947f36e6a3f0acb14e9647776d2c2022058686057784ab1c617a8671a2b2f00f50b389c578ea98632583487c58f68bd7b[ALL] 0378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f", "hex": "47304402205ce86d13e347c3dc9d02b88c77ad0c30364947f36e6a3f0acb14e9647776d2c2022058686057784ab1c617a8671a2b2f00f50b389c578ea98632583487c58f68bd7b01210378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f" }, "votype": "pubkeyhash" } ], "txouts": [ { "amount": "0.00024", "type": "pubkeyhash", "spent": false, "addresses": [ "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz" ], "script": { "asm": "OP_DUP OP_HASH160 45bfa6143f69be3475e17724397f1146a60a81f3 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a91445bfa6143f69be3475e17724397f1146a60a81f388ac", "reqsigs": 1 } }, ... { "amount": "0.00071338", "type": "pubkeyhash", "spent": true, "addresses": [ "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9" ], "script": { "asm": "OP_DUP OP_HASH160 7b9a627a184897f10d31d73d87c2eea191d8f501 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac", "reqsigs": 1 } } ] } ], "meta": { "totalCount": 23, "index": 0, "limit": 50, "results": 23 } }</code></pre> </details> --- #### Get Unconfirmed Transactions By Address _syncAddressTransactions() GET ```/v1/bc/btc/${NETWORK}/address/${ADDRESS}/unconfirmed-transactions?index=0&limit=50``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": [ { "txid": "882e1c1e072fa06d1010f778ca4fd5e422fb549d92a98d29079756dd37d89810", "hash": "7bd2b91409fbf412a691e31364b255f7092e4a2ded27e7bdd1f65484048944c5", "version": 2, "size": 418, "vsize": 256, "locktime": 1664453, "time": "2020-01-31 08:04:11 UTC", "datetime": "2020-01-31 08:04:11 UTC", "timestamp": 1580457851, "txins": [ { "txout": "77ee9aabd52e846e11540549e053207f72ad86012c04805bf6a8feb789fc6edd", "vout": 1, "amount": "0.01199502", "addresses": [ "2N5WueKVbqmVY2csn3RduofvkFpQRJkE9JJ" ], "script": { "asm": "001461240d9cf12baa3319bd9a8e63afbb08d5a28712", "hex": "16001461240d9cf12baa3319bd9a8e63afbb08d5a28712" }, "votype": "scripthash" }, { "txout": "4c6ce106a3f9bda81c10447b46de1cc9fc312f58063f29405996a6c35ebdebfd", "vout": 1, "amount": "0.01099515", "addresses": [ "2MzNdMDsDVaDYhvcVJetFarNJ5epA53nGrK" ], "script": { "asm": "001430f59295b7d699a1f15d81b6686817102ca295a0", "hex": "16001430f59295b7d699a1f15d81b6686817102ca295a0" }, "votype": "scripthash" } ], "txouts": [ { "amount": "0.01298761", "type": "scripthash", "spent": false, "addresses": [ "2NFAxXg23VHV9cuSNhAfLR8ebesDxeaY3wT" ], "script": { "asm": "OP_HASH160 f08432f43efd8b80b3cbcf8e976bdd8cc7c99943 OP_EQUAL", "hex": "a914f08432f43efd8b80b3cbcf8e976bdd8cc7c9994387", "reqsigs": 1 } }, { "amount": "0.01", "type": "scripthash", "spent": false, "addresses": [ "2NBMEXNEWwemEeSpqh5hLddUgTVAcxdEVey" ], "script": { "asm": "OP_HASH160 c695350d70c80b59ab85be75bdf7e8c879a09b8f OP_EQUAL", "hex": "a914c695350d70c80b59ab85be75bdf7e8c879a09b8f87", "reqsigs": 1 } } ] }, ... { "txid": "c1e41924798fb406cae10a0dfe8b609bea320387b02c80078026e2631e4c5409", "hash": "185e5157ce97a8ebee2b9844c7d4ef73e06c1c697d9eac466002e599dd43077c", "version": 2, "size": 247, "vsize": 166, "locktime": 1664453, "time": "2020-01-31 08:02:19 UTC", "datetime": "2020-01-31 08:02:19 UTC", "timestamp": 1580457739, "txins": [ { "txout": "7ca0653fa177e6f0aef383d997bb06f18e75a4a8e827fd913e66ee6e0484690c", "vout": 0, "amount": "71.82084979", "addresses": [ "2NB3q5jrZkEFPCk8essUxNS3fkXTt9BVa7x" ], "script": { "asm": "0014fd1d415acd19fac72292de5750787a6ec834313e", "hex": "160014fd1d415acd19fac72292de5750787a6ec834313e" }, "votype": "scripthash" } ], "txouts": [ { "amount": "0.00368989", "type": "scripthash", "spent": false, "addresses": [ "2NBMEXNEWwemEeSpqh5hLddUgTVAcxdEVey" ], "script": { "asm": "OP_HASH160 c695350d70c80b59ab85be75bdf7e8c879a09b8f OP_EQUAL", "hex": "a914c695350d70c80b59ab85be75bdf7e8c879a09b8f87", "reqsigs": 1 } }, { "amount": "71.81632946", "type": "scripthash", "spent": false, "addresses": [ "2NAnBM2u6jQjRdLKej9RQwmdfNL46xMd6KE" ], "script": { "asm": "OP_HASH160 c054d3d7286ca37346bdbcd3caa04f952e580f94 OP_EQUAL", "hex": "a914c054d3d7286ca37346bdbcd3caa04f952e580f9487", "reqsigs": 1 } } ] } ], "meta": { "totalCount": 4, "index": 0, "limit": 50, "results": 4 } }</code></pre> </details> #### Get Transaction Details By Transaction ID (Txid) _syncTransaction() GET ```/v1/bc/btc/${NETWORK}/txs/txid/${TXID}``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "txid": "5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2", "hash": "5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2", "index": 1, "version": 1, "size": 158, "vsize": 158, "locktime": 0, "time": "2010-09-16 05:03:47 UTC", "blockhash": "000000000043a8c0fd1d6f726790caa2a406010d19efd2780db27bdbbd93baf6", "blockheight": 80000, "blocktime": "2010-09-16 05:03:47 UTC", "timestamp": 1284613427, "confirmations": 484349, "txins": [ { "txout": "f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6", "vout": 0, "amount": "50.00000000", "addresses": [ "1JBSCVF6VM6QjFZyTnbpLjoCJTQEqVbepG" ], "script": { "asm": "304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b2415[ALL]", "hex": "48304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501" }, "votype": "pubkey" } ], "txouts": [ { "amount": "50.00000000", "type": "pubkeyhash", "spent": true, "addresses": [ "16ro3Jptwo4asSevZnsRX6vfRS24TGE6uK" ], "script": { "asm": "OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914404371705fa9bd789a2fcd52d2c580b65d35549d88ac", "reqsigs": 1 } } ] } }</code></pre> </details> --- ### Transaction #### Broadcast a Signed Transaction _publishTransaction() -d '{ "hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000" } ```POST /v1/bc/btc/${NETWORK}/txs/send``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "txid": "dd033f3d0639f9ed7fdcef5966d931e833f13364cdf7c742af0ea5f04806bc62" } }</code></pre> </details> --- ## ETH ### Address #### Get Address Details _syncEtherDetails() ``` GET /v1/bc/eth/${NETWORK}/address/${ADDRESS} ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "chain": "ETH.ropsten", "address": "0x9e44c54a4ccdade765d23bbbdb99e66003b5e987", "balance": "0.116622817690596", //eth "txs_count": 18, "from": 17, "to": 1 } }</code></pre> </details> --- #### Get Transactions By Address _syncEtherTxs() ``` GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/transactions?index=${INDEX}&limit=${LIMIT} ``` <details><summary>RESPONSE</summary> <pre><code> "payload": [ { "from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be", "to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11", "hash": "0xd990474c67fd5f3c41298f6603c611e3bfa19f27c05e0dddf772edbc6c932e9c", "value": "4884207551764164050", "date": "2019-07-02 11:57:30 UTC", //deprecated "datetime": "2019-07-02 11:57:30 UTC", "timestamp": 1562068650, "nonce": 83, "confirmations": 374882, "block": 5905850, "gas_price": "15000000000", "gas_used": "21000" }, { "from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be", "to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11", "hash": "0x248ca3dc240680bca6670f8a34238f4ed1f6fbdbf3f8925978e7dd38458150b6", "value": "120000000000000", "date": "2019-04-16 11:20:15 UTC", //deprecated "datetime": "2019-04-16 11:20:15 UTC", "timestamp": 1555413615, "nonce": 69, "confirmations": 864432, "block": 5416300, "gas_price": "21000000000", "gas_used": "21000" }, ... { "from": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11", "to": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be", "hash": "0xf667dbdf4433357766bb3d31c10c71fba6e96ae0ce786f947692639fb1f84ba9", "value": "12410000000000000", "date": "2018-12-04 12:56:20 UTC", //deprecated "datetime": "2018-12-04 12:56:20 UTC", "timestamp": 1543928180, "nonce": 166, "confirmations": 1719929, "block": 4560803, "gas_price": "10000000000", "gas_used": "21000" } ], "meta": { "totalCount": 281, "index": 0, "limit": 15, "results": 15 } }</code></pre> </details> --- #### Get Address Nonce _getNonce() ``` GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/nonce ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "nonce": 108 } }</code></pre> </details> --- ### Transaction #### Broadcast a Signed Transaction _publishTransaction() ``` POST /v1/bc/eth/${NETWORK}/txs/push -d '{ "hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69" }' ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c" } }</code></pre> </details> --- ### TOKEN #### Get Contract Details _getCurrencyInfo() ``` GET /v1/bc/eth/${NETWORK}/tokens/contract/{contract} ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "decimals": 18.0, "totalSupply": 109531.470139209559249714, "balance": 0, "tokenType": "ERC-20", // In case the contract is not for Token, this is missing. "tokenName": "Tellor Tributes", // In case the contract is not for Token, this is missing. "tokenSymbol": "TRB", // In case the contract is not for Token, this is missing. "contractCreator": "0xe010ac6e0248790e08f42d5f697160dedf97e024" } }</code></pre> </details> --- #### Get Token Balance _getTokenBalance() ``` GET /v1/bc/eth/${NETWORK}/tokens/{address}/{contract}/balance ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "name": "Elly Token", "token": "0.70429514041990424", "symbol": "ELT" } }</code></pre> </details> --- #### Get Token Transactions By Address _syncTokenTransactions() ``` GET /v1/bc/eth/${NETWORK}/tokens/address/{address}/transfers ``` <details><summary>RESPONSE</summary> <pre><code>{ "meta": { "totalCount": 600, "limit": 50, "results": 50 }, "payload": [ { "txHash": "0xf80c67cc3fb999fe399ba80d35b5da5d4b531d01f9156a02a8a18a98229c23d5", "date": "2019-08-14 11:05:12 UTC", //deprecated "datetime": "2019-08-14 11:05:12 UTC", "timestamp": 1565823902, "from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d", "to": "0x74be2a31763c2aa64590c47654cae1a2352d9cb9", "value": "1000000000000000000", "name": "The Force Token", "symbol": "FOR", "type": "ERC-20" }, { "txHash": "0xcd85d17c9144288eae62bf12751925fe14929c4f074d90f5889ae023cc484cd0", "date": "2019-08-14 11:05:12 UTC", //deprecated "datetime": "2019-08-14 11:05:12 UTC", "timestamp": 1565823902, "from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d", "to": "0x74cb6771ff18d6db0221b17541630eac8229a35f", "value": "1000000000000000000", "name": "The Force Token", "symbol": "FOR", "type": "ERC-20" }, ... { "txHash": "0xf6aeecd5a4cd4bb23578d9171d2365a64370c28820a5914218086bd30b93195b", "date": "2019-08-14 10:59:37 UTC", //deprecated "datetime": "2019-08-14 10:59:37 UTC", "timestamp": 1565823577, "from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d", "to": "0x747f9be4c13fe78af434766ee4521e85be168bd4", "value": "1000000000000000000", "name": "The Force Token", "symbol": "FOR", "type": "ERC-20" } ] }</code></pre> </details> --- ## Transaction Fee ### #### Get Gas Limit getTransactionGasLimitFromAPIs() ##### ETH ``` POST /v1/bc/eth/${NETWORK}/txs/gas -d '{ "fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb", "toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7", "value" : 0.12, "data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7" }' ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "gasLimit": "25148" } }</code></pre> </details> #### Estimate Token Transaction GasLimit getTransactionGasLimitFromAPIs() ##### ETH Token ``` POST /v1/bc/eth/${NETWORK}/tokens/transfer/gas-limit -d '{ "fromAddress" : "0xc065b539490f81b6c297c37b1925c3be2f190738", "toAddress" : "0x6f2d8d4062dd05da2f4fb6b09a3869401d5a08a6", "contract" : "0x092de782a7e1e0a92991ad829a0a33aef3c7545e", "tokenAmount" : 10 }' ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "gasLimit": "43144" } }</code></pre> </details> #### Get Gas Price _getTransactionFeeFromAPIs() ##### ETH ``` GET /v1/bc/eth/${NETWORK}/txs/fee ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "min": "1", "max": "59894.458", "average": "42.985", "recommended": "45", // deprecated "slow": "33.46200020", "standard": "43.20000233", "fast": "56.82152409", "unit": "Gwei" } }</code></pre> </details> #### Get Contracts GasPrice _getTransactionFeeFromAPIs() ##### ETH Token ``` GET /v1/bc/eth/${NETWORK}/mainnet/contracts/gas-price ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "slow": "88.9", "standard": "98", "fast": "120", "unit": "Gwei" } }</code></pre> </details> #### Transactions Fee _getTransactionFeeFromAPIs() ##### BTC ``` GET /v1/bc/btc/${NETWORK}/txs/fee ``` <details><summary>RESPONSE</summary> <pre><code>{ "payload": { "min": "0.00000113", "max": "0.05992189", "average": "0.00014718", "min_fee_per_byte": "0.00000001", "average_fee_per_byte": "0.00000027", "max_fee_per_byte": "0.00011151", "average_bytes": "545", //deprecated "recommended": "0.00012508", //deprecated "slow_fee_per_byte": "0.00000078", "standard_fee_per_byte": "0.00000157", "fast_fee_per_byte": "0.00000264", "unit": "btc" } }</code></pre> </details>