use github.com/tyler-smith/go-bip39 to generate mnemonic
252
docker run --rm --network none kumakichi/bip39:alpine-3.18
FROM golang:1.21.0-alpine3.18 as build
WORKDIR /app
COPY bip39.go .
COPY go.mod .
COPY go.sum .
RUN go build -ldflags="-s -w" -o bip39 bip39.go
FROM alpine:3.18
WORKDIR /app
COPY --from=build /app/bip39 .
CMD ["./bip39"]
package main
import (
"fmt"
"github.com/tyler-smith/go-bip39"
"github.com/tyler-smith/go-bip32"
)
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)
}
Content type
Image
Digest
sha256:1e2d7aca9…
Size
4.2 MB
Last updated
about 3 years ago
docker pull kumakichi/bip39:alpine-3.18