当前位置: 首页 > 软件库 > Web3 > 开源货币/比特币 >

btcd

授权协议 ISC License
开发语言 Python
所属分类 Web3、 开源货币/比特币
软件类型 开源软件
地区 不详
投 递 者 袁翰池
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

btcd

Build Status

btcd is an alternative full node bitcoin implementation written in Go (golang).

This project is currently under active development and is in a Beta state. Itis extremely stable and has been in production use since October 2013.

It properly downloads, validates, and serves the block chain using the exactrules (including consensus bugs) for block acceptance as Bitcoin Core. We havetaken great care to avoid btcd causing a fork to the block chain. It includes afull block validation testing framework which contains all of the 'official'block acceptance tests (and some additional ones) that is run on every pullrequest to help ensure it properly follows consensus. Also, it passes all ofthe JSON test data in the Bitcoin Core code.

It also properly relays newly mined blocks, maintains a transaction pool, andrelays individual transactions that have not yet made it into a block. Itensures all individual transactions admitted to the pool follow the rulesrequired by the block chain and also includes more strict checks which filtertransactions based on miner requirements ("standard" transactions).

One key difference between btcd and Bitcoin Core is that btcd does NOT includewallet functionality and this was a very intentional design decision. See theblog entry herefor more details. This means you can't actually make or receive paymentsdirectly with btcd. That functionality is provided by thebtcwallet andPaymetheus (Windows-only) projectswhich are both under active development.

Requirements

Go 1.16 or newer.

Installation

https://github.com/btcsuite/btcd/releases

Linux/BSD/MacOSX/POSIX - Build from Source

  • Install Go according to the installation instructions here:http://golang.org/doc/install

  • Ensure Go was installed properly and is a supported version:

$ go version
$ go env GOROOT GOPATH

NOTE: The GOROOT and GOPATH above must not be the same path. It isrecommended that GOPATH is set to a directory in your home directory such as~/goprojects to avoid write permission issues. It is also recommended to add$GOPATH/bin to your PATH at this point.

  • Run the following commands to obtain btcd, all dependencies, and install it:
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ GO111MODULE=on go install -v . ./cmd/...
  • btcd (and utilities) will now be installed in $GOPATH/bin. If you didnot already add the bin directory to your system path during Go installation,we recommend you do so now.

Updating

Linux/BSD/MacOSX/POSIX - Build from Source

  • Run the following commands to update btcd, all dependencies, and install it:
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ git pull
$ GO111MODULE=on go install -v . ./cmd/...

Getting Started

btcd has several configuration options available to tweak how it runs, but allof the basic operations described in the intro section work with zeroconfiguration.

Linux/BSD/POSIX/Source

$ ./btcd

IRC

  • irc.libera.chat
  • channel #btcd
  • webchat

Issue Tracker

The integrated github issue trackeris used for this project.

Documentation

The documentation is a work-in-progress. It is located in the docs folder.

Release Verification

Please see our documentation on the current build/verificationprocess for all ourreleases for information on how to verify the integrity of published releasesusing our reproducible build system.

License

btcd is licensed under the copyfree ISC License.

  • 1. 写在前面 从这一篇博客开始,我们将介绍btcd节点之间P2P连接建立的过程。考虑到内容太长,分为上下两篇博客来讲解。这两篇博客之后,我们将继续介绍节点之间数据的同步过程。 源码解析是基于btcd仓库c26ffa870fd817666a857af1bf6498fabba1ffe3的commit id 版本。 2. 从节点的“启动”说起 btcd节点的启动主要由btcd.go文件中的btcdMa

  • 前言 上一篇文章介绍了单节点和双节点的btcd使用,也用btcctl命令做了一些交互。 这篇文章介绍一些btcctl我至今经常用的命令。 本文章不定期更新 命令概览 通过btcctl -l可以看到所有的btcctl的命令 Chain Server Commands: addnode "addr" "add|remove|onetry" createrawtransaction [{"txid":"

  • 1. 写在前面 我们从‘新区块的生成“开始我们的btcd源码之旅。 2. 相关命令 # start btcd ./btcd -u seafooler -P 123456 --simnet --miningaddr=SRgBmewVAfaVzqKMPHeFYwkiAGD8jKBWFz # start btcwallet ./btcwallet -u seafooler -P 123456 --si

  • 1.写在前面 因为学习的需要,这一年半和接下来更长的时间都会与Bitcoin打交道。不可避免地,需要对Bitcoin的源码进行修改。 网上找过一些Bitcoin源码分析的资源,但大多都是基于C++实现的源码。笔者对C++并不是很熟悉,相反,用Go语言用得更多一些。所以,这个系列的博客会针对Go语言实现的Bitcoin进行分析,也即btcd。因为btcd的实现中将wallet的功能独立了出来,形成一

  • 交易的验证 从btcd.go中的main函数开始,启动btcd调用了btcdMain,btcdMain中有以下代码: // Create server and start it. server, err := newServer(cfg.Listeners, cfg.AgentBlacklist, cfg.AgentWhitelist, db, activeNetParams.Params

  • 4.2 作为客户端的btcwallet 我们接着上一篇博客,继续来讲解作为客户端的btcwallet是如何工作的。 也即,作为客户端的btcwallet是如何与btcd进程交互的。 // walletMain[btcwallet.go] -> rpcClientConnnectLoop[btcwallet.go] func rpcClientConnectLoop(legacyRPCServer

  • 1. 写在前面 从这一篇博客开始,我们将介绍btcd节点之间的数据同步。考虑到内容太长,分为三篇博客来讲解。 第一篇 (本篇) 介绍节点是如何发起数据请求的 第二篇介绍headersFirstMode模式下的数据同步 第三篇介绍非headersFirstMode模式下的数据同步 源码解析是基于btcd仓库c26ffa870fd817666a857af1bf6498fabba1ffe3的commit

  • chaincfg定义了三个标准bitcoin网络的链配置参数,并为调用者提供自定义bitcoin网络的功能。虽然这个包主要是为btcd编写的,但它可以作为一个独立的包用于任何需要使用标准比特币网络的参数的工程项目,或者需要自定义bitcoin网络的项目。

  • 4. 与其他peer建立P2P连接 我们接着上一篇博客,继续讲解P2P主动连接的管理和被动接受连接的过程。 4.2 主动连接的管理 前面介绍到Start [connmanager.go]函数中调用的connHandler函数,主要用来管理主动连接。此外,在4.1节中我们提及requests管道的接收工作就是在connHandler函数中完成的。本小节我们就来看看connHandler函数的具体细节

  • 交易打包上链的概述 btcd首先从内存池取得交易,用交易填充区块,并往区块上填入必要的信息。随后区块进行POW计算。当计算符合难度值的区块哈希后,btcd对新区块进行最后一步的验证,将新区块连接到本地的主链上,并广播这个新区块给对等方。 BitCoin RPCs 为了了解交易是怎么被打包到区块,最后发布的,首先从查看相关的RPC调用。 getblocktemplate getblocktempla

  • 4.3. 创建input 前一篇博客btcd源码解析——交易创建中的4.2节介绍了创建output的细节,本篇博客主要介绍input的创建细节。 由于已经拥有了output,input的创建也就是整个transaction的创建了。因此在本节中,我们会不加区分地使用“创建input”和“创建交易”这两个词。换句话说,在本节中,创建交易的过程主要就是创建input的过程。 4.3.1. “创建交易”

  • // Copyright (c) 2013-2017 The btcsuite developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package btcec import ( "bytes" "crypto/rand" "cryp

相关阅读

相关文章

相关问答

相关文档