Sidetree Batch Size Limit and Proof of Payment
I would like to elaborate on why sidetree has a batch size limit and how the proof of payment works to combat a denial of service attack to the network. Each sidetree node (at least a full node) maintains a mongodb database to store all valid DID operations that are confirmed in the Bitcoin blockchain and written into IPFS. DID operations are basically json documents that contains a DID document and a sidetree operation type. When you think about it the mongodb store acts as a DID and DID document cache that improves the performance of sidetree fetch services. When resolving a DID Document given a DID, sidetree would just read a local database instead of a fetching data from Bitcoin network and IPFS every time. The mongodb store is also known as DID cache.
Suppose a malicious sidetree node wants to harm the network and tries to flood 100M protocol-adherent but bogus DID documents into sidetree network by sending 1M DID operations. Those operations gets queued in a single batch. The batch of operations gets successfully written into both Bitcoin and IPFS. Now all other good sidetree nodes sync their DID cache from Bitcoin and IPFS and now is 100M bigger, making the nodes to fetch slower due to cache size, or making the node unusable at all.
Suppose a malicious sidetree node wants to harm the network and tries to flood 100M protocol-adherent but bogus DID documents into sidetree network by sending 1M DID operations. Those operations gets queued in a single batch. The batch of operations gets successfully written into both Bitcoin and IPFS. Now all other good sidetree nodes sync their DID cache from Bitcoin and IPFS and now is 100M bigger, making the nodes to fetch slower due to cache size, or making the node unusable at all.
The first strategy to counter the attack is to add a batch size limit. This does not prevent the malicious nodes to spam Bitcoin and IPFS (since they can always remove limits from the code and build their own version of sidetree), but good nodes when syncing their DID cache will check first the batch size of a batch file before storing DID operations into the DID cache. Great, problem solved.
But the malicious node can still send multiple batches with the correct batch size limit. This led sidetree to add a more efficient solution, by introducing the proof of payment.
The proof of payment requires a sidetree node to pay a certain fee when writing N number of DID operations, where N is a configurable value. Technically this is implemented by providing a proof of fee to the batch file before writing it into Bitcoin and IPFS. This means that you have to pay more in order to write more. This makes the spamming not an economically viable option.
Comments
Post a Comment