github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/test/p2p/README.md (about)

     1  # Tendermint P2P Tests
     2  
     3  These scripts facilitate setting up and testing a local testnet using docker containers.
     4  
     5  Setup your own local testnet as follows.
     6  
     7  For consistency, we assume all commands are run from the Tendermint repository root.
     8  
     9  First, build the docker image:
    10  
    11  ```
    12  docker build -t tendermint_tester -f ./test/docker/Dockerfile .
    13  ```
    14  
    15  Now create the docker network:
    16  
    17  ```
    18  docker network create --driver bridge --subnet 172.57.0.0/16 my_testnet
    19  ```
    20  
    21  This gives us a new network with IP addresses in the rage `172.57.0.0 - 172.57.255.255`.
    22  Peers on the network can have any IP address in this range.
    23  For our four node network, let's pick `172.57.0.101 - 172.57.0.104`.
    24  Since we use Tendermint's default listening port of 26656, our list of seed nodes will look like:
    25  
    26  ```
    27  172.57.0.101:26656,172.57.0.102:26656,172.57.0.103:26656,172.57.0.104:26656
    28  ```
    29  
    30  Now we can start up the peers. We already have config files setup in `test/p2p/data/`.
    31  Let's use a for-loop to start our peers:
    32  
    33  ```
    34  for i in $(seq 1 4); do
    35  	docker run -d \
    36  	  --net=my_testnet\
    37  	  --ip="172.57.0.$((100 + $i))" \
    38  	  --name local_testnet_$i \
    39  	  --entrypoint tendermint \
    40  	  -e TMHOME=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$((i-1)) \
    41  	  tendermint_tester node --p2p.persistent_peers 172.57.0.101:26656,172.57.0.102:26656,172.57.0.103:26656,172.57.0.104:26656 --proxy_app=kvstore
    42  done
    43  ```
    44  
    45  If you now run `docker ps`, you'll see your containers!
    46  
    47  We can confirm they are making blocks by checking the `/status` message using `curl` and `jq` to pretty print the output json:
    48  
    49  ```
    50  curl 172.57.0.101:26657/status | jq .
    51  ```
    52  
    53  ## IPv6 tests
    54  
    55  IPv6 tests require a Docker daemon with IPv6 enabled, by setting the following in `daemon.json`:
    56  
    57  ```json
    58  {
    59    "ipv6": true,
    60    "fixed-cidr-v6": "2001:db8:1::/64"
    61  }
    62  ```
    63  
    64  In Docker for Mac, this is done via Preferences → Docker Engine.
    65  
    66  Once set, run IPv6 tests via `make test_p2p_ipv6`.