Change block explorer
This commit is contained in:
parent
ebcfc002d8
commit
d27090c9f4
@ -1,4 +1,4 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
NET = testnet
|
NET = mainnet
|
||||||
FLO_CLI_PATH = /usr/local/bin/flo-cli
|
FLO_CLI_PATH = /usr/local/bin/flo-cli
|
||||||
START_BLOCK = 525360
|
START_BLOCK = 3387900
|
||||||
3
cronjob.sh
Executable file
3
cronjob.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
cd /home/production/deployed/flo-token-tracking/
|
||||||
|
python3 tracktokens-smartcontracts.py
|
||||||
|
|
||||||
@ -232,11 +232,10 @@ def parse_flodata(string):
|
|||||||
# todo Rule 31 - Extract number of tokens to be sent and the address to which to be sent, both data is mandatory
|
# todo Rule 31 - Extract number of tokens to be sent and the address to which to be sent, both data is mandatory
|
||||||
elif not incorporation and transfer:
|
elif not incorporation and transfer:
|
||||||
amount = extractAmount(cleanstring, hashList[0][:-1])
|
amount = extractAmount(cleanstring, hashList[0][:-1])
|
||||||
address = extractAddress(nospacestring)
|
if None not in [amount]:
|
||||||
if None not in [amount, address]:
|
|
||||||
parsed_data = {'type': 'transfer', 'transferType': 'token', 'flodata': string,
|
parsed_data = {'type': 'transfer', 'transferType': 'token', 'flodata': string,
|
||||||
'tokenIdentification': hashList[0][:-1],
|
'tokenIdentification': hashList[0][:-1],
|
||||||
'tokenAmount': amount, 'address': address[:-1]}
|
'tokenAmount': amount}
|
||||||
else:
|
else:
|
||||||
parsed_data = {'type': 'noise'}
|
parsed_data = {'type': 'noise'}
|
||||||
|
|
||||||
|
|||||||
23
tracktokens-smartcontracts.py
Normal file → Executable file
23
tracktokens-smartcontracts.py
Normal file → Executable file
@ -241,12 +241,9 @@ def startWorking(transaction_data, parsed_data):
|
|||||||
|
|
||||||
# todo Rule 45 - If the transfer type is token, then call the function transferToken to adjust the balances
|
# todo Rule 45 - If the transfer type is token, then call the function transferToken to adjust the balances
|
||||||
if parsed_data['transferType'] == 'token':
|
if parsed_data['transferType'] == 'token':
|
||||||
if parsed_data['address'] == outputlist[0]:
|
returnval = transferToken(parsed_data['tokenIdentification'], parsed_data['tokenAmount'], inputlist[0], outputlist[0])
|
||||||
returnval = transferToken(parsed_data['tokenIdentification'], parsed_data['tokenAmount'], inputlist[0], outputlist[0])
|
if returnval is None:
|
||||||
if returnval is None:
|
print("Something went wrong in the token transfer method")
|
||||||
print("Something went wrong in the token transfer method")
|
|
||||||
else:
|
|
||||||
print('Address mentioned in flodata doesn\'t match the address in blockchain\'s outputlist')
|
|
||||||
|
|
||||||
# todo Rule 46 - If the transfer type is smart contract, then call the function transferToken to do sanity checks & lock the balance
|
# todo Rule 46 - If the transfer type is smart contract, then call the function transferToken to do sanity checks & lock the balance
|
||||||
elif parsed_data['transferType'] == 'smartContract':
|
elif parsed_data['transferType'] == 'smartContract':
|
||||||
@ -274,13 +271,13 @@ def startWorking(transaction_data, parsed_data):
|
|||||||
engine = create_engine('sqlite:///tokens/{}.db'.format(parsed_data['tokenIdentification']), echo=True)
|
engine = create_engine('sqlite:///tokens/{}.db'.format(parsed_data['tokenIdentification']), echo=True)
|
||||||
Base.metadata.create_all(bind=engine)
|
Base.metadata.create_all(bind=engine)
|
||||||
session = sessionmaker(bind=engine)()
|
session = sessionmaker(bind=engine)()
|
||||||
session.add(ActiveTable(address=outputlist[0], parentid=0, transferBalance=parsed_data['tokenAmount']))
|
session.add(ActiveTable(address=inputlist[0], parentid=0, transferBalance=parsed_data['tokenAmount']))
|
||||||
string = "{} getblock {}".format(localapi, transaction_data['blockhash'])
|
string = "{} getblock {}".format(localapi, transaction_data['blockhash'])
|
||||||
response = subprocess.check_output(string, shell=True)
|
response = subprocess.check_output(string, shell=True)
|
||||||
block_data = json.loads(response.decode("utf-8"))
|
block_data = json.loads(response.decode("utf-8"))
|
||||||
session.add(TransferLogs(sourceFloAddress=inputadd, destFloAddress=outputlist[0], transferAmount=parsed_data['tokenAmount'], sourceId=0, destinationId=1, blockNumber=block_data['height'], time=block_data['time'], transactionHash=transaction_data['txid']))
|
session.add(TransferLogs(sourceFloAddress=inputadd, destFloAddress=outputlist[0], transferAmount=parsed_data['tokenAmount'], sourceId=0, destinationId=1, blockNumber=block_data['height'], time=block_data['time'], transactionHash=transaction_data['txid']))
|
||||||
blockchainReference = neturl + 'tx/' + transaction_data['txid']
|
blockchainReference = neturl + 'tx/' + transaction_data['txid']
|
||||||
session.add(TransactionHistory(sourceFloAddress=inputadd, destFloAddress=outputlist[0],
|
session.add(TransactionHistory(sourceFloAddress=inputadd, destFloAddress='-',
|
||||||
transferAmount=parsed_data['tokenAmount'], blockNumber=block_data['height'],
|
transferAmount=parsed_data['tokenAmount'], blockNumber=block_data['height'],
|
||||||
time=block_data['time'],
|
time=block_data['time'],
|
||||||
transactionHash=transaction_data['txid'],
|
transactionHash=transaction_data['txid'],
|
||||||
@ -394,10 +391,10 @@ config.read('config.ini')
|
|||||||
|
|
||||||
# Assignment the flo-cli command
|
# Assignment the flo-cli command
|
||||||
if config['DEFAULT']['NET'] == 'mainnet':
|
if config['DEFAULT']['NET'] == 'mainnet':
|
||||||
neturl = 'https://florincoin.info/'
|
neturl = 'https://flosight.duckdns.org/'
|
||||||
localapi = config['DEFAULT']['FLO_CLI_PATH']
|
localapi = config['DEFAULT']['FLO_CLI_PATH']
|
||||||
elif config['DEFAULT']['NET'] == 'testnet':
|
elif config['DEFAULT']['NET'] == 'testnet':
|
||||||
neturl = 'https://testnet.florincoin.info/'
|
neturl = 'https://testnet-flosight.duckdns.org/'
|
||||||
localapi = '{} --testnet'.format(config['DEFAULT']['FLO_CLI_PATH'])
|
localapi = '{} --testnet'.format(config['DEFAULT']['FLO_CLI_PATH'])
|
||||||
else:
|
else:
|
||||||
print("NET parameter is wrong\nThe script will exit now ")
|
print("NET parameter is wrong\nThe script will exit now ")
|
||||||
@ -449,6 +446,9 @@ print("current_block_height : " + str(current_index))
|
|||||||
for blockindex in range( startblock, current_index ):
|
for blockindex in range( startblock, current_index ):
|
||||||
print(blockindex)
|
print(blockindex)
|
||||||
|
|
||||||
|
if blockindex == 3387978:
|
||||||
|
print('hello')
|
||||||
|
|
||||||
# Scan every block
|
# Scan every block
|
||||||
string = "{} getblockhash {}".format(localapi, str(blockindex))
|
string = "{} getblockhash {}".format(localapi, str(blockindex))
|
||||||
response = subprocess.check_output(string, shell=True)
|
response = subprocess.check_output(string, shell=True)
|
||||||
@ -467,9 +467,6 @@ for blockindex in range( startblock, current_index ):
|
|||||||
transaction_data = json.loads(response.decode("utf-8"))
|
transaction_data = json.loads(response.decode("utf-8"))
|
||||||
text = transaction_data["floData"]
|
text = transaction_data["floData"]
|
||||||
|
|
||||||
if blockindex == 525362:
|
|
||||||
print('debug point')
|
|
||||||
|
|
||||||
# todo Rule 9 - Reject all noise transactions. Further rules are in parsing.py
|
# todo Rule 9 - Reject all noise transactions. Further rules are in parsing.py
|
||||||
|
|
||||||
parsed_data = parsing.parse_flodata(text)
|
parsed_data = parsing.parse_flodata(text)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user