The PoREP algorithm has changed from window SDR to SDR in a short time. The new PoREP algorithm NSE is already in the works. The full name of the NSE algorithm is: N arrow Straight E xpander PoRep. You can view the implementation of the NSE algorithm in the feat/nse branch of rust-fil-proofs . The last commit information of the source code used in this article is as follows: commit af4bdcb6da4b371230eed441218c459e99d32068 (HEAD -> feat/nse, origin/feat/nse) To understand the NSE algorithm, you can start with the replicate function of the NarrowStackedExpander structure in storage-proofs/porep/src/nse/vanilla/porep.rs. NSE is called NSE because N stands for Narrow. Narrow means that it is narrower than the previous SDR algorithm and each time the data is processed is a Window. Each Window will generate a corresponding Replica after layers of processing. The data of each layer corresponding to all Windows are constructed into a Merkle tree together. The data of the Replica corresponding to all Windows are also constructed into a Merkle tree together. The result of the Poseidon Hash of the roots of these two trees is used as comm_r. comm_d and comm_r are data that need to be uploaded to the chain. Each window needs to go through many layers of processing, which are divided into mask layer, expander layer, and butterfly layer. The core logic is in the encode_with_trees function in storage-proofs/porep/src/nse/vanilla/labels.rs. The configuration of the number of layers and some parameter configurations of Expander/Butterfly have not been determined. From the configuration of the test code : let num_windows = 1; Window is set to 1, expander's dependency is set to 384, and butterfly's dependency is 16. A total of 15 layers. Mask Layer Mask Layer has nothing to do with the specific data, but is related to the window number/node number: Expander Layer Expander Layer generates the data of the nodes in the upper layer based on ExpanderGraph. The sha256 result of these data and some numbering information is used as the data of the new node. The diagram is as follows: For the calculation of the parent node, please refer to the update_hash and next functions of the ExpanderGraphParentsIter structure in storage-proofs/porep/src/nse/vanilla/expander_graph.rs: pub struct ExpanderGraph { Simply put, the number of parents that each node depends on is degree*k. Parents are determined by the hash result of the node number and the parents sequence number. For the specific hash calculation logic, please see the batch_hash function in storage-proofs/porep/src/nse/vanilla/batch_hasher.rs. for (i, j) in (0..degree).tuples() { The name of batch hash comes from batch. Before hashing, k parents need to be added modularly, and then the result of the modular addition is hashed. Butterfly Layer The calculation of Butterfly Layer is similar to that of Expander Layer, the difference is the way to obtain Parents and the hash calculation method of Parents. The calculation of Parents depends on the implementation of ButterflyGraph: pub struct ButterflyGraph { A node in the Butterfly Layer depends on the nodes in the previous layer by degree. The calculation formula for each Parent number is: node + pos * factor Among them, node is the node number, pos is the Parents number, and factor is the coefficient (related to the layer number). This kind of dependency shape with fixed intervals is a bit like the stripes on a butterfly's wings, so it is called a butterfly layer. The hash calculation of all Parents is relatively simple, which is the hash value of all Parent data concatenated. // Compute hash of the parents. After the multi-layer processing is completed, the last bufferfly layer is encoded with the original data to generate the final Replica layer. The calculation process is to perform another bufferfly calculation based on the last bufferfly layer, and perform large number addition calculation on the result and the original data. For the detailed calculation process, please refer to the butterfly_encode_decode_layer function in storage-proofs/porep/src/nse/vanilla/labels.rs. Summarize: PoREP's NSE algorithm is another attempt at the SDR algorithm. It attempts to reduce the size of data processed in a single process (window), tries not to use the front-end and back-end dependencies of nodes (layer calculations can be parallelized), increases the dependency of a single layer, and increases the number of layers. The underlying layer of the entire algorithm still uses the sha256 algorithm. The NSE algorithm can be understood as an attempt to balance security and performance. Star Idea Technology changes the world Long press the QR code to follow me |
<<: XBIT Tao Maowen: Is there a future for blockchain games?
>>: Canaan Technology plans to distribute $12.4 million in stock as employee benefits
A person's marriage age can be completely see...
A person's face is actually divided into seve...
In the twelve palaces of physiognomy, the nose is...
When people interact with each other, they are mo...
In fact, having peach blossoms does not mean that...
Short chin idealist If a person has a short chin,...
In ancient times, willow-leaf eyebrows and peach ...
What does it mean to have a mole on your temple? ...
Decentralized peer-to-peer marketplace OpenBazaar...
How to read the lifeline on your hand? There are ...
If blockchain is the right direction, national bo...
Illustration of nose physiognomy, various noses f...
Love is like a mystery from the beginning. Who wi...
The quality of one's face is related to one...
What mistakes are you most likely to make? People...