### Install rpcclient Package Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincoreunixsocket/README.md Use `go get` to download and install the rpcclient package before running the example. ```bash go get github.com/btcsuite/btcd/rpcclient ``` -------------------------------- ### Install rpcclient Package Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincorehttp/README.md Use `go get` to download and install the rpcclient package before running the example. ```bash $ go get github.com/btcsuite/btcd/rpcclient ``` -------------------------------- ### Run Bitcoin Core HTTP Example Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincorehttp/README.md Navigate to the example's directory and execute the `go run` command to start the example. ```bash $ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp $ go run *.go ``` -------------------------------- ### Run the btcwallet Websockets Example Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/btcwalletwebsockets/README.md Navigate to the example's directory and execute the `go run` command to start the application. ```bash cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcwalletwebsockets go run *.go ``` -------------------------------- ### Install rpcclient Package Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/README.md Use 'go get' to install the latest version of the rpcclient package. ```bash go get -u github.com/btcsuite/btcd/rpcclient ``` -------------------------------- ### Install and Update Package Source: https://github.com/btcsuite/btcd/blob/master/wire/README.md Use 'go get' to install or update the wire package to the latest version. ```bash $ go get -u github.com/btcsuite/btcd/wire/v2 ``` -------------------------------- ### Install and Update Database Package Source: https://github.com/btcsuite/btcd/blob/master/database/README.md Use 'go get -u' to install or update the database package. ```bash go get -u github.com/btcsuite/btcd/database ``` -------------------------------- ### Install and Update btcjson Source: https://github.com/btcsuite/btcd/blob/master/btcjson/README.md Use go get to install or update the btcjson package. ```bash $ go get -u github.com/btcsuite/btcd/btcjson ``` -------------------------------- ### Run the Example Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincoreunixsocket/README.md Navigate to the example's directory and execute the Go program using `go run`. ```bash cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp go run *.go ``` -------------------------------- ### Install btcd from Source Source: https://github.com/btcsuite/btcd/blob/master/README.md Obtain btcd, its dependencies, and install it by navigating to the source directory and running the go install command. Ensure GOPATH/bin is in your system's PATH. ```bash $ cd $GOPATH/src/github.com/btcsuite/btcd $ go install -v . ./cmd/... ``` -------------------------------- ### Install Blockchain Indexers Source: https://github.com/btcsuite/btcd/blob/master/blockchain/indexers/README.md Use 'go get' to install the indexers package. This command ensures you have the latest version. ```bash go get -u github.com/btcsuite/btcd/blockchain/indexers ``` -------------------------------- ### Run the Btcd Websockets Example Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/btcdwebsockets/README.md Navigate to the example's directory and execute the `go run` command. ```bash $ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcdwebsockets $ go run *.go ``` -------------------------------- ### Install base58 Package Source: https://github.com/btcsuite/btcd/blob/master/address/base58/README.md Use 'go get' to install or update the base58 package. This command fetches the latest version and makes it available for your Go projects. ```bash go get -u github.com/btcsuite/btcd/address/v2/base58 ``` -------------------------------- ### Install and Update Netsync Package Source: https://github.com/btcsuite/btcd/blob/master/netsync/README.md Use 'go get' to install or update the netsync package. This command fetches the latest version and makes it available for your Go projects. ```bash go get -u github.com/btcsuite/btcd/netsync ``` -------------------------------- ### Example Version Return Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md An example of the expected JSON response when querying the 'version' RPC method. ```json { "btcdjsonrpcapi": { "versionstring": "1.0.0", "major": 1, "minor": 0, "patch": 0, "prerelease": "", "buildmetadata": "" } } ``` -------------------------------- ### Run the Custom Command Example Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/customcommand/README.md Navigate to the example's directory and execute the Go program. This will run the custom command logic. ```bash $ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/customcommand $ go run *.go ``` -------------------------------- ### Install and Update Blockchain Package Source: https://github.com/btcsuite/btcd/blob/master/blockchain/README.md Use 'go get' to install or update the blockchain package. This command ensures you have the latest version. ```bash go get -u github.com/btcsuite/btcd/blockchain ``` -------------------------------- ### Obtain and Install btcd Source: https://github.com/btcsuite/btcd/blob/master/docs/installation.md Clone the btcd repository, install all dependencies, and build/install the btcd binary and its command-line utilities. Ensure GOPATH is set correctly. ```bash git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd cd $GOPATH/src/github.com/btcsuite/btcd go install -v . ./cmd/... ``` -------------------------------- ### Get Block Information Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Example return for the getblock method, showing details of a specific block. ```json { "hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", "confirmations": 277113, "size": 285, "height": 0, "version": 1, "merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "tx": [ "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" ], "time": 1231006505, "nonce": 2083236893, "bits": "1d00ffff", "difficulty": 1, "previousblockhash": "0000000000000000000000000000000000000000000000000000000000000000", "nextblockhash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048" } ``` -------------------------------- ### Install btcutil/coinset Source: https://github.com/btcsuite/btcd/blob/master/btcutil/coinset/README.md Use this command to install or update the coinset package. ```bash go get -u github.com/btcsuite/btcd/btcutil/coinset ``` -------------------------------- ### Install Bech32 Package Source: https://github.com/btcsuite/btcd/blob/master/address/bech32/README.md Use 'go get' to install or update the bech32 package. This command fetches the latest version and makes it available for your Go projects. ```bash go get -u github.com/btcsuite/btcd/address/v2/bech32 ``` -------------------------------- ### Get Block Hash Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Example return value for the getblockhash method, showing a block hash for a given height. ```string 000000000000000096579458d1c0f1531fcfc58d57b4fce51eb177d8d10e784d ``` -------------------------------- ### Verify Go Installation Source: https://github.com/btcsuite/btcd/blob/master/README.md Verify that Go is installed and check the supported version. Ensure GOROOT and GOPATH are set correctly and are not the same. ```bash $ go version $ go env GOROOT GOPATH ``` -------------------------------- ### Check Go Installation Source: https://github.com/btcsuite/btcd/blob/master/docs/installation.md Verify that Go is installed and check its version and environment variables. Ensure Go 1.25 or newer is used. ```bash go version ``` ```bash go env GOROOT GOPATH ``` -------------------------------- ### Install and Update Chaincfg Package Source: https://github.com/btcsuite/btcd/blob/master/chaincfg/README.md Command to install or update the chaincfg package using go get. ```bash go get -u github.com/btcsuite/btcd/chaincfg/v2 ``` -------------------------------- ### Install and Update btcutil/txsort Source: https://github.com/btcsuite/btcd/blob/master/btcutil/txsort/README.md Use this command to install the package or update it to the latest version. ```bash go get -u github.com/btcsuite/btcd/btcutil/v2/txsort ``` -------------------------------- ### Install and Update CPUMiner Package Source: https://github.com/btcsuite/btcd/blob/master/mining/cpuminer/README.md Use this command to install or update the cpuminer package. It is recommended to use the go get command for managing dependencies. ```bash $ go get -u github.com/btcsuite/btcd/mining/cpuminer ``` -------------------------------- ### Install btcutil/bloom Package Source: https://github.com/btcsuite/btcd/blob/master/btcutil/bloom/README.md Use this command to install or update the bloom filter package. ```bash $ go get -u github.com/btcsuite/btcd/btcutil/v2/bloom ``` -------------------------------- ### Get Transaction Details (Example) Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This is an example JSON object representing the details of a transaction, including transaction ID, version, locktime, inputs (vin), and outputs (vout). It shows formats for both coinbase and non-coinbase transactions. ```json { "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "version": 1, "locktime": 0, "vin": [ { "coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6...", "sequence": 4294967295 }, { "txid": "60ac4b057247b3d0b9a8173de56b5e1be8c1d1da970511c626ef53706c66be04", "vout": 0, "scriptSig": { "asm": "3046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f0...", "hex": "493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8..." }, "sequence": 4294967295 } ], "vout": [ { "value": 50, "n": 0, "scriptPubKey": { "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce...", "hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4...", "reqSigs": 1, "type": "pubkey", "addresses": [ "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" ] } } ] } ``` -------------------------------- ### Install and Update txscript Source: https://github.com/btcsuite/btcd/blob/master/txscript/README.md Use this command to install or update the txscript package to the latest version. ```bash go get -u github.com/btcsuite/btcd/txscript/v2 ``` -------------------------------- ### Run btcd Source: https://github.com/btcsuite/btcd/blob/master/README.md Start the btcd daemon. Basic operations work with zero configuration. ```bash ./btcd ``` -------------------------------- ### Install btcutil Package Source: https://github.com/btcsuite/btcd/blob/master/btcutil/README.md Use this command to install or update the btcutil package to the latest version. ```bash go get -u github.com/btcsuite/btcd/btcutil/v2 ``` -------------------------------- ### Install and Update Mining Package Source: https://github.com/btcsuite/btcd/blob/master/mining/README.md Use this command to install or update the mining package. Ensure you are using Go modules. ```bash go get -u github.com/btcsuite/btcd/mining ``` -------------------------------- ### Install and Update rpctest Package Source: https://github.com/btcsuite/btcd/blob/master/integration/rpctest/README.md Use this command to install or update the rpctest package to the latest version. ```bash go get -u github.com/btcsuite/btcd/integration/rpctest ``` -------------------------------- ### Example GetHeaders Return Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md An example of the expected JSON response when querying the 'getheaders' RPC method, containing block header hashes. ```json [ "0000002099417930b2ae09feda10e38b58c0f6bb44b4d60fa33f0e000000000000000000d53...", "000000203ba25a173bfd24d09e0c76002a910b685ca297bd09a17b020000000000000000702..." ] ``` -------------------------------- ### Install Chainhash Package Source: https://github.com/btcsuite/btcd/blob/master/chainhash/README.md Use this command to install or update the chainhash package to the latest version. ```bash go get -u github.com/btcsuite/btcd/chainhash/v2 ``` -------------------------------- ### Function Commenting: RIGHT Example Source: https://github.com/btcsuite/btcd/blob/master/docs/code_contribution_guidelines.md Demonstrates a comprehensive function comment that explains the purpose, assumptions, and internal representation details. ```Go // CompactToBig converts a compact representation of a whole number N to a // big integer. The representation is similar to IEEE754 floating point // numbers. // // Like IEEE754 floating point, there are three basic components: the sign, // the exponent, and the mantissa. They are broken out as follows: // // * the most significant 8 bits represent the unsigned base 256 exponent // * bit 23 (the 24th bit) represents the sign bit // * the least significant 23 bits represent the mantissa // // ------------------------------------------------- // | Exponent | Sign | Mantissa | // ------------------------------------------------- // | 8 bits [31-24] | 1 bit [23] | 23 bits [22-00] | // ------------------------------------------------- // // The formula to calculate N is: // N = (-1^sign) * mantissa * 256^(exponent-3) // // This compact form is only used in bitcoin to encode unsigned 256-bit numbers // which represent difficulty targets, thus there really is not a need for a // sign bit, but it is implemented here to stay consistent with bitcoind. func CompactToBig(compact uint32) *big.Int { ``` -------------------------------- ### Install and Update Mempool Package Source: https://github.com/btcsuite/btcd/blob/master/mempool/README.md Use this command to install or update the mempool package to the latest version. ```bash go get -u github.com/btcsuite/btcd/mempool ``` -------------------------------- ### Install and Update hdkeychain Package Source: https://github.com/btcsuite/btcd/blob/master/btcutil/hdkeychain/README.md Use this command to install or update the hdkeychain package to the latest version. ```bash go get -u github.com/btcsuite/btcd/btcutil/v2/hdkeychain ``` -------------------------------- ### Install and Update Full Block Tests Package Source: https://github.com/btcsuite/btcd/blob/master/blockchain/fullblocktests/README.md Use this command to install or update the fullblocktests package. It ensures you have the latest version for testing. ```bash go get -u github.com/btcsuite/btcd/blockchain/fullblocktests ``` -------------------------------- ### Get Help for a Command Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Returns help text for a specified command or a list of all available commands if no command is specified. ```text help Returns a list of all commands or help for a specified command. When no command parameter is specified, a list of available commands is returned When command is a valid method, the help text for that method is returned. ``` -------------------------------- ### Format for CHANGES file entries Source: https://github.com/btcsuite/btcd/blob/master/release/README.md This is an example of how to format entries in the CHANGES file for a new release. It includes categorizing changes and listing contributors. ```markdown Changes in X.YY.Z (Month Day Year): - Protocol and Network-related changes: - PR Title One (#PRNUM) - PR Title Two (#PRNUMTWO) ... - RPC changes: - Crypto changes: ... - Contributors (alphabetical order): - Contributor A - Contributor B - Contributor C ... ``` -------------------------------- ### Update btcd and Dependencies Source: https://github.com/btcsuite/btcd/blob/master/docs/update.md Run these commands in your terminal to update the btcd project, fetch all dependencies, and install the updated binaries. ```bash cd $GOPATH/src/github.com/btcsuite/btcd git pull && go install -v . ./cmd/... ``` -------------------------------- ### Function Commenting: WRONG Example Source: https://github.com/btcsuite/btcd/blob/master/docs/code_contribution_guidelines.md Illustrates an insufficient function comment that lacks detail about its purpose and assumptions. ```Go // convert a compact uint32 to big.Int func CompactToBig(compact uint32) *big.Int { ``` -------------------------------- ### Configure Mining Software URL with HTTPS Source: https://github.com/btcsuite/btcd/blob/master/docs/mining.md Example of setting the mining software URL to use HTTPS for connecting to the btcd RPC server. ```bash cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword ``` -------------------------------- ### Inline Comment: RIGHT Example Source: https://github.com/btcsuite/btcd/blob/master/docs/code_contribution_guidelines.md Demonstrates an effective inline comment that explains the intention or reasoning behind a piece of code, such as why a specific threshold is used. ```Go // Treat transactions with amounts less than the amount which is considered dust // as non-standard. if amt < 5460 { return err } ``` -------------------------------- ### Get Block Count Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Example return value for the getblockcount method, indicating the total number of blocks. ```numeric 276820 ``` -------------------------------- ### Sample Use of Chain Configuration Parameters Source: https://github.com/btcsuite/btcd/blob/master/chaincfg/README.md Demonstrates how to use chain configuration parameters to create a payment address specific to the active network (mainnet or testnet). ```Go package main import ( "flag" "fmt" "log" "github.com/btcsuite/btcd/btcutil/v2" "github.com/btcsuite/btcd/chaincfg/v2" ) var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network") // By default (without -testnet), use mainnet. var chainParams = &chaincfg.MainNetParams func main() { flag.Parse() // Modify active network parameters if operating on testnet. if *testnet { chainParams = &chaincfg.TestNet3Params } // later... // Create and print new payment address, specific to the active network. pubKeyHash := make([]byte, 20) addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, chainParams) if err != nil { log.Fatal(err) } fmt.Println(addr) } ``` -------------------------------- ### Build Release Binaries from Source Source: https://github.com/btcsuite/btcd/blob/master/release/README.md Compile the release binaries from source for a specific operating system and architecture using the release script. Ensure the GO_VERSION environment variable matches the release. ```bash BTCDBUILDSYS=OS-ARCH ./release/release.sh ``` -------------------------------- ### Get Raw Transaction Example (Verbose=0) Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This is an example of a raw transaction hex string returned by the getrawtransaction RPC method when verbose is set to 0. Newlines are added for display purposes only. ```text 010000000104be666c7053ef26c6110597dad1c1e81b5e6be53d17a8b9d0b34772054bac60000000 008c493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f 022100fbce8d84fcf2839127605818ac6c3e7a1531ebc69277c504599289fb1e9058df0141045a33 76eeb85e494330b03c1791619d53327441002832f4bd618fd9efa9e644d242d5e1145cb9c2f71965 656e276633d4ff1a6db5e7153a0a9042745178ebe0f5ffffffff0280841e00000000001976a91406 f1b6703d3f56427bfcfd372f952d50d04b64bd88ac4dd52700000000001976a9146b63f291c295ee abd9aee6be193ab2d019e7ea7088ac00000000 ``` -------------------------------- ### Get Block Headers (getheaders) Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Fetches block headers starting from a list of known block hashes. The 'hashstop' parameter specifies the last desired block hash. ```json { "method": "getheaders", "params": [["00000000000000000005d7c810040731077031e513330611000000000000000000000000000000000", "0000002099417930b2ae09feda10e38b58c0f6bb44b4d60fa33f0e000000000000000000d53..."], "00000000000000000005d7c810040731077031e513330611000000000000000000000000000000000"] } ``` -------------------------------- ### Display btcctl Help Source: https://github.com/btcsuite/btcd/blob/master/docs/controlling.md Run the btcctl command with the --help flag to view all available options and commands. This is useful for discovering the utility's capabilities. ```bash $ btcctl --help ``` -------------------------------- ### Create and Use a Bloom Filter Source: https://github.com/btcsuite/btcd/blob/master/btcutil/bloom/README.md Demonstrates how to create a new bloom filter, add a transaction hash to it, and check if the filter matches the transaction. ```go package main import ( "fmt" "github.com/btcsuite/btcd/btcutil/bloom" "github.com/btcsuite/btcd/chaincfg/chainhash" ) func main() { // Create a new bloom filter with default parameters. filter := bloom.New(1000, 0.001) // Create a dummy transaction hash. var txHash chainhash.Hash copy(txHash[:], "some_transaction_hash") // Add the transaction hash to the filter. filter.Add(&txHash) // Check if the filter matches the transaction hash. matches := filter.Match(&txHash) fmt.Printf("Does the filter match the transaction hash? %t\n", matches) } ``` -------------------------------- ### Configure RPC Credentials Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincorehttp/README.md Modify the `main.go` source to include your Bitcoin Core RPC username and password. ```go User: "yourrpcuser", Pass: "yourrpcpass", ``` -------------------------------- ### Received Transaction Notification Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This example shows a 'recvtx' notification for the same transaction output as the 'redeemingtx' example, but after the spending transaction has been mined into a block. It includes block details such as height, hash, index, and time. ```json { "jsonrpc": "1.0", "method": "recvtx", "params": [ "0100000003ad3fba7ebd67c09baa9538898e10d6726dcb8eadb006be0c7388c8e46d69d3610000000...", { "height": 279143, "hash": "00000000000000017188b968a371bab95aa43522665353b646e41865abae02a4", "index": 6, "time": 1389115004 } ], "id": null } ``` -------------------------------- ### Configure RPC Credentials Source: https://github.com/btcsuite/btcd/blob/master/rpcclient/examples/bitcoincoreunixsocket/README.md Modify the `main.go` source to include your Bitcoin Core RPC username and password. ```go User: "yourrpcuser", Pass: "yourrpcpass", ``` -------------------------------- ### Import GPG Key Source: https://github.com/btcsuite/btcd/blob/master/chainhash/README.md Import the Conformal public GPG key into your keyring to verify release signatures. ```bash gpg --import GIT-GPG-KEY-conformal.txt ``` -------------------------------- ### help Source: https://github.com/btcsuite/btcd/wiki/Bitcoind-RPC-Parity Returns a list of all commands, or a detailed description of a specific command. ```APIDOC ## help ### Description Returns a list of all commands, or a detailed description of a specific command. ### Method RPC ### Endpoint help ### Parameters - **command** (string, optional) - The name of the command to get help for. ### Request Example ```json { "method": "help", "params": ["getmininginfo"] } ``` ### Response #### Success Response (200) - **Example**: "getmininginfo\nReturns a json object containing mining-related information.\n" ``` -------------------------------- ### Marshal Command Source: https://github.com/btcsuite/btcd/blob/master/btcjson/README.md Demonstrates creating and marshalling a command into a JSON-RPC request. ```go package main import ( "encoding/json" "fmt" "github.com/btcsuite/btcd/btcjson" ) func main() { // Create a new getinfo request. getCmd := btcjson.NewGetInfoCmd() // Marshal the command into a JSON-RPC request. // The second argument is the ID to use for the request. // The third argument is the JSON-RPC version to use. jsonRequest, err := json.Marshal(btcjson.NewRequest(getCmd, 1, btcjson.JSONRPCVersion10)) if err != nil { fmt.Println("Error marshalling request:", err) return } fmt.Println(string(jsonRequest)) } ``` -------------------------------- ### Create ffldb Database Source: https://github.com/btcsuite/btcd/blob/master/database/ffldb/README.md Creates a new ffldb database at the specified path. Use this when initializing a new database. ```Go db, err := database.Create("ffldb", "path/to/database", wire.MainNet) if err != nil { // Handle error } ``` -------------------------------- ### Specify RPC Listen Interfaces Source: https://github.com/btcsuite/btcd/blob/master/docs/configuration.md These examples demonstrate various ways to specify RPC listen interfaces using command-line flags. You can bind to all IPv4, all IPv6, specific ports, or combinations thereof. The `--rpclisten` flag can be used multiple times to specify multiple interfaces. ```bash --rpclisten= ``` ```bash --rpclisten=0.0.0.0 ``` ```bash --rpclisten=:: ``` ```bash --rpclisten=:8334 ``` ```bash --rpclisten=0.0.0.0:8334 ``` ```bash --rpclisten=[::]:8334 ``` ```bash --rpclisten=127.0.0.1:8334 ``` ```bash --rpclisten=[::1]:8334 ``` ```bash --rpclisten=:8336 ``` ```bash --rpclisten=0.0.0.0:8336 ``` ```bash --rpclisten=[::]:8336 ``` ```bash --rpclisten=127.0.0.1:8337 --listen=[::1]:8334 ``` ```bash --rpclisten=:8334 --listen=:8337 ``` -------------------------------- ### Install and Update connmgr Package Source: https://github.com/btcsuite/btcd/blob/master/connmgr/README.md Use this command to install or update the connmgr package to the latest version. ```bash go get -u github.com/btcsuite/btcd/connmgr ``` -------------------------------- ### help Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md Returns a list of all commands or help for a specified command. When no 'command' parameter is specified, a list of available commands is returned. When 'command' is a valid method, the help text for that method is returned. ```APIDOC ## help ### Description Returns a list of all commands or help for a specified command. When no `command` parameter is specified, a list of available commands is returned. When `command` is a valid method, the help text for that method is returned. ### Parameters #### Query Parameters - **command** (string, optional) - the command to get help for ### Returns string ### Example Return getblockcount Returns a numeric for the number of blocks in the longest block chain. ``` -------------------------------- ### Import bootstrap.dat on Windows Source: https://github.com/btcsuite/btcd/blob/master/docs/configuration.md Use the addblock utility with the -i argument to import bootstrap.dat on Windows. Ensure btcd is stopped before running this command. ```bat "%PROGRAMFILES%\Btcd Suite\Btcd\addblock" -i C:\Path\To\bootstrap.dat ``` -------------------------------- ### Update btcd from Source Source: https://github.com/btcsuite/btcd/blob/master/README.md Update btcd and its dependencies by pulling the latest changes from the repository and then running the go install command. Ensure GOPATH/bin is in your system's PATH. ```bash $ cd $GOPATH/src/github.com/btcsuite/btcd $ git pull $ go install -v . ./cmd/... ``` -------------------------------- ### Install and Update gcs Package Source: https://github.com/btcsuite/btcd/blob/master/btcutil/gcs/README.md Use this command to install or update the gcs package to the latest version. Ensure you are using Go modules. ```bash go get -u github.com/btcsuite/btcd/btcutil/v2/gcs ``` -------------------------------- ### Import bootstrap.dat on Linux/Unix/BSD/POSIX Source: https://github.com/btcsuite/btcd/blob/master/docs/configuration.md Use the addblock utility with the -i argument to import bootstrap.dat on POSIX-compliant systems. Ensure btcd is stopped before running this command. ```bash $GOPATH/bin/addblock -i /path/to/bootstrap.dat ``` -------------------------------- ### Transaction Accepted Notification Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This example demonstrates a 'txaccepted' notification for a new transaction that has been accepted into the mempool. It includes the transaction hash and the sum of its outpoint values. ```json { "jsonrpc": "1.0", "method": "txaccepted", "params": [ "16c54c9d02fe570b9d41b518c0daefae81cc05c69bbe842058e84c6ed5826261", 55838384 ], "id": null } ``` -------------------------------- ### Redeeming Transaction Notification Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This example shows a 'redeemingtx' notification for an outpoint that has been spent by a transaction accepted to the mempool. It includes the full transaction hex and a null ID. ```json { "jsonrpc": "1.0", "method": "redeemingtx", "params": [ "0100000003ad3fba7ebd67c09baa9538898e10d6726dcb8eadb006be0c7388c8e46d69d3610000000..." ], "id": null } ``` -------------------------------- ### txacceptedverbose Notification Example Source: https://github.com/btcsuite/btcd/blob/master/docs/json_rpc_api.md This is an example of a txacceptedverbose notification. It is sent when a new transaction is accepted and the client has requested verbose transaction details. Note that the structure of the 'vin' field differs for coinbase and non-coinbase transactions. ```json { "jsonrpc": "1.0", "method": "txacceptedverbose", "params": [ { "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000f...", "txid": "90743aad855880e517270550d2a881627d84db5265142fd1e7fb7add38b08be9", "version": 1, "locktime": 0, "vin": [ // For coinbase transactions: { "coinbase": "03708203062f503253482f04066d605108f800080100000ea2122f6f7a636f696e4065757374726174756d2f", "sequence": 0, } // For non-coinbase transactions: { "txid": "60ac4b057247b3d0b9a8173de56b5e1be8c1d1da970511c626ef53706c66be04", "vout": 0, "scriptSig": { "asm": "3046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f0...", "hex": "493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8...", }, "sequence": 4294967295, } ], "vout": [ { "value": 25.1394, "n": 0, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 ea132286328cfc819457b9dec386c4b5c84faa5c OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914ea132286328cfc819457b9dec386c4b5c84faa5c88ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "1NLg3QJMsMQGM5KEUaEu5ADDmKQSLHwmyh", ] } } ] } ], "id": null } ```