Last active
January 14, 2023 16:10
-
-
Save WietseWind/fffe167163f29e53b04ba27fe3761b9b to your computer and use it in GitHub Desktop.
Generate ETH account from XRPL Secret Numbers (node)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {Account} = require('xrpl-secret-numbers') | |
const EthWallet = require('ethereumjs-wallet').default | |
const XrplAccount = new Account() // Empty = generate, input = derive | |
console.log(`\n Imported/generated account secret numbers\n `, | |
XrplAccount.getSecret().join(' ')) | |
console.log(`\n Imported/generated account address\n `, | |
XrplAccount.getAddress()) | |
console.log(`\n Imported/generated account family seed\n `, | |
XrplAccount.getFamilySeed()) | |
const XrplPkBuffer = Buffer.from(XrplAccount.getKeypair().privateKey, 'hex').slice(1) | |
const EthAccount = EthWallet.fromPrivateKey(XrplPkBuffer) | |
console.log(`\n ETH address\n `, | |
EthAccount.getAddressString()) | |
console.log(`\n ETH private key\n `, | |
EthAccount.getPrivateKeyString()) | |
console.log(`\n`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run: | |
# curl https://gist.githubusercontent.com/WietseWind/fffe167163f29e53b04ba27fe3761b9b/raw/install.sh | bash | |
cd /tmp | |
mkdir eth-secret-numbers | |
cd eth-secret-numbers | |
npm install xrpl-secret-numbers ethereumjs-wallet | |
curl https://gist.githubusercontent.com/WietseWind/fffe167163f29e53b04ba27fe3761b9b/raw/cb71ab99d1694b56560d58f5c0daeb9790aee851/index.js > index.js | |
node index.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment