Skip to content

How to create solana and other wallet? #4

Answered by heroims
Meshcoins asked this question in Q&A
Discussion options

You must be logged in to vote

You must use the official counterpart of the library.(e.g. Solana use solana-web3.js ,)

const bs58 = require("bs58")
const bip39 = require('bip39');
const nacl = require("tweetnacl") // nacl
const ed25519 = require('ed25519-hd-key')

const derivePath = "m/44'/501'/0'/0'"
const seed = bip39.mnemonicToSeedSync(mnemonic)
const derivedSeed = ed25519.derivePath(derivePath, seed.toString('hex')).key
const privateKey = bs58.encode(nacl.sign.keyPair.fromSeed(derivedSeed).secretKey)
const address = bs58.encode(nacl.sign.keyPair.fromSeed(derivedSeed).publicKey)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Meshcoins
Comment options

Answer selected by Meshcoins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants