What is Nostr?
salvatoshi
npub157y…60gr
2024-10-04 04:23:58

salvatoshi on Nostr: If you often use regtest, you often need to manually mine blocks to test things. If ...

If you often use regtest, you often need to manually mine blocks to test things.

If you're on linux, add this to ~/.bashrc:

```
mine() {
if [ "$#" -eq 0 ]; then
bitcoin-cli -regtest -generate 1
else
bitcoin-cli -regtest -generate "$1"
fi
}

alias mine=mine
```

Now you can write:

```
$ mine
```

to mine a block, or:

```
$ mine 100
```

to mine 100 blocks and make your Liana timelocks expire.


Another useful alias for .bashrc:

```
alias lastblock='bitcoin-cli -regtest getblock $(bitcoin-cli -regtest getbestblockhash) 2'
```

So you can just write 'lastblock' on the terminal to see all the transactions in the last block.

Please reply below with your best regtest aliases and scripts.
Author Public Key
npub157y6gz0l0rfhw220rfwnujeff6q2mec33nzkwz23umkrt6482exq8e60gr