readdatafromblockchain function not working
This commit is contained in:
parent
3b771a74d3
commit
31d489405e
@ -74,8 +74,9 @@ def readUnitFromBlockchain(txid):
|
|||||||
|
|
||||||
def writeDatatoBlockchain(text):
|
def writeDatatoBlockchain(text):
|
||||||
n_splits = len(text)//350 + 1 #number of splits to be created
|
n_splits = len(text)//350 + 1 #number of splits to be created
|
||||||
splits = list(sliced(text, n_splits)) #create a sliced list of strings
|
splits = list(sliced(text, 350))
|
||||||
tail = writeUnitToBlockchain(splits[n_splits],'oV9ZoREBSV5gFcZTBEJ7hdbCrDLSb4g96i') #create a transaction which will act as a tail for the data
|
print(splits) #create a sliced list of strings
|
||||||
|
tail = writeUnitToBlockchain(splits[n_splits-1],'oV9ZoREBSV5gFcZTBEJ7hdbCrDLSb4g96i') #create a transaction which will act as a tail for the data
|
||||||
cursor = tail
|
cursor = tail
|
||||||
if n_splits == 1:
|
if n_splits == 1:
|
||||||
return cursor #if only single transaction was created then tail is the cursor
|
return cursor #if only single transaction was created then tail is the cursor
|
||||||
@ -89,12 +90,16 @@ def writeDatatoBlockchain(text):
|
|||||||
def readDatafromBlockchain(cursor):
|
def readDatafromBlockchain(cursor):
|
||||||
text = []
|
text = []
|
||||||
cursor_data = readUnitFromBlockchain(cursor)
|
cursor_data = readUnitFromBlockchain(cursor)
|
||||||
text.append(cursor_data[69:])
|
print(cursor_data)
|
||||||
|
text.append(cursor_data[69:])
|
||||||
|
print(text)
|
||||||
while(cursor_data[:5]=='next:'):
|
while(cursor_data[:5]=='next:'):
|
||||||
cursor = cursor_data[5:69]
|
cursor = cursor_data[5:69]
|
||||||
cursor_data = readUnitFromBlockchain(cursor)
|
cursor_data = readUnitFromBlockchain(cursor)
|
||||||
text.append(cursor_data[69:])
|
text.append(cursor_data[69:])
|
||||||
text.join('')
|
text.append(cursor_data[:])
|
||||||
|
text=('').join(text)
|
||||||
|
print(text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
class GUI:
|
class GUI:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user