Skip to content

Instantly share code, notes, and snippets.

@davecgh
davecgh / example_txscript_signaturescript.go
Last active September 20, 2018 19:45
Example of signing a transaction using txscript.SignatureScript
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@davecgh
davecgh / btcd_pull_request_management.md
Last active September 20, 2018 19:43
Managing a btcd Pull Request for Code Contibutions

Initial Preparation

The first step is to read the Code Contribution Guidelines documentation to get a good understanding of policies used by the project

Once that is done, the following commands illustrate a straight forward setup for submitting pull requests to the project:

One time setup

  • Fork btcd on github
  • Run the following command to obtain btcd, all dependencies, and install it (this has probably already been done):
@davecgh
davecgh / build_btcd.sh
Created October 20, 2015 18:13
Shell script to build btcd with the git commit in the description.
#!/bin/sh
cd $GOPATH/src/github.com/btcsuite/btcd
go build -ldflags "-X main.appBuild=$(git describe)"
@davecgh
davecgh / commands.sh
Created January 31, 2016 22:21
Using OpenSSL To Generate a Wildcard Decred Certificate Pair
openssl ecparam -name secp521r1 -genkey -out dcrd.key
openssl req -new -x509 -key dcrd.key -out dcrd.cert -sha512 -days 3650 -extensions v3_req -config ./openssl.cnf
@davecgh
davecgh / hexseedtowords.go
Created February 10, 2016 21:46
Simple utility to convert DCR seed hex to seed words.
package main
import (
"encoding/hex"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/decred/dcrwallet/pgpwordlist"
@davecgh
davecgh / blocknotifybridge.go
Created February 20, 2016 06:19
Naive bridge to listen for blockconnected notifications and invoke an executable.
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"io/ioutil"
"log"
@davecgh
davecgh / masternode.conf
Created February 25, 2016 04:03
Example btcd config files for 8 node simnet network
rpcuser=youruser
rpcpass=SomeDecentp4ssw0rd
simnet=1
logdir=~/btcdsimnetnodes/master/log
datadir=~/btcdsimnetnodes/master/data
listen=127.0.0.1:18555
connect=127.0.0.1:18501
connect=127.0.0.1:18502
connect=127.0.0.1:18503
connect=127.0.0.1:18504
@davecgh
davecgh / mainnet_v4votebits.md
Last active May 5, 2017 09:36
Decred votebit combinations for mainnet v4 agendas.

The following table shows all of the valid combinations of votebits for the version 4 agendas on mainnet.

Vote Version 4

--votebits explorer OP_RETURN lnsupport sdiffalgo Previous Block Valid?
0 (0x00) OP_RETURN 000004000000 ABSTAIN ❓ ABSTAIN ❓ NO ❌
1 (0x01) OP_RETURN 010004000000 ABSTAIN ❓ ABSTAIN ❓ YES ✅
2 (0x02) OP_RETURN 020004000000 ABSTAIN ❓ NO ❌ NO ❌
@davecgh
davecgh / decred_example_txscript_step.go
Last active November 5, 2023 18:12
Example of stepping through a Decred script using the txscript API.
package main
import (
"encoding/hex"
"fmt"
"os"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/txscript/v4"
"github.com/decred/dcrd/wire"