You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.8 KiB
1.8 KiB
Harmony-SDK-Core
A Harmony's blockchain javascript library
It's a mono-repo library, not yet published to npm.
Packages
Usage
-
git clone and make sure you have
node.js
andyarn
installed -
cleanup and build
yarn install && yarn bootstrap && yarn dist
-
open folder
examples
andnode testNode.js
Example
** This package is not published to npm **
const { Account, Wallet } = require('@harmony/account');
const { isAddress, isPrivateKey, numberToHex } = require('@harmony/utils');
async function createAndEncrypt() {
const wallet = new Wallet();
const mne = wallet.generateMnemonic();
console.log('---hint: please write these down');
console.log(`${mne}`);
const newAcc = wallet.addByMnemonic(mne);
const password = '123456';
console.log('---hint: we use this dump password to encrypt, lol');
console.log(`${password}`);
await wallet.encryptAccount(newAcc.address, password);
console.log('---hint: Encrypting...');
console.log('---hint: Done!');
console.log('---hint: Your account address is:');
const encrypted = wallet.getAccount(newAcc.address);
console.log(`${encrypted.address}`);
console.log('---hint: here is your keyStore file:');
console.log(`${encrypted.privateKey}`);
}
createAndEncrypt();