Approved 2022/05/17 19:15 by drirmbda (version: 98) Newest approved

This is an old revision of the document!

Welcome to (a) SAFE Network Wiki

The SAFE Network project is vast and complex. The purpose of this wiki is to make the SAFE Network project more accessible. This is starting-out as a growing collection of personal notes of the editor trying to thoroughly understand the project, and is intended to evolve into an community-driven and independent guide to SAFE Network.

All information here is unofficial. You are free to edit and contribute right here as you learn about MaidSafe and SAFE Network yourself. This Wiki fills gaps, referencing existing resources whenever possible. Opinions belong on the SAFE Network Forum.

To edit this wiki your will need to go through automatic registration which is needed to avoid spam. There are some rules to keep this fun. The rules page contains contact information and legal notices.

By accessing this site you accept that it is your responsibility to obtain expert judgment and advice before using any information from this site for your particular situation. You alone are responsible for any losses or damages resulting from using this website.

The full history of this wiki is archived on GitHub

If you want to find out more about SAFE Network or start contributing, we want to be your guide. For specific topics look at the table on contents on the right. Otherwise pick a subsection based on the desired level of depth you are looking for.

=> Introduction - Start Here TOP

Cutting through marketing and hype, we are interested in which of the many good things SAFE Network will do for it's users will matter most to you. Understand what SAFE Network is really about, and why it's worth the wait.

=> Goals of the SAFE Network TOP

In this section we will try to separate out and have a closer look at the mechanisms that will keep the SAFE Network working as intended. Each of these need to be checked for possible weaknesses that could lead to disastrous malicious attacks.

=> Mechanisms TOP

One special mechanism regulating the network involves SafeCoin, a medium of exchange within the network, but with a reach well beyond it. This section is intended to consider this from an Economist's viewpoint.

=> Economics TOP

Dealing with MAID and SAFE Network tokens is much more complicated than dealing with cash. This should be a guide to make things easier. A thread tracking all MAID transactions so far is here.

=> Handling MAID and SafeCoin TOP

The 2014 MAID crowd sale record is here.

=> Crypto Charts Page

(what do you need to join.)

(how to start using apps.)

(how to start app software development)

This section is for tinkerers; experimental how-to's, etc.

Fleming Testnet 4/8/2021 v1; 4/14 v2; 4/15 v3; 4/22 v4; 5/13 v5.

Fleming TestNets April/May 2021

Note that all data and test coin balances will be lost at launch of the next testnet!

Instructions how to get started on Fleming testnet (if up) are below. (Search the latest Fleming Testnet V<version> on the SafeNetForum for more.) The cli user guide provides a lot of detail on how to interact with the network via the cli.

The following was tested on Ubuntu 18.04 with testnet v1, but there were issues with the later test-nets so be prepared for some road bumps along the way though as this is still very experimental. The network is not stable yet and you are most likely to succeed if it's early after a new bootstrap. The purpose is to debug and iterate in public, in a real-world environment.

Here is a simple guide to creating your own Ubuntu VM to work with: Ubuntu VM.

[ ] Clean out prior installations
  rm -rf $HOME/.safe
[ ] Run the installation script (on a 64-bit machine)
  curl -so- | bash
| Installs into ~/.safe
[ ] Close and reopen your terminal, and test version
  safe -V
| Expect: sn_cli 0.24.0
[ ] Make sure any and all old processes are dead, or kill them if needed.
  ps -A | grep sn_*
! killall sn_node
! killall sn_authd
[ ] Install Authenticator daemon (0.6.0) and Node (0.39.0).
  safe auth install
  safe node install
[ ] Add network profile to join the first Fleming testnet, and switch to the profile/testnet
  safe networks add fleming-testnet
  safe networks switch fleming-testnet
| The .config file contains a list of IP addresses and ports of hard-coded bootstrap nodes.
[ ] View the configured network profiles
  safe networks
[ ] Join our node to the network (this process continues to attempt to join the network until successful or killed.)
  safe node join
