Running a Node on Windows

PowerShell is the recommended shell (not Command Prompt)

If you are running a node from home you will likely need to port forward.

Port Forwarding - This example does not detail port forwarding.
Open PowerShell and enter ipconfig
Use the IPv4 Address displayed as the internal IP when opening a port on your router.
In this example let’s open port 12000 for both internal and external.

Install safeup and the node binary
Using PowerShell install safeup: (this only needs to be done once).

iex (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/maidsafe/safeup/main/install.ps1")

Once installed restart PowerShell.

Get the node binary
The binary version that you need will be listed in the instructions for the network that you wish to join.

safeup node --version 0.105.2 (change the version number as needed).

Start the node
safenode --port 12000
Closing the PowerShell will kill your node.

That’s it your node should be running.
NB. Your node will likely stop if your PC is set to hibernate after a specific time.


To check how things are going you can do several things.

PowerShell Get-Process | Where-Object {$_.ProcessName -like "*safenode*"} this will show you if the process is running.
get-process

Resource Monitor : Type resmon in the Start menu and hit Enter. Go to the “CPU” tab and search for safenode in the list of processes, select it and you can more easily view cpu, network, memory etc.

Task Manager : Press Ctrl+Shift+Esc to open Task Manager, then look for safenode in the “Processes” tab.

To see your nodes files open File Explorer, select Local Disk (C:) then Users followed by your <username>.
Make sure that hidden Hidden items is selected in the view tab.
Select AppData then Roaming then safe followed by node

Here you will see your node.
To be sure that your node is receiving chunks open the record_store folder, this is where you are storing other users data, it should get files pretty soon if all is well.

After some time has passed you should receive rewards.
To see your balance make sure that you have the relevant client installed.
safe wallet balance --peer-id <PeerID>
(Replace <PeerID> with that of the node you wish to check the balance of)
Your nodes PeerID is the name of its folder.


Cleanup

To kill your node Get-Process safenode | Stop-Process

For a fresh start or when joining a new network: Remove-Item -Recurse -Path "C:\Users\kyte7\AppData\Roaming\safe"

16 Likes

Do you happen to know how to get the time it takes to finish commands? In Linux I can just put time in front of every command, not in windows.

1 Like

Like this?

PS C:\Users\kyte7> Measure-Command { safe wallet balance --peer-id 12D3KooWNGwzVwzfad97Xt6VyhhbpVbCJNiRVUGexuySvWnhBUgK }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 180
Ticks             : 11801543
TotalDays         : 1.3659193287037E-05
TotalHours        : 0.000327820638888889
TotalMinutes      : 0.0196692383333333
TotalSeconds      : 1.1801543
TotalMilliseconds : 1180.1543
4 Likes

Nice one Josh!

It would be cool to hear about your experience with the node manager on Windows too, if you try it.

2 Likes

Sure thing, I’ll give node-manager a go next and add a section for it’s use too!

Just not quite clear when it will start being recommended in the network instructions so figured I’ll stick with the “current way” until it is.

3 Likes

Thank you so much

This fails for me though:

safe wallet balance --peer-id 12D3KooWQF85NTTyv1b44atFW5J65VvLbqJXdCtmBEbR8FbZPV4C

Result: error: Found argument ‘–peer-id’ which wasn’t expected, or isn’t valid in this context

Am I doing something wrong?

That’s odd, run safe --version does it return sn_cli 0.90.2

wait nope

sn_cli 0.52.0 appearing …

But I have just ran just installed: safeup client --version 0.90.2

not sure what’s happening…

One feedback I like to give to the community is:

It be a lot less technical debt on everyone if the community and the dev teams focused on powershell .net core scripts which runs on mac / windows / linux etc when providing instructions (at least to the windows community as a starting point), and update the docs and scripts to be under that platform.

Powershell 5 and below is legacy and only supported on Windows.

The benefit off Powershell 7+ (pwsh) would be even other folks say on Linux can test it out locally or make suggestions to it etc regardless of the OS (linux vs windows debacle).

The $isMacOS, $isLinux, $isWindows are core automatic variables in this framework and can be used to work around slightly different native OS commands if running commands outside of the Powershell .NET Core framework.

3 Likes

Good shout. Is there anything currently in violation of that?

1 Like

You have a old version lurking somewhere, in powershell run: Get-ChildItem -Path C:\ -Filter safe.exe -Recurse -ErrorAction SilentlyContinue | ForEach-Object { $_ | Select-Object FullName, @{Name='Version'; Expression={$_.VersionInfo.FileVersion}} }
I should tell you where they are.

1 Like

Thank you. Sorted, up and running. 0 rewards lol

2 Likes

Don’t be disheartened by that, they are scarce for me too.

2 Likes

No idea… I don’t operate a Windows OS at home anymore, but I can’t tell if the community is referring to Powershell as in Windows Powershell or Powershell 7.x (.NET Core) based, and the code folks have written is tested against the latter version as oppose to Windows Powershell.

For instance, the testnets have this instruction:

On Windows, run the following command in a Powershell session (be careful to use Powershell, not cmd.exe):

https://raw.githubusercontent.com/maidsafe/safeup/main/install.ps1

You are distinguishing between powershell and cmd.exe, but ‘Powershell’ can be installed along side with ‘Windows Powershell’ also on Windows. i.e. - pwsh.exe vs powershell.exe.

We need to be ultra clear on which framework the code has been tested against produced by the community and by the dev team, and be syntax free including possibly setting say Set-StrictMode mode on etc. Otherwise folks will intermix the code when running it on Powershell.exe or Pwsh.exe, and it may not work as intended.

To be honest, I don’t think there’s many people here, including admittedly myself, who have been knowledgeable enough to make that distinction.

2 Likes

I am a fairly advanced user of Windows Powershell (now abandoned by me), and have over the many years, transitioned to ‘Powershell’ aka pwsh on Linux & Windows, so I really wanted to make this distinction clear:

For instance on a Windows OS, you can have these 2 options when right clicking on say .ps1 script:

image

Yeah fair enough. I wasn’t really aware of this. I’ll try to be more careful in the future to make the distinction.

No worries. Its all good. I saw this new topic show up on Running Nodes on Windows, and I thought it be best for the community to stick to a cross platform version of powershell based on .net core (assuming MaidSafe management agrees here (tbd)).

Since I don’t have a Windows OS anymore, I have mostly stayed away from commenting on that part of the setup instructions and other users’ questions on the forum in that environment.


Over the years, on a personal note, I have appreciated Microsoft’s attempt at making pwsh behave uniformly across MacOS, Linux, and Windows and increase its feature sets.

I suspect many advanced Linux or Mac OS users may not want to switch to pwsh even though its widely available on many Linux distributions as well on Mac OS (separate topic).


Therefore, for many reasons (not stated here), I believe MaidSafe will have to continue to maintain 3 different bootstrap documentation and toolkits for the 3 different OSes outside of the release binaries themselves that are different per OS/architecture.

2 Likes

Raises my hand. Also keep away from .net as much as possible because its an avenue for microsoft to introduce unwanted “features”. People running windows will not be affected since windows already has those unwanted “features” in other ways.

3 Likes

=========================
ALL TOTALLY HYPOTHETICAL

If anyone was to accidentally DM me a link to a Win11 iso that they knew was reasonably malware-free, I might accidentally put it on some spare hardware here and join in the fun.

1 Like