# README
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:
Unit tests
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
# Packages
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
New return a new bitcoind.
No description provided by the author
# Constants
estimatesmartfee mode https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/.
estimatesmartfee mode https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/.
estimatesmartfee mode https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/.
DEFAULT_RPCCLIENT_TIMEOUT represent http timeout for rcp client.
VERSION represents bicoind package version.
# Structs
A Bitcoind represents a Bitcoind client.
Represents a block.
See https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html.
No description provided by the author
Represents a verbose 2 block.
No description provided by the author
No description provided by the author
EstimateSmartFeeResult result for call estimatesmartfee https://bitcoincore.org/en/doc/0.16.0/rpc/util/estimatesmartfee/.
ImportDescriptorsCmd @see https://developer.bitcoin.org/reference/rpc/importdescriptors.html.
No description provided by the author
An Info represent a response to getmininginfo.
ListAddressResult represents a result composing ListAddressGroupings slice reply.
No description provided by the author
See https://developer.bitcoin.org/reference/rpc/getmempoolinfo.html.
A MiningInfo represents a mininginfo response.
No description provided by the author
See https://developer.bitcoin.org/reference/rpc/getnetworkinfo.html.
No description provided by the author
RawTx represents a raw transaction.
ReceivedByAccount represents how much coin a account have recieved.
ReceivedByAddress represents how much coin a account have recieved.
RPCError represents an error that is used as a part of a JSON-RPC Response object.
No description provided by the author
No description provided by the author
A ScriptSig represents a scriptsyg.
Transaction represents a transaction.
TransactionDetails represents details about a transaction.
TransactionOutSet represents statistics about the unspent transaction output database.
UnspendableOutput represents a unspendable (locked) output.
UTransactionOut represents a unspent transaction out (UTXO).
ValidateAddressResponse represents a response to "validateaddress" call.
No description provided by the author
Vin represent an IN value.
Vout represent an OUT value.
See https://developer.bitcoin.org/reference/rpc/getwalletinfo.html.
A Work represents a formatted hash data to work on.
# Type aliases
No description provided by the author
RPCErrorCode represents an error code to be used as a part of an RPCError which is in turn used in a JSON-RPC Response object.