-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcore_interface.py
More file actions
31 lines (21 loc) · 821 Bytes
/
Copy pathcore_interface.py
File metadata and controls
31 lines (21 loc) · 821 Bytes
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
import jsonrpc
from jsonrpc.proxy import JSONRPCException
class CoreInterface:
def __init__(self):
self.access = jsonrpc.ServiceProxy('http://user:pass@127.0.0.1:8332')
def transactions(self):
return self.access.listtransactions()
def balance(self):
return self.access.getbalance()
def stop(self):
return self.access.stop()
def validate_address(self, address):
return self.access.validateaddress(address)['isvalid']
def send(self, address, amount):
return self.access.sendtoaddress(address, amount)
def default_address(self):
return self.access.getaccountaddress('')
def new_address(self):
return self.access.getnewaddress('')
def is_initialised(self):
return self.access.getinfo()['isinitialized']