privateKey = bsv.PrivateKey.fromRandom();
- privateKey.toString();
publicKey = bsv.PublicKey.fromRandom(privateKey);
- publicKey.toString();
address = bsv.Address.fromPublicKey(publicKey);
- address.toString();
ciphertext = CryptoJS.AES.encrypt(privateKey.toString(), password).toString();
- Encrypted Key: cypertext.toString()
bytes = CryptoJS.AES.decrypt(ciphertext, password);
originalText = bytes.toString(CryptoJS.enc.Utf8);
- Decrypted Key: originalText.toString()
var addressCode = 'bitcoinsv:' + address;
new QRCode(document.getElementById("qrcode"), addressCode);
var config = {
method: 'get',
url: "https://api.whatsonchain.com/v1/bsv/main/exchangerate",
};
var config = {
method: 'get',
url: "https://api.whatsonchain.com/v1/bsv/main/address/" + address + "/balance",
};
- randomly generate a HD private key
- get the corresponding HD public key
- derive regular private and public keys from a HD key pair
hdPrivateKey = bsv.HDPrivateKey.fromRandom();
- hdPrivateKey.toString();
hdPublicKey = bsv.HDPublicKey(hdPrivateKey);
- hdPublicKey.toString();
publicKey1 = hdPublicKey.publicKey.toString();
privateKey1 = hdPrivateKey.privateKey.toString();
var hdPrivateKey = bsv.HDPrivateKey.fromString("{xprvkey}")
var privateKeyStandard = hdPrivateKey.deriveChild("m/44'/0'/0'");
var hdPublicKey = bsv.HDPublicKey.fromHDPrivateKey(privateKeyStandard);
var publicKey = hdPublicKey.publicKey;
var address = bsv.Address.fromPublicKey(publicKey);
- A Mnemonic Phrase, otherwise known as a bitcoin seed phrase.
- It is a list of words which store all the information needed to recover access to a bitcoin wallet.
var Mnemonic = window.bsvMnemonic;
var Mnemonic1 = Mnemonic.fromRandom();
<script type="text/javascript" src="https://unpkg.com/bsv@1.5.3/bsv.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/bsv@1.5.3/bsv-mnemonic.min.js"></script>
A Complete Wallet Workshop Project
This Project contains :
- Mnemonic Phrase (BIP 39)
- HD PrivateKey
- derivation path selection
- Private Key
- Public Key
- Address
- QR Code