Skip to content

Instantly share code, notes, and snippets.

@davecgh
davecgh / example_txscript_signtxoutput.go
Last active September 20, 2018 19:47
Example of signing a transaction using txscript.SignTxOutput.
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 / p2sh_multisig_manual.go
Last active September 20, 2018 19:49
P2SH Multisig Manual
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcutil"
. "github.com/btcsuite/btcd/txscript"
)
@davecgh
davecgh / p2sh_pubkey.go
Last active September 20, 2018 19:49
P2SH Pubkey
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcutil"
. "github.com/btcsuite/btcd/txscript"
)

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:

@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 / 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 / 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"
@davecgh
davecgh / example_txscript_step.go
Last active March 8, 2019 07:01
Example of stepping through a script using the txscript API.
package main
import (
"encoding/hex"
"fmt"
"os"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davecgh
davecgh / btcdwstest.html
Last active July 29, 2020 10:16
btcd Browser Websocket Connection Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = 'wss://127.0.0.1:8334/ws';
var rpcUser = "rpcuser";
var rpcPass = "rpcpass";