With this testnet we’re going to punch some holes!
Computers in a home network will normally be unreachable from the outside, unless ports are forwarded manually. Lately, we’ve been experimenting with relays and hole punching, meaning nodes from inside a home network can participate in the network.
Home nodes will be reachable through public nodes that feature relay server capability. When home nodes are contacted through these relays, this relayed connection is attempted to be upgraded to a direct connection. Upgrading will involve hole punching. On success, data can flow between the home node and peer directly, without involvement of the relay.
For the first iteration of this testnet, we must manually specify --home-network
to enable hole punching for a node. We are planning to eliminate this argument further down the line with the help of AutoNAT, but for now, if you know you’re behind a NAT, you can use this argument. Publically reachable nodes can ignore this argument.
Some Caveats
- This is an experimental version where the relay servers are practically uncapped, so you can expect some extra incoming connections from home nodes.
- If you are running both a client and node from the same home network, they still have issue talking with each other. So your own home node cannot get chunk rewards from the uploads that are made from your home client.
Network Details
Node version: 0.106.0-alpha.4
Client version: 0.91.0-alpha.4
Faucet url: 209.97.185.196:8000
We have 50 droplets running a total of 2000 nodes. One droplet has 2vcpu and 4GB of memory.
If you are a regular user, see the ‘quickstart’ section for getting up and running.
If you are a first-time user, or would like more information, see the ‘further information’ section.
Quickstart
If you already have safeup
, you can obtain the client and node binaries:
safeup client --version 0.91.0-alpha.4
safeup node --version 0.106.0-alpha.4
Run a Node
safenode [--home-network]
Notice the --home-network
argument here, use this if you know you are behind a NAT firewall.
Check local node’s reward balance
Your local node’s peer id will be printed to the terminal on startup with an example command). (You can also retrieve this from the node directory.)
safe wallet balance --peer-id="<local-node-peer-id>"
Connect to the Network as a Client
safe wallet get-faucet 209.97.185.196:8000
safe files upload <directory-path>
To do this with non-default batch-size
s (along with SAFE_PEERS
set as above):
safe files upload --batch-size 40 <directory-path>
40
being the integer value you want to set
Further Information
You can participate in the testnet either by connecting as a client or running your own node.
Connecting as a client requires the safe
client binary; running a node requires the safenode
binary.
Obtaining Binaries
We have a tool named safeup
which is intended to make it easy to obtain the client, node, and other utility binaries.
Installing Safeup
On Linux/macOS, run the following command in your terminal:
curl -sSL https://raw.githubusercontent.com/maidsafe/safeup/main/install.sh | bash
On Windows, run the following command in a Powershell session (be careful to use Powershell, not cmd.exe):
iex (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/maidsafe/safeup/main/install.ps1")
On either platform, you may need to restart your shell session for safeup
to become available.
Installing Binaries
After obtaining safeup
, you can install binaries like so:
safeup client # get the latest version of the client
safeup client --version 0.91.0-alpha.4 # get a specific version
safeup node # get the latest version of the node
safeup node --version 0.106.0-alpha.4 # get a specific version
safeup update # update all installed components to latest versions
When participating in our testnets, it is recommended to use a specific version. In our project we release a new version of the binaries every time we merge new code. This happens frequently, so over the lifetime of a testnet, many new releases will probably occur. So for participating in this particular testnet, you may not want the latest version.
The binaries are installed to ~/.local/bin
on Linux and macOS, and on Windows they go to C:\Users\<username>\safe
. Windows doesn’t really have a standard location for binaries that doesn’t require elevated privileges.
The safeup
tool will modify the PATH
variable on Linux/macOS, or the user Path
variable on Windows. The effect of this is that the installed binaries will then become available in your shell without having to refer to them with their full paths. However, if you’re installing for the first time, you may need to start a new shell session for this change to be picked up.
Running a Node
You can participate in the testnet by running your own node. If you are running the node from your home machine, you must specify the home-network
argument. But if you run from a cloud provider like Digital Ocean or AWS, you can ignore this argument.
Not specifying this argument will make your node act as a Relay Server, which will facilitate the people behind NATs to perform hole punching.
You can run the node process like so:
# Home machine:
safenode --home-network --peer /ip4/142.93.46.42/udp/43338/quic-v1/p2p/12D3KooWSaCWsF2qLULtKTtjJPYpzCKn3X3aY19WdznPB5jUfmt3
# Cloud Providers:
safenode --peer /ip4/142.93.46.42/udp/43338/quic-v1/p2p/12D3KooWSaCWsF2qLULtKTtjJPYpzCKn3X3aY19WdznPB5jUfmt3
This will output all the logs to the filesystem, with the location of logs being platform specific:
# Linux
~/.local/share/safe/node/<peer id>/logs
# macOS
/Users/<username>/Library/Application Support/safe/node/<peer id>/logs
# Windows
C:\Users\<username>\AppData\Roaming\safe\node\<peer-id>\logs
If you wish, you can also provide your own path:
# Linux/macOS
SN_LOG=all safenode --log-output-dest <path>
# Windows
$env:SN_LOG = "all"; safenode --log-output-dest <path>
The advantage of using the predefined data-dir
location is you can run multiple nodes on one machine without having to specify your own unique path for each node and manage that overhead yourself.
Connecting as a Client
You can use the safe
client binary to connect as a client and upload or download files to/from the network.
Using the Client
You’ll first need to get some Safe Network Tokens:
safe wallet get-faucet 209.97.185.196:8000
You can now proceed to use the client, by, e.g., uploading files:
safe files upload <directory-path>
To download that same content:
safe files download
This will download the files to the default location, which is platform specific:
# Linux
~/.local/share/safe/client/downloaded_files
# macOS
/Users/<username>/Library/Application Support/safe/client/downloaded_files
# Windows
C:\Users\<username>\AppData\Roaming\safe\client\downloaded_files
To download to a particular file or directory:
safe file download [directory/filename] [NetworkAddress]
Troubleshooting
Cleanup
If you’ve used previous versions of the network before and you find problems when running commands, you may want to consider clearing out previous data (worthless DBCs from previous runs, old logs, old keys, etc.).
# Linux
rm -rf ~/.local/share/safe
# macOS
rm -rf ~/Library/Application\ Support/safe
# Windows
rmdir /s C:\Users\<username>\AppData\Roaming\safe
If you encounter a problem running any of our binaries on Windows, it’s possible you need the Visual C++ Redistributable installed.