# Playground overview

## Overview dei container

![](/files/-MREuULu5aUG3QLltZoR)

### Hansel e Gretel

> [https://github.com/bitcoin-dalla-teoria-alla-pratica/playground/blob/master/docker-compose.yml#L4-L23](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L4-L29)

Questi sono i due container che utilizzano Bitcoin core *raw*. Contengono solo lo stretto necessario:

* base58 - <https://pypi.org/project/base58/>
* bc - <https://linux.die.net/man/1/bc>
* bitcoin-cli - <https://developer.bitcoin.org/reference/rpc/index.html>
* bitcoind - <https://en.bitcoin.it/wiki/Running_Bitcoin>
* btcdeb - <https://github.com/kallewoof/btcdeb>
* bx - <https://github.com/libbitcoin/libbitcoin-explorer>
* jq - <https://stedolan.github.io/jq/>
* openssl - <https://linux.die.net/man/1/openssl>
* swiss knife suite (eg. awk, sed, cat, cut, vim, ps, curl, wget)
* xxd - <https://linux.die.net/man/1/xxd>

Se avete acquistato uno dei due libri e volete sperimentare con mano gli esempi correlati che vengono via via indicati Hansel e Gretel sono il posto giusto!\
Per "entrare" in Hansel

```
docker exec -ti hansel bash
```

Per "entrare" in Gretel

```
docker exec -ti gretel bash
```

{% hint style="info" %}
Qualsiasi file copiato nella cartella `wald` e' immediatamente disponibile nel percorso `/opt/wald` all'interno di Hansel/Gretel.

**NB**: una volta aggiunto un file `sh` potrebbe essere necessario un `chmod +x nomefile.sh` prima di eseguirlo.
{% endhint %}

#### Hansel REST API

Il container di Hansel espone anche l'interfaccia [REST di Bitcoin](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md), la trovate all'indirizzo [`http://localhost:18443/rest`](http://localhost:18443/rest).

Nei link qui sulla sinistra trovate dei preferiti per la API blockchain info e mempool content.

### OZ

> [https://github.com/bitcoin-dalla-teoria-alla-pratica/playground/blob/master/docker-compose.yml#L24-L31](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L30-L40)

Container con ambiente bitcoinjs-lib, vedi [pagina dedicata](/bitcoin-e-node.js.md) in questo sito.

```
docker exec -ti oz bash
```

### blockchain-explorer

> [https://github.com/bitcoin-dalla-teoria-alla-pratica/playground/blob/master/docker-compose.yml#L32-L45](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L41-L56)

Questo container e' gentilmente offerto da Blockstream: <https://github.com/Blockstream/esplora>.

L'interfaccia web alla quale si accede tramite i link qui sulla sinistra *Bitcoin regtest explorer* e *Bitcoin regtest mempool* e' messa a disposizione da questo container.\
Sempre nell'elenco dei link qui di fianco trovate *Bitcoin regtest explorer API* grazie al quale potrete scoprire tutte le API messe a disposizione da *Blockstream esplora* e disponibili su `localhost:8094`.

> L'explorer mette a disposizione API REST <https://github.com/Blockstream/esplora/blob/master/API.md>

### bitcoinjs-regtest-server

> [https://github.com/bitcoin-dalla-teoria-alla-pratica/playground/blob/master/docker-compose.yml#L46-L54](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L57-L67)

Questo container e' presente al solo scopo di supportare l'[ambiente bitcoinjs-lib](/playground-overview.md#oz).

### &#x20;blockchain-reader

> <https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L68-L78>

Questo container mette a disposizione

* Apache Tomcat up & running nel caso vogliate integrare Bitcoin e backend Java\
  <http://localhost:8080/manager/html> `tomcat/tomcat`
* interfaccia web che permette di esplorare i dati grezzi della vostra regtest che chiameremo [Bitcoin regtest reader](http://localhost:8080/explorer)
* la possibilita' di giocare a snake con i vostri vicini di LAN <http://localhost:8080/examples/websocket/snake.xhtml>

## Collegamenti di rete fra i container

Tramite i link network di docker-compose abbiamo simulato una piccola rete P2P di [full node](https://bitcoin.org/en/full-node) (regtest) Bitcoin :)

* gretel si collega [via Bitcoin](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/gretel/bitcoin.conf#L5) a hansel
* blockchain-explorer si collega [via Bitcoin](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/blockchain-explorer/.bitcoin.conf#L7) a gretel
* bitcoinjs-regtest-server si collega [via Bitcoin](https://github.com/bitcoin-dalla-teoria-alla-pratica/playground/blob/master/bitcoinjs-regtest-server/bitcoin-data/bitcoin.conf#L4) a hansel
* oz si collega [via HTTP](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/oz/fetch_tx.js#L6) a bitcoinjs-regtest-server e volendo puo' [raggiungere](https://github.com/bitcoin-dalla-teoria-alla-pratica/bitcoin-in-action-playground/blob/master/docker-compose.yml#L40) gretel

## Script utili esterni ai container

### hansel-gretel-exec.sh

E' possibile eseguire in contemporanea lo stesso comando su Hansel e Gretel.

Ad esempio potete verificare la connettivita' tra Hansel e Gretel e gli altri nodi

```
./hansel-gretel-exec.sh getpeerinfo.sh
```

### regtest-delete.sh

Questo script va a cancellare tutti i file di tutti i nodi relativi alla blockchain ed il suo stato.

Utile per tornare allo stato iniziale.

```
./regtest-delete.sh
```

### hansel-bitcoin-cli.sh

Vi permette di eseguire comandi bitcoin-cli senza essere all'interno del container Hansel.

```
./hansel-bitcoin-cli.sh generatetoaddress 100 $(./hansel-bitcoin-cli.sh getnewaddress)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://playground.bitcoininaction.com/playground-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
