Skip to content

Instantly share code, notes, and snippets.

View pierrenoizat's full-sized avatar

Pierre Noizat pierrenoizat

View GitHub Profile
@pierrenoizat
pierrenoizat / eth_address_generator.rb
Last active February 22, 2022 20:43
Generate your eth address and private key from mnemonic passphrase
require 'bitcoin'
require 'money-tree'
require 'eth'
require 'bip44'
require 'bip_mnemonic'
require 'bip44/utils'
require 'bip44/bitcoin'
require 'bip44/ethereum'
require 'bip44/wallet'
@pierrenoizat
pierrenoizat / p2sh_p2wsh.rb
Last active November 16, 2020 08:47
Generate a P2SH-P2WSH address, create a tx spending from it.
require 'bitcoin'
include Bitcoin
include Bitcoin::Builder
include Bitcoin::Protocol
include Bitcoin::Util
include Bitcoin::Secp256k1
base_factor = 100000000
mnemonic = "beyond .. satoshi"
seed = BipMnemonic.to_seed(mnemonic: mnemonic)
require 'bitcoin'
require 'money-tree'
require 'bip44'
require 'bech32'
include Bitcoin
include Bitcoin::Builder
include Bitcoin::Protocol
include Bitcoin::Util
include Bitcoin::Secp256k1
@pierrenoizat
pierrenoizat / native_p2wpkh.rb
Last active February 3, 2022 17:00
Build a Segwit transaction spending a Segwit native P2WPKH utxo and another (standard) transaction funding a native P2WPKH Segwit address
require 'bitcoin'
require 'money-tree'
require 'bip44'
require 'bech32'
include Bitcoin
include Bitcoin::Builder
include Bitcoin::Protocol
include Bitcoin::Util
include Bitcoin::Secp256k1
0x6517D80AA1369316
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFi55M0BEADfqA0//Fr91yMaTJPnBrMF2eoV4RPjRyO3UeZWKkduErJMzlLA
aYqkQYOOimU+h8WQXj2IJ2/ieBt8mf9qYbP7v3zGsGW2IYNIs3xAOWCGBttVwTCj
4TnoMLtbNtZXkAgfzSzh2ixjZkDz8zcNeHPEBxcLFnUTqy+YF78T9M9pYz1bUN2z
yF+a2w3GhAm2PwdDboyKCfgoGJDO5Aw6fiuJ610mR/lBOjQ/TWuHEg3HQRbQcK0y
gJ9vRLaeC1IXarznpmCFwooRbCrLuOX4GbRoN3khXsOkdYDz2zECVihMNnAg56Ry
b5Nl8jGGPfJgZWBnj8oF/cpJkoZhVXVFKtF0CRvuBlsyi/EKIUSJZ6RuhIWF445l
574EUUR9TLdV94r5DnS3bZYhXI0FCnbJKWgTDTTCz9toTwMppqd/EGNGnmnAE56b
@pierrenoizat
pierrenoizat / p2sh_p2wpkh.rb
Last active December 16, 2021 09:26
Generate Segwit P2SH-P2WPKH address, create tx spending from it.
require 'bitcoin'
include Bitcoin
include Bitcoin::Builder
include Bitcoin::Protocol
include Bitcoin::Util
include Bitcoin::Secp256k1
# Compute P2SH-P2WPKH address:
@pierrenoizat
pierrenoizat / drawkey.js
Last active August 29, 2015 14:15
Generate a Bitcoin private key and its colorful SVG image.
/*!
* Random private key generator with colorful SVG representation
* This gist uses the excellent D3 javascript data visualization library, http://d3js.org
* Download D3 or copy this snippet to your html code <script src="http://d3js.org/d3.v3.min.js" charset="utf-8">
*
* Copyright Pierre Noizat, http://www.e-ducat.fr, DWTFYW License.
*/
var dataset = [];
var str = "";