mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-06 22:23:56 -05:00
* Vendor go-bip39 dependency locally to third_party/ The github.com/tyler-smith/go-bip39 repository has been deleted from GitHub but is still needed for BIP-39 mnemonic functionality in the validator wallet system. This change vendors v1.1.0 of the library into third_party/go-bip39/ to ensure continued availability. Changes: - Copy go-bip39 v1.1.0 source from Go module cache to third_party/go-bip39/ - Create BUILD.bazel files for main package and wordlists subpackage - Update 5 BUILD.bazel files to reference local vendored version instead of external dependency - Remove go-bip39 from go.mod and deps.bzl - All builds and tests pass successfully The vendored package includes all 9 language wordlists (English, Chinese Simplified/Traditional, Czech, French, Italian, Japanese, Korean, Spanish) and maintains the original import paths for compatibility. * Changelog fraagment * use go mod replace for vendored lib * Run gazelle --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
1.7 KiB
1.7 KiB
go-bip39
A golang implementation of the BIP0039 spec for mnemonic seeds
Example
package main
import (
"github.com/tyler-smith/go-bip39"
"github.com/tyler-smith/go-bip32"
"fmt"
)
func main(){
// Generate a mnemonic for memorization or user-friendly seeds
entropy, _ := bip39.NewEntropy(256)
mnemonic, _ := bip39.NewMnemonic(entropy)
// Generate a Bip32 HD wallet for the mnemonic and a user supplied password
seed := bip39.NewSeed(mnemonic, "Secret Passphrase")
masterKey, _ := bip32.NewMasterKey(seed)
publicKey := masterKey.PublicKey()
// Display mnemonic and keys
fmt.Println("Mnemonic: ", mnemonic)
fmt.Println("Master private key: ", masterKey)
fmt.Println("Master public key: ", publicKey)
}
Credits
Wordlists are from the bip39 spec.
Test vectors are from the standard Python BIP0039 implementation from the Trezor team: https://github.com/trezor/python-mnemonic