### joinpsbts command example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/joinpsbts Example of using bitcoin-cli to call joinpsbts with a PSBT. ```bash bitcoin-cli joinpsbts "psbt" ``` -------------------------------- ### Install ethereum.rb gem Source: https://docs.watchdata.io/web3/web3-sdk/ethereum.rb.md Install the ethereum.rb gem using the gem install command. ```shell gem install ethereum.rb ``` -------------------------------- ### bitcoin-cli finalizepsbt example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/finalizepsbt.md Command-line example showing how to call finalizepsbt with a PSBT argument. ```bash bitcoin-cli finalizepsbt "psbt" ``` -------------------------------- ### bitcoin-cli utxoupdatepsbt example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/utxoupdatepsbt.md Example command to call utxoupdatepsbt with a base64 PSBT string. ```bash bitcoin-cli utxoupdatepsbt "psbt" ``` -------------------------------- ### Result example for net_version Source: https://docs.watchdata.io/blockchain-apis/polygon-api/net_version-polygon.md Example JSON response showing the network id result. ```javascript { "jsonrpc": "2.0", "id": 1, "result": "137" } ``` -------------------------------- ### Request example for DOGE to EUR Source: https://docs.watchdata.io/tutorials-and-guides/watchdata-price-api-and-how-it-works.md A JSON request body for the Price API to get the current price of DOGE in EUR. ```json { "base_symbol": "DOGE", "quote_symbol": "EUR" } ``` -------------------------------- ### createpsbt bitcoin-cli example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/createpsbt.md Example command using bitcoin-cli to create a PSBT with a single input and a data output. ```bash bitcoin-cli createpsbt "[{\"txid\":\"myid\",\"vout\":0}]" "[{\"data\":\"00010203\"}]" ``` -------------------------------- ### eth_getBalance parameters example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_getbalance-bsc Example parameters array for eth_getBalance, showing the address and block parameter 'latest'. ```json params: [ '0x295e26495CEF6F69dFA69911d9D8e4F3bBadB89B', 'latest' ] ``` -------------------------------- ### eth_getTransactionCount parameters example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_gettransactioncount-bsc Example of the parameters array for eth_getTransactionCount, showing the address and the 'latest' tag. ```json params: [ '0xea0A6E3c511bbD10f4519EcE37Dc24887e11b55d', 'latest' // state at the latest block ] ``` -------------------------------- ### getblockstats request example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/getblockstats Example request for getblockstats with height 1000. The response is not shown on this page. ```bash getblockstats 1000 ``` -------------------------------- ### eth_getBalance response example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_getbalance-bsc Example JSON response from eth_getBalance, showing the balance in wei as a hex string. ```json { "jsonrpc": "2.0", "id": 0, "result": "0x1afd41af26009fe" } ``` -------------------------------- ### getmempoolinfo Response Example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/getmempoolinfo.md Example JSON response from getmempoolinfo, showing typical values for mempool state. ```json { "loaded": true, "size": 5871, "bytes": 31646146, "usage": 89216496, "total_fee": 0.46723178, "maxmempool": 300000000, "mempoolminfee": 1e-05, "minrelaytxfee": 1e-05, "unbroadcastcount": 0 } ``` -------------------------------- ### eth_getTransactionByHash parameters example Source: https://docs.watchdata.io/blockchain-apis/ethereum-api/eth_gettransactionbyhash Example of the parameters array for eth_getTransactionByHash, containing a transaction hash. ```json params: [ "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b" ] ``` -------------------------------- ### Result example for net_version Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/net_version-bsc Example JSON-RPC response for the net_version method, showing the result as "0x1" (Ethereum Mainnet). ```json { "jsonrpc": "2.0", "id": 1, "result": "0x1" } ``` -------------------------------- ### getmempoolentry Response Example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/getmempoolentry.md Example JSON response from getmempoolentry, showing actual values for the returned fields. ```json { "fees": { "base": 3.074e-05, "modified": 3.074e-05, "ancestor": 0.0002642, "descendant": 0.00014454 }, "vsize": 153, "weight": 609, "fee": 3.074e-05, "modifiedfee": 3.074e-05, "time": 1652729437, "height": 736669, "descendantcount": 5, "descendantsize": 719, "descendantfees": 14454, "ancestorcount": 9, "ancestorsize": 1298, "ancestorfees": 26420, "wtxid": "3ec83e75f4cf7bee16eb5f360598099b946e8534492e68c2eeb58386f2a4d8cd", "depends": [ "0dac7e5e2d6aaddf65407a95220e4b6e8af8863fc97725e04cdefa00eaa9f0b2" ], "spentby": [ "2c812831d86ca5661917dd6dc52274b21a14678338e5c95f11ca82b2657ea393" ], "bip125-replaceable": false, "unbroadcast": false } ``` -------------------------------- ### Mapping Position Calculation Example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_getstorageat-bsc.md Example calculation for retrieving pos1["0x391694e7e0b0cce554cb130d723a9d27458f9298"]. ```javascript keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001")) ``` -------------------------------- ### trace_block response example Source: https://docs.watchdata.io/powered-api/trace/trace_block.md Example response from trace_block, showing an array of block traces with action, result, and trace details. ```javascript { "id": 1, "jsonrpc": "2.0", "result": [ { "action": { "author": "0xea674fdde714fd979de3edf0f56aa9716b898ec8", "rewardType": "block", "value": "0x4563918244f40000" }, "result": null, "subtraces": 0, "traceAddress": [], "transactionHash": null, "transactionPosition": null, "type": "reward", "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add", "blockNumber": 3068185 }, { "action": { "callType": "call", "from": "0xaa7b131dc60b80d3cf5e59b5a21a666aa039c951", "gas": "0x0", "input": "0x", "to": "0xd40aba8166a212d6892125f079c33e6f5ca19814", "value": "0x4768d7effc3fbe" }, "result": { "gasUsed": "0x0", "output": "0x" }, "subtraces": 0, "traceAddress": [], "transactionHash": "0x07da28d752aba3b9dd7060005e554719c6205c8a3aea358599fc9b245c52f1f6", "transactionPosition": 0, "type": "call", "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add", "blockNumber": 3068185 }, { "action": { "callType": "call", "from": "0x4f11ba23bb526c0486d83c6a8f18f632f3fc172a", "gas": "0x0", "input": "0x", "to": "0x7ed1e469fcb3ee19c0366d829e291451be638e59", "value": "0x446cde325fbfbe" }, "result": { "gasUsed": "0x0", "output": "0x" }, "subtraces": 0, "traceAddress": [], "transactionHash": "0x056f11efb5da4ff7cf8523cfcef08393e5dd2ff3ab3223e4324426d285d7ae92", "transactionPosition": 1, "type": "call", "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add", "blockNumber": 3068185 }, ] } ``` -------------------------------- ### GenerateAddress response example Source: https://docs.watchdata.io/blockchain-apis/tron-api/address-utilities/generateaddress.md Example JSON response from the GenerateAddress endpoint. The result is for demonstration only and should not be used as an account because it is a real key pair and is public. ```json { "privateKey": "097c8ba8a310f39a41a667d35a20000cd21d58c7322484b584c4ada8ebd3ec06", "address": "TLHx2Ta9WwtwDjgGxyeifHs5ipmJrJAbZ3", "hexAddress": "41713ca8ee9c3db6bdc947b8e0c7846645307e6e63" } ``` -------------------------------- ### gettxout Response Example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/gettxout.md Example JSON response from the gettxout RPC, showing an unspent output with zero confirmations and a scripthash type. ```json { "bestblock": "0000000000000000000559adec1f56ee949c2e20abef7150bb29dd7d2cf0260a", "confirmations": 0, "value": 1.91332048, "scriptPubKey": { "asm": "OP_HASH160 39790a15e75a2f6ccbd8becaee975b819da6b636 OP_EQUAL", "hex": "a91439790a15e75a2f6ccbd8becaee975b819da6b63687", "address": "36vuSSdrx8zBXrGYPCifixtLbbxK615fCR", "type": "scripthash" }, "coinbase": false } ``` -------------------------------- ### bitcoin-cli getrawtransaction with txid Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/getrawtransaction.md Example command to get raw transaction data for a transaction ID using bitcoin-cli. ```bash bitcoin-cli getrawtransaction "mytxid" ``` -------------------------------- ### bitcoin-cli getrawtransaction with verbose true and blockhash Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/getrawtransaction.md Example command to get raw transaction data with verbose true and a blockhash. ```bash bitcoin-cli getrawtransaction "mytxid" true "myblockhash" ``` -------------------------------- ### bitcoin-cli getrawtransaction with verbose false and blockhash Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/getrawtransaction.md Example command to get raw transaction data with verbose false and a blockhash. ```bash bitcoin-cli getrawtransaction "mytxid" false "myblockhash" ``` -------------------------------- ### bitcoin-cli getrawtransaction with verbose true Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/getrawtransaction.md Example command to get raw transaction data with verbose output set to true. ```bash bitcoin-cli getrawtransaction "mytxid" true ``` -------------------------------- ### Request example for EUR to DOGE Source: https://docs.watchdata.io/tutorials-and-guides/watchdata-price-api-and-how-it-works.md A JSON request body for the Price API to get the current price of EUR in DOGE (reverse rate). ```json { "base_symbol": "EUR", "quote_symbol": "DOGE" } ``` -------------------------------- ### CreateAssetIssue error response Source: https://docs.watchdata.io/blockchain-apis/tron-api/trc-10-token/createassetissue.md Example error response when the start_time parameter is missing. The API returns a ContractValidateException indicating that the start time should not be empty. ```json { "Error": "class org.tron.core.exception.ContractValidateException : Start time should be not empty" } ``` -------------------------------- ### eth_getCode Parameters Example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_getcode-bsc Shows the parameters array for eth_getCode, including the address and block tag 'latest'. ```json params: [ '0xe9ae3261a475a27bb1028f140bc2a7c843318afd', 'latest' ] ``` -------------------------------- ### Get last Ethereum block number with web3.py Source: https://docs.watchdata.io/web3/web3-sdk/web3.py Requires Python >=3.5.3 and web3.py installed via pip3 install web3. Replace YOUR_ETHEREUM_NODE_URL with your Watchdata HTTP provider URL. The snippet imports web3, creates an HTTPProvider, and prints the last block number using w3.eth.block_number. ```python from web3 import Web3 watchdata_url = 'YOUR_ETHEREUM_NODE_URL' w3 = Web3(Web3.HTTPProvider(watchdata_url)) last_block_number = w3.eth.block_number print(f'last block number in eth = {last_block_number}') ``` -------------------------------- ### watch_getTransfersByAddress Example Query Source: https://docs.watchdata.io/tutorials-and-guides/how-to-guides/how-getting-ethereum-account-balance-and-transactions.md JSON-RPC request to fetch transaction history for address 0x2Ec9436c5fc5ecCEF819B388519B9171521E9C56. Uses contractAddresses 'native' to get ETH transfers, with offset 0 and limit 100. ```json { "id": 1, "jsonrpc": "2.0", "method": "watch_getTransfersByAddress", "params": [ { "addresses": "0x2Ec9436c5fc5ecCEF819B388519B9171521E9C56", "contractAddresses": "native", "offset": 0, "limit": 100, "fromBlock": 0 } ] } ``` -------------------------------- ### JSON response with shielded address keys Source: https://docs.watchdata.io/blockchain-apis/tron-api/tronz-shielded-smart-contract/getnewshieldedaddress.md Example response containing the spending key (sk), address keys (ak, nk, ivk), and the payment address. The payment address starts with 'ztron1'. ```json { "sk": "025411aa238adf2e1e5847d0a244bc60971f2b5fd0989b2056a5278f6bf94f39", "ask": "078d13716e3c2ef039f522f31a80d230a6205552ebfda6053888246231984405", "nsk": "02a092817bab1058a1adda745edf2455c97e00e8fc66f4c3a89496cdbf8fe904", "ovk": "036976ed35faa679f0ad62a4122804bd1468e729f817ed76c25b3be4dd9287b7", "ak": "9dae7a4c5f9379e305cc835bdd34002fcbcb23becbb3590a7c6582bd8c8934de", "nk": "9f787c98ddd652bae2049ad7300a8bad3cf94f461ee15cee4b3d8b6b12d44790", "ivk": "2a9db56f2315a40c0e3ac28ee4f09e4151e7baad9b3f6cb668a6888b5cbbfc00", "d": "c0464761dfba166e327bb7", "pkD": "d23d0f286d2e7d2439d8a4ca11d4ad41fbc08177316b8b09a01f821b03777cba", "payment_address": "ztron1cprywcwlhgtxuvnmklfr6regd5h86fpemzjv5yw544qlhsypwuckhzcf5q0cyxcrwa7t56ppcz3" } ``` -------------------------------- ### getchaintips Response Example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/getchaintips.md Example JSON response from getchaintips, showing an array of chain tips with height, hash, branchlen, and status. The first entry is the active main chain tip. ```json [ { "height": 736664, "hash": "00000000000000000002412a773c2c03a7848722c15ec346598ba8ce7246f9fc", "branchlen": 0, "status": "active" }, { "height": 730848, "hash": "000000000000000000029ec31578132d01696910f299f8d104f29b8f8bbdc24f", "branchlen": 1, "status": "valid-headers" }, { "height": 723102, "hash": "00000000000000000006a970fdd8e537521747aff917d909bf3a78b4b68143e1", "branchlen": 1, "status": "valid-headers" }, { "height": 715276, "hash": "00000000000000000009b160476c5f407ccd4957e20346b862d8fc46004759f0", "branchlen": 1, "status": "valid-headers" }, { "height": 715139, "hash": "0000000000000000000407bc4e26035c137869cdb677dfcab268b3faf7d7b5d1", "branchlen": 1, "status": "valid-headers" }, { "height": 714637, "hash": "00000000000000000009f819d004fea5bcb77bda25f4906d0a39e79c9ba19590", "branchlen": 1, "status": "valid-fork" }, { "height": 714367, "hash": "0000000000000000000b2e70d7675bc7b4e89d384d0e6e1a7ecc2779e1d93244", "branchlen": 1, "status": "valid-headers" }, { "height": 710226, "hash": "0000000000000000000299304196510f9f40d0e640a94258a473009efe587516", "branchlen": 1, "status": "valid-headers" }, { "height": 708426, "hash": "0000000000000000000a5ee4cbb64a5e1496d6840b4744ecf3b559449a96148c", "branchlen": 1, "status": "valid-headers" }, { "height": 706409, "hash": "0000000000000000000d6d4a65126b6e5c8cd9edf65b332f2f6a5189f9e800b6", "branchlen": 1, "status": "valid-headers" }, { "height": 705970, "hash": "00000000000000000002328fe71f98eff128c9566bbf344d76234570b4a96e69", "branchlen": 1, "status": "valid-headers" }, { "height": 697008, "hash": "000000000000000000077247c3ca9bae18511418667c4562fc6f92477b5d339e", "branchlen": 1, "status": "valid-headers" }, { "height": 696145, "hash": "00000000000000000007c8948e5a89cd01804b7e5c6f454597c49d5b3b368b66", "branchlen": 1, "status": "valid-headers" }, { "height": 694157, "hash": "00000000000000000006e24bdc5c1875fa40909ace270fb2b8756ac652ede82d", "branchlen": 1, "status": "valid-headers" }, { "height": 693118, "hash": "00000000000000000011563e0ffef300d61465d69c92875e510050fc332bbe99", "branchlen": 1, "status": "valid-headers" }, { "height": 692894, "hash": "00000000000000000007b160fdec44c7a20d01bcfe9ac0b46a3a897359fb1d69", "branchlen": 1, "status": "valid-headers" } ] ``` -------------------------------- ### joinpsbts txs argument example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/joinpsbts JSON array of base64 PSBT strings, required. ```json [ "psbt", (string, required) A base64 string of a PSBT ... ] ``` -------------------------------- ### eth_sendRawTransaction result example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_sendrawtransaction-bsc Example response from eth_sendRawTransaction, containing the transaction hash. ```json { "id":1, "jsonrpc": "2.0", "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" } ``` -------------------------------- ### Curl request example for eth_gasPrice Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_gasprice-bsc.md Use this curl command to call the eth_gasPrice method on the Binance Smart Chain API. Replace your_api_key with your actual API key. The method takes no parameters and returns the current gas price in wei. ```bash curl https://bsc.api.watchdata.io/node/jsonrpc?api_key=your_api_key -X POST \ -d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":0}' ``` -------------------------------- ### getchaintxstats Response Example Source: https://docs.watchdata.io/blockchain-apis/bitcoin-api/blockchain-rpcs/getchaintxstats.md Example JSON response from getchaintxstats showing the computed statistics for a window of 2016 blocks, including txcount, window_final_block_hash, and txrate. ```json { "time": 1652727595, "txcount": 734099358, "window_final_block_hash": "00000000000000000002412a773c2c03a7848722c15ec346598ba8ce7246f9fc", "window_final_block_height": 736664, "window_block_count": 2016, "window_tx_count": 3674003, "window_interval": 1188256, "txrate": 3.09192884361619 } ``` -------------------------------- ### watch_getStatsByDay Parameters Example Source: https://docs.watchdata.io/powered-api/stats/watch_getstatsbyday Example of the params array containing a unix timestamp for the watch_getStatsByDay method. ```json params: [ 1644419586, ] ``` -------------------------------- ### Response example for eth_gasPrice Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_gasprice-bsc.md Example JSON response from the eth_gasPrice method. The result is a QUANTITY integer representing the current gas price in wei, shown here as 0x12a05f200. ```javascript { "jsonrpc": "2.0", "id": 0, "result": "0x12a05f200" } ``` -------------------------------- ### eth_getTransactionCount response example Source: https://docs.watchdata.io/blockchain-apis/binance-smart-chain-api/eth_gettransactioncount-bsc Example JSON-RPC response for eth_getTransactionCount, showing the result as a hexadecimal quantity. ```json { "jsonrpc": "2.0", "id": 1, "result": "0xe110b" } ``` -------------------------------- ### eth_getLogs response example Source: https://docs.watchdata.io/tutorials-and-guides/how-eth_getlogs-works.md Sample response from eth_getLogs showing a list of log objects with fields like address, blockHash, blockNumber, data, logIndex, topics, transactionHash, transactionIndex, and removed. The actual response contains more data than shown. ```json { "jsonrpc": "2.0", "id": 1, "result": [ { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "blockHash": "0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe", "blockNumber": "0x989680", "data": "0x00000000000000000000000000000000000000000000000000000000121eac00", "logIndex": "0x3", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x00000000000000000000000039bb7d39a395e0ce36875244ad48bcaec54faf03", "0x0000000000000000000000009354de9e63674f3e44303b8cc3853d7f10f97d06" ], "transactionHash": "0x80e195cabafd0358a35cec5fadc9b304734ac1f0ed6edf607d170dab13f5e069", "transactionIndex": "0x7", "removed": false }, { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "blockHash": "0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe", "blockNumber": "0x989680", "data": "0x00000000000000000000000000000000000000000000000000000000b2d05e00", "logIndex": "0x8", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000001987ae42dbb74b80996e16a4d1d581465226f24d", "0x000000000000000000000000c054429edce0b6172ab9fed39254fba802639aa6" ], "transactionHash": "0xd104afd704cef2b36800e6472793ff52211f3253f0e1a21416ad7735ababf6bf", "transactionIndex": "0x11", "removed": false }, { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "blockHash": "0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe", "blockNumber": "0x989680", "data": "0x000000000000000000000000000000000000000000000000000000174876e800", "logIndex": "0x58", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000006f013cb44095efe19e2af1fb4dae2e9b90eaa654", "0x00000000000000000000000001787eeb697b730616956f225a981619d2cc4216" ], "transactionHash": "0x99a5105016f2ddbddfcf14a3f02944d1c77587801fd7c45cdbcbb166dfdfdb63", "transactionIndex": "0x39", "removed": false }, { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "blockHash": "0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe", "blockNumber": "0x989680", "data": "0x0000000000000000000000000000000000000000000000000000000000000000", "logIndex": "0x59", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "transactionHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "transactionIndex": "0x0", "removed": false } ] } ```