Skip to content

toorop/go-bitcoind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9a2292b · Mar 20, 2024
Sep 23, 2023
May 9, 2022
Jan 12, 2015
May 8, 2014
Oct 5, 2023
Jan 2, 2024
May 18, 2014
Sep 23, 2023
Sep 18, 2023
Sep 23, 2023
Sep 23, 2023
Jul 5, 2019
Nov 24, 2019
Sep 23, 2023
May 20, 2014
May 20, 2014
Jul 8, 2019
Dec 27, 2018
May 1, 2022
May 21, 2014

Repository files navigation

bitcoind

A Golang client library wrapping the bitcoind JSON RPC API

Installation

$ go get github.com/toorop/go-bitcoind

Usage

package main

import (
	"github.com/toorop/go-bitcoind"
	"log"
)

const (
	SERVER_HOST        = "You server host"
	SERVER_PORT        = port (int)
	USER               = "user"
	PASSWD             = "passwd"
	USESSL             = false
	WALLET_PASSPHRASE  = "WalletPassphrase"
)

func main() {
	bc, err := bitcoind.New(SERVER_HOST, SERVER_PORT, USER, PASSWD, USESSL)
	if err != nil {
		log.Fatalln(err)
	}

	//walletpassphrase
	err = bc.WalletPassphrase(WALLET_PASSPHRASE, 3600)
	log.Println(err)

	// backupwallet
	err = bc.BackupWallet("/tmp/wallet.dat")
	log.Println(err)


	// dumpprivkey
	privKey, err := bc.DumpPrivKey("1KU5DX7jKECLxh1nYhmQ7CahY7GMNMVLP3")
	log.Println(err, privKey)

}

Mores examples in example.go (in examples folder)

Documentation

Click on the button below to access the full documentation:

GoDoc

Unit tests

Build Status

More than 100 unit tests are made.

To run tests:

$ go get github.com/onsi/ginkgo/ginkgo
$ go get github.com/onsi/gomega
$ ginkgo

Running Suite: Bitcoind Suite	
=============================
Random Seed: 1401120770
Will run 112 of 112 specs

•••••••••••••••••••••••••••••••••••
Ran 112 of 112 Specs in 0.001 seconds
SUCCESS! -- 112 Passed | 0 Failed | 0 Pending | 0 Skipped PASS

Ginkgo ran in 10.856335553s
Test Suite Passed

Todo

  • GetBlockTemplate
  • sendrawtransaction
  • signrawtransaction
  • submitblock
Note on SSL support

Note on ssl support : bitcoind library doesn't verify the server's certificate chain. That means that it accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks.

Donation

Donation QR

1HgpsmxV52eAjDcoNpVGpYEhGfgN7mM1JB

About

A Golang client library wrapping the bitcoind JSON RPC API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages