Script for joining a testnet on Linux

Here is a little script I’m trying to optimize for easy testnet installation on Linux. Thoughts?

EDIT: I’m updating the OP as we go along.


# Testing on Librem laptop 29.1.

# Edit the variables to fit your Linux system.

LOCAL_IP=$(echo `ifdata -pa wlp1s0`)
PUBLIC_IP=$(echo `curl -s`)
MAX_NODE_CAPACITY=$(numfmt --from auto 5Gi)

# Install Safe software and configuration

rm -rf $HOME/.safe
curl -so- | bash
safe networks add $COMNET

# Join a node from home

safe node install
echo "Node install completed"
RUST_LOG=safe_network=trace ~/.safe/node/sn_node --max-capacity $MAX_NODE_CAPACITY --local-addr $LOCAL_IP:$SAFE_PORT --public-addr $PUBLIC_IP:$SAFE_PORT --skip-auto-port-forwarding --log-dir ~/.safe/node/local_node

# Update vdash

cargo install vdash

# Use vdash to watch your node working. Can this be done in the same terminal window?

#vdash ~/.safe/node/local_node/sn_node.log

I like this @Sascha, well done.

This will vary depending on your kit and linux distro, you should know your own local IP anyway and be able to type it in.

It may not be strictly necessary but it does no harm - leave it

Again, may not be strictly necessary for 99% of us. May be useful for folk with very old kit, again it does no harm - leave it unless saving 2 secs is important.

Not sure why you chose port 12001, AFAICT 12000 works well for everyone - tell me if Im wrong. please.


Try something like this:

MAX_NODE_CAPACITY=$(numfmt --from auto 5Gi)

(but value is one unit greater: 5368709120)


use cargo install vdash it will update it if a new version is available, otherwise you will get a msg like

willie@gagarin:~$ cargo install vdash
    Updating index
     Ignored package `vdash v0.7.0` is already installed, use --force to override

I ended up forwarding port 12000 on one machine, and 12001 on the other. I’m not sure this makes any sense.

The script is obviously not for everyone, so I want to make it as simple as possible. I’m also trying to understand each command. I’m removing “sleep” and “switch” for now.

@tfa’s suggestion looks a bit “scary”, but so does just a long string of numbers, so I’ll implement that.

I’ll keep editing the OP as we go along. There are no guarantees it will work, but maybe it’ll be useful to somebody besides me.


thats what matters, if it helps one person get one step forward then its all good

the safe networks switch command is simply Good Practice If Somewhat Verbose
as is safe networks check to start with and end with safe networks to display the table of connections - which normally will only show one entry for 99% of users. But check if there is an asterisk * next to that entry. If there is no ‘*’, then your client knows about the genesis node but has not yet been told to switch to it.

sleep 2 just adds a 2 sec pause - gives folk time to read any output - I’d leave it in TBH.

@tfa 's suggestion is a lot less scary than mistyping a long string - good idea

It does, I didnt know you had two machines running. Most n00bs will only have one so KISS and leave it at 12000.

Keep at it. Your homework :laughing: is to get the script to ask the user to input their local IP
Hint: will probably start 192.168

For extra credit, ask what vault size they want, but default to 5Gb.


You could also try something like this I’d think…


Personally find it pretty simple to then work in multiples.

1024*1024*1024*5 and so forth.