Split out of https://github.com/bitcoin/bitcoin/pull/30596/files#r1706957219
Instead of the static “bc” human-readable part, it’s now randomly generated based on https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki and the extra restrictions in the code:
The human-readable part, which is intended to convey the type of data, or anything else that is relevant to the reader. This part MUST contain 1 to 83 US-ASCII characters, with each character having a value in the range [33-126]. HRP validity may be further restricted by specific applications.
Since bech32::Encode
rejects uppercase letters, we’re actually generating values in the [33-126] - ['A'-'Z']
range.