long secret messages are now supported
This commit is contained in:
parent
adb1f3ff12
commit
9ba4921820
@ -74,30 +74,33 @@ 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, 350))
|
splits = list(sliced(text, 350)) #create a sliced list of strings
|
||||||
print(splits) #create a sliced list of strings
|
for split in splits:
|
||||||
|
print(split)
|
||||||
|
print('no.of splits: '+str(n_splits))
|
||||||
tail = writeUnitToBlockchain(splits[n_splits-1],'oV9ZoREBSV5gFcZTBEJ7hdbCrDLSb4g96i') #create a transaction which will act as a tail for the data
|
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
|
||||||
|
|
||||||
#for each string in the list create a transaction with txid of previous string
|
#for each string in the list create a transaction with txid of previous string
|
||||||
for i in range(n_splits-1,0):
|
for i in range(n_splits-2,-1,-1):
|
||||||
splits[i] = 'next:'+cursor+splits[i]
|
splits[i] = 'next:'+cursor+" "+splits[i]
|
||||||
cursor = writeUnitToBlockchain(splits[i])
|
print(splits[i])
|
||||||
|
cursor = writeUnitToBlockchain(splits[i],'oV9ZoREBSV5gFcZTBEJ7hdbCrDLSb4g96i')
|
||||||
return cursor
|
return cursor
|
||||||
|
|
||||||
def readDatafromBlockchain(cursor):
|
def readDatafromBlockchain(cursor):
|
||||||
text = []
|
text = []
|
||||||
cursor_data = readUnitFromBlockchain(cursor)
|
cursor_data = readUnitFromBlockchain(cursor)
|
||||||
print(cursor_data)
|
|
||||||
while(cursor_data[:5]=='next:'):
|
while(cursor_data[:5]=='next:'):
|
||||||
cursor = cursor_data[5:69]
|
cursor = cursor_data[5:69]
|
||||||
|
print("fetching this transaction->>"+cursor)
|
||||||
|
text.append(cursor_data[70:])
|
||||||
cursor_data = readUnitFromBlockchain(cursor)
|
cursor_data = readUnitFromBlockchain(cursor)
|
||||||
text.append(cursor_data[69:])
|
|
||||||
text.append(cursor_data)
|
text.append(cursor_data)
|
||||||
text=('').join(text)
|
|
||||||
print(text)
|
print(text)
|
||||||
|
text=('').join(text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
class GUI:
|
class GUI:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user