Skip to content

Instantly share code, notes, and snippets.

@zQueal
Last active December 3, 2021 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zQueal/3a3d18e091213ead267a1dbf0bca39ac to your computer and use it in GitHub Desktop.
Save zQueal/3a3d18e091213ead267a1dbf0bca39ac to your computer and use it in GitHub Desktop.
A little how-to on how to build `atto` from source.

Requirements

  • golang v1.17 or higher
  • git
  • Add executables to %PATH%

If you're working under Windows and would like to use winget it may make this process a little easier.

These should be the file locations you need to add to your %PATH%;

  • go: %ProgramFiles%\Go\bin
  • git: %ProgramFiles%\Git\bin
  • go bin: %USERPROFILE%\go\bin

note: These folders will not exist until both go and git are installed. So ensure you install both go and git with either method and then ensure the folders are added to %PATH%.

Winget

~
❯ winget source update
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
  ██████████████████████████████  100%
Done
~
❯ winget install GoLang.Go Git.Git

Normal

You can grab the latest versions of go and git here;

If you're unsure how to add folders to your path, you can find out how here.


Grabbing Source From Git

Open cmd.exe or powershell.exe whichever you prefer and change to a recognizable folder location and clone atto from Github;

~
❯ cd Downloads

~/Downloads
❯ git clone https://github.com/codesoap/atto.git
Cloning into 'atto'...
remote: Enumerating objects: 499, done.
remote: Counting objects: 100% (499/499), done.
remote: Compressing objects: 100% (332/332), done.Receiving objects:  12% (60/499)
Receiving objects:  88% (440/499)al 499 (delta 317), reused 342 (delta 160), pack-reused 0
Receiving objects: 100% (499/499), 86.49 KiB | 1.96 MiB/s, done.
Resolving deltas: 100% (317/317), done.

cd into the atto repository folder;

~/Downloads
❯ cd atto\

atto on master via 🐹 v1.17.3
❯

Grab All Required Go Dependencies

Because this project was created after go version 1.16, it already comes with an initilized go.mod file, so the only thing we have to do is execute go mod tidy to pull all requirements atto needs to build;

atto on master via 🐹 v1.17.3
❯ go mod tidy
go: downloading filippo.io/edwards25519 v1.0.0-beta.3
go: downloading golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670
go: downloading golang.org/x/sys v0.0.0-20201119102817-f84b799fce68

(Optional) Configure atto

There are two configuration options which you can choose to change before we build, if you want. This step is entirely option and works just fine if you touch nothing. The file will be located at atto/cmd/atto/config.go so for the purpose of this example it's located at ~Downloads/atto/cmd/atto/config.go;

package main

var (
        // The node needs to support the work_generate action.
        // See e.g. https://publicnodes.somenano.com to find public nodes or
        // set up your own node to use. Here are some public alternatives:
        // - https://proxy.nanos.cc/proxy
        // - https://mynano.ninja/api/node
        // - https://rainstorm.city/api
        node = "https://proxy.powernode.cc/proxy"

        // defaultRepresentative will be set as the representative when
        // opening an accout, but can be changed afterwards. See e.g.
        // https://mynano.ninja/principals to find representatives.
        defaultRepresentative = "nano_3hjo1cehsxrssawmpew98u4ug8bxy4ppht5ch647zpuscdgedfy1xh4yga7z"
)

You may change the node which atto will use to execute all RPC commands. There are a few more here (copy the "api" link under the name of the node RPC you'd like to use). You may also change the default representative to whomever you want. This representative will be used as a representative for any account index which isn't already opened. My personal recomendation is the Nalli representative; nano_3zapp5z141qpjipsb1jnjdmk49jwqy58i6u6wnyrh6x7woajeyme85shxewt. Changing this value will not change your already configured representatives.

Build Time

We're all set, and it's time to build. The only thing left to do is to cd to the atto cli application folder, and build;

~/Downloads
❯ cd atto\cmd\atto\

atto/cmd/atto on master [!] via 🐹 v1.17.3
❯ go build

Only errors will be output. If the build is a success, there will be no output, but atto.exe now exists in the directory;

atto/cmd/atto on master [!?] via 🐹 v1.17.3 took 3s
❯ ls
⠀atto.exe  ﳑ⠀config.go  ﳑ⠀main.go  ﳑ⠀util.go

Last thing that needs to be done is for you to move atto to your go bin directory (%USERPROFILE%\go\bin) which you should have already added to your %PATH%;

atto/cmd/atto on master [!?] via 🐹 v1.17.3 took 3s
❯ mv atto.exe %USERPROFILE%\go\bin\atto.exe

You can now close, and reopen cmd.exe or powershell.exe to refresh your environment variables. Atto should now be available as a command;

atto/cmd/atto on master [!] via 🐹 v1.17.3
❯ atto -v
1.4.0

If you get a version number, then you built atto successfully. If not, start from the beginning!

You can read more about how to use atto, as well as great examples, here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment