Skip to content

Instantly share code, notes, and snippets.

View pinheadmz's full-sized avatar
🕺

Matthew Zipkin pinheadmz

🕺
  • port 8333
View GitHub Profile
'use strict';
const fs = require('fs');
const path = require('path');
const readline = require('readline');
(async () => {
const DIR = process.argv[2];
if (!DIR)
@pinheadmz
pinheadmz / bitcoind-regtest-taproot-address.md
Last active April 17, 2024 04:53
Use Bitcoin Core in regtest mode to generate a Taproot address

To start you need a master private key. For me, the easiest way to do this is with bcoin and its default wallet in regtest mode:

$ bwallet-cli mkwallet --mnemonic='zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' --id=zoo
$ bwallet-cli --id=zoo master
{
  "encrypted": false,
  "key": {
    "xprivkey": "tprv8ZgxMBicQKsPdCttbKDzsuDzypKyWMDfGbzR5YsQe3dnPg6B69PPEaxawUuaanULMtgA8Etd9DaqDVSEBSbScA9xTsdR8PRfPsJZwKS3dJQ"
  },

Claim a Handshake reserved name: ICANN TLD using HSM for DNSSEC signing (e.g. with CentralNic)

Demonstration with Bob Wallet: https://youtu.be/32Oi65rhdfE?t=886

  1. Install Bob Wallet https://bobwallet.io/
    • Must be at least version 0.9.0, due for release in November 2021
    • Launch Bob Wallet, it may take a few hours and around 20 GB of disk space to complete blockchain sync.
    • Create a new wallet one of two ways:
      • Let Bob generate seed phrase, you MUST write it down and keep that backup safe

bcoin v2.2.0 has been released!

Featuring bech32m support for sending to Taproot addresses.

https://github.com/bcoin-org/bcoin/releases/tag/v2.2.0

Be sure to read and understand the upgrade details in CHANGELOG

IF YOU USE THE ADDRESS INDEXER you will need to delete and rebuild that database, which could take 24-48 hours depending on your machine:

  • Stop bcoin (bcoin-cli rpc stop or ctrl-C)
'use strict';
const assert = require('assert');
const {SPVNode, Namestate, Rules, resource} = require('hsd');
const argv = process.argv;
assert(argv.length === 3, 'Usage:\n $ node zooko-spv.js <name>');
assert(Rules.verifyName(argv[2], 'Invalid name.'));
const nameHash = Rules.hashName(argv[2]);

Abstract

Introduce new covenant types and backwards-compatible rules for miners in order to collectively generate a deterministic yet unpredictable random value over a period of time. This scheme relies on the assumption that miners are diverse (decentralized) and are competitive against each other, not collaborating with each other.

TODO

'use strict';
const {NodeClient} = require('hs-client');
const {Network} = require('hsd');
const network = Network.get('main');
const clientOptions = {
network: network.type,
port: network.rpcPort
}
// USAGE: hsd --log-console=false --plugins=/path/to/this/file/expiring-plug.js
'use strict';
const {
Namestate,
Network
} = require('hsd');
const plugin = exports;
// USAGE: hsd --log-console=false --plugins=/path/to/this/file/addr-bal.js
'use strict';
const {CoinEntry} = require('hsd');
const layout = require('hsd/lib/blockchain/layout');
const plugin = exports;
class Plugin {
constructor(node) {
'use strict';
const {NodeClient} = require('hs-client');
const {Address, Network} = require('hsd');
const network = Network.get('main');
if (process.argv.length !== 3)
throw new Error('Usage:\n node transfer-address.js <NAME>');
const name = process.argv[2];