diff --git a/docs/XDAGJ_RPC.md b/docs/XDAGJ_RPC.md index cfad504e..29ac0e51 100644 --- a/docs/XDAGJ_RPC.md +++ b/docs/XDAGJ_RPC.md @@ -1,23 +1,25 @@ -| Function name | parameter | example | describe | -|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| -| **xdag_getBlockByHash** | BlockHash(String), Page(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7\",\"1\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"6912.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":1,"refs":null,"transactions":[{"direction":0,"hashlow":"0000000000000000bf32a3dcbf86f0f581fa813ed00ff86a3e5358d1a1c5c61c","address":"HMbFodFYUz5q+A/QPoH6gfXwhr/cozK/","amount":"640.000000000","time":1690418353515,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"]}}} | Enter blockhash & page to return the block information | -| **xdag_getBlockByHash** | BlockHash(String), Page(String), startTime(String), endTime(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho\",\"1\",\"2023-7-27 12:30:10\",\"2023-7-27 13:05:20\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":2653389,"balance":"64.000000000","blockTime":1690433215999,"timeStamp":1731003613183,"state":"Main","hash":"aa66fae386b3cf9868c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","remark":"XdagJ_Test02","diff":"0xcdf6e05670013e7d15c4b9324f3","type":"Main","flags":"3f","totalPage":1,"refs":[{"direction":2,"address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","hashlow":"000000000000000068c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","amount":"0.000000000"},{"direction":1,"address":"pagdyv2jCPcPqxwBnV5BibEDFnIlTkZ6","hashlow":"00000000000000007a464e25721603b189415e9d011cab0ff708a3fdca1da8a5","amount":"0.000000000"}],"transactions":[{"direction":2,"hashlow":"000000000000000068c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","amount":"64.000000000","time":1690433215999,"remark":"XdagJ_Test02"]}}} | Enter blockhash & page & start time & end time to return the block information | -| **xdag_getBlockByHash** | BlockHash(String), Page(String), startTime(String), endTime(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7\",\"1\",\"1690418353515\",\"1690433215999\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"6912.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":1,refs":null,"transactions":[{"direction":0,"hashlow":"0000000000000000bf32a3dcbf86f0f581fa813ed00ff86a3e5358d1a1c5c61c","address":"HMbFodFYUz5q+A/QPoH6gfXwhr/cozK/","amount":"640.000000000","time":1690418353515,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"]}}} | Enter blockhash & page & start timestamp & end timestamp to return the block information | -| **xdag_getBlockByHash** | BlockHash(String), 0
"Set Page = 0, thereby avoiding querying MySQL to retrieve tx". | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp\",\"0\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"1600.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":0,"refs":null,"transactions":null}} | Enter blockhash & set page = 0 to return the block information without querying MySQL to obtain tx | -| **xdag_getBlockByNumber** | BlockHeight(String), Page(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[\"2652592\",\"1\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":2652592,"balance":"0.000000000","blockTime":1690356415999,"timeStamp":1730924969983,"state":"Main","hash":"e5975ce26b8102350573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","remark":"XdagJ","diff":"0xcdf6e05670013e7517c3e4582f8","type":"Main","flags":"3f","totalpage":1,"refs":[{"direction":2,"address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","hashlow":"00000000000000000573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","amount":"0.000000000"},{"direction":1,"address":"/JoxRqqgh7T/z2n7TjptTQ84n+QYfrqS","hashlow":"000000000000000092ba7e18e49f380f4d6d3a4efb69cfffb487a0aa46319afc","amount":"0.000000000"},{"direction":1,"address":"7LE5lCuvIAyREE3jF1VWTa85apucqS7Z","hashlow":"0000000000000000d92ea99c9b6a39af4d565517e34d10910c20af2b9439b1ec","amount":"0.000000000"}],"transactions":[{"direction":2,"hashlow":"00000000000000000573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","amount":"64.000000000","time":1690356415999,"remark":"XdagJ"}]}} | Enter block height & page to return block information | -| **xdag_getBlockByNumber** | BlockHeight(String), 0
"Set Page = 0, thereby avoiding querying MySQL to retrieve tx". | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[\"2652628\",\"0\"],\"id\":1}"
Resp: {"jsonrpc":"2.0","id":1,"result":{"height":2652628,"balance":"64.000000000","blockTime":1690781887999,"timeStamp":1731360653311,"state":"Main","hash":"efb5d86f28f16dc1ff51e4468edcaa508e97fe3a704b6db7a40c393b84d59683","address":"g5bVhDs5DKS3bUtwOv6XjlCq3I5G5FH/","remark":"XdagJ","diff":"0xcdf6e05670013e752373b6389d4","type":"Main","flags":"3f","totalPage":0,"refs":[{"direction":2,"address":"g5bVhDs5DKS3bUtwOv6XjlCq3I5G5FH/","hashlow":"0000000000000000ff51e4468edcaa508e97fe3a704b6db7a40c393b84d59683","amount":"0.000000000"},{"direction":1,"address":"uA+JMeO1R+XMraLPywQDbS+J44FqqOqt","hashlow":"0000000000000000adeaa86a81e3892f6d0304cbcfa2adcce547b5e331890fb8","amount":"0.000000000"},{"direction":1,"address":"Zt3jpA2OXs38d3scK5BxPVfT6+pUSFf/","hashlow":"0000000000000000ff574854eaebd3573d71902b1c7b77fccd5e8e0da4e3dd66","amount":"0.000000000"}],"transactions":null}} | Enter block height & set page = 0 to return block information without querying MySQL to obtain tx | -| **xdag_blockNumber** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"5"} | Used to return the current main block height | -| **xdag_coinbase** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_coinbase\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"K5q0ews/ma110QLUzePetOdU+EwYKrud"} | Used to return the current pool miner | -| **xdag_getBalance** | Address(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBalance\",\"params\":[\"K5q0ews/ma110QLUzePetOdU+EwYKrud\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"1024.000000000"} | Enter an address to return the balance of the address | -| **xdag_getTotalBalance** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getTotalBalance\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"5120.000000000"} | Used to return the current balance of this pool | -| **xdag_getStatus** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getStatus\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"nblock":"410","totalNblocks":"410","nmain":"355","totalNmain":"355","curDiff":"0x8cdcc571bb0","netDiff":"0x8cdcc571bb0","hashRateOurs":"4.6310760077049364E-15","hashRateTotal":"4.6310760077049364E-15","ourSupply":"363520.000000000","netSupply":"363520.000000000"}} | Used to return the status of the XDAG network | -| **xdag_personal_sendTransaction** | From(String);
"from can be null, because it is pool default".
To(String);
Value(String); Remark(String); | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_personal_sendTransaction\",\"params\":[{\"to\":\"K5q0ews/ma110QLUzePetOdU+EwYKrud\",\"value\": \"100\",\"remark\":\"test\"},\"password\"],\"id\":1}" #replace password
Resp:
{"jsonrpc":"2.0","id":1,"result":["vdRhmOwyMnZGWa175jIeGM8wRKxFD4R8","5OzeDiBqW3B6mtTeETgtR3WaVMKtB4+1","XUpG7kNvo+Ry0NYdPXSZCosaKdA2DfyR","byoUkvt9Y3jOLHjNpoiAJiwNT5ERSo+D","/7Fbib4Q/hONloUxX0lFNr28zEGdzOFp","9ECM/iCC9llyMfESZqDujftpkACcvR3R","eYi9z1vmNHNQqsXyXnzeq/gUlS7//WhQ","srN4XT6jPIrBWZ+OZZRydE/0bqZavjQZ","iXekUXBKRhuPWou7ChFZAmyrHEOfFVuI","LHhaVsyA8BSdumNlxTJ4o5j+I1IyeXj2"]} | Used to transfer from pool to other address | -| **xdag_getRewardByNumber** | Height | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getRewardByNumber\",\"params\":[\"1000\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"1024.000000000"} | Used to return the reward of some height | -| **xdag_sendRawTransaction** | BlockData(String)
"raw data of the block" | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "
{\"jsonrpc\":\"2.0\",\"method\":\"xdag_sendRawTransaction\",\"params\":
[\"00000000000000002863550000000000feffed9d7d01000000000000000000005d453264dfe0f2dcd0b09fff8db233af668bf7aa873176470000000064000000defb03f1a99ce1498f19afa5b0c752d5409bb2fdc4e087e10000000064000000506bc1dc099358e5137292f4efdd57e400f29ba5132aa5d12b18dac1c1f6aaba12dfa82f55245fb4a8a8ddbbe2eb970f80347741ff0907e8844630004981eb230a329c87c
2736c8067e7a15190587502e5bf761e4f919aaf84ce62b3f1f5cffc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000(TxBlockRawDate)\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"MWdnWaYpLMwlazfFwmk4onmNE82JVFTB(BlockHash)"} | Used to send transactions | -| **xdag_netType** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_netType\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"testnet"} | Used to return the net type xdag running for | -| **xdag_netConnectionList** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_netConnectionList\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":[{"nodeAddress":"localhost:8002","connectTime":1654431183389,"inBound":1744,"outBound":1101},{"nodeAddress":"localhost:61179","connectTime":1654431099718,"inBound":7949,"outBound":5623}]}Used to return the net conn list | Used to return the net connect list | -| **xdag_poolConfig** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_poolConfig\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"poolIp":"127.0.0.1","poolPort":7001,"nodeIp":"127.0.0.1","nodePort":8001,"globalMinerLimit":8192,"maxConnectMinerPerIp":256,"maxMinerPerAccount":256,"poolFeeRation":"5.0","poolRewardRation":"5.0","poolDirectRation":"5.0","poolFundRation":"5.0"}} | Used to get pool config | -| **xdag_updatePoolConfig** | poolRewardRation(String) poolDirectRation(String) poolFundRation(String) poolFeeRation(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_updatePoolConfig\",\"params\":[{\"poolFeeRation\":\"12\",\"poolRewardRation\":\"11\",\"poolDirectRation\":\"13\",\"poolFundRation\":\"14.2\"},\"password\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"Success"} | Used to update award configuration | +| Function name | parameter | example | describe | +|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| +| **xdag_getBlockByHash** | BlockHash(String), Page(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7\",\"1\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"6912.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":1,"refs":null,"transactions":[{"direction":0,"hashlow":"0000000000000000bf32a3dcbf86f0f581fa813ed00ff86a3e5358d1a1c5c61c","address":"HMbFodFYUz5q+A/QPoH6gfXwhr/cozK/","amount":"640.000000000","time":1690418353515,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"]}}} | Enter blockhash & page to return the block information | +| **xdag_getBlockByHash** | BlockHash(String), Page(String), PageSize(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp\",\"1\",\"3\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"37.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":2,"refs":null,"transactions":[{"direction":1,"hashlow":"00000000000000004beb1b1214268ed714df3eabc10b978177b11ebc7c3dafc1","address":"wa89fLwesXeBlwvBqz7fFNeOJhQSG+tL","amount":"5.000000000","time":1691675600194,"remark":null},{"direction":1,"hashlow":"0000000000000000fd4b4640100f97b784decfe237fa3dd510e7f2de8f6a1bae","address":"rhtqj97y5xDVPfo34s/ehLeXDxBARkv9","amount":"10.000000000","time":1691675494125,"remark":null},{"direction":1,"hashlow":"0000000000000000edd2bf7e76c8118b5dfaff85467a572f89df9df49fda1ed7","address":"1x7an/Sd34kvV3pGhf/6XYsRyHZ+v9Lt","amount":"12.000000000","time":1691675453150,"remark":null}]}} | Enter blockhash & page & page size to return the block information | +| **xdag_getBlockByHash** | BlockHash(String), Page(String), startTime(String), endTime(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho\",\"1\",\"2023-7-27 12:30:10\",\"2023-7-27 13:05:20\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":2653389,"balance":"64.000000000","blockTime":1690433215999,"timeStamp":1731003613183,"state":"Main","hash":"aa66fae386b3cf9868c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","remark":"XdagJ_Test02","diff":"0xcdf6e05670013e7d15c4b9324f3","type":"Main","flags":"3f","totalPage":1,"refs":[{"direction":2,"address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","hashlow":"000000000000000068c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","amount":"0.000000000"},{"direction":1,"address":"pagdyv2jCPcPqxwBnV5BibEDFnIlTkZ6","hashlow":"00000000000000007a464e25721603b189415e9d011cab0ff708a3fdca1da8a5","amount":"0.000000000"}],"transactions":[{"direction":2,"hashlow":"000000000000000068c8b361db777f4274b7572f9e73970decc2e9d5743cdf63","address":"Y988dNXpwuwNl3OeL1e3dEJ/d9ths8ho","amount":"64.000000000","time":1690433215999,"remark":"XdagJ_Test02"]}}} | Enter blockhash & page & start time & end time to return the block information | +| **xdag_getBlockByHash** | BlockHash(String), Page(String), startTime(String), endTime(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7\",\"1\",\"1690418353515\",\"1690433215999\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"6912.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"55Tffne2cwGSDRJU3kouvZfRNjk19ZaE7","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":1,refs":null,"transactions":[{"direction":0,"hashlow":"0000000000000000bf32a3dcbf86f0f581fa813ed00ff86a3e5358d1a1c5c61c","address":"HMbFodFYUz5q+A/QPoH6gfXwhr/cozK/","amount":"640.000000000","time":1690418353515,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"]}}} | Enter blockhash & page & start timestamp & end timestamp to return the block information | +| **xdag_getBlockByHash** | BlockHash(String), Page(String), startTime(String), endTime(String), PageSize(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp\",\"1\",\"1691675158000\",\"1691675168999\",\"3\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"37.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":1,"refs":null,"transactions":[{"direction":0,"hashlow":"00000000000000005161900e0c375f9c3600cf1aa894bb5d003127b9f3ca0f56","address":"Vg/K87knMQBdu5SoGs8ANpxfNwwOkGFR","amount":"64.000000000","time":1691675158000,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"}]}} | Enter blockhash & page & start timestamp & end timestamp & page size to return the block information | +| **xdag_getBlockByHash** | BlockHash(String), 0
"Set Page = 0, thereby avoiding querying MySQL to retrieve tx". | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBlockByHash\",\"params\":[\"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp\",\"0\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"1600.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":"Accepted","hash":null,"address":"4mvr3DNkpWY9ikpGy4maaMSQqUmXjR2hp","remark":null,"diff":null,"type":"Wallet","flags":null,"totalPage":0,"refs":null,"transactions":null}} | Enter blockhash & set page = 0 to return the block information without querying MySQL to obtain tx | +| **xdag_getBlockByNumber** | BlockHeight(String), Page(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[\"2652592\",\"1\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":2652592,"balance":"0.000000000","blockTime":1690356415999,"timeStamp":1730924969983,"state":"Main","hash":"e5975ce26b8102350573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","remark":"XdagJ","diff":"0xcdf6e05670013e7517c3e4582f8","type":"Main","flags":"3f","totalpage":1,"refs":[{"direction":2,"address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","hashlow":"00000000000000000573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","amount":"0.000000000"},{"direction":1,"address":"/JoxRqqgh7T/z2n7TjptTQ84n+QYfrqS","hashlow":"000000000000000092ba7e18e49f380f4d6d3a4efb69cfffb487a0aa46319afc","amount":"0.000000000"},{"direction":1,"address":"7LE5lCuvIAyREE3jF1VWTa85apucqS7Z","hashlow":"0000000000000000d92ea99c9b6a39af4d565517e34d10910c20af2b9439b1ec","amount":"0.000000000"}],"transactions":[{"direction":2,"hashlow":"00000000000000000573292b19c38d0ef9dc09a374b9e86a2aedb011fa7c0d8e","address":"jg18+hGw7Spq6Ll0ownc+Q6NwxkrKXMF","amount":"64.000000000","time":1690356415999,"remark":"XdagJ"}]}} | Enter block height & page to return block information | +| **xdag_getBlockByNumber** | BlockHeight(String), 0
"Set Page = 0, thereby avoiding querying MySQL to retrieve tx". | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[\"2652628\",\"0\"],\"id\":1}"
Resp: {"jsonrpc":"2.0","id":1,"result":{"height":2652628,"balance":"64.000000000","blockTime":1690781887999,"timeStamp":1731360653311,"state":"Main","hash":"efb5d86f28f16dc1ff51e4468edcaa508e97fe3a704b6db7a40c393b84d59683","address":"g5bVhDs5DKS3bUtwOv6XjlCq3I5G5FH/","remark":"XdagJ","diff":"0xcdf6e05670013e752373b6389d4","type":"Main","flags":"3f","totalPage":0,"refs":[{"direction":2,"address":"g5bVhDs5DKS3bUtwOv6XjlCq3I5G5FH/","hashlow":"0000000000000000ff51e4468edcaa508e97fe3a704b6db7a40c393b84d59683","amount":"0.000000000"},{"direction":1,"address":"uA+JMeO1R+XMraLPywQDbS+J44FqqOqt","hashlow":"0000000000000000adeaa86a81e3892f6d0304cbcfa2adcce547b5e331890fb8","amount":"0.000000000"},{"direction":1,"address":"Zt3jpA2OXs38d3scK5BxPVfT6+pUSFf/","hashlow":"0000000000000000ff574854eaebd3573d71902b1c7b77fccd5e8e0da4e3dd66","amount":"0.000000000"}],"transactions":null}} | Enter block height & set page = 0 to return block information without querying MySQL to obtain tx | +| **xdag_blockNumber** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"5"} | Used to return the current main block height | +| **xdag_coinbase** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_coinbase\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"K5q0ews/ma110QLUzePetOdU+EwYKrud"} | Used to return the current pool miner | +| **xdag_getBalance** | Address(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBalance\",\"params\":[\"K5q0ews/ma110QLUzePetOdU+EwYKrud\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"1024.000000000"} | Enter an address to return the balance of the address | +| **xdag_getTotalBalance** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getTotalBalance\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"5120.000000000"} | Used to return the current balance of this pool | +| **xdag_getStatus** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getStatus\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"nblock":"410","totalNblocks":"410","nmain":"355","totalNmain":"355","curDiff":"0x8cdcc571bb0","netDiff":"0x8cdcc571bb0","hashRateOurs":"4.6310760077049364E-15","hashRateTotal":"4.6310760077049364E-15","ourSupply":"363520.000000000","netSupply":"363520.000000000"}} | Used to return the status of the XDAG network | +| **xdag_personal_sendTransaction** | From(String);
"from can be null, because it is pool default".
To(String);
Value(String); Remark(String); | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_personal_sendTransaction\",\"params\":[{\"to\":\"K5q0ews/ma110QLUzePetOdU+EwYKrud\",\"value\": \"100\",\"remark\":\"test\"},\"password\"],\"id\":1}" #replace password
Resp:
{"jsonrpc":"2.0","id":1,"result":["vdRhmOwyMnZGWa175jIeGM8wRKxFD4R8","5OzeDiBqW3B6mtTeETgtR3WaVMKtB4+1","XUpG7kNvo+Ry0NYdPXSZCosaKdA2DfyR","byoUkvt9Y3jOLHjNpoiAJiwNT5ERSo+D","/7Fbib4Q/hONloUxX0lFNr28zEGdzOFp","9ECM/iCC9llyMfESZqDujftpkACcvR3R","eYi9z1vmNHNQqsXyXnzeq/gUlS7//WhQ","srN4XT6jPIrBWZ+OZZRydE/0bqZavjQZ","iXekUXBKRhuPWou7ChFZAmyrHEOfFVuI","LHhaVsyA8BSdumNlxTJ4o5j+I1IyeXj2"]} | Used to transfer from pool to other address | +| **xdag_getRewardByNumber** | Height | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getRewardByNumber\",\"params\":[\"1000\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"1024.000000000"} | Used to return the reward of some height | +| **xdag_sendRawTransaction** | BlockData(String)
"raw data of the block" | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "
{\"jsonrpc\":\"2.0\",\"method\":\"xdag_sendRawTransaction\",\"params\":
[\"00000000000000002863550000000000feffed9d7d01000000000000000000005d453264dfe0f2dcd0b09fff8db233af668bf7aa873176470000000064000000defb03f1a99ce1498f19afa5b0c752d5409bb2fdc4e087e10000000064000000506bc1dc099358e5137292f4efdd57e400f29ba5132aa5d12b18dac1c1f6aaba12dfa82f55245fb4a8a8ddbbe2eb970f80347741ff0907e8844630004981eb230a329c87c
2736c8067e7a15190587502e5bf761e4f919aaf84ce62b3f1f5cffc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000(TxBlockRawDate)\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"MWdnWaYpLMwlazfFwmk4onmNE82JVFTB(BlockHash)"} | Used to send transactions | +| **xdag_netType** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_netType\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"testnet"} | Used to return the net type xdag running for | +| **xdag_netConnectionList** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_netConnectionList\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":[{"nodeAddress":"localhost:8002","connectTime":1654431183389,"inBound":1744,"outBound":1101},{"nodeAddress":"localhost:61179","connectTime":1654431099718,"inBound":7949,"outBound":5623}]}Used to return the net conn list | Used to return the net connect list | +| **xdag_poolConfig** | Null | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_poolConfig\",\"params\":[],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"poolIp":"127.0.0.1","poolPort":7001,"nodeIp":"127.0.0.1","nodePort":8001,"globalMinerLimit":8192,"maxConnectMinerPerIp":256,"maxMinerPerAccount":256,"poolFeeRation":"5.0","poolRewardRation":"5.0","poolDirectRation":"5.0","poolFundRation":"5.0"}} | Used to get pool config | +| **xdag_updatePoolConfig** | poolRewardRation(String) poolDirectRation(String) poolFundRation(String) poolFeeRation(String) | Req:
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_updatePoolConfig\",\"params\":[{\"poolFeeRation\":\"12\",\"poolRewardRation\":\"11\",\"poolDirectRation\":\"13\",\"poolFundRation\":\"14.2\"},\"password\"],\"id\":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":"Success"} | Used to update award configuration | diff --git a/src/main/java/io/xdag/core/Blockchain.java b/src/main/java/io/xdag/core/Blockchain.java index 9bfb8d0e..850ab751 100644 --- a/src/main/java/io/xdag/core/Blockchain.java +++ b/src/main/java/io/xdag/core/Blockchain.java @@ -72,7 +72,7 @@ public interface Blockchain { // 注册监听器 void registerListener(Listener listener); - List getBlockTxHistoryByAddress(Bytes32 addressHashlow, int page, Object... timeRange); + List getBlockTxHistoryByAddress(Bytes32 addressHashlow, int page, Object... parameters); XdagExtStats getXdagExtStats(); } diff --git a/src/main/java/io/xdag/core/BlockchainImpl.java b/src/main/java/io/xdag/core/BlockchainImpl.java index eeda6c4d..b4cf6d1b 100644 --- a/src/main/java/io/xdag/core/BlockchainImpl.java +++ b/src/main/java/io/xdag/core/BlockchainImpl.java @@ -494,12 +494,12 @@ public void onNewTxHistory(Bytes32 addressHashlow, Bytes32 txHashlow, XdagField. } } - public List getBlockTxHistoryByAddress(Bytes32 addressHashlow, int page, Object... timeRange) { + public List getBlockTxHistoryByAddress(Bytes32 addressHashlow, int page, Object... parameters) { List txHistory = Lists.newArrayList(); if (txHistoryStore != null) { try { txHistory.addAll(txHistoryStore.listTxHistoryByAddress(checkAddress(addressHashlow) ? - BasicUtils.hash2PubAddress(addressHashlow) : BasicUtils.hash2Address(addressHashlow), page, timeRange)); + BasicUtils.hash2PubAddress(addressHashlow) : BasicUtils.hash2Address(addressHashlow), page, parameters)); } catch (Exception e) { log.error(e.getMessage(), e); } diff --git a/src/main/java/io/xdag/db/TransactionHistoryStore.java b/src/main/java/io/xdag/db/TransactionHistoryStore.java index 0b490c6a..e41e099c 100644 --- a/src/main/java/io/xdag/db/TransactionHistoryStore.java +++ b/src/main/java/io/xdag/db/TransactionHistoryStore.java @@ -31,7 +31,7 @@ public interface TransactionHistoryStore { boolean saveTxHistory(TxHistory txHistory); boolean batchSaveTxHistory(TxHistory txHistory,int... cacheNum); - List listTxHistoryByAddress(String address, int page, Object... timeRange); + List listTxHistoryByAddress(String address, int page, Object... parameters); int getTxHistoryCount(String address); diff --git a/src/main/java/io/xdag/db/mysql/TransactionHistoryStoreImpl.java b/src/main/java/io/xdag/db/mysql/TransactionHistoryStoreImpl.java index e7229ae9..13ad92a1 100644 --- a/src/main/java/io/xdag/db/mysql/TransactionHistoryStoreImpl.java +++ b/src/main/java/io/xdag/db/mysql/TransactionHistoryStoreImpl.java @@ -60,7 +60,7 @@ public class TransactionHistoryStoreImpl implements TransactionHistoryStore { private static final int BLOCK_ADDRESS_FLAG = 0; private static final int WALLET_ADDRESS_FLAG = 1; - private static final int PAGE_SIZE = 100; + private static final int Default_PAGE_SIZE = 100; private Connection connBatch = null; private PreparedStatement pstmtBatch = null; private int count = 0; @@ -156,23 +156,43 @@ public boolean batchSaveTxHistory(TxHistory txHistory, int... cacheNum) { @Override - public List listTxHistoryByAddress(String address, int page, Object... timeRange) { + public List listTxHistoryByAddress(String address, int page, Object... parameters) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List txHistoryList = Lists.newArrayList(); int totalcount = 0; + int PAGE_SIZE = Default_PAGE_SIZE; long start = new Date(0).getTime(); long end = System.currentTimeMillis(); - if (timeRange.length != 0) { - try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - start = sdf.parse(timeRange[0].toString()).getTime(); - end = sdf.parse(timeRange[1].toString()).getTime(); - } catch (ParseException e) { - start = Long.parseLong(timeRange[0].toString()); - end = Long.parseLong(timeRange[1].toString()); - } + switch (parameters.length) { + case 0: break; + case 1: + int pageSize = Integer.parseInt(parameters[0].toString()); + PAGE_SIZE = (pageSize > 0 && pageSize <= 500) ? pageSize : PAGE_SIZE; + break; + case 2: + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + start = sdf.parse(parameters[0].toString()).getTime(); + end = sdf.parse(parameters[1].toString()).getTime(); + } catch (ParseException e) { + start = Long.parseLong(parameters[0].toString()); + end = Long.parseLong(parameters[1].toString()); + } + break; + case 3: + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + start = sdf.parse(parameters[0].toString()).getTime(); + end = sdf.parse(parameters[1].toString()).getTime(); + } catch (ParseException e) { + start = Long.parseLong(parameters[0].toString()); + end = Long.parseLong(parameters[1].toString()); + } + int page_size = Integer.parseInt(parameters[2].toString()); + PAGE_SIZE = (page_size > 0 && page_size <= 500) ? page_size : PAGE_SIZE; + break; } try { conn = DruidUtils.getConnection(); diff --git a/src/main/java/io/xdag/rpc/Web3Impl.java b/src/main/java/io/xdag/rpc/Web3Impl.java index f2f95f5c..dec354a4 100644 --- a/src/main/java/io/xdag/rpc/Web3Impl.java +++ b/src/main/java/io/xdag/rpc/Web3Impl.java @@ -101,13 +101,21 @@ public Object xdag_getBlocksByNumber(String bnOrId) { @Override public BlockResultDTO xdag_getBlockByHash(String blockHash, int page, String startTime, String endTime) { - return web3XdagModule.xdag_getBlockByHash(blockHash, page, startTime,endTime); + return web3XdagModule.xdag_getBlockByHash(blockHash, page, startTime, endTime); } public BlockResultDTO xdag_getBlockByHash(String blockHash, int page) { return web3XdagModule.xdag_getBlockByHash(blockHash, page); } + public BlockResultDTO xdag_getBlockByHash(String blockHash, int page, String startTime, String endTime, int pageSize) { + return web3XdagModule.xdag_getBlockByHash(blockHash, page, startTime, endTime, pageSize); + } + + public BlockResultDTO xdag_getBlockByHash(String blockHash, int page, int pageSize) { + return web3XdagModule.xdag_getBlockByHash(blockHash, page, pageSize); + } + @Override public StatusDTO xdag_getStatus() throws Exception { return web3XdagModule.xdag_getStatus(); diff --git a/src/main/java/io/xdag/rpc/modules/xdag/Web3XdagModule.java b/src/main/java/io/xdag/rpc/modules/xdag/Web3XdagModule.java index bc604626..37c64648 100644 --- a/src/main/java/io/xdag/rpc/modules/xdag/Web3XdagModule.java +++ b/src/main/java/io/xdag/rpc/modules/xdag/Web3XdagModule.java @@ -98,6 +98,14 @@ default BlockResultDTO xdag_getBlockByHash(String blockHash, int page) { return getXdagModule().getBlockByHash(blockHash, page); } + default BlockResultDTO xdag_getBlockByHash(String blockHash, int page, String startTime, String endTime, int pageSize) { + return getXdagModule().getBlockByHash(blockHash, page, startTime, endTime, pageSize); + } + + default BlockResultDTO xdag_getBlockByHash(String blockHash, int page, int pageSize) { + return getXdagModule().getBlockByHash(blockHash, page, pageSize); + } + StatusDTO xdag_getStatus() throws Exception; Object xdag_netType() throws Exception; diff --git a/src/main/java/io/xdag/rpc/modules/xdag/XdagModule.java b/src/main/java/io/xdag/rpc/modules/xdag/XdagModule.java index 956b0e62..941ba736 100644 --- a/src/main/java/io/xdag/rpc/modules/xdag/XdagModule.java +++ b/src/main/java/io/xdag/rpc/modules/xdag/XdagModule.java @@ -81,8 +81,8 @@ public String getCoinBase() { } @Override - public BlockResultDTO getBlockByHash(String hash, int page,Object... timeRange ) { - return xdagModuleChain.getBlockByHash(hash, page, timeRange); + public BlockResultDTO getBlockByHash(String hash, int page,Object... parameters ) { + return xdagModuleChain.getBlockByHash(hash, page, parameters); } @Override diff --git a/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChain.java b/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChain.java index 4bd9b48b..fdafdb77 100644 --- a/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChain.java +++ b/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChain.java @@ -30,7 +30,7 @@ public interface XdagModuleChain { String getCoinBase(); - BlockResultDTO getBlockByHash(String hash, int page, Object... timeRange); + BlockResultDTO getBlockByHash(String hash, int page, Object... parameters); BlockResultDTO getBlockByNumber(String bnOrId, int page); diff --git a/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChainBase.java b/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChainBase.java index 5842853a..21f73dd4 100644 --- a/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChainBase.java +++ b/src/main/java/io/xdag/rpc/modules/xdag/XdagModuleChainBase.java @@ -87,8 +87,8 @@ public String getCoinBase() { } @Override - public BlockResultDTO getBlockByHash(String hash, int page, Object... timeRange) { - return getBlockDTOByHash(hash, page, timeRange); + public BlockResultDTO getBlockByHash(String hash, int page, Object... parameters) { + return getBlockDTOByHash(hash, page, parameters); } @Override @@ -147,10 +147,10 @@ public String getMaxXferBalance() { return Commands.getBalanceMaxXfer(kernel); } - public BlockResultDTO getBlockDTOByHash(String hash, int page, Object... timeRange) { + public BlockResultDTO getBlockDTOByHash(String hash, int page, Object... parameters) { Bytes32 blockHash; if (checkAddress(hash)) { - return transferAccountToBlockResultDTO(hash, page, timeRange); + return transferAccountToBlockResultDTO(hash, page, parameters); } else { if (StringUtils.length(hash) == 32) { blockHash = address2Hash(hash); @@ -160,9 +160,9 @@ public BlockResultDTO getBlockDTOByHash(String hash, int page, Object... timeRan Block block = blockchain.getBlockByHash(blockHash, true); if (block == null) { block = blockchain.getBlockByHash(blockHash, false); - return transferBlockInfoToBlockResultDTO(block, page, timeRange); + return transferBlockInfoToBlockResultDTO(block, page, parameters); } - return transferBlockToBlockResultDTO(block, page, timeRange); + return transferBlockToBlockResultDTO(block, page, parameters); } } @@ -186,7 +186,7 @@ private BlockResultDTO transferBlockToBriefBlockResultDTO(Block block) { return BlockResultDTOBuilder.build(); } - private BlockResultDTO transferBlockInfoToBlockResultDTO(Block block, int page, Object... timeRange) { + private BlockResultDTO transferBlockInfoToBlockResultDTO(Block block, int page, Object... parameters) { if (null == block) { return null; } @@ -206,14 +206,14 @@ private BlockResultDTO transferBlockInfoToBlockResultDTO(Block block, int page, // .refs(getLinks(block)) // .height(block.getInfo().getHeight()) if (page != 0){ - BlockResultDTOBuilder.transactions(getTxLinks(block, page, timeRange)) + BlockResultDTOBuilder.transactions(getTxLinks(block, page, parameters)) .totalPage(totalPage); } totalPage = 1; return BlockResultDTOBuilder.build(); } - private BlockResultDTO transferAccountToBlockResultDTO(String address, int page, Object... timeRange) { + private BlockResultDTO transferAccountToBlockResultDTO(String address, int page, Object... parameters) { XAmount balance = kernel.getAddressStore().getBalanceByAddress(hash2byte(pubAddress2Hash(address).mutableCopy())); BlockResultDTO.BlockResultDTOBuilder BlockResultDTOBuilder = BlockResultDTO.builder(); @@ -225,14 +225,14 @@ private BlockResultDTO transferAccountToBlockResultDTO(String address, int page, .timeStamp(kernel.getConfig().getSnapshotSpec().getSnapshotTime()) .state("Accepted"); if (page != 0){ - BlockResultDTOBuilder.transactions(getTxHistory(address, page, timeRange)) + BlockResultDTOBuilder.transactions(getTxHistory(address, page, parameters)) .totalPage(totalPage); } totalPage = 1; return BlockResultDTOBuilder.build(); } - private BlockResultDTO transferBlockToBlockResultDTO(Block block, int page, Object... timeRange) { + private BlockResultDTO transferBlockToBlockResultDTO(Block block, int page, Object... parameters) { if (null == block) { return null; } @@ -251,7 +251,7 @@ private BlockResultDTO transferBlockToBlockResultDTO(Block block, int page, Obje .refs(getLinks(block)) .height(block.getInfo().getHeight()); if (page != 0) { - BlockResultDTOBuilder.transactions(getTxLinks(block, page, timeRange)) + BlockResultDTOBuilder.transactions(getTxLinks(block, page, parameters)) .totalPage(totalPage); } totalPage = 1; @@ -296,8 +296,8 @@ private List getLinks(Block block) { return links; } - private List getTxLinks(Block block, int page, Object timeRange) { - List txHistories = blockchain.getBlockTxHistoryByAddress(block.getHashLow(), page, timeRange); + private List getTxLinks(Block block, int page, Object... parameters) { + List txHistories = blockchain.getBlockTxHistoryByAddress(block.getHashLow(), page, parameters); List txLinks = Lists.newArrayList(); // 1. earning info if (getStateByFlags(block.getInfo().getFlags()).equals(MAIN.getDesc()) && block.getInfo().getHeight() > kernel.getConfig().getSnapshotSpec().getSnapshotHeight()) { @@ -333,8 +333,8 @@ private List getTxLinks(Block block, int page, Object timeRange) { return txLinks; } - private List getTxHistory(String address, int page, Object... timeRange) { - List txHistories = blockchain.getBlockTxHistoryByAddress(pubAddress2Hash(address), page, timeRange); + private List getTxHistory(String address, int page, Object... parameters) { + List txHistories = blockchain.getBlockTxHistoryByAddress(pubAddress2Hash(address), page, parameters); List txLinks = Lists.newArrayList(); for (TxHistory txHistory : txHistories) { Block b = blockchain.getBlockByHash(txHistory.getAddress().getAddress(), false);