On page 20 of the Stellar Consensus Protocol white paper the specifics of calculating a weighting for other nodes, the neighbours of a node and the priority of another node are all described. Specifically:

neighbors(v, n) = {v' | G_{i} (N, n, v') < h_{max} * weight(v, v')}

and

priority(n, v') = G_{i}(P, n, v')

where v and v' are nodes, n is a slot number h_{max} is the maximum value of the hashing function used and G_{i}(P, n, v') and G_{i} (N, n, v') are two different hash functions. This is according to the paper, because they take in the two constants, N and P.

My question is what exactly are N and P and how are they created/calculated and how are they given to the hash function to produce different hash functions. If this is too general, assume we are using SHA-256 (as I believe the stellar-core does) and give an answer specifically for that.

up vote 1 down vote accepted

According to p.10 of the IETF draft about the Stellar Consensus Protocol, N=1 and P=2. Both are 32-bit XDR values.

The two hash functions are then SHA-256(1 || n || v) and SHA-256(2 || n || v), where "||" denotes the concatenation of serialized values.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.