ERC-3450 BIP-39 Mnemonic Shamir Sharing Standard (Standardized Shamir Secret Sharing Scheme for BIP-39 Mnemonics)
Stagnant · Accounts & wallets · created 2021-03-29
A standardized Shamir's Secret Sharing scheme that splits a BIP-39 recovery mnemonic into N shares, requiring a minimum threshold (T) of them to reconstruct the original.
Why it is needed
A single mnemonic holds all access rights to an asset, so losing it means permanently losing the asset, and if it is stolen, anyone can take the asset. Shamir's Secret Sharing can solve this single point of failure problem, but without a standardized implementation, shares split with one tool risked being unrecoverable with another tool. If the tool disappears or changes, gathering all the shares would still fail to reconstruct the original. This standard unifies the procedure for applying Shamir's Secret Sharing to BIP-39 mnemonics, letting a user split the mnemonic into multiple shares, store them separately, discard the original, and later safely recover it with any compatible tool once enough shares are gathered.
In depth
The basic principle of Shamir's Secret Sharing
The secret is placed as the coefficient of x^0, and the remaining coefficients are generated randomly to form a degree T-1 polynomial f. Each share is a point on this polynomial: an integer x and its corresponding f(x) value. Once T points are gathered, polynomial interpolation can reconstruct the original polynomial, while fewer than T points reveal no information about the original at all.
Entropy and checksum of a BIP-39 mnemonic
BIP-39 represents 128 to 256 bits (ENT) of entropy as a word list. It appends the first ENT/32 bits of the SHA256 hash of the entropy as a checksum (CS), then splits the combined bits into 11-bit chunks to convert them into word indices ranging from 0 to 2047. For example, if ENT=128, then CS=4, and the full 132 bits become 12 words (MS). This standard supports only the English word list.
Applying Shamir at the entropy level
Before splitting a mnemonic, it is first converted into pure entropy with the checksum removed. This way, when each share's y value is converted back into a mnemonic, a new checksum can be computed, making the share itself a valid BIP-39 mnemonic. Shamir sharing is applied independently to each byte of the entropy, treating each byte as an element of the finite field GF(256). This uses arithmetic modulo the same Rijndael irreducible polynomial used in AES, x^8+x^4+x^3+x+1.
Share generation procedure
The inputs are the mnemonic, the number of shares N, and the threshold T, with the constraints 1<T<=N<256 and BIP-39 validity of the mnemonic checked. The entropy E (length n bytes) is obtained, and T-1 random byte vector coefficients are generated from a cryptographically secure uniform random source. Varying x from 1 to N, compute f(x)=E+coeff1*x+...+coeffT-1*x^(T-1), and use the result as the entropy to build each share's mnemonic.
Data composition of a share
A single share consists of two pieces of data: an ID (the polynomial's x value, 0<x<256) and a BIP-39 mnemonic (the y value at that x). An alternative of hiding the ID in the mnemonic's checksum position was considered, but this was not adopted because the checksum would then not match the entropy, preventing the share from being a valid BIP-39 mnemonic.
Recovery procedure and lack of validation
After recovering the entropy from each share's mnemonic, the Lagrange interpolation function Interpolate(0, {(x_i, y_i)}) is used to compute the original entropy E, which is then converted back into a mnemonic and returned. A procedure to verify whether the recovered result is correct was deliberately omitted, in order to prevent an attacker from being able to tell whether they have gathered T shares or not, thereby reducing information leakage.
Reason for choosing GF(256)
GF(256) was adopted because it is also used in AES, has many existing implementations across various languages, and is easy to work with. The alternative, GF(2048), could be applied directly to word indices, but the share's checksum would not match, so it would not be a valid mnemonic. A GF(2^n) sized to the full entropy was also considered, but was excluded because it would require a different field and irreducible polynomial for each mnemonic length, and large-number arithmetic would be cumbersome.
Proposal status
This proposal is in Stagnant status, meaning it has not yet been finalized as an official standard and is no longer being progressed.
Things to watch out for
- Risk of unrecoverability if a share's ID is lost: The ID must be stored together with the share's mnemonic. If the ID is lost or separated from the mnemonic, the original may become unrecoverable, and depending on how much is known about the number of shares and the threshold, brute-force recovery may or may not be possible.
- Risk of the ID hinting at the existence of other keys: ID data stored in addition to the mnemonic may hint to an attacker that other keys exist or that this sharing scheme is in use. For this reason, the ID should be stored in a way that obscures its purpose.