diff options
-rw-r--r-- | 20210926_181912 | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/20210926_181912 b/20210926_181912 new file mode 100644 index 0000000..199a14c --- /dev/null +++ b/20210926_181912 @@ -0,0 +1,133 @@ +Message splitting +================= + +In the following, I am going to analyze in written text, as you already see, how can I slpit a chunk of text in parts and then take the parts and put them back. + +This is a practical problem I have. I want to utilize ARCHINGKAOS token, to put in a transaction the IPFS link of some data. Whether this is a clear text, or binary I don't care. + +My problem starts with the 46bytes strings that are used in IPFS. +The Stellar Network provides an ability to send a memo with each transaction which can handle up to 32bytes of information. + +A basic split could be for 46/2=23bytes +Then 32-23=9 + +46bytes: +a1a2a3a4a5a6a7a8a9a0b1b2b3b4b5b6b7b8b9b0c1c2c3 or +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa or +aaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaa which could be splitted +aaaaaaaaaaaaaaaaaaaaaab +baaaaaaaaaaaaaaaaaaaaaa + +32bytes: +cccccccccccccccccccccccccccccccc +cccccccccaaaaaaaaaaaaaaaaaaaaaab +cccccccccbaaaaaaaaaaaaaaaaaaaaaa + +One the 9bytes we firstly have to arrange which of the strings is first +For example: +cccccccc0aaaaaaaaaaaaaaaaaaaaaab +cccccccc1baaaaaaaaaaaaaaaaaaaaaa + +I only care for the ipfs link to be readable and searchable at the moment. If have a sender and a receiver and a link splitted in two. + +The rest of 8bytes could be used as any keycodes. Could also extend the protocol (cause I guess this is that I am doing here) to have up to 62^9 possibilites means could be used as array with for every transaction you permantly store part of information. + +A question is how do I glue them back? + +In our case we need the 0 and the 1. but again, let's say we send from some stellar address to another one. What's is happening. Person A sends and B receives. So, B gets 2 transaction with some info. However, our new friend, C, can also see the transaction and the memo. Can C assemble the info? Of course! There is a need for the joiner tool as well. + +We can mark with another byte in the start of 9bytes +sccccccc0 s as of start +mccccccc1 m as of middle in cases +eccccccc2 e as for ending enumerating of transactions + +Operating transaction data can be overwhelming at some point. If someone send two messages? and the get mixed up? What happens then? + +We have rest of the 7bytes not allocated to any task. We can define some more "rules" but which better than error detection or even better, correctness approval. + +In our previous message: +aaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaa we transformed to that +sccccccc0aaaaaaaaaaaaaaaaaaaaaab +eccccccc1baaaaaaaaaaaaaaaaaaaaaa + +We can use the last 7bytes of the splitted message aaaaaab and put in the 7byte area of the second half +However, this does not ensure the stability. Cause if lets say, there are a couple of data that can match, we will have an issue for any amount we then talk about lost data. + +How to validate? +2nd 1st +aaaaaaabbaaaaaaa|0aaaaaaaaaaaaaaa tx1 + +1st 2nd +0aaaaaaaaaaaaaaa|aaaaaaabbaaaaaaa tx2 + +2nd 3rd +aaaaaaabbaaaaaaa|aaaaaaaaaaaaaaa0 tx3 + +1st 3rd +0aaaaaaaaaaaaaaa|aaaaaaaaaaaaaaa0 tx4 + +If we are getting tx4 we can check all the 1st places, places in other transactions, in order to find the one string the we are making. Serialization of transactions is kept by Stellar Network. + +Now, we get the previous array or let's say the data we gathered from stellar network into simplified format: + + +aaaaaaabbaaaaaaa0aaaaaaaaaaaaaaa +aaaaaaabbaaaaaaa0caaaaaaaaaaaaaa +0aaaaaaaaaaaaaaaaaaaaaabbaaaaaaa +aaaaaaabbaaaaaaaaaaaaaaaaaaaaaa0 +0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0 +0caaaaaaaaaaaaaaaaaaaaabbaaaaaaa +aaaaaaabbaaaaaaaaaaaaaaaaaaaaaa0 +0caaaaaaaaaaaaaaaaaaaaaaaaaaaaa0 + + +21=we split [0]2|1 +12=we compare [1]1==[0]1 && [1]2==[0]2 +23=we compare 22 +13=we compare the 1==1 3==3 + + +for tx in txs +tx.memo get first 16bytes and last to an array of objects + +[ +{"aaaaaaabbaaaaaaa","0aaaaaaaaaaaaaaa"}, +{"aaaaaaabbaaaaaaa","0caaaaaaaaaaaaaa"}, +{"0aaaaaaaaaaaaaaa","aaaaaaabbaaaaaaa"}, +{"aaaaaaabbaaaaaaa","aaaaaaaaaaaaaaa0"}, +{"0aaaaaaaaaaaaaaa","aaaaaaaaaaaaaaa0"}, +{"0caaaaaaaaaaaaaa","aaaaaaabbaaaaaaa"}, +{"aaaaaaabbaaaaaaa","aaaaaaaaaaaaaaa0"}, +{"0caaaaaaaaaaaaaa","aaaaaaaaaaaaaaa0"} +] + +gathered[8] + +if ga[f][1]==ga[i][0] then keep an i the block has 2nd and 3rd parts +if ga[f][0]==ga[i][0] then keep an i the block has 3rd and 1st parts +if ga[f][1]==ga[i][1] then keep an i the block0 has 2nd and 1st parts +if ga[f][0]==ga[i][1] then keep an i the block its the 1st or 2nd block the other block has 1st or 3rd + +we have a block and we compare it with the next ones. + +Transactions that we look at are on the amount of 0.25ARCHINGKAOS +1 ARCHINGKAOS = 1 IPFS link transfer + +1. Gather transactions of 0.25ARCHINGKAOS in an array +2. Their memos are assumed to be part of messages +3. We find the pieces +4. We parse the message +5. We do stuff :) +: + + + + + + + + + + + + |