Gustavo Silva

Bitcoin transaction with bitcoinlib-js

January 21, 2019 | 0 Minute Read

Intro

In this post I will cover step by step from creating a mnemonic to signing a transaction.

Dependencies

There are two main libraries bitcoinlib-js and bip 39.

Generate mnemonic

We are going to use the function generateMemonic from bip39.

import bip39 from 'bip39';

// mnemonic 12 words
var strength = 128;

// generate mnemonic
var mnemonic = bip39.generateMnemonic(strength);

console.log(mnemonic)
// => 'guilt balance hidden quiz obscure spend adult gas neutral snap hair arm'