Giter VIP home page Giter VIP logo

docker-bitcoind's Introduction

Bitcoind for Docker

Docker Stars Docker Pulls Build Status

Docker image that runs the Bitcoin bitcoind node in a container for easy deployment.

Requirements

  • Physical machine, cloud instance, or VPS that supports Docker (i.e. Vultr, Digital Ocean, KVM or XEN based VMs) running Ubuntu 14.04 or later (not OpenVZ containers!)
  • At least 500 GB to store the block chain files (and always growing!)
  • At least 1 GB RAM + 2 GB swap file

Recommended and tested on unadvertised (only shown within control panel) Vultr SATA Storage 1024 MB RAM/250 GB disk instance @ $10/mo. Vultr also accepts Bitcoin payments!

Really Fast Quick Start

One liner for Ubuntu 14.04 LTS machines with JSON-RPC enabled on localhost and adds upstart init script:

curl https://raw.githubusercontent.com/kylemanna/docker-bitcoind/master/bootstrap-host.sh | sh -s trusty

Quick Start

  1. Create a bitcoind-data volume to persist the bitcoind blockchain data, should exit immediately. The bitcoind-data container will store the blockchain when the node container is recreated (software upgrade, reboot, etc):

     docker volume create --name=bitcoind-data
     docker run -v bitcoind-data:/bitcoin/.bitcoin --name=bitcoind-node -d \
         -p 8333:8333 \
         -p 127.0.0.1:8332:8332 \
         kylemanna/bitcoind
    
  2. Verify that the container is running and bitcoind node is downloading the blockchain

     $ docker ps
     CONTAINER ID        IMAGE                         COMMAND             CREATED             STATUS              PORTS                                              NAMES
     d0e1076b2dca        kylemanna/bitcoind:latest     "btc_oneshot"       2 seconds ago       Up 1 seconds        127.0.0.1:8332->8332/tcp, 0.0.0.0:8333->8333/tcp   bitcoind-node
    
  3. You can then access the daemon's output thanks to the docker logs command

     docker logs -f bitcoind-node
    
  4. Install optional init scripts for upstart and systemd are in the init directory.

Documentation

docker-bitcoind's People

Contributors

achristianson avatar aureleoules avatar ayrat555 avatar hectorj avatar jherrma avatar jpascalw avatar karstenwintermann avatar kelostrada avatar kylemanna avatar mitrofanov avatar morganrowse avatar olegabr avatar pckltr avatar phuongnd08 avatar prettymuchbryce avatar schinzelh avatar sethforprivacy avatar ypid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-bitcoind's Issues

Where is data stored?

Data is not stored into /bitcoin. I ssh into the container and it is empty even while is downloading the blockchain.

Create systemd service file

Need to create a systemd service file that does the same as the upstart.init file. Service file is easy, testing is hard because it's time consuming.

container exits immediately

I see logs like:

Initialization completed successfully
+ [ 0 -eq 0 ]
+ set -- -rpcbind=:8332 -rpcallowip=0.0.0.0/0
+ exec bitcoind -rpcbind=:8332 -rpcallowip=0.0.0.0/0

Then the container exits immediately. Same using "docker run" or docker-compose.

My config is:

daemon=1
regtest=1
listen=0
fallbackfee=0.0002
rpcuser=theuser
rpcpassword=thepass
# accept JSON-RPC commands
server=1
# prune=5500
txindex=1

[regtest]
rpcport=8332

bitcoin-cli getnewaddress

Sorry , my english is not very well , buy i has a problem hope you can help me
I user command bitcoin-cli getnewaddress and bitcoin-cli getblance
return:
error code: -32601
error message:
Method not found

i remark the disablewallet=1 and "docker exec {CONTAINER ID} bitcoind -conf=/bitcoin/.bitcoin/bitcoin.conf -rescan"
but it still the same, is it still disable wallet?
what can I do ? what command can show wallet status ? can you help me

error on :dev image

i get this error when running bitcoin docker on dev mode

