CRUST DIY instructions & discussions

Please correct if something is not right, using this I am running all the examples successfully!

1.) install rust Nightly (the compiler)

http://www.rust-lang.org/install.html4 or on mac/linux

    curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly

2.) install gcc (linux sudo apt-get install gcc)

3.) clone crust (install git if you don’t have it sudo apt-get install git on linux)

git clone https://github.com/maidsafe/crust.git

4.) go into the crust folder:

cd crust

5.) install libsodium if you have not yet done so

Unfortunally, there are not libsodium packages for Ubuntu. So, you should download, build and install libsodium as follows:

Download the newer tar archive from https://download.libsodium.org/libsodium/releases/ (you can also get the git repository from https://github.com/jedisct1/libsodium).

Follow the ritual:

tar xzf libsodium-1.0.3.tar.gz

cd libsodium-1.0.3/

./configure

make && make check && sudo make install

Once you have installed you have to reload/rebuild the GNU linkers. A simple sudo ldconfig is enough.

Now run ./configure and it should generate the makefile. (I’m assuming you have at least build-essentials package installed).

6.)cd crust

( to run crust_peer)

cargo run --example crust_peer

( to run simple_receiver)

cargo run --example simple_receiver

(open new terminal window)

( to run simple_sender)

cargo run --example simple_sender

culexevilman@ubuntu:~/crust$ cargo run --example crust_peer
Compiling libsodium-sys v0.0.5
Compiling rustc-serialize v0.3.14
Compiling strsim v0.3.0
Compiling libc v0.1.7
Compiling term v0.2.7
Compiling gcc v0.3.5
Compiling byteorder v0.3.9
Compiling regex v0.1.30
Compiling rand v0.3.8
Compiling time v0.1.25
Compiling cbor v0.3.6
Compiling docopt v0.6.64
Compiling sodiumoxide v0.0.4
Compiling crust v0.0.7 (file:///home/culexevilman/crust)
Running target/debug/examples/crust_peer
Listening for new connections on Tcp(V4(127.0.0.1:37810)), and listening for UDP broadcast on port 9999.
Didn't bootstrap to an existing network - this is the first node of a new network.

Enter command (stop | connect | send )>

culexevilman@ubuntu:~/crust$ cargo run --example simple_receiver
   Compiling crust v0.0.7 (file:///home/culexevilman/crust)
     Running `target/debug/examples/simple_receiver`
Listening for new connections on Tcp(V4(127.0.0.1:8888)), and not listening for UDP broadcasts.
Run the simple_sender example in another terminal to send messages to this node.
New connection made to Tcp(V4(127.0.0.1:43872))
Received "0" from Tcp(V4(127.0.0.1:43872)) - replying with "0"
Received "1" from Tcp(V4(127.0.0.1:43872)) - replying with "1"
Received "2" from Tcp(V4(127.0.0.1:43872)) - replying with "1"
Received "3" from Tcp(V4(127.0.0.1:43872)) - replying with "2"
Received "4" from Tcp(V4(127.0.0.1:43872)) - replying with "3"
Received "5" from Tcp(V4(127.0.0.1:43872)) - replying with "5"
Received "6" from Tcp(V4(127.0.0.1:43872)) - replying with "8"
Received "7" from Tcp(V4(127.0.0.1:43872)) - replying with "13"
Received "8" from Tcp(V4(127.0.0.1:43872)) - replying with "21"
Received "9" from Tcp(V4(127.0.0.1:43872)) - replying with "34"
Received "10" from Tcp(V4(127.0.0.1:43872)) - replying with "55"
Received "11" from Tcp(V4(127.0.0.1:43872)) - replying with "89"
Received "12" from Tcp(V4(127.0.0.1:43872)) - replying with "144"
Lost connection to Tcp(V4(127.0.0.1:43872))


----------
culexevilman@ubuntu:~/crust$ cargo run --example simple_sender
   Compiling crust v0.0.7 (file:///home/culexevilman/crust)
     Running `target/debug/examples/simple_sender`
New connection made to Tcp(V4(127.0.0.1:8888))
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 0 is 0"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 1 is 1"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 2 is 1"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 3 is 2"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 4 is 3"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 5 is 5"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 6 is 8"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 7 is 13"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 8 is 21"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 9 is 34"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 10 is 55"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 11 is 89"
Peer on Tcp(V4(127.0.0.1:8888)) replied with "The Fibonacci number for 12 is 144"
culexevilman@ubuntu:~/crust$

EDIT by @happybeing: changed crust_node to crust peer and updated rustc install command as per post 24

6 Likes

This is your error. If you install libsodium then you will be fine. IF you follwo the instructions for self_encryption then it will be cool. Thanks, we now know we need to update the README to show this. @prakash will jump on that I am sure :slight_smile:

3 Likes

Yeah I was following the instructions there, :wink: TY

1 Like

These instruction worked for me. I got 3 nodes running.
Btw these instruction are priceless, I hope we’ll have them for all modules.

5 Likes

Newbie question, how do you pass a parameter to crust_node?

“cargo run --example crust_node -s 32” returns:
Unknown flag: '-s’
Usage:
cargo run [options] [–] […]

1 Like

I tend to run the exe directly so cd into the target/debug/examples/ dir and run the example direct. This is in debug so slower than release but handy. You can also compile in release mode to see it as users will (faster, less output)

2 Likes

Modified OP for easier reading.

2 Likes

ok - just for clarification - i started the first node … this seems to be the central node
and all the other nodes are only connected to this node …? and the other nodes can’t communicate with each other …? or did i configure something not/wrong …?

and I started 2 receivers plus one sender - the messages were only sent to the first receiver - that is how it is meant i suppose …?

it is extremely cool that everything just works out of the box (if you install the nightly rust version and not the 1.0 :wink: ) nodes go online and connect to the central node and messages get delivered - but it isn’t a grid yet - is it …? or is it not meant to be a grid and there are always central nodes necessary …?

sorry for having so many questions … i should probably look for some documentation to read before asking stupid questions ;D … i’ll try to do that soon [promise]

That’s right CRUST itself is not able to provide routing info. When you add routing to this (in the routing examples) then you see the interconnect of machines to talk to each other. Then we add vaults and they talk in a language that securely stores data etc. This is a good way to discover the whole process as we release bits at a time and as you say critical it’s an out of the box experience. Shows progress as well nicer than a roadmap alone (which we are updating).

5 Likes

Pretty neat…I’m interested to see how this all goes together.

Hey all, I’m trying compiling on an odroid c1, and I’m getting a bunch of mismatched type errors:

    found enum `core::result::Result`) [E0308]

/home/odroid/.multirust/toolchains/unofficial-nightly/cargo/registry/src/github.com-1285ae84e5963aae/asynchronous-0.4.5/src/lib.rs:143 tx.send(f())
^~~~~~~~~~~~
/home/odroid/.multirust/toolchains/unofficial-nightly/cargo/registry/src/github.com-1285ae84e5963aae/asynchronous-0.4.5/src/lib.rs:201:13: 204:15 error: mismatched types:
expected (),
found core::result::Result<(), std::sync::mpsc::SendError<core::result::Result<TT, EE>>>
(expected (),
found enum core::result::Result) [E0308]

Any idea why? (i set up rust via https://github.com/japaric/ruststrap )

Have you checked if Rust supports the C1 processor (presumably ARMv7 or something?).

Yeh, that’s why I had to go down this ruststrap route (at least I think that means that it works), the toolchain and the first steps listed in the repo all come out okay. Hmmm. I’ll ping the ruststrap dev about it too and see if anything turns up.

3 Likes

Great work. I’m very keen to hear how you get on!

Hmm. Okay, so I’ve only got rust 1.0.0 not nightly, and trying to install anything else is proving a pain. I’m keen to play around so I’m just going to default to the mac. Here’s hoping that’s simpler.

Just to note in the instructions above (op), you’ve an em-dash where there should be two hyphens. I just realised after playing with self-encryption.

On a related note:
Are these in the wiki? I’d be happy to fire in and edit myself (if I’m able/allowed?)

Okay, so my simple_sender just bugged out with:

New connection made to Tcp(V4(127.0.0.1:8888))
thread 'SimpleSender event handler' panicked at 'cannot access stdout during shutdown'

It also, when not throwing errors, doesn’t appear to give anywhere near as much output as above; it only seems to make one connection and then die, right now. (OSX, Yosemite; can provide more info if it interests)

1 Like

ubuntu 15.04

  mranderson@neo:~/crust$ cargo run --example crust_node
       Compiling crust v0.0.8 (file:///home/mranderson/crust)
    
    error: linking with `cc` failed: exit code: 1
    note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mranderson/crust/target/debug/examples/crust_node.o" "-o" "/home/mranderson/crust/target/debug/examples/crust_node" "-Wl,--whole-archive" "-l" "morestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/home/mranderson/crust/target/debug/libcrust.rlib" "/home/mranderson/crust/target/debug/deps/libcbor-a029b1d21f636c96.rlib" "/home/mranderson/crust/target/debug/deps/libsodiumoxide-a4232303ae15c797.rlib" "/home/mranderson/crust/target/debug/deps/libdocopt-40f44425b0f8ac23.rlib" "/home/mranderson/crust/target/debug/deps/librustc_serialize-9ef26f158d5284e0.rlib" "/home/mranderson/crust/target/debug/deps/libasynchronous-e3362aaa40f64b19.rlib" "/home/mranderson/crust/target/debug/deps/libterm-1a85d6dfb646e607.rlib" "/home/mranderson/crust/target/debug/deps/libbyteorder-b315ab53bf71328b.rlib" "/home/mranderson/crust/target/debug/deps/liblibsodium_sys-a15ae7085732209a.rlib" "/home/mranderson/crust/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib" "/home/mranderson/crust/target/debug/deps/libnum_cpus-d64cdaf0c78cf4e8.rlib" "/home/mranderson/crust/target/debug/deps/libtime-e758cbe877e9589d.rlib" "/home/mranderson/crust/target/debug/deps/liblibc-2eda841eb12a3090.rlib" "/home/mranderson/crust/target/debug/deps/libstrsim-fb046b3f6ce0ea34.rlib" "/home/mranderson/crust/target/debug/deps/libregex-bee3bd02b59b955b.rlib" "/home/mranderson/crust/target/debug/deps/libregex_syntax-030d2a219106b7e6.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-11582ce5.rlib" "-L" "/home/mranderson/crust/target/debug" "-L" "/home/mranderson/crust/target/debug/deps" "-L" "/home/mranderson/crust/target/debug/build/time-e758cbe877e9589d/out" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/mranderson/crust/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/mranderson/crust/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "sodium" "-l" "rt" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "rt" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
    note: /usr/bin/ld: cannot find -lsodium
    collect2: error: ld returned 1 exit status
    
    error: aborting due to previous error
    Could not compile `crust`.

and

mranderson@neo:~/crust$ cargo run --example simple_receiver
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading libsodium-sys v0.0.5
 Downloading sodiumoxide v0.0.4
 Downloading term v0.2.7
   Compiling libsodium-sys v0.0.5
   Compiling regex-syntax v0.1.1
   Compiling gcc v0.3.5
   Compiling byteorder v0.3.10
   Compiling rustc-serialize v0.3.14
   Compiling libc v0.1.8
   Compiling strsim v0.3.0
   Compiling term v0.2.7
   Compiling num_cpus v0.2.6
   Compiling rand v0.3.8
   Compiling time v0.1.25
   Compiling asynchronous v0.4.5
   Compiling regex v0.1.33
   Compiling sodiumoxide v0.0.4
   Compiling cbor v0.3.6
   Compiling docopt v0.6.64
   Compiling crust v0.0.8 (file:///home/mranderson/crust)
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mranderson/crust/target/debug/examples/simple_receiver.o" "-o" "/home/mranderson/crust/target/debug/examples/simple_receiver" "-Wl,--whole-archive" "-l" "morestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/home/mranderson/crust/target/debug/libcrust.rlib" "/home/mranderson/crust/target/debug/deps/libcbor-a029b1d21f636c96.rlib" "/home/mranderson/crust/target/debug/deps/libsodiumoxide-a4232303ae15c797.rlib" "/home/mranderson/crust/target/debug/deps/librustc_serialize-9ef26f158d5284e0.rlib" "/home/mranderson/crust/target/debug/deps/libasynchronous-e3362aaa40f64b19.rlib" "/home/mranderson/crust/target/debug/deps/libbyteorder-b315ab53bf71328b.rlib" "/home/mranderson/crust/target/debug/deps/liblibsodium_sys-a15ae7085732209a.rlib" "/home/mranderson/crust/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib" "/home/mranderson/crust/target/debug/deps/libnum_cpus-d64cdaf0c78cf4e8.rlib" "/home/mranderson/crust/target/debug/deps/libtime-e758cbe877e9589d.rlib" "/home/mranderson/crust/target/debug/deps/liblibc-2eda841eb12a3090.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-11582ce5.rlib" "-L" "/home/mranderson/crust/target/debug" "-L" "/home/mranderson/crust/target/debug/deps" "-L" "/home/mranderson/crust/target/debug/build/time-e758cbe877e9589d/out" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/mranderson/crust/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/mranderson/crust/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "sodium" "-l" "rt" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "rt" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lsodium
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile `crust`.

and it seemed I successfully installed sodium before?

PASS: aead_chacha20poly1305
PASS: auth
PASS: auth2
PASS: auth3
PASS: auth5
PASS: auth6
PASS: auth7
PASS: box
PASS: box2
PASS: box7
PASS: box8
PASS: box_easy
PASS: box_easy2
PASS: box_seal
PASS: box_seed
PASS: chacha20
PASS: core1
PASS: core2
PASS: core3
PASS: core4
PASS: core5
PASS: core6
PASS: ed25519_convert
PASS: generichash
PASS: generichash2
PASS: generichash3
PASS: hash
PASS: hash3
PASS: onetimeauth
PASS: onetimeauth2
PASS: onetimeauth7
PASS: pwhash
PASS: pwhash_scrypt_ll
PASS: randombytes
PASS: scalarmult
PASS: scalarmult2
PASS: scalarmult5
PASS: scalarmult6
PASS: scalarmult7
PASS: secretbox
PASS: secretbox2
PASS: secretbox7
PASS: secretbox8
PASS: secretbox_easy
PASS: secretbox_easy2
PASS: shorthash
PASS: sign
PASS: sodium_core
PASS: sodium_utils
PASS: sodium_version
PASS: stream
PASS: stream2
PASS: stream3
PASS: stream4
PASS: verify1
PASS: sodium_utils2
PASS: sodium_utils3
============================================================================
Testsuite summary for libsodium 1.0.3
============================================================================
# TOTAL: 57
# PASS:  57
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

This link re: Upgraded to Ubuntu 14.10. Now git clone fails
may help if git clone fails.

Basically go into /usr/local and delete all libgmp.* and reinstall git if needed.

I get
no example target named crust_node

however cargo run --example crust_peer works just fine,

Im using nightly so I assume the file name has changed since this was written 3 weeks ago.
Early days but this looks as if it is working (sort of) across the LAN to/from my wifi connected laptop.
Next step is to install the routing and encryption on laptop and PC (Ubuntu 14.04 and 15.04).
Then I will try to install on my Centos 7 server - if that goes OK I’ll post whatever workarounds I needed and that can form the basis for instructions for RedHat and Fedora variants.
Thanks for the tutorials - its looking good :smile: