Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davecgh
davecgh / dcr_offline_multisig_p2sh_example.go
Created January 15, 2019 11:49
Sample code to create and sign an offline p2sh 2-of-3 multisig transaction given WIF-encoded private keys
package main
import (
"bytes"
"encoding/hex"
"fmt"
"github.com/decred/dcrd/chaincfg"
"github.com/decred/dcrd/dcrec/secp256k1"
"github.com/decred/dcrd/dcrutil"

Keybase proof

I hereby claim:

  • I am davecgh on github.
  • I am davecgh (https://keybase.io/davecgh) on keybase.
  • I have a public key ASBSTkEPsWT6fRYfeh8WTlJPI9PKZPklV8mH6nK9YIVjpwo

To claim this, I am signing this object:

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 dcrd on github
  • Run the following commands to obtain dcrd, all dependencies, and install it (this has probably already been done):
@davecgh
davecgh / dcrdsimnetsetup8nodes.sh
Last active November 13, 2018 06:25
Script to create a sample 8 node Decred simnet network
#!/bin/sh
set -e
SIMNET_NODES_ROOT=~/dcrdsimnetnodes
MASTERNODE_ADDR=127.0.0.1:19555
NODE1_ADDR=127.0.0.1:19501
NODE2_ADDR=127.0.0.1:19502
NODE3_ADDR=127.0.0.1:19503
NODE4_ADDR=127.0.0.1:19504
@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"
@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 / 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 / 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 / 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"