Skip to content

Commit

Permalink
Merge pull request #658 from ethersphere/private-testnet
Browse files Browse the repository at this point in the history
add missing node options and info about funding
  • Loading branch information
NoahMaizels authored Oct 22, 2024
2 parents 65d37e4 + 2328f35 commit 1f3f7c8
Showing 1 changed file with 67 additions and 15 deletions.
82 changes: 67 additions & 15 deletions docs/develop/tools-and-features/starting-a-test-network.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Starting a Test Network
title: Starting a Private Network
id: starting-a-test-network
---

A test network can be used to test your applications in an isolated environment before you deploy to Swarm mainnet. It can be started by overriding the default configuration values of your Swarm node. Throughout this tutorial, we will make use of configuration files to configure the nodes but of course you can also do the same using flags or environment variables (see [Start your node](/docs/bee/working-with-bee/configuration)).
A private network can be used to test your applications in an isolated environment before you deploy to Swarm mainnet. It can be started by overriding the default configuration values of your Swarm node. Throughout this tutorial, we will make use of configuration files to configure the nodes but of course you can also do the same using flags or environment variables (see [Start your node](/docs/bee/working-with-bee/configuration)).

## Start a network on your own computer

Expand All @@ -19,8 +19,12 @@ api-addr: 127.0.0.1:1633
p2p-addr: :1634
bootnode: ""
data-dir: /tmp/bee/node1
password: some pass phze
password: set-a-strong-password
swap-enable: false
mainnet: false
blockchain-rpc-endpoint: https://sepolia.dev.fairdatasociety.org
verbosity: 5
full-node: true
```
**config_2.yaml**
Expand All @@ -31,9 +35,13 @@ api-addr: 127.0.0.1::1733
p2p-addr: :1734
data-dir: /tmp/bee/node2
bootnode: ""
password: some pass phze
password: set-a-strong-password
welcome-message: "Bzz Bzz Bzz"
swap-enable: false
mainnet: false
blockchain-rpc-endpoint: https://sepolia.dev.fairdatasociety.org
verbosity: 5
full-node: true
```
Note that for each node, we provide a different `api-addr`. If we had not specified different addresses here, we
Expand All @@ -50,14 +58,17 @@ to be the empty string `""`. A bootnode is responsible for
bootstrapping the network so that a new node can find its first few
peers before it begins its own journey to find friends in the
Swarm. In Swarm any node can be used as a bootnode. Later, we will
manually join our nodes together so in this case a bootnode isn't
required.
use our first node as the bootnode for our other node(s), but for now we leave this option blank.

We have set `mainnet` to false so that our node runs on the Sepolia testnet, and we provide an RPC endpoint for Sepolia in the `blockchain-rpc-endpoint` option. We have also set `full-node` and `swap-enable` to `true` so that we can run full nodes.

Log verbosity has been set to level 5 with the `verbosity` option. By setting it at the highest level of 5, we make sure all important information is shown in our logs. Setting this is optional.

Finally, note the `welcome-message` in the first nodes configuration file. This is a friendly feature allowing you to send a message to peers that connect to you!

### Starting Your Nodes

Now we have created our configuration files, let's start our nodes by running `bee start --config config_1.yaml`, then in another Terminal session, run `bee start --config-file config_2.yaml`.
Now we have created our configuration files, let's start our nodes by running `bee start --config config_1.yaml`, then in another Terminal session, run `bee start --config config_2.yaml`.

We can now inspect the state of our network by sending HTTP requests to the [API](/api/).

Expand Down Expand Up @@ -95,13 +106,15 @@ curl localhost:1633/addresses | jq

```json
{
"overlay": "f57a65207f5766084d3ebb6bea5e2e4a712504e54d86a00961136b514f07cdac",
"overlay": "b1978be389998e8c8596ef3c3a54214e2d4db764898ec17ec1ad5f19cdf7cc59",
"underlay": [
"/ip4/127.0.0.1/tcp/1634/p2p/16Uiu2HAmUdCRWmyQCEahHthy7G4VsbBQ6dY9Hnk79337NfadKJEs",
"/ip4/192.168.0.10/tcp/1634/p2p/16Uiu2HAmUdCRWmyQCEahHthy7G4VsbBQ6dY9Hnk79337NfadKJEs",
"/ip6/::1/tcp/1634/p2p/16Uiu2HAmUdCRWmyQCEahHthy7G4VsbBQ6dY9Hnk79337NfadKJEs",
"/ip4/xx.xx.xx.xx/tcp/40317/p2p/16Uiu2HAmUdCRWmyQCEahHthy7G4VsbBQ6dY9Hnk79337NfadKJEs"
]
"/ip4/127.0.0.1/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ",
"/ip4/172.25.128.69/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ",
"/ip6/::1/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ"
],
"ethereum": "0xd22cc790e2aef341827e1e49cc631d2a16898cd9",
"publicKey": "023b26ce8b78ed8cdb07f3af3d284c95bee5e038e7c5d0c397b8a5e33424f5d790",
"pssPublicKey": "039ceb9c1f0afedf79991d86d89ccf4e96511cf656b43971dc3e878173f7462487"
}
```

Expand All @@ -116,10 +129,13 @@ network-id: 7357
api-addr: 127.0.0.1::1733
p2p-addr: :1734
data-dir: /tmp/bee/node2
bootnode: "/ip4/127.0.0.1/tcp/1634/p2p/16Uiu2HAmUdCRWmyQCEahHthy7G4VsbBQ6dY9Hnk79337NfadKJEs"
password: some pass phze
bootnode: "/ip4/127.0.0.1/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ"
password: set-a-strong-password
welcome-message: "Bzz Bzz Bzz"
swap-enable: false
blockchain-rpc-endpoint: https://sepolia.dev.fairdatasociety.org
verbosity: 5
full-node: true
```
Now, we can shut our second node and reboot with the new configuration.
Expand All @@ -137,3 +153,39 @@ curl -s http://localhost:1733/peers | jq
```

Congratulations! You have made your own tiny two bee Swarm! 🐝 🐝


## Funding Nodes

While you have successfully set up two nodes, they are currently unfunded with either sETH or sBZZ. Sepolia ETH (sETH) is required for issuing transactions on the Sepolia testnet, and Sepolia BZZ (sBZZ) is required for your node to operate as a full staking node.

To fund our nodes, we need to first collect the blockchain addresses for each node. We can use the `/addresses` endpoint for this:


```bash
curl localhost:1633/addresses | jq
```

```bash
{
"overlay": "b1978be389998e8c8596ef3c3a54214e2d4db764898ec17ec1ad5f19cdf7cc59",
"underlay": [
"/ip4/127.0.0.1/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ",
"/ip4/172.25.128.69/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ",
"/ip6/::1/tcp/1634/p2p/QmQHgcpizgoybDtrQXCWRSGdTP526ufeMFn1PyeGd1zMEZ"
],
"ethereum": "0xd22cc790e2aef341827e1e49cc631d2a16898cd9",
"publicKey": "023b26ce8b78ed8cdb07f3af3d284c95bee5e038e7c5d0c397b8a5e33424f5d790",
"pssPublicKey": "039ceb9c1f0afedf79991d86d89ccf4e96511cf656b43971dc3e878173f7462487"
}
```

Then copy the address in the "ethereum" field. This is the address you need to send sETH and sBZZ to. There are many public faucets you can use to obtain Sepolia ETH, such as [this one](https://www.infura.io/faucet/sepolia) from Infura.

To get Sepolia BZZ (sBZZ) you can use [this Uniswap market](https://app.uniswap.org/swap?outputCurrency=0x543dDb01Ba47acB11de34891cD86B675F04840db&inputCurrency=ETH), just make sure that you've switched to the Sepolia network in your browser wallet.

You will need to send only a very small amount of sETH such as 0.01 sETH, to get started. You will need 10 sBZZ to run a full node with staking.

After sending sETH and sBZZ to your node's address which you copied above, restart your node and it should begin operating properly as a full node.

Repeat these same steps with the other node in order to complete a private test network of two full nodes.

0 comments on commit 1f3f7c8

Please sign in to comment.