Grin Node on Raspberry Pi

I would like to run an HTTP listener on a Raspberry Pi, so I need to run a Grin node + a listener on the RPi. I have a Rpi set up with an external HDD. I also managed to cross-compile Grin for armv7-a by replacing
.set_mapsize(549_755_813_888)
with
.set_mapsize(4_294_967_295)
in store/src/lmdb.rs
The listener is meant to accept incoming funds and what I’m afraid of is that it will stop working at some point because obviously Grin was designed for a 64-bit system (hence the above constraint) and I’m forcing it to run on a 32-bit.
Anybody has any experience with this?
Are there any plans to make a 32-bit compatible version or should I just give up and use my old 64-bit laptop instead?

1 Like

We started the topic ‘Grin Pie’ and a few of us are working on it and sharing even though others think we are misguided, we could use your feedback. It would be for the newest Raspberry Pi 3+ models.

I have grin working on a Rpi, you have to change the mapsize to something like 900mb and wait for this PR to be merged https://github.com/mimblewimble/secp256k1-zkp/pull/38 or fork and merge on your own.

1 Like

Thanks a million for the update. I will retry again and make a step by step recipe/guide for ‘Grin Pie’ if I can follow through.

GrinPie: Directions much yum!

This is what I’m using but still not having success yet… the pie is half baked. Can anyone see where the missing part is for changing the mapsize? Thanks for your help.

Installing the GRIN Node # Open A New Terminal (Ctrl + Alt + T)

Set up Firewall

sudo apt-get update sudo apt-get upgrade
sudo apt-get install ufw sudo ufw enable
sudo ufw satus sudo apt install cargo curl build-essential cmake git libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev pkg-config libssl- dev llvm

Install RUST

$ curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env

( If error use: $ sudo apt remove rustc )

$ rustup update

Build Grin Node

git clone https://github.com/mimblewimble/grin.git cd grin cargo build --release target/release/grin

Build Wallet713

Open A New Terminal Ctrl + Alt + T

git clone https://github.com/vault713/wallet713 cd wallet713 $ source HOME/.cargo/env cargo build --release

cd target/release ./wallet713

Wallet Usage

init # init -p yourpasswordhere # unlock -p yourpasswordhere info listen send 10 --to <yourAddresshere>

To receive grins keep wallet713 running and transactions are processed automatically. Any transactions received while being offline are fetched once you initiate listen.

Create New Address

stop config -g

# config -g -i 10 listen

Send Payment By File

send 10 --file ~/path/to/transaction.tx receive --file ~/path/to/transaction.tx
$ finalize --file ~/path/to/transaction.tx.response

$ exit

This is the error message from tonight:

libfailure-01afa8ab57da5c7f.rlib --extern failure_derive=/home/pi/ grin/target/debug/deps/libfailure_derive-b1834022c6a55d01.so – extern grin_core=/home/pi/grin/target/debug/deps/ libgrin_core-4a394fc8edc4029d.rlib --extern grin_util=/home/pi/grin/ target/debug/deps/libgrin_util-0a9ab363e282bb1f.rlib --extern libc=/ home/pi/grin/target/debug/deps/liblibc-32615a55482856db.rlib – extern lmdb_zero=/home/pi/grin/target/debug/deps/liblmdb_zero- bcb94320bde5a037.rlib --extern log=/home/pi/grin/target/debug/deps/ liblog-ec6b2534ba42b177.rlib --extern memmap=/home/pi/grin/target/ debug/deps/libmemmap-f30e4deef5894bdf.rlib --extern serde=/home/pi/ grin/target/debug/deps/libserde-5e0ebc388e89efb2.rlib --extern serde_derive=/home/pi/grin/target/debug/deps/ libserde_derive-72309c603f7ca95a.so -L native=/home/pi/grin/target/ debug/build/croaring-sys-3c6b32be046d7499/out -L native=/home/pi/ grin/target/debug/build/backtrace-sys-65d29a1ac5ad3d94/out -L native=/home/pi/grin/target/debug/build/grin_secp256k1zkp- ef7b142610dcab85/out -L native=/home/pi/grin/target/debug/build/ miniz-sys-bac252a36f35c681/out -L native=/home/pi/grin/target/debug/ build/liblmdb-sys-414a46f16e3971a3/out`

error: literal out of range for usize --> store/src/lmdb.rs:77:16

| 77 | .set_mapsize(549_755_813_888)

| ^^^^^^^^^^^^^^^ | = note: #[deny(overflowing_literals)] on by default

error: aborting due to previous error

error: Could not compile grin_store.

Caused by: process didn’t exit successfully: `rustc --edition=2018 --crate-

name grin_store store/src/lib.rs --color always --crate-type lib – emit=dep-info,link -C debuginfo=2 -C metadata=9d9021972aeefa0c -C extra-filename=-9d9021972aeefa0c --out-dir /home/pi/grin/target/ debug/deps -C incremental=/home/pi/grin/target/debug/incremental -L dependency=/home/pi/grin/target/debug/deps --extern byteorder=/home/ pi/grin/target/debug/deps/libbyteorder-2c380fd638d02801.rlib – extern croaring=/home/pi/grin/target/debug/deps/ libcroaring-587501ffdaacf8fe.rlib --extern env_logger=/home/pi/grin/ target/debug/deps/libenv_logger-d09fb5c08c6fd6dd.rlib --extern failure=/home/pi/grin/target/debug/deps/ libfailure-01afa8ab57da5c7f.rlib --extern failure_derive=/home/pi/ grin/target/debug/deps/libfailure_derive-b1834022c6a55d01.so – extern grin_core=/home/pi/grin/target/debug/deps/ libgrin_core-4a394fc8edc4029d.rlib --extern grin_util=/home/pi/grin/ target/debug/deps/libgrin_util-0a9ab363e282bb1f.rlib --extern libc=/ home/pi/grin/target/debug/deps/liblibc-32615a55482856db.rlib – extern lmdb_zero=/home/pi/grin/target/debug/deps/liblmdb_zero- bcb94320bde5a037.rlib --extern log=/home/pi/grin/target/debug/deps/ liblog-ec6b2534ba42b177.rlib --extern memmap=/home/pi/grin/target/ debug/deps/libmemmap-f30e4deef5894bdf.rlib --extern serde=/home/pi/ grin/target/debug/deps/libserde-5e0ebc388e89efb2.rlib --extern serde_derive=/home/pi/grin/target/debug/deps/

libserde_derive-72309c603f7ca95a.so -L native=/home/pi/grin/target/ debug/build/croaring-sys-3c6b32be046d7499/out -L native=/home/pi/ grin/target/debug/build/backtrace-sys-65d29a1ac5ad3d94/out -L native=/home/pi/grin/target/debug/build/grin_secp256k1zkp- ef7b142610dcab85/out -L native=/home/pi/grin/target/debug/build/ miniz-sys-bac252a36f35c681/out -L native=/home/pi/grin/target/debug/ build/liblmdb-sys-414a46f16e3971a3/out` (exit code: 1)

pi@raspberrypi:~/grin secp256k1_scratch_allocate_frame bash: secp256k1_scratch_allocate_frame: command not found pi@raspberrypi:~/grin

Yes as I said you have to change this line and recompile

1 Like

My apologies for not understanding.

When you say “change this line” are you talking about opening something in a GRIN folder such as a text file and re saving it or are you talking about a terminal command that sets the numbers and recompiles? I’ve searched folders on the Pi for something like this “.set_mapsize(549_755_813_888)” but don’t find anything maybe because it’s in an invisible folder perhaps?

In the directions above, where would I insert this action item? Before building the grin node? And should the change finally look like this?: .set_mapsize(549_755_813_900)

If you can help amend the directions above I will be able to design a layout with step-by-step GRIN Onboarding guide to share with others.

Ok, I managed to cross-compile and run on the RPi thanks to the suggestions by mcdallas (thanks!), but when the node syncs, it gets stuck on the “Preparing chain state for validation, step 3/4” stage. From the log it looks like some kind of an out-of-memory error:

> 20190214 17:07:16.873 INFO grin_util::logger - log4rs is initialized, file level: Info, stdout level: Warn, min. level: Info
> 20190214 17:07:16.873 INFO grin - Using configuration file at /media/moosh/0fca0135-5ca5-4fdc-a7cd-881d70147561/grin/grin-server.toml
> 20190214 17:07:16.873 INFO grin - This is Grin version 1.0.1 (git v1.0.0-76-gc41ea4b), built for armv7-unknown-linux-gnueabihf by rustc 1.32.0 (9fda7c223 2019-01-16).
> 20190214 17:07:16.874 WARN grin::cmd::server - Starting GRIN in UI mode...
> 20190214 17:07:16.874 INFO grin_servers::grin::server - Starting server, genesis block: 40adad0aec27
> 20190214 17:07:53.439 INFO grin_servers::grin::server - Starting rest apis at: 127.0.0.1:3413
> 20190214 17:07:53.440 INFO grin_api::handlers - Starting HTTP API server at 127.0.0.1:3413.
> 20190214 17:07:53.441 INFO grin_servers::grin::server - Starting dandelion monitor: 127.0.0.1:3413
> 20190214 17:07:53.441 WARN grin_servers::grin::server - Grin server started.
> 20190214 17:08:25.140 INFO grin_servers::common::adapters - Received 32 block headers from 46.101.187.171:3414
> 20190214 17:08:25.872 INFO grin_servers::common::adapters - Received 32 block headers from 46.101.187.171:3414
> 20190214 17:08:26.488 INFO grin_servers::common::adapters - Received 32 block headers from 46.101.187.171:3414
> 20190214 17:08:27.180 INFO grin_servers::common::adapters - Received 32 block headers from 46.101.187.171:3414
> 20190214 17:08:27.847 INFO grin_servers::common::adapters - Received 32 block headers from 46.101.187.171:3414
> 20190214 17:08:28.487 INFO grin_servers::common::adapters - Received 19 block headers from 46.101.187.171:3414
> 20190214 17:11:55.550 ERROR grin_servers::common::adapters - Failed to save txhashset archive: TxHashSetErr: Cannot allocate memory (os error 12) 
>  Cause: Unknown 
>  Backtrace: 
> 20190214 17:11:55.558 ERROR grin_servers::grin::sync::state_sync - state_sync: error = Chain(Error { inner: 
> 
> TxHashSetErr: Cannot allocate memory (os error 12) }). restart fast sync

Does anyone has a suggestion?

1 Like