-
Notifications
You must be signed in to change notification settings - Fork 2
/
getethtransactions.py
46 lines (35 loc) · 1.21 KB
/
getethtransactions.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""The Python implementation of the gRPC Godbledger client."""
from __future__ import print_function
import config
import random
import logging
import grpc
import transaction_pb2
import transaction_pb2_grpc
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(config.ethereumHTTPProvider))
def checkEthTransactions():
balance = w3.eth.get_balance(Web3.toChecksumAddress(config.address)) / 10**18
return balance
def run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = transaction_pb2_grpc.TransactorStub(channel)
print("-------------- Sending Transaction --------------")
response = stub.AddTransaction(transaction_pb2.TransactionRequest(
date="2019-06-30",
description="Sales",
lines=[
transaction_pb2.LineItem(
accountname="Income",
description="Some Specifics",
amount=-1000),
transaction_pb2.LineItem(
accountname="Cash",
description="Some Specifics",
amount=1000)
]
))
print(response)
if __name__ == '__main__':
logging.basicConfig()
run()