| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
"""Daemon class to make rpc calls and store state.""" |
| 31 |
|
| 32 |
from .rpc import JSONRPC |
| 33 |
|
| 34 |
class Daemon(object): |
| 35 |
|
| 36 |
def __init__(self, protocol='http', host='127.0.0.1', port=0, idx=0, restricted_rpc = False): |
| 37 |
base = 18480 if restricted_rpc else 18180 |
| 38 |
self.host = host |
| 39 |
self.port = port |
| 40 |
self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else base+idx)) |
| 41 |
|
| 42 |
def getblocktemplate(self, address, prev_block = "", client = ""): |
| 43 |
getblocktemplate = { |
| 44 |
'method': 'getblocktemplate', |
| 45 |
'params': { |
| 46 |
'client': client, |
| 47 |
'wallet_address': address, |
| 48 |
'reserve_size' : 1, |
| 49 |
'prev_block' : prev_block, |
| 50 |
}, |
| 51 |
'jsonrpc': '2.0', |
| 52 |
'id': '0' |
| 53 |
} |
| 54 |
return self.rpc.send_json_rpc_request(getblocktemplate) |
| 55 |
get_block_template = getblocktemplate |
| 56 |
|
| 57 |
def get_miner_data(self): |
| 58 |
get_miner_data = { |
| 59 |
'method': 'get_miner_data', |
| 60 |
'jsonrpc': '2.0', |
| 61 |
'id': '0' |
| 62 |
} |
| 63 |
return self.rpc.send_json_rpc_request(get_miner_data) |
| 64 |
|
| 65 |
def calc_pow(self, major_version, height, block_blob, seed_hash = ''): |
| 66 |
calc_pow = { |
| 67 |
'method': 'calc_pow', |
| 68 |
'params': { |
| 69 |
'major_version': major_version, |
| 70 |
'height': height, |
| 71 |
'block_blob' : block_blob, |
| 72 |
'seed_hash' : seed_hash, |
| 73 |
}, |
| 74 |
'jsonrpc': '2.0', |
| 75 |
'id': '0' |
| 76 |
} |
| 77 |
return self.rpc.send_json_rpc_request(calc_pow) |
| 78 |
|
| 79 |
def add_aux_pow(self, blocktemplate_blob, aux_pow, client = ""): |
| 80 |
add_aux_pow = { |
| 81 |
'method': 'add_aux_pow', |
| 82 |
'params': { |
| 83 |
'blocktemplate_blob': blocktemplate_blob, |
| 84 |
'aux_pow' : aux_pow, |
| 85 |
'client' : client, |
| 86 |
}, |
| 87 |
'jsonrpc': '2.0', |
| 88 |
'id': '0' |
| 89 |
} |
| 90 |
return self.rpc.send_json_rpc_request(add_aux_pow) |
| 91 |
|
| 92 |
def send_raw_transaction(self, tx_as_hex, do_not_relay = False, do_sanity_checks = True, client = ""): |
| 93 |
send_raw_transaction = { |
| 94 |
'client': client, |
| 95 |
'tx_as_hex': tx_as_hex, |
| 96 |
'do_not_relay': do_not_relay, |
| 97 |
'do_sanity_checks': do_sanity_checks, |
| 98 |
} |
| 99 |
return self.rpc.send_request("/send_raw_transaction", send_raw_transaction) |
| 100 |
sendrawtransaction = send_raw_transaction |
| 101 |
|
| 102 |
def submitblock(self, block): |
| 103 |
submitblock = { |
| 104 |
'method': 'submitblock', |
| 105 |
'params': [ block ], |
| 106 |
'jsonrpc': '2.0', |
| 107 |
'id': '0' |
| 108 |
} |
| 109 |
return self.rpc.send_json_rpc_request(submitblock) |
| 110 |
submit_block = submitblock |
| 111 |
|
| 112 |
def getblock(self, hash = '', height = 0, fill_pow_hash = False, client = ""): |
| 113 |
getblock = { |
| 114 |
'method': 'getblock', |
| 115 |
'params': { |
| 116 |
'client': client, |
| 117 |
'hash': hash, |
| 118 |
'height': height, |
| 119 |
'fill_pow_hash': fill_pow_hash, |
| 120 |
}, |
| 121 |
'jsonrpc': '2.0', |
| 122 |
'id': '0' |
| 123 |
} |
| 124 |
return self.rpc.send_json_rpc_request(getblock) |
| 125 |
get_block = getblock |
| 126 |
|
| 127 |
def getlastblockheader(self, client = ""): |
| 128 |
getlastblockheader = { |
| 129 |
'method': 'getlastblockheader', |
| 130 |
'params': { |
| 131 |
'client': client, |
| 132 |
}, |
| 133 |
'jsonrpc': '2.0', |
| 134 |
'id': '0' |
| 135 |
} |
| 136 |
return self.rpc.send_json_rpc_request(getlastblockheader) |
| 137 |
get_last_block_header = getlastblockheader |
| 138 |
|
| 139 |
def getblockheaderbyhash(self, hash = "", hashes = [], client = ""): |
| 140 |
getblockheaderbyhash = { |
| 141 |
'method': 'getblockheaderbyhash', |
| 142 |
'params': { |
| 143 |
'client': client, |
| 144 |
'hash': hash, |
| 145 |
'hashes': hashes, |
| 146 |
}, |
| 147 |
'jsonrpc': '2.0', |
| 148 |
'id': '0' |
| 149 |
} |
| 150 |
return self.rpc.send_json_rpc_request(getblockheaderbyhash) |
| 151 |
get_block_header_by_hash = getblockheaderbyhash |
| 152 |
|
| 153 |
def getblockheaderbyheight(self, height, client = ""): |
| 154 |
getblockheaderbyheight = { |
| 155 |
'method': 'getblockheaderbyheight', |
| 156 |
'params': { |
| 157 |
'client': client, |
| 158 |
'height': height, |
| 159 |
}, |
| 160 |
'jsonrpc': '2.0', |
| 161 |
'id': '0' |
| 162 |
} |
| 163 |
return self.rpc.send_json_rpc_request(getblockheaderbyheight) |
| 164 |
get_block_header_by_height = getblockheaderbyheight |
| 165 |
|
| 166 |
def getblockheadersrange(self, start_height, end_height, fill_pow_hash = False, client = ""): |
| 167 |
getblockheadersrange = { |
| 168 |
'method': 'getblockheadersrange', |
| 169 |
'params': { |
| 170 |
'client': client, |
| 171 |
'start_height': start_height, |
| 172 |
'end_height': end_height, |
| 173 |
'fill_pow_hash': fill_pow_hash, |
| 174 |
}, |
| 175 |
'jsonrpc': '2.0', |
| 176 |
'id': '0' |
| 177 |
} |
| 178 |
return self.rpc.send_json_rpc_request(getblockheadersrange) |
| 179 |
get_block_headers_range = getblockheadersrange |
| 180 |
|
| 181 |
def get_connections(self, client = ""): |
| 182 |
get_connections = { |
| 183 |
'client': client, |
| 184 |
'method': 'get_connections', |
| 185 |
'jsonrpc': '2.0', |
| 186 |
'id': '0' |
| 187 |
} |
| 188 |
return self.rpc.send_json_rpc_request(get_connections) |
| 189 |
|
| 190 |
def get_info(self, client = ""): |
| 191 |
get_info = { |
| 192 |
'method': 'get_info', |
| 193 |
'params': { |
| 194 |
'client': client, |
| 195 |
}, |
| 196 |
'jsonrpc': '2.0', |
| 197 |
'id': '0' |
| 198 |
} |
| 199 |
return self.rpc.send_json_rpc_request(get_info) |
| 200 |
getinfo = get_info |
| 201 |
|
| 202 |
def hard_fork_info(self, client = ""): |
| 203 |
hard_fork_info = { |
| 204 |
'method': 'hard_fork_info', |
| 205 |
'params': { |
| 206 |
'client': client, |
| 207 |
}, |
| 208 |
'jsonrpc': '2.0', |
| 209 |
'id': '0' |
| 210 |
} |
| 211 |
return self.rpc.send_json_rpc_request(hard_fork_info) |
| 212 |
|
| 213 |
def generateblocks(self, address, blocks=1, prev_block = "", starting_nonce = 0): |
| 214 |
generateblocks = { |
| 215 |
'method': 'generateblocks', |
| 216 |
'params': { |
| 217 |
'amount_of_blocks' : blocks, |
| 218 |
'reserve_size' : 20, |
| 219 |
'wallet_address': address, |
| 220 |
'prev_block': prev_block, |
| 221 |
'starting_nonce': starting_nonce, |
| 222 |
}, |
| 223 |
'jsonrpc': '2.0', |
| 224 |
'id': '0' |
| 225 |
} |
| 226 |
return self.rpc.send_json_rpc_request(generateblocks) |
| 227 |
|
| 228 |
def get_height(self, client = ""): |
| 229 |
get_height = { |
| 230 |
'method': 'get_height', |
| 231 |
'jsonrpc': '2.0', |
| 232 |
'id': '0' |
| 233 |
} |
| 234 |
return self.rpc.send_request("/get_height", get_height) |
| 235 |
getheight = get_height |
| 236 |
|
| 237 |
def pop_blocks(self, nblocks = 1): |
| 238 |
pop_blocks = { |
| 239 |
'nblocks' : nblocks, |
| 240 |
} |
| 241 |
return self.rpc.send_request("/pop_blocks", pop_blocks) |
| 242 |
|
| 243 |
def start_mining(self, miner_address, threads_count = 0, do_background_mining = False, ignore_battery = False): |
| 244 |
start_mining = { |
| 245 |
'miner_address' : miner_address, |
| 246 |
'threads_count' : threads_count, |
| 247 |
'do_background_mining' : do_background_mining, |
| 248 |
'ignore_battery' : ignore_battery, |
| 249 |
} |
| 250 |
return self.rpc.send_request('/start_mining', start_mining) |
| 251 |
|
| 252 |
def stop_mining(self): |
| 253 |
stop_mining = { |
| 254 |
} |
| 255 |
return self.rpc.send_request('/stop_mining', stop_mining) |
| 256 |
|
| 257 |
def mining_status(self): |
| 258 |
mining_status = { |
| 259 |
} |
| 260 |
return self.rpc.send_request('/mining_status', mining_status) |
| 261 |
|
| 262 |
def get_transaction_pool(self, client = ""): |
| 263 |
get_transaction_pool = { |
| 264 |
'client': client, |
| 265 |
} |
| 266 |
return self.rpc.send_request('/get_transaction_pool', get_transaction_pool) |
| 267 |
|
| 268 |
def get_transaction_pool_hashes(self, client = ""): |
| 269 |
get_transaction_pool_hashes = { |
| 270 |
'client': client, |
| 271 |
} |
| 272 |
return self.rpc.send_request('/get_transaction_pool_hashes', get_transaction_pool_hashes) |
| 273 |
|
| 274 |
def get_transaction_pool_stats(self, client = ""): |
| 275 |
get_transaction_pool_stats = { |
| 276 |
'client': client, |
| 277 |
} |
| 278 |
return self.rpc.send_request('/get_transaction_pool_stats', get_transaction_pool_stats) |
| 279 |
|
| 280 |
def flush_txpool(self, txids = []): |
| 281 |
flush_txpool = { |
| 282 |
'method': 'flush_txpool', |
| 283 |
'params': { |
| 284 |
'txids': txids |
| 285 |
}, |
| 286 |
'jsonrpc': '2.0', |
| 287 |
'id': '0' |
| 288 |
} |
| 289 |
return self.rpc.send_json_rpc_request(flush_txpool) |
| 290 |
|
| 291 |
def get_version(self): |
| 292 |
get_version = { |
| 293 |
'method': 'get_version', |
| 294 |
'jsonrpc': '2.0', |
| 295 |
'id': '0' |
| 296 |
} |
| 297 |
return self.rpc.send_json_rpc_request(get_version) |
| 298 |
|
| 299 |
def get_bans(self): |
| 300 |
get_bans = { |
| 301 |
'method': 'get_bans', |
| 302 |
'params': { |
| 303 |
}, |
| 304 |
'jsonrpc': '2.0', |
| 305 |
'id': '0' |
| 306 |
} |
| 307 |
return self.rpc.send_json_rpc_request(get_bans) |
| 308 |
|
| 309 |
def set_bans(self, bans = []): |
| 310 |
set_bans = { |
| 311 |
'method': 'set_bans', |
| 312 |
'params': { |
| 313 |
'bans': bans |
| 314 |
}, |
| 315 |
'jsonrpc': '2.0', |
| 316 |
'id': '0' |
| 317 |
} |
| 318 |
return self.rpc.send_json_rpc_request(set_bans) |
| 319 |
|
| 320 |
def banned(self, address = ''): |
| 321 |
banned = { |
| 322 |
'method': 'banned', |
| 323 |
'params': { |
| 324 |
'address': address |
| 325 |
}, |
| 326 |
'jsonrpc': '2.0', |
| 327 |
'id': '0' |
| 328 |
} |
| 329 |
return self.rpc.send_json_rpc_request(banned) |
| 330 |
|
| 331 |
def set_bootstrap_daemon(self, address, username = '', password = ''): |
| 332 |
set_bootstrap_daemon = { |
| 333 |
'address': address, |
| 334 |
'username': username, |
| 335 |
'password': password, |
| 336 |
} |
| 337 |
return self.rpc.send_request('/set_bootstrap_daemon', set_bootstrap_daemon) |
| 338 |
|
| 339 |
def get_public_nodes(self, gray = False, white = True): |
| 340 |
get_public_nodes = { |
| 341 |
'gray': gray, |
| 342 |
'white': white, |
| 343 |
} |
| 344 |
return self.rpc.send_request('/get_public_nodes', get_public_nodes) |
| 345 |
|
| 346 |
def get_transactions(self, txs_hashes = [], decode_as_json = False, prune = False, split = False, client = ""): |
| 347 |
get_transactions = { |
| 348 |
'client': client, |
| 349 |
'txs_hashes': txs_hashes, |
| 350 |
'decode_as_json': decode_as_json, |
| 351 |
'prune': prune, |
| 352 |
'split': split, |
| 353 |
} |
| 354 |
return self.rpc.send_request('/get_transactions', get_transactions) |
| 355 |
gettransactions = get_transactions |
| 356 |
|
| 357 |
def get_outs(self, outputs = [], get_txid = False, client = ""): |
| 358 |
get_outs = { |
| 359 |
'client': client, |
| 360 |
'outputs': outputs, |
| 361 |
'get_txid': get_txid, |
| 362 |
} |
| 363 |
return self.rpc.send_request('/get_outs', get_outs) |
| 364 |
|
| 365 |
def get_coinbase_tx_sum(self, height, count, client = ""): |
| 366 |
get_coinbase_tx_sum = { |
| 367 |
'method': 'get_coinbase_tx_sum', |
| 368 |
'params': { |
| 369 |
'client': client, |
| 370 |
'height': height, |
| 371 |
'count': count, |
| 372 |
}, |
| 373 |
'jsonrpc': '2.0', |
| 374 |
'id': '0' |
| 375 |
} |
| 376 |
return self.rpc.send_json_rpc_request(get_coinbase_tx_sum) |
| 377 |
|
| 378 |
def get_output_distribution(self, amounts = [], from_height = 0, to_height = 0, cumulative = False, binary = False, compress = False, client = ""): |
| 379 |
get_output_distribution = { |
| 380 |
'method': 'get_output_distribution', |
| 381 |
'params': { |
| 382 |
'client': client, |
| 383 |
'amounts': amounts, |
| 384 |
'from_height': from_height, |
| 385 |
'to_height': to_height, |
| 386 |
'cumulative': cumulative, |
| 387 |
'binary': binary, |
| 388 |
'compress': compress, |
| 389 |
}, |
| 390 |
'jsonrpc': '2.0', |
| 391 |
'id': '0' |
| 392 |
} |
| 393 |
return self.rpc.send_json_rpc_request(get_output_distribution) |
| 394 |
|
| 395 |
def get_output_histogram(self, amounts = [], min_count = 0, max_count = 0, unlocked = False, recent_cutoff = 0, client = ""): |
| 396 |
get_output_histogram = { |
| 397 |
'method': 'get_output_histogram', |
| 398 |
'params': { |
| 399 |
'client': client, |
| 400 |
'amounts': amounts, |
| 401 |
'min_count': min_count, |
| 402 |
'max_count': max_count, |
| 403 |
'unlocked': unlocked, |
| 404 |
'recent_cutoff': recent_cutoff, |
| 405 |
}, |
| 406 |
'jsonrpc': '2.0', |
| 407 |
'id': '0' |
| 408 |
} |
| 409 |
return self.rpc.send_json_rpc_request(get_output_histogram) |
| 410 |
|
| 411 |
def set_log_level(self, level): |
| 412 |
set_log_level = { |
| 413 |
'level': level, |
| 414 |
} |
| 415 |
return self.rpc.send_request('/set_log_level', set_log_level) |
| 416 |
|
| 417 |
def set_log_categories(self, categories = ''): |
| 418 |
set_log_categories = { |
| 419 |
'categories': categories, |
| 420 |
} |
| 421 |
return self.rpc.send_request('/set_log_categories', set_log_categories) |
| 422 |
|
| 423 |
def get_alt_blocks_hashes(self, client = ""): |
| 424 |
get_alt_blocks_hashes = { |
| 425 |
'client': client, |
| 426 |
} |
| 427 |
return self.rpc.send_request('/get_alt_blocks_hashes', get_alt_blocks_hashes) |
| 428 |
|
| 429 |
def get_alternate_chains(self, client = ""): |
| 430 |
get_alternate_chains = { |
| 431 |
'method': 'get_alternate_chains', |
| 432 |
'params': { |
| 433 |
'client': client, |
| 434 |
}, |
| 435 |
'jsonrpc': '2.0', |
| 436 |
'id': '0' |
| 437 |
} |
| 438 |
return self.rpc.send_json_rpc_request(get_alternate_chains) |
| 439 |
|
| 440 |
def get_fee_estimate(self, grace_blocks = 0): |
| 441 |
get_fee_estimate = { |
| 442 |
'method': 'get_fee_estimate', |
| 443 |
'params': { |
| 444 |
'grace_blocks': grace_blocks, |
| 445 |
}, |
| 446 |
'jsonrpc': '2.0', |
| 447 |
'id': '0' |
| 448 |
} |
| 449 |
return self.rpc.send_json_rpc_request(get_fee_estimate) |
| 450 |
|
| 451 |
def is_key_image_spent(self, key_images = [], client = ""): |
| 452 |
is_key_image_spent = { |
| 453 |
'key_images': key_images, |
| 454 |
'client': client, |
| 455 |
} |
| 456 |
return self.rpc.send_request('/is_key_image_spent', is_key_image_spent) |
| 457 |
|
| 458 |
def save_bc(self): |
| 459 |
save_bc = { |
| 460 |
} |
| 461 |
return self.rpc.send_request('/save_bc', save_bc) |
| 462 |
|
| 463 |
def get_peer_list(self): |
| 464 |
get_peer_list = { |
| 465 |
} |
| 466 |
return self.rpc.send_request('/get_peer_list', get_peer_list) |
| 467 |
|
| 468 |
def set_log_hash_rate(self, visible): |
| 469 |
set_log_hash_rate = { |
| 470 |
'visible': visible, |
| 471 |
} |
| 472 |
return self.rpc.send_request('/set_log_hash_rate', set_log_hash_rate) |
| 473 |
|
| 474 |
def stop_daemon(self): |
| 475 |
stop_daemon = { |
| 476 |
} |
| 477 |
return self.rpc.send_request('/stop_daemon', stop_daemon) |
| 478 |
|
| 479 |
def get_net_stats(self): |
| 480 |
get_net_stats = { |
| 481 |
} |
| 482 |
return self.rpc.send_request('/get_net_stats', get_net_stats) |
| 483 |
|
| 484 |
def get_limit(self): |
| 485 |
get_limit = { |
| 486 |
} |
| 487 |
return self.rpc.send_request('/get_limit', get_limit) |
| 488 |
|
| 489 |
def set_limit(self, limit_down, limit_up): |
| 490 |
set_limit = { |
| 491 |
'limit_down': limit_down, |
| 492 |
'limit_up': limit_up, |
| 493 |
} |
| 494 |
return self.rpc.send_request('/set_limit', set_limit) |
| 495 |
|
| 496 |
def out_peers(self, out_peers): |
| 497 |
out_peers = { |
| 498 |
'out_peers': out_peers, |
| 499 |
} |
| 500 |
return self.rpc.send_request('/out_peers', out_peers) |
| 501 |
|
| 502 |
def in_peers(self, in_peers): |
| 503 |
in_peers = { |
| 504 |
'in_peers': in_peers, |
| 505 |
} |
| 506 |
return self.rpc.send_request('/in_peers', in_peers) |
| 507 |
|
| 508 |
def update(self, command, path = None): |
| 509 |
update = { |
| 510 |
'command': command, |
| 511 |
'path': path, |
| 512 |
} |
| 513 |
return self.rpc.send_request('/update', update) |
| 514 |
|
| 515 |
def get_block_count(self): |
| 516 |
get_block_count = { |
| 517 |
'method': 'get_block_count', |
| 518 |
'params': { |
| 519 |
}, |
| 520 |
'jsonrpc': '2.0', |
| 521 |
'id': '0' |
| 522 |
} |
| 523 |
return self.rpc.send_json_rpc_request(get_block_count) |
| 524 |
getblockcount = get_block_count |
| 525 |
|
| 526 |
def get_block_hash(self, height): |
| 527 |
get_block_hash = { |
| 528 |
'method': 'get_block_hash', |
| 529 |
'params': [height], |
| 530 |
'jsonrpc': '2.0', |
| 531 |
'id': '0' |
| 532 |
} |
| 533 |
return self.rpc.send_json_rpc_request(get_block_hash) |
| 534 |
on_get_block_hash = get_block_hash |
| 535 |
on_getblockhash = get_block_hash |
| 536 |
|
| 537 |
def relay_tx(self, txids = [], client = ""): |
| 538 |
relay_tx = { |
| 539 |
'method': 'relay_tx', |
| 540 |
'params': { |
| 541 |
'txids': txids, |
| 542 |
'client': client, |
| 543 |
}, |
| 544 |
'jsonrpc': '2.0', |
| 545 |
'id': '0' |
| 546 |
} |
| 547 |
return self.rpc.send_json_rpc_request(relay_tx) |
| 548 |
|
| 549 |
def sync_info(self, client = ""): |
| 550 |
sync_info = { |
| 551 |
'method': 'sync_info', |
| 552 |
'params': { |
| 553 |
'client': client, |
| 554 |
}, |
| 555 |
'jsonrpc': '2.0', |
| 556 |
'id': '0' |
| 557 |
} |
| 558 |
return self.rpc.send_json_rpc_request(sync_info) |
| 559 |
|
| 560 |
def get_txpool_backlog(self, client = ""): |
| 561 |
get_txpool_backlog = { |
| 562 |
'method': 'get_txpool_backlog', |
| 563 |
'params': { |
| 564 |
'client': client, |
| 565 |
}, |
| 566 |
'jsonrpc': '2.0', |
| 567 |
'id': '0' |
| 568 |
} |
| 569 |
return self.rpc.send_json_rpc_request(get_txpool_backlog) |
| 570 |
|
| 571 |
def prune_blockchain(self, check = False): |
| 572 |
prune_blockchain = { |
| 573 |
'method': 'prune_blockchain', |
| 574 |
'params': { |
| 575 |
'check': check, |
| 576 |
}, |
| 577 |
'jsonrpc': '2.0', |
| 578 |
'id': '0' |
| 579 |
} |
| 580 |
return self.rpc.send_json_rpc_request(prune_blockchain) |
| 581 |
|
| 582 |
def flush_cache(self, bad_txs = False): |
| 583 |
flush_cache = { |
| 584 |
'method': 'flush_cache', |
| 585 |
'params': { |
| 586 |
'bad_txs': bad_txs, |
| 587 |
}, |
| 588 |
'jsonrpc': '2.0', |
| 589 |
'id': '0' |
| 590 |
} |
| 591 |
return self.rpc.send_json_rpc_request(flush_cache) |
| 592 |
|
| 593 |
def sync_txpool(self): |
| 594 |
sync_txpool = { |
| 595 |
'method': 'sync_txpool', |
| 596 |
'params': { |
| 597 |
}, |
| 598 |
'jsonrpc': '2.0', |
| 599 |
'id': '0' |
| 600 |
} |
| 601 |
return self.rpc.send_json_rpc_request(sync_txpool) |
| 602 |
|
| 603 |
def rpc_access_info(self, client): |
| 604 |
rpc_access_info = { |
| 605 |
'method': 'rpc_access_info', |
| 606 |
'params': { |
| 607 |
'client': client, |
| 608 |
}, |
| 609 |
'jsonrpc': '2.0', |
| 610 |
'id': '0' |
| 611 |
} |
| 612 |
return self.rpc.send_json_rpc_request(rpc_access_info) |
| 613 |
|
| 614 |
def rpc_access_submit_nonce(self, client, nonce, cookie): |
| 615 |
rpc_access_submit_nonce = { |
| 616 |
'method': 'rpc_access_submit_nonce', |
| 617 |
'params': { |
| 618 |
'client': client, |
| 619 |
'nonce': nonce, |
| 620 |
'cookie': cookie, |
| 621 |
}, |
| 622 |
'jsonrpc': '2.0', |
| 623 |
'id': '0' |
| 624 |
} |
| 625 |
return self.rpc.send_json_rpc_request(rpc_access_submit_nonce) |
| 626 |
|
| 627 |
def rpc_access_pay(self, client, paying_for, payment): |
| 628 |
rpc_access_pay = { |
| 629 |
'method': 'rpc_access_pay', |
| 630 |
'params': { |
| 631 |
'client': client, |
| 632 |
'paying_for': paying_for, |
| 633 |
'payment': payment, |
| 634 |
}, |
| 635 |
'jsonrpc': '2.0', |
| 636 |
'id': '0' |
| 637 |
} |
| 638 |
return self.rpc.send_json_rpc_request(rpc_access_pay) |
| 639 |
|
| 640 |
def rpc_access_tracking(self, clear = False): |
| 641 |
rpc_access_tracking = { |
| 642 |
'method': 'rpc_access_tracking', |
| 643 |
'params': { |
| 644 |
'clear': clear, |
| 645 |
}, |
| 646 |
'jsonrpc': '2.0', |
| 647 |
'id': '0' |
| 648 |
} |
| 649 |
return self.rpc.send_json_rpc_request(rpc_access_tracking) |
| 650 |
|
| 651 |
def rpc_access_data(self): |
| 652 |
rpc_access_data = { |
| 653 |
'method': 'rpc_access_data', |
| 654 |
'params': { |
| 655 |
}, |
| 656 |
'jsonrpc': '2.0', |
| 657 |
'id': '0' |
| 658 |
} |
| 659 |
return self.rpc.send_json_rpc_request(rpc_access_data) |
| 660 |
|
| 661 |
def rpc_access_account(self, client, delta_balance = 0): |
| 662 |
rpc_access_account = { |
| 663 |
'method': 'rpc_access_account', |
| 664 |
'params': { |
| 665 |
'client': client, |
| 666 |
'delta_balance': delta_balance, |
| 667 |
}, |
| 668 |
'jsonrpc': '2.0', |
| 669 |
'id': '0' |
| 670 |
} |
| 671 |
return self.rpc.send_json_rpc_request(rpc_access_account) |