diff --git a/README.md b/README.md index 602789c..de29bed 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Buidl.js -Buidl.js is a bitcoinjs-lib wrapper. - +Buidl.js is a bitcoinjs-lib wrapper. This is intended as a tool for developers, hobbyists and crypto-enthusiasts looking for an easy way to create bitcoin keys and build and sign transactions offline without having the hurdle of having to learn the bitcoinjs-lib library. Buidl.js is a simplified (and therefore less powerful) approach to pro grammatically working with bitcoin in javascript. It is NOT intended for production use -- it is 100% client-side javascript. # Usage 0. Save a copy of buidl.js or clone the repo @@ -28,8 +27,21 @@ Buidl.js is a bitcoinjs-lib wrapper. +3. Create key pair from sha256 hash of an input aka brainwallet -3. Get details of a private key + + + + + + + +4. Get details of a private key @@ -43,7 +55,7 @@ Buidl.js is a bitcoinjs-lib wrapper. -4. Build and sign a transaction +5. Build and sign a transaction * createTransaction(typei, txidi, outni, outputi, amounti, wifi, changeout, changeamt, inputvalue) @@ -62,8 +74,14 @@ Buidl.js is a bitcoinjs-lib wrapper. createTransaction("b", "34eceJ... > spending from p2wpk(bech32) createTransaction("3", "34eceJ..", 0, "1P5Ef7FsaD1KsJNSTUcACceEWN9vsUe3eN", 350000, "L1RLQhjuGoQ37QP4jfaEFTHMuEUeh4JdUDkx32xeafhnpzRMDMXD", null, null, 4000000) + + //returns {"signedtx":"894291f54d..."} +This function will return an object with the key "signedtx" which will contain the raw hex signed transaction that can now be broadcast to any node or API. + +See test.html for an example of using the `createTransaction()` function. + ## Additional Info diff --git a/buidl.js b/buidl.js index 83e416a..3f91225 100644 Binary files a/buidl.js and b/buidl.js differ diff --git a/create.js b/create.js index 4f2f561..a18dbd2 100644 --- a/create.js +++ b/create.js @@ -1,4 +1,6 @@ -const bitcoin = require("bitcoinjs-lib"); +let bitcoin = require("bitcoinjs-lib"); +bitcoin.bigi = require('bigi'); +bitcoin.Buffer = require('safe-buffer').Buffer; function createP2PKH(){ var NETWORK = bitcoin.networks.bitcoin; @@ -236,6 +238,8 @@ function createTransaction(typei, txidi, outni, outputi, amounti, wifi, changeou } + + module.exports = { createP2PKH, createP2WPKH, @@ -243,7 +247,8 @@ module.exports = { getNewAddress, getDetails, validateAddress, - createTransaction + createTransaction, + bitcoin } //binding functions to buidl diff --git a/test.html b/test.html index 206aaaa..28ab1ba 100644 --- a/test.html +++ b/test.html @@ -4,11 +4,77 @@ + + + + + + +

INPUT

+ + + + + + + + + + + + + +
TypeTransaction Hash/IDN OutInput Value
+

OUTPUT(S)

+ + + + + + + + + + + + + + +
AddressValue
+
+ +

WIF Private Key of Input

+ +
+ +
+ + \ No newline at end of file