2021-01-08 10:34:20 Bitcoin Core version v0.16.0.0-g4b4d7eb255 (release build)
2021-01-08 10:34:20 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2021-01-08 10:34:20 Assuming ancestors of block 0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0 have valid signatures.
2021-01-08 10:34:20 Setting nMinimumChainWork=000000000000000000000000000000000000000000f91c579d57cad4bc5278cc
2021-01-08 10:34:20 Using the 'sse4' SHA256 implementation
2021-01-08 10:34:20 ERROR: Error while attempting to lock directory /bitcoin/.bitcoin: No such file or directory
2021-01-08 10:34:20 Error: Cannot obtain a lock on data directory /bitcoin/.bitcoin. Bitcoin Core is probably already running.
Error: Cannot obtain a lock on data directory /bitcoin/.bitcoin. Bitcoin Core is probably already running.

Cannot access rpc after upgrading

I cannot access rpc services after upgrade anymore. This is how I configured bitcoind:

  d3-btc-node0:
    image: kylemanna/bitcoind:latest
    container_name: d3-btc-node0
    ports:
      - 8332:8332
      - 8333:8333
      - 18333:18333
      - 18444:18444
    entrypoint:
      - bitcoind
      - --rpcuser=test
      - --rpcpassword=test
      - --regtest=1
      - --server=1
      - --rpcallowip=::/0
      - --rpcport=8332

Whenever I call bitcoin-cli --regtest generate 1 it answers with

error: couldn't connect to server: EOF reached (code 1)
(make sure server is running and you are connecting to the correct RPC port)

Before upgrade everything was ok. What is wrong?

Couldn't connect with rpc

Failed to connect to 127.0.0.1 port 8332: Connection refused
this happened when I update bitcoin core from version 15.0 to 19.1.
With 15.0 all was working fine, what is the difference in RPC methods in bitcoind from 19.1 ???

external volume of /bitcoin don't seem to work?

talisker:~ jordan$ docker run -v /Users/jordan/blockchains/bitcoin:/bitcoin --name=bitcoind-node3 -p 8333:8333 -p 127.0.0.1:8332:8332    kylemanna/bitcoind
+ btc_init
+ '[' '!' -e /bitcoin/.bitcoin/bitcoin.conf ']'
+ mkdir -p /bitcoin/.bitcoin
+ echo 'Creating bitcoin.conf'
+ cat
Creating bitcoin.conf
+ cat /bitcoin/.bitcoin/bitcoin.conf
disablewallet=1
printtoconsole=1
rpcuser=bitcoinrpc
rpcpassword=dd if=/dev/urandom bs=33 count=1 status=none | base64
Initialization completed successfully
+ echo 'Initialization completed successfully'
+ '[' 0 -gt 0 ']'
+ args=("-rpcallowip=::/0")
+ exec bitcoind -rpcallowip=::/0
2016-08-17 10:51:57 



















2016-08-17 10:51:57 Bitcoin version v0.12.1.0-g9779e1e (Mon, 11 Apr 2016 13:01:43 +0200)
2016-08-17 10:51:57 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2016-08-17 10:51:57 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2016-08-17 10:51:57 Default data directory /bitcoin/.bitcoin
2016-08-17 10:51:57 Using data directory /bitcoin/.bitcoin
2016-08-17 10:51:57 Using config file /bitcoin/.bitcoin/bitcoin.conf
2016-08-17 10:51:57 Using at most 125 connections (1048576 file descriptors available)
2016-08-17 10:51:57 Using 8 threads for script verification
2016-08-17 10:51:57 scheduler thread start
2016-08-17 10:51:57 Binding RPC on address 0.0.0.0 port 8332 failed.
2016-08-17 10:51:57 HTTP: creating work queue of depth 16
2016-08-17 10:51:57 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2016-08-17 10:51:57 HTTP: starting 4 worker threads
2016-08-17 10:51:57 Bound to [::]:8333
2016-08-17 10:51:57 Bound to 0.0.0.0:8333
2016-08-17 10:51:57 Cache configuration:
2016-08-17 10:51:57 * Using 2.0MiB for block index database
2016-08-17 10:51:57 * Using 32.5MiB for chain state database
2016-08-17 10:51:57 * Using 65.5MiB for in-memory UTXO set
2016-08-17 10:51:57 init message: Loading block index...
2016-08-17 10:51:57 Opening LevelDB in /bitcoin/.bitcoin/blocks/index
2016-08-17 10:51:57 IO error: /bitcoin/.bitcoin/blocks/index: Invalid argument
2016-08-17 10:51:57 : Error opening block database.

Do you want to rebuild the block database now?
2016-08-17 10:51:57 Aborted block database rebuild. Exiting.
2016-08-17 10:51:57 Shutdown: In progress...
2016-08-17 10:51:57 scheduler thread interrupt
: Error opening block database.

Do you want to rebuild the block database now?
2016-08-17 10:51:57 StopNode()
2016-08-17 10:51:57 Shutdown: done
talisker:~ jordan$ 

It does seem to do some stuff though..

talisker:blockchains jordan$ 
talisker:blockchains jordan$ pwd
/Users/jordan/blockchains
talisker:blockchains jordan$ 
talisker:blockchains jordan$ tree -a bitcoin/
bitcoin/
└── .bitcoin
    β”œβ”€β”€ .lock
    β”œβ”€β”€ bitcoin.conf
    β”œβ”€β”€ blocks
    β”‚Β Β  └── index
    β”‚Β Β      β”œβ”€β”€ 000003.log
    β”‚Β Β      β”œβ”€β”€ CURRENT
    β”‚Β Β      β”œβ”€β”€ LOCK
    β”‚Β Β      β”œβ”€β”€ LOG
    β”‚Β Β      └── MANIFEST-000001
    └── debug.log

3 directories, 8 files
talisker:blockchains jordan$ 

I can confirm that using a docker volume (as per the instructions) does work. Wonder why it flips out with external volumes? I have plenty of disk, cpu, mem availible.

doesn't seem to calculate anything after having download the chain

except these kind of message
2016-08-30 00:30:12 ProcessMessages: advertizing address ......:8333 2016-08-30 00:30:12 receive version message: /Satoshi:0.12.1/: version 70012, blocks=427441, us=81.247.172.246:48208, peer=10 2016-08-30 00:30:12 AdvertizeLocal: advertizing address ....:8333 2016-08-30 00:34:45 socket send error No route to host (113) 2016-08-30 00:34:46 ProcessMessages: advertizing address .....:8333 2016-08-30 00:34:46 receive version message: /Satoshi:0.12.1/: version 70012, blocks=427441, us=81.247.172.246:42590, peer=11 2016-08-30 00:34:46 AdvertizeLocal: advertizing address 81.247.172.246:8333 2016-08-30 00:38:04 UpdateTip: new best=000000000000000001b9bcbbfffd677ef19ed159c74c16579dcb4f657782cd95 height=427442 log2_work=85.199677 tx=152629851 date=2016-08-30 00:37:36 progress=1.000000 cache=5.7MiB(6903tx) 2016-08-30 00:38:04 UpdateTip: 5 of last 100 blocks have unexpected version

Idon't have much...

does the port forwarding be a problem?

Couldn't connect with rpc

used commands:
docker volume create --name=bitcoind-data
docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d -p 8333:8333 -p 127.0.0.1:8332:8332 kylemanna/bitcoind
bitcoin-cli works fine:
docker exec -it bitcoind-node bitcoin-cli getblockchaininfo
but curl couldn't get response:

Ξ» curl -v localhost:8332

  • Rebuilt URL to: localhost:8332/
  • Trying ::1...
  • Trying 127.0.0.1...
  • connect to ::1 port 8332 failed: Connection refused
  • connect to 127.0.0.1 port 8332 failed: Connection refused
  • Failed to connect to localhost port 8332: Connection refused
  • Closing connection 0
    curl: (7) Failed to connect to localhost port 8332: Connection refused

this is the same
curl -v -u bitcoinrpc:PWgnaXeUDG3PBpr/6uE/ZuKMO7/pkgAQqGBY8bqYhmxj http://127.0.0.1:8332

any ideas why?

RPC issue

If i run according to your config.md

docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d \ -p 8333:8333 \ -p 127.0.0.1:8332:8332 \ -e DISABLEWALLET=1 \ -e PRINTTOCONSOLE=1 \ -e RPCUSER=rpcuser \ -e RPCPASSWORD=rpcpass \ kylemanna/bitcoind

or with
docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d -p 8333:8333 -p 127.0.0.1:8332:8332 -v /etc/bitcoind/bitcoin.conf kylemanna/bitcoind

/etc/bitcoind/bitcoin.conf content being
rpcuser=rpcuser
rpcpassword=rpcpass
rpcport=8332
server=1
rpcbind=127.0.0.1

i never succeed to connect with RPC
curl --user rpcuser --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

always get a timeout

went inside the container
docker exec -it bitcoind-node bash
and found

cat /bitcoin/.bitcoin/bitcoin.conf
disablewallet=1
printtoconsole=1
rpcuser=bitcoinrpc
rpcpassword=QvZjzT9o4ZkpgIMK4CyQDrRzGat1Bn57mKnJarne+0k8

Then i tried also
curl --user bitcoinrpc --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
I am a bit lost, did you try to use another rpc password already?

thanks and regards

Wrong USER_ID / GROUP_ID and permissions on volume

-- Synology Docker

For whatever reason after creating / launching the container user bitcoin is always 1000:1000 instead of what I've specified in environment.

I can confirm that ENV variables are being passed to the shell. It's messing up permissions on my host OS. Other images using ENV variables switch the UID/GID correctly.

Is there a way to work around this?

root@kylemanna-bitcoind1:~# echo $USER_ID                                                                              
1034                                                                                                                   
root@kylemanna-bitcoind1:~# echo $GROUP_ID                                                                             
65537                                                                                                                  
root@kylemanna-bitcoind1:~# grep bitcoin /etc/passwd /etc/group                                                        
/etc/passwd:bitcoin:x:1000:1000::/bitcoin:/bin/bash                                                                    
/etc/group:bitcoin:x:1000:

Node upgrade/reboot sync taking too much time to boot

From the last 2 upgrades, whenever I upgrade the node it takes 3-4 days to boot to the last synced block.

For ex. After upgrade, if I query latest block it starts from 1 and take days to reach the last synced block saved in mapped data folder.

Is there any configuration changes I have to do or any system requirement is changed?

Earlier using the same the system config it used to take max 10-15 mins to boot and start syncing to the mainnet.

Thanks

traffic limit

is there a way to limit upload traffic on this image?

If not where could I modify the config for that?

Docker images for ARM

HI - have you successfully built images for arm processors (raspberry pi) ? I have this working well on intel cpu but trying to get it working for the raspberry pi. Thanks

Out of memory

With the installation commands, I receive an out of disk space error. However, I have plenty of disk space on my system. Attempting to restart the download of the blockchain results in an error.

When specifying that I would like to reserve 200g in the volume with:

docker volume create --opt o=size=200g --name=bitcoind-data

and then attempted to start the container using the volume:

docker run --volume bitcoind-data:/bitcoin --volume-driver local --name=bitcoind-node -d -p 8333:8333 -p 127.0.0.1:8332:8332 kylemanna/bitcoind

results in the error:

docker: Error response from daemon: missing device in volume options.

Write-up bittorrent seed node

The kylemanna/bitcoin image has everything in it act as a bittorrent seed node. Need to find time to write it up.

Thoughts:

  • Separate running docker container (one container for bitcoind, one for aria2 seeder)
  • Would clean-up old stale bootstrap file by relocating it and using it to seed
  • Write-up howto and place in docs folder
  • Add seeder.init script for those on Ubuntu VMs that want to seed

Documentation does not point to the correct volume path

The path for the data volume has changed from "/bitcoin" to "/bitcoin/.bitcoin" in the ":latest" image. If you specify a volume for "/bitcoin" and not for "/bitcoin/.bitcoin", then docker mounts the subfolder to a default docker volume, and not the volume which is specified. This caused some issues on my machine, since the drive holding the docker volumes is only a small SSD, and not my big NAS drive. The docker commands in the documentation should be adjusted accordingly.

Can we run this behind TOR?

I have setup using docker & everything working.
How can I run this behind a TOR?

I have also setup EZNODE docker container which runs a TOR, BTC RPC Explorer
It would be nice to connect to the TOR created by that.

Any advice on this?

Use environment variables AND config

It appears that when I use my own config file, environment variables set in the docker-compose.yaml are not respected. I'd like to keep most of my config in a file for version control, but I'd also like to have sensitive things like RPCUSER and RPCPASSWORD as environment variables, out of plain-text version control. Is there a way to achieve this?

run btcoind on testnet

Is it possible to connect with testnet with this image?
Or do we need 18333 etc?

docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d -p 8333:8333 -p 127.0.0.1:8332:8332 kylemanna/bitcoind -testnet

bitcoin-cli getinfo
{
  "version": 140200,
  "protocolversion": 70015,
  "blocks": 32,
  "timeoffset": 0,
  "connections": 3,
  "proxy": "",
  "difficulty": 1,
  "testnet": false,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

When I try:

 docker run -v bitcoind-data:/bitcoin --name=bitcoind-node -d \
     -p 18333:18333 \
     -p 127.0.0.1:18332:18332 \
     kylemanna/bitcoind -testnet

error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

Clean-up bittorrent bootstrap.dat.old

Need to determine a simple way to clean-up bootstrap.dat.old without other simultaneous running processes in the container (cron, init, process manager, etc).

One thought is to leverage btc_oneshot to check for the file, and delete it if it's older then say, 14 days. This would happen automatically by the upstart.init file on reboot/restart and is probably what the user wants.

If the file is less than 14 days old, it's nice to keep it around so that it could be relocated and used for seeding as mentioned in issue #9.

Long term a solution is needed to determine how to expire the torrent file when new torrent files are created and old ones are abandoned. First thought is to store metadata about the torrent file in the Docker image and then the Docker image as it will be periodically updated.

bitcoin-cli and `error: couldn't connect to server`

After doing "quick start" I waited for a few days. CPU was 100% and 41gb of data was downloaded.

Buy I still can't connect with bitcoin-cli.

docker run --volumes-from=bitcoind-data --rm -it kylemanna/bitcoind bitcoin-cli getinfo

gives me error: couldn't connect to server
Usually I get whit when blockchain was not fully loaded.

Right now CPU load is 1-2%

docker logs -f bitcoind-node

showing some old blocks
4cbedb5749b972cf1191508a43fb7f06f789a71b70709cc height=25194 log2_work=46.620872 tx=25355 date=2009-10-18 00:08:20 progress=0.000132 cache=6.0MiB(23623tx) UpdateTip: new best=00000000fef8903bda5d6bcc6ff1c396b93730c425ee637e14f9d98eea6ac086 height=25195 log2_work=46.620929 tx=25356 date=2009-10-18 00:19:24 progress=0.000132 cache=6.0MiB(23624tx) UpdateTip: new best=000000006f9cd96b8bec9b08d4891bb9d0d3723a3967e19e4943e498dec99784 height=25196 log2_work=46.620986 tx=25357 date=2009-10-18 00:58:37 progress=0.000132 cache=6.0MiB(23625tx) UpdateTip: new best=00000000b0f920c91fd933436084ec4eea4072210d2d80cea71090e211baa081 height=25197 log2_work=46.621044 tx=25358 date=2009-10-18 01:00:40 progress=0.000132 cache=6.0MiB(23626tx) UpdateTip: new best=00000000e3fb23aa147bf48c22cdb1e2fc2b00522be508e89e9ec6f364a78f0e height=25198 log2_work=46.621101 tx=25359 date=2009-10-18 01:12:44 progress=0.000132 cache=6.0MiB(23627tx)

System: Debian
3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
Hosted on Digital Ocean plan ($ 40 / mo)
Docker version 1.8.1, build d12ea79

Can somebody explain what happening?
Do I need to wait more?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.