How DelegateCall's edit funcionality works
Yesterday, DelegateCall was launched. Read the post to find out what it is and why it's important.
In this short post, I'll cover how the editing on that platform works and why it's not possible to edit comments or questions, but it is possible to edit answers.
When you post a question on DelegateCall, that question is stored in a transaction. That transaction goes into the DelegateCall dappchain, a small side-chain which is used only for this app. The transaction is bound to a specific user, as you can see in the image below taken from their blockchain explorer.
It is not possible to edit transactions on a blockchain, so the question is there forever. Editing it would be impossible because submitting a new question transaction would simply create a new question by that user. In order to be able to edit questions, the following implementation would be needed:
- Additional identifier for question ID in the transaction
- On editing a question, use the same ID, but change the question
- The UI web app (the interface of DelegateCall.com) would need to look at the question ID, and then show only the question with that ID from the newer transaction.
When you post an answer, because a single user can only have one answer for every question, when publishing it, you are creating a combination of (username=>question). So how is editing an answer possible?
When you click Edit on an answer and submit a changed one, this happens:
- The dappchain gets a new transaction with a (username=>question) identifier, but different post body.
- The UI (DelegateCall.com) then reads all the answers for the (username=>question) identifier and uses the newest one.
You didn't actually edit your answer, you merely published a new one which is being shown because it's fresher. This lets users implement versioning tools on top of DelegateCall - like Quora or StackOverflow, DelegateCall can also display different versions of an answer, because all prior versions are stored in the dappchain.
So what about comments? If you comment on DelegateCall, that is also written into the dappchain.
However, because a single user can have multiple comments on a single answer or question, it is not possible to apply the Answer method of updating here - the new edits would appear as new comments.
This is where I feel Loom made an architectural mistake. They should have used identifiers for comments and questions so that we can "edit" them by submitting new revisions. We'll see if they can change this somehow.