Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 36.7 KB

XDAGJ_RPC.md

File metadata and controls

26 lines (23 loc) · 36.7 KB
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_getBlockByNumber","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_getBlockByNumber","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_getBlockByNumber BlockHeight(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_getBlockByNumber","params":["2650572","1","2"],"id":1}"
Resp:
{"jsonrpc":"2.0","id":1,"result":{"height":0,"balance":"0.000000000","blockTime":1689139840000,"timeStamp":1729679196160,"state":null,"hash":"2f9f2c437ccf2bb5a51bb1f8c2dc7484d2c64e9ba48e3eb31073c52a7b63e7ff","address":"/+djeyrFcxCzPo6km07G0oR03ML4sRul","remark":null,"diff":null,"type":"Snapshot","flags":null,"totalPage":2,"refs":null,"transactions":[{"direction":1,"hashlow":"0000000000000000042b5b9cb5241190af069321f194f14e39b59c9616371d83","address":"gx03FpactTlO8ZTxIZMGr5ARJLWcWysE","amount":"64.000000000","time":1691827406885,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"},{"direction":1,"hashlow":"0000000000000000042b5b9cb5241190af069321f194f14e39b59c9616371d83","address":"gx03FpactTlO8ZTxIZMGr5ARJLWcWysE","amount":"64.000000000","time":1691827406885,"remark":"old balance to new address\u0000\u0000\u0000\u0000\u0000\u0000"}]}}
Enter block height & page & page size to return block information
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":"127.0.0.1:55067","connectTime":1751104356352,"inBound":0,"outBound":0}]} Used to return the net conn list
Used to return the net connect list
xdag_poolConfig Abandon in XDAGj V0.7.0, move to XDAGPool-Go 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 Abandon in XDAGj V0.7.0, move to XDAGPool-Go 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