| or:  until grep "The network is not accepting" ~/.safe/node/local-node/sn_node.log; do echo "Starting node..." ; safe node killall ; safe node join; sleep 300; done
| logs will be here: ~/.safe/node/local-node/sn_node.log
| node data, incl. reward key pair should be here: ~/.safe/node/local-node
[ ] In a new terminal follow the log
  tail -f ~/.safe/node/local-node/sn_node.log
| You may see something like: The network is not accepting nodes right now. Retrying after 3 minutes, or the logging may seem to hang, reattempting to join periodically.
[ ] Download an example file in read-only mode, before creating your own Vault.
  safe dog safe://hygoyeye9mq5jmipo3we79wohue8hjyw55e6f8xyk1hquwy9hsxnk9tdsme
  safe cat safe://hygoyeye9mq5jmipo3we79wohue8hjyw55e6f8xyk1hquwy9hsxnk9tdsme > ~/safe-the-planet.png
| Be patient; command execution can take a minute.
| Or you get: Error: NetDataError: Failed to GET Public Blob: ErrorMessage(NoSuchData)

With your own node joined or not, you can always interact with the network through the cli. safe -h provides all the options, and safe subcommand -h the options for each sub-command. cli user guide

To transact we will need some coin, so let's just create test-coins first. Because we can on the test-net.

[ ] Create SafeKey and preload with a balance of e.g. 123456
  safe keys create --test-coins --preload 123456
| Be patient, it takes a minute.
| Note the safe xor address, and the public and secret key pair.
[ ] Check the balance
  safe keys balance
| enter the secret key when requested
| expect e.g.: SafeKey's current balance: 123456.000000000
[ ] Send coins
  safe keys transfer --from <secret key> --to "safe://<user>" <amount>
| without --from option, a default SafeKey will be used. (WHICH SAFEKEY IS DEFAULT??)
| expect e.g.: Success. TX_ID: 0 where the number is the serial tx from the SafeKey.

Note that this is not the default SafeKey that is associated with the CLI and which is used to pay for operations on the network. You can also create a wallet (a SafeKey container) to store SafeKeys, see CLI documenation.

For authenticator to work and to avoid this error Error: AuthdClientError: Failed to create client endpoint: [Error] ClientError - Failed to read certificate from '/home/mbouda/.safe/authd/cert.der': No such file or directory (os error 2) we need to start the daemon, which creates ~/.safe/authd/logs folder and additional files such as cert.der and key.der in ~/.safe/authf/ to get you started. Then we need to create a Safe (incl. an identity), and link a SafeKey to it. However, in this iteration of the testnet we need to create a new SafeKey using –test-coin option.

[ SETUP_AUTH_AND_SAFE 20210423/v4 ]
[ ] Ensure that you have enabled UPnP on your WAN router.
[ ] Start and Interact with Authenticator
  safe auth start
  safe auth status
| The authenticator endpoint is by default at https://localhost:33000
[ ] Follow the authenticator's log
  tail -f ~/.safe/authd/logs/sn_authd.log
| if the authd does not start, there may already be an authd running. Find it using ps -A | grep authd and kill <pid> and retry safe auth start.
[ ] Create an Safe (passphrase and password) and attach a SafeKey to it, to pay with.
  safe auth create --test-coins
| safe auth create alone does not work yet.
| note the pasphrase and password.
| If the initial balance is insufficient, you will get Error: AuthdError: AuthenticatorError: Failed to store Safe on a Map: Insufficient balance to complete this operation
| After re-install and using the same credentials: Error: AuthdError: AuthenticatorError: Client data already exists. In that case change your passphrase and password and try again.
| or you get: Error: AuthdClientError: [Error] ClientError - Response not received: read error: connection closed: timed out
| expect: Safe was created successfully!

To perform operations on the network that are not free, the CLI needs to be unlocked.

[ UNLOCK_CLI 20210423/v4 ]
[ ] Authorize the CLI
| The unlocking and authorizing can be done using --self-auth:
  safe auth unlock --self-auth
| provide passphrase and password.
| Be patient, this can take a few minutes.
| at fail: Error: Application authorisation failed Caused by: AuthdClientError: [Error] ClientError - Response not received: read error: connection closed: timed out
| expect: Safe CLI app was successfully authorised
| If it fails, try once more. Sometimes it times out and then succeeds.

An alternative:?

[ ] Request authorization
  safe auth
| at fail: Error: Application authorisation failed Caused by: AuthdClientError: [Error] ClientError - Response not received: read error: connection closed: timed out
| at fail: Error: Application authorisation failed Caused by: AuthdError: AuthenticatorError: Failed to authorise application on the network: AuthError: Failed to retrieve keypair from the Safe: Requested data not found
| expect: Safe CLI app was successfully authorised
[ ] To avoid timeout error, check on request status from a second terminal, and approve the request
  safe auth reqs
  safe auth allow <request id>

A shortcut to bypass the need for authd was implemented so that you can write to the network without it.

[ ] Generate test-coins for cli
  safe keys create --test-coins --for-cli
| expect: Safe CLI now has write access to the network
| note the Public and Private keys.

Under ~/.safe/cli/ there will be a file credentials containing a json array of numbers. Next up is creation of easy to read names NRS-URLs, mapping to XOR-URLs. NRS stands for Name Resolution System. These mappings are held in NRS Map Containers, which are based on Public Sequence data type.

[ CREATE_NRS_CONTAINER 20210409/v1 ]
[ ] Lookup XOR name and other details by XOR URL
  safe dog "safe://<xor-url>"
[ ] Create NRS for an xor-URL. Note that the container is versioned and therefore you need to add ?v=0 to the URL to point to the first version.
  safe nrs create -l "safe://<xor-url>?v=<version>" <readble name>
| on fail: Error: NetDataError: Failed to get current version: NetDataError: Failed to retrieve last entry from Sequence data: ErrorMessage(NoSuchData)
| expect: New NRS Map for "safe://<readable name>" created at: "safe://<xor-url of map container>"
+  <readable name>  safe://<xor-url-of file container version>
| note the NRS Map container URL.

Now you can use safe://<readable name> in place of corresponding safe://<xor-url>. Instead of create, use add to add sub-addresses.

[ ] Check if you have a positive balance to pay for uploads.
  safe keys balance
| expect e.g.: SafeKey's current balance: 1000.111
[ ] Add a first file to the network, creating a file container
  safe files put <local filename>
| Be very patient as this may take several minutes.
| expect: FilesContainer created at: "safe://<container xor-url>"
+  ./<local filename>  safe://<file xor-url> 
| Note the XOR-URL of the new container, as well as of the new file.
[ ] Optionally create an NRS for the container.
  safe nrs create -l "safe://<xor-url>" <readble name>
| on fail: Error: InvalidInput: The linked content (FilesContainer) is versionable, therefore NRS requires the link to specify a version: "safe://xor-url"
[ ] View the contents of the files container. Use the container xor-url.
  safe files ls "safe://<xor-url>"
| the default path within a container is "/".
[ ] Download a file from the container
  safe cat "safe://<xor-url>/<path to file>" > ./<local filename>
[ ] Download all files (the whole tree, incl. subdirs)
  safe files get "safe://<xor-url>" > ./<local dir>

Versions of objects can be requested by adding ?v=<version> to the URL. Below are some additional examples to play with. Read the cli manual for more…

[ MISC_CLI_EXAMPLES 20210409/v1 ]
[ ] List network profiles, switch, etc.
  safe networks
  safe networks check
[ ] Stop your local node
  safe node killall
[ ] Send test-coins
  safe keys transfer 1.1 --from <> --to safe://<user>
  safe dog safe://<user>
[ ] Check balance of rewards key of your node
  safe keys balance --sk $(cat ~/.safe/node/local-node/reward_secret_key)
[ ] Upload a bunch of files. Note that you will reach an upload limit after some time.
  safe files put ~/Music --recursive
[ ] Restart authenticator
  safe auth restart
[ ] Check on an XOR-URL and get details
  safe dog "safe://<xor-url>>"

Vdash node monitor

ARCHIVE of Community SAFE Network Testnet Instructions

A useful XOR distance calculator on the web. This is an example implementation in JS.