Skip to content

Commit

Permalink
makefile with prefix bitcoind and fix bitcoind docker version
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Vo <[email protected]>
  • Loading branch information
vuvoth committed Dec 17, 2024
1 parent e518b68 commit cc65f9f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ cover-html: test-unit-cover
## Infrastructure ##
###############################################################################

BITCOIND_IMAGE="kylemanna/bitcoind@sha256:2400e64960457b22be55299a2d7fa2aaa217f3dfc4afb84387e5511fe8ce5055"
BITCOIND_SNAPSHOT=$(shell pwd)/contrib/snapshot
BITCOIND_DATA=$(shell pwd)/contrib/regtest
WALLET="nativewallet"

run-bitcoind:
bitcoind-run:
@docker run -v $(BITCOIND_DATA):/bitcoin/.bitcoin --name=bitcoind-node -d \
-p 18444:8333 \
-p 127.0.0.1:18443:8332 \
Expand All @@ -80,22 +82,22 @@ run-bitcoind:
-e PRINTTOCONSOLE=1 \
-e RPCUSER=mysecretrpcuser \
-e RPCPASSWORD=mysecretrpcpassword \
kylemanna/bitcoind
@sleep 1
@docker exec -it bitcoind-node bitcoin-cli -regtest -rpcport=8332 loadwallet "nativewallet"
$(BITCOIND_IMAGE)
@sleep 2
@docker exec -it bitcoind-node bitcoin-cli -regtest -rpcport=8332 loadwallet $(WALLET)

bitcoind-reinit: bitcoinregtest-snapshot bitcoind-run
bitcoind-reinit: bitcoinregtest-snapshot bitcoind-remove bitcoind-run

bitcoind-start:
@docker start bitcoind-node

stop-bitcoind:
bitcoind-stop:
@docker stop bitcoind-node

delete-bitcoind:
bitcoind-remove:
@docker rm -f bitcoind-node

restart-bitcoind: delete-bitcoind create-bitcoind
restart-bitcoind: bitcoind-remove bitcoind-run

bitcoinregtest-snapshot:
@rm -rf $(BITCOIND_DATA)
Expand Down
10 changes: 7 additions & 3 deletions contrib/MockBitcoind.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
Create a new bitcoind node with snapshot data

```bash
make create-bitcoind
make bitcoind-run
```

## Stop bitcoind node

```bash
make stop-bitcoind
make bitcoind-stop
```

## Start bitcoind node

You can start bitcoind node again. This command will keep any state changes on the bitcoind node.

```bash
make bitcoind-start
```

## Restart bitcoind node

Restarting bitcoind will create node with a snapshot data.

```bash
make restart-bitcoind
make bitcoind-reinit
```

## Interact with bitcoind node
Expand Down

0 comments on commit cc65f9f

Please sign in to comment.