this reminds me of something. how can i count how many coins i received from the luck node project?
i did not find a way to filter transactions. how can i do this? Ordinary Payment i can filter. but not the account of the sender.
It is probably possible to do through the
http://127.0.0.1:7876/test direct database query, but I don't speak SQL of H2 db.
Here is a little python3 script that can calculate earnings using NXT API. You need to install python3, on debian and raspbian it can be installed with:
sudo apt-get install python3. Save the file, chmod 755 filename and run.
Oh, and change
myAccount to your NXT account. Let me know if it worked for you.
#!/usr/bin/python3
import json
node = "http://127.0.0.1:7876/nxt"
myAccount = "NXT-1111-1111-1111-11111"
def sendQuery(Query):
from urllib import parse, request
params = parse.urlencode(Query)
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
req = request.Request(node, params.encode('utf-8'))
response = request.urlopen(req)
return response.read()
output = sendQuery({'requestType': 'getBlockchainTransactions', 'account': myAccount});
txs = json.loads(output.decode('utf-8'))
total = 0;
a = 0;
for i in range(0,len(txs["transactions"])):
if txs['transactions'][i]['senderRS'] == "NXT-8F28-EDVE-LPPX-HY4E7":
total += int(txs['transactions'][i]['amountNQT'])
a += 1
print("Found " + str(a) + " txs from Lucky node\nTotal received from Lucky node: " + str(total/100000000) + " NXT")
just this:
File "nextpython3.py", line 9
from urllib import parse, request
^
SyntaxError: invalid character in identifier
i will try to solve this and give you a feedback afterwards.
the first error was solvable. but now.....
Traceback (most recent call last):
File "test.py", line 16, in
output = sendQuery({'requestType': 'getBlockchainTransactions', 'account': myAccount});
File "test.py", line 13, in sendQuery
response = request.urlopen(req)
File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.4/urllib/request.py", line 455, in open
response = self._open(req, data)
File "/usr/lib/python3.4/urllib/request.py", line 473, in _open
'_open', req)
File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/lib/python3.4/urllib/request.py", line 1202, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.4/urllib/request.py", line 1177, in do_open
r = h.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 333, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: P