Skip to content

Instantly share code, notes, and snippets.

@crtahlin
Created June 19, 2023 19:47
Show Gist options
  • Save crtahlin/13895983697e81215014469d13967fc4 to your computer and use it in GitHub Desktop.
Save crtahlin/13895983697e81215014469d13967fc4 to your computer and use it in GitHub Desktop.
Mining an overlay and using it for Bee
# Mining an overlay and using it for Bee
- The following is a brief step-by-step process of using tools to mine an overlay address in a specific Swarm neighborhood (e.g. less populated one) and using the generated keys with a Bee node. Staking step is left out (if you want to earn BZZ you have to also stake).
- Use swarm-tools to mine the address and generate keys
- Build swarm-tools-rs from source ...
- clone the repo with tool:
- https://github.com/rndlabs/swarm-tools-rs.git
- install cargo rust package manager, on Ubuntu
- `sudo apt install cargo`
- `cargo check` in the cloned folder, it seems to also download dependencies etc.
- `cargo build --release`
- `cd /target/release`
- `./swarm-tools --help`
- to check if the binary works
- ... or get the binary version from `https://github.com/rndlabs/swarm-tools-rs/releases`
- To mine the overlay for 190th nbhood at depth 9, aka nbhood `010111110` , run
- `./swarm-tools overlay manual-mine -r 9 -n 190`
- to determine which index (-n XXX) to use, sort the binary overlays ascending, and start counting them from 0
- or ask someone for a table listing them ([depth9](https://gateway.ethswarm.org/access/bcb7849ddd8cc64ff934cc75ba02003c63a165a13a1163b51a019454883f89c2), [depth10](https://gateway.ethswarm.org/access/42fc19a2976b491cbc31aaef623b25d0654e2e16976316f6d7a7ed012db2f23d), [depth11](https://gateway.ethswarm.org/access/299f7ac1729b250291d3a923f63a70cb7aad6a06ca980882b8942973906bc9de) )
- check that the mined address falls into the neighborhood you want before using it (convert to binary to check; or at least compare first few hex chars)
- cd to `cd bees`
- in the folder, you will find <overlay_address.json> and <overlay_address.password>
- the .json you will use as Swarm.key and the .password contains the password you copy into your config.yaml or wherever your settings are. Or use in a separate password file, as specified in your config file.
- Log into your machine (e.g. with `ssh`)
- download appropriate bee version, e.g.
- `wget https://github.com/ethersphere/bee/releases/download/v1.16.1/bee_1.16.1_amd64.deb`
- install Bee
- `dpkg -i bee_1.16.1_amd64.deb`
- it will not start as the settings are not correct and also there are no funds for deploying the contracts etc.
- replace the keys first
- `cd /var/lib/bee`
- remove statestore `rm -r statestore/`
- `cd keys`
- `rm libp2p_v2.key pss.key`
- `nano swarm.key`
- paste in the contents of the generated overlay_address.json file, to replace existing contents
- `cd ..`
- `nano password`
- paste in the contents of overlay_address.password file to replace current contents
- edit the settings file
- `cd /etc/bee/`
- `nano bee.yaml`
- `# mainnet: false` --> `mainnet: true`
- `# blockchain-rpc-endpoint: "" ` --> `blockchain-rpc-endpoint: "https://xdai.fairdatasociety.org"`
- `full-node: false` --> `full-node: true`
- save
- restart bee service `systemctl start bee`
- get info about service by running `systemctl status bee`
- note the line
- `"using ethereum address" "address"="0xCaFbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"`
- send some xDAI and xBZZ to the address you noted - mind that it is not an address on the Ethereum network, but actually on the Gnosis network. There are different ways how to do this. you could get an invite code, import it as private key to a wallet (Metamask?) and then send from that wallet.
- check that the transactions go through, using e.g. `https://gnosisscan.io/address/0xCaFbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
- restart bee `systemctl restart bee`
- you should messages about chequebook deploying and such, if you do `systemctl status bee`
- it should take some minutes to sync postage batch data `"waiting to sync postage contract data, this may take a while... more info available in Debug loglevel"`
- then the Bee starts discovering peers etc.
- After a while, you will have a running and synced bee. best to use the command to check:
- `sudo apt install jq`
- `curl localhost:1635/status | jq`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment