User Experience for the CLIs

I just packed up, heading to the airport. Will have some time to play there!

But in the meantime, is there such a thing as a client binary?

1 Like

oops NEVER cut n paste before actually drinking your coffee

try

wget https://github.com/maidsafe/safe_network/releases/download/0.1.0-0.20.10-0.15.5-0.6.4-0.82.5-0.80.4-0.80.4-0.74.2-0.1.4/safe-0.74.2-x86_64-unknown-linux-musl.zip

Sorry - have a safe flight.

1 Like

Despite what is said in --help safenode/testnet defaults to 127.0.0.1:0 NOT 0.0.0.0:0

        --local-addr <LOCAL_ADDR>
            Local address to be used for the node.
            
            When unspecified, the node will listen on `0.0.0.0` with a random unused port. If you're
            running a local-only network, you should set this to `127.0.0.1:0` to prevent any
            external traffic from reaching the node (but note that the node will also be unable to
            connect to non-local nodes).

This causes grief when I want to run a LAN network so I can hook up my SBCs, laptops, backup box etc

willie@gagarin:~/.safe/network_contacts$ testnet -c25 -- -vv --local-addr 192.168.100.100:0
2023-03-27T02:43:24.470437Z  INFO sn_testnet: Clearing "/home/willie/.safe/node/local-test-network" for new network
2023-03-27T02:43:24.470600Z  INFO sn_testnet: Launching genesis node using address 127.0.0.1:12000...
2023-03-27T02:43:24.470707Z DEBUG sn_testnet: Running "safenode" with [
    "--first",
    "127.0.0.1:12000",
    "--local-addr",
    "0.0.0.0:12000",
    "--root-dir",
    "/home/willie/.safe/node/local-test-network/safenode-genesis",
    "--log-dir",
    "/home/willie/.safe/node/local-test-network/safenode-genesis",
    "-vv",
    "--local-addr",
    "192.168.100.100:0",
]
2023-03-27T02:43:24.471043Z  INFO sn_testnet: Delaying for 5 seconds before launching other nodes
error: The argument '--local-addr <LOCAL_ADDR>' was provided more than once, but cannot be used multiple times

USAGE:
    sn_node [OPTIONS]

For more information try --help

I got it to work but it was an ugly kludge

i’llwrite it up after some sleep

I’m going to page @bzee in here to help with this.

I’ve never really been completely sure on how --local-addr and --public-addr should be correctly used and if their usage differs in certain contexts.

1 Like

How to set up a LAN network

safenode --first 192.168.100.100:0 -vvv -r /home/willie/.safe/node/local-test-network/safenode-genesis/

then copy the section_tree from the local-test-network/safenode-genesis/ dir to ~/.safe/network_contacts. I renamed it to default - “lan” or something would have been better.

then I start the bulk of the nodes
testnet -c30 --join -n $HOME/.safe/network_contacts/default

Each time I do this I get an error on the last node

Node PID: 297245, prefix: Prefix(), name: 66cea7(01100110).., age: 5, connection info: 0.0.0.0:34391
2023-03-27T03:39:43.733238Z  INFO sn_testnet: Launching node 30 of 30...
2023-03-27T03:39:43.733368Z DEBUG sn_testnet: Running "safenode" with [
    "--network-contacts-file",
    "/home/willie/.safe/network_contacts/default",
    "--root-dir",
    "/home/willie/.safe/node/local-test-network/safenode-30",
    "--log-dir",
    "/home/willie/.safe/node/local-test-network/safenode-30",
]
2023-03-27T03:39:43.733796Z  INFO sn_testnet: Copying network contacts file to /home/willie/.safe/network_contacts
willie@gagarin:~$ Starting logging to directory: "/home/willie/.safe/node/local-test-network/safenode-30"
Node started
Error: 
   0: Network knowledge error:: Failed to deserialise section tree: EOF while parsing a value at line 1 column 0
   1: Failed to deserialise section tree: EOF while parsing a value at line 1 column 0

Location:
   /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/convert/mod.rs:726

Suggestion: If this is the first node on the network pass the local address to be used using --first
   Cannot start node. Node log path: /home/willie/.safe/node/local-test-network/safenode-30

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Node PID: 297152, prefix: Prefix(), name: 051bce(00000101).., age: 5, connection info: 0.0.0.0:44927
Node PID: 297199, prefix: Prefix(), name: 6f5e8d(01101111).., age: 5, connection info: 0.0.0.0:45364

However this is not fatal and AFAICS - need to check with logging enabled later- the node works OK

After this I can copy section_tree from one of the testnet nodes to ~/.safe/network_contacts on the PIs and laptops and then connect a single node.

And so far with minimal testing it seems to work, But something tells me this is not the way it was meant to be…

Anyhow a new release is out so I need to go get that onto each machine and try again.

1 Like

The --public-addr does not exist anymore and is replaced by --first. We accept a socket address for --first, because this is the address that the genesis should be available at. In case of a network on a single machine, this can be a 127.0.0.1 address, in a local network it could e.g. be 192.168.0.100 and public testnets could use their public address. This address will be put in the network contacts file, so other nodes know where to reach this genesis at.

The --local-addr is just the socket we bind to. So this is almost always fine with the default 0.0.0.0, because that means it binds to all interfaces.

2 Likes

Ah sorry for reintroducing --public-addr, forgot that had been removed.

Do we need to provide an argument for testnet to override the genesis address then? So that the user could pass 192.168 type addresses?

1 Like

While you are at it please can you check how to specify the log-dir on a testnet if it is joining an existing network- or single genesis node?

What’s the use case for overriding the log dir while using testnet?

Previously I was getting a similar error for log-dir as --local-addr

was provided more than once, but cannot be used multiple

Im beginning to wonder if this is not all a distraction to you guys - how many folk are actually going to test in this manner at this time before we get an API and it should all get a lot simpler?

Im going to pkill -e safenode on all my devices and try again with the new release

Yeah, well that makes sense, because testnet is using the --local-addr and --log-dir arguments when it launches safenode. The additional arguments only apply to arguments that aren’t already used.

We could add a --log-dir override to testnet so that users can pass their only logging directory, but testnet is supposed to just be a simple tool for bringing up a local network. What I’m really asking is, why would you want to use a different logging directory other than the one it sets up for you? Considering this is just a basic little network.

1 Like

I dont want them to go to a different log-dir, I want all the logs to go to a consistent destination and when I play with safenode and testnet they seem to go to different places.
Anyway I wouldnt worry too much about it - I seem to have found something that kinda works. Let me play with it over a few releases and then I can come back with reasoned suggestions not panicked pleas for help :slight_smile:

Right, I’m not sure off the top of my head what the default logging directory is if you use safenode on its own.

However, if you use testnet, which manages safenode for you, then use safenode outside of that to participate in something you already launched with testnet, it’s probably the user’s responsibility to make sure they know what they are doing and that will work correctly.

Indeed but there is a difference between local on one machine 127.0.0.1 and “local” on a LAN. I totally understand why it was done that way and perhaps we should just add testnet docs that it is meant for one PC, not for one LAN

Well, it’s not necessarily just meant for one machine. I’m happy to work with users to get something that works better on a LAN.

Its all @aatonnomicc’s fault anyway. If he hadnt given me a pile of old Pis, I wouldnt be getting so deep into this :slight_smile:

1 Like

It sounds like overriding the genesis node address would work for the LAN. That’s easy to provide.

2 Likes

We could do with a flag for testnet so that the LAN address can be defined 192.168.100.0 10.0.0.0 or whatever as well as the machine that the genesis node is hosted on - 192.168.100.100 in my case

The other nodes use the network contacts to find the genesis node.