当前位置: 首页 > 软件库 > 云计算 > >

bitcoin-testnet-box

Create your own private bitcoin testnet
授权协议 MIT License
开发语言 Java
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 司徒高寒
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

bitcoin-testnet-box

Create your own private bitcoin testnet

You must have bitcoind and bitcoin-cli installed on your system and in thepath unless running this within a Docker container(see below).

Large Git History

If you'd like to clone this git repository locally and disk space or bandwidthusage is of concern, it's suggested to do a shallow clone, excluding someearlier history of the repo, where some testnet data was included.

Regular clone: du -sh . 44M

Shallow clone: du -sh . 168K

Regular Clone

git clone git@github.com:freewil/bitcoin-testnet-box.git

Shallow Clone

git clone --shallow-since 2014-10-18 git@github.com:freewil/bitcoin-testnet-box.git

Starting the testnet-box

This will start up two nodes using the two datadirs 1 and 2. Theywill only connect to each other in order to remain an isolated private testnet.Two nodes are provided, as one is used to generate blocks and it's balancewill be increased as this occurs (imitating a miner). You may want a second nodewhere this behavior is not observed.

Node 1 will listen on port 19000, allowing node 2 to connect to it.

Node 1 will listen on port 19001 and node 2 will listen on port 19011for the JSON-RPC server.

$ make start

Check the status of the nodes

$ make getinfo
bitcoin-cli -datadir=1  getinfo
{
    "version" : 90300,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 0,
    "timeoffset" : 0,
    "connections" : 1,
    "proxy" : "",
    "difficulty" : 0.00000000,
    "testnet" : false,
    "keypoololdest" : 1413617762,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}
bitcoin-cli -datadir=2  getinfo
{
    "version" : 90300,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 0,
    "timeoffset" : 0,
    "connections" : 1,
    "proxy" : "",
    "difficulty" : 0.00000000,
    "testnet" : false,
    "keypoololdest" : 1413617762,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}

Generating blocks

Normally on the live, real, bitcoin network, blocks are generated, on average,every 10 minutes. Since this testnet-in-box uses Bitcoin Core's (bitcoind)regtest mode, we are able to generate a block on a private networkinstantly using a simple command.

To generate a block:

$ make generate

To generate more than 1 block:

$ make generate BLOCKS=10

Need to generate at least 100 blocks before there will be a balance in the first wallet

$ make generate BLOCKS=200

Verify that there is a balance on the first wallet

$ make getinfo

Generate a wallet address for the second wallet

$ make address2

Sending bitcoins

To send bitcoins that you've generated to the second wallet: (be sure to change the ADDRESS value below to wallet address generated in the prior command)

$ make sendfrom1 ADDRESS=mxwPtt399zVrR62ebkTWL4zbnV1ASdZBQr AMOUNT=10

Does the balance show up?

Run the getinfo command again. Does the balance show up? Why not?

$ make getinfo

Generate another block

$ make generate

Stopping the testnet-box

$ make stop

To clean up any files created while running the testnet and restore to theoriginal state:

$ make clean

Using with docker

This testnet-box can be used with Docker to run it inan isolated container.

Building docker image

Pull the image

  • docker pull freewil/bitcoin-testnet-box

or build it yourself from this directory

  • docker build -t bitcoin-testnet-box .

Running docker container

The docker image will run two bitcoin nodes in the background and is meant to beattached to allow you to type in commands. The image also exposesthe two JSON-RPC ports from the nodes if you want to be able to access themfrom outside the container.

$ docker run -t -i -p 19001:19001 -p 19011:19011 freewil/bitcoin-testnet-box

or if you built the docker image yourself:

$ docker run -t -i -p 19001:19001 -p 19011:19011 bitcoin-testnet-box

  • 参考: https://www.2cto.com/kf/201707/659271.html 通过docker运行BTC的testnet 启动Docker. $ service docker start or $ systemctl start docker 下载BTC测试网络(bitcoin-testnet)的Docker镜像。 docker pull freewil/bitcoin-tes

 相关资料
  • Bitcoin (比特币)是点对点(peer-to-peer)基于网络的匿名数字货币。点对点(peer-to-peer)的意思是指没有中央权威控制货币 的汇款通道。相反,这些货币转帐的任务是由网络节点进行的集体管理。匿名就意味着交易各方可以隐藏自己的真实身份。优势: 无需信托中间人,能够方便的进行互联网上的汇款。 第三方不能够控制或者阻止您的交易。 Bitcoin 交易几乎免费, 而信用卡的网上在

  • Bitcoin-Qt 是使用 Qt 开发的比特币客户端,目前该项目已经成为比特币官方的客户端,合并到比特币项目中,不再单独立项。

  • Bitcoin ETL Join Telegram Group Install Bitcoin ETL: pip install bitcoin-etl Export blocks and transactions (Schema, Reference): > bitcoinetl export_blocks_and_transactions --start-block 0 --end-block

  • BITCOIN WALLET Welcome to Bitcoin Wallet, a standalone Bitcoin payment app for your Android device! This project contains several sub-projects: wallet:The Android app itself. This is probably what you

  • Feature-rich toolkit for making Bitcoin and Lightning applications on the JVM. For a complete guide on how to get started with Bitcoin-S, see our website at Bitcoin-S.org. Contents What is bitcoin-s?

  • Translations ���� ελληνικά | ���� Français | ���� 한국어 | ���� 普通話 | ���� 台灣話 | ���� Español | ���� Türkçe | ���� Deutsch | ���� Italiano | ���� हिन्दी | Arabic | ���� Português | ���� Русский язык | ��

相关阅读

相关文章

相关问答

相关文档