StorageΒ games

What is this?

This is a deep-dive on the Swarm Storage Incentives. Contained within is guidance on how to optimise performance in the "Schelling Game" - the core component of the storage incentives. The article includes details for using tools to optimise this performance. There is NO tl;dr - understanding how to optimise performance REQUIRES knowledge of some Swarm primitives. If you're in for the long haul, read on enthusiastic bee 🐝...

Primitives

Storage (Chunks)

When uploading data to Swarm, end users may think of "files", but this is NOT how Swarm works (contrary to the likes of IPFS). Swarm will take a file and break it into chunks of 4KB, similar to how when writing to storage in a computer your file is actually stored over a number of sectors on disk.

Unlike disk-sectors that are sequentially addressed, a chunk is addressed by it's cryptographic hash. This is known as the chunk's content address, and looks something like: 9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658.

Nodes

In order to store data, and to do so in a privacy preserving, censorship-resistant manner, with data-redundancy and availability guarantees requires a set of nodes to co-operate based on protocols. Collectively these protocols are what define Swarm, and the reference implementation of these protocols is bee.

Each node is identified in Swarm by it's overlay address. From the bee source code, it can be determined that an overlay address O is defined as:

O = H(ethAddr . netIdBytes .nonce)

In practice, this looks something like: 9c0d5eba6c3c1c59233066c6004e92c8b693846f351f5083a2f75a1d4718969d

How does a node know what to store?

In Swarm, nodes are grouped into neighbourhoods, which determine:

  1. What nodes they will prefer for connectivity (their neighbours).

  2. What chunks fall into their area of responsibility - these are the chunks that nodes MUST store (the node's store is also known as the reserve).

To determine the node's neighbourhood, and also who it's neighbours are, the node needs to get some idea as to just how much data is in the Swarm.

Storage Radius

The storage radius is a number representing the number of leading bits used when comparing the node's overlay address and a chunk's content address that form it's area of responsibility / neighbourhood.

Example: Overlay address O: 9c0d5eba6c3c1c59233066c6004e92c8b693846f351f5083a2f75a1d4718969d Storage radius r: 8
Neighbourhood prefix (the first 8 bits, taken from the storage radius): 9c Total number of neighbourhoods: 256 (n = 2^r)

Therefore, this node must synchronise all chunks whose content address begins with 9c, such as the previously mentioned example chunk!

A node will attempt to fill it's reserve to at least 40% capacity (nominally the reserve has a maximum capacity of 4M chunks, or ~15.25GB). To do this, the node first "warms up", connecting to other nodes to build a reasonable guess of the Swarm's size. This guess is based on the distribution of the other nodes that the node is connected to. Now, from this guess, the node will begin synchronising historical chunks using the pullsync protocol.

CAUTION: Above capacity statements are targets for the node and do not include other data stored (such as database indexes, statestore etc) and should NOT be used as guidance for determining maximum bee node storage. In practice, you should allow conservatively up to 60GB, though the node may use considerably less.

Pull sync

If the node started with a storage radius below the swarm's average, it will pull in more chunks than required, resulting in the reserve exceeding 100% capacity. At this point, the pullsync will increase the storage radius, and trim the chunks from the reserve that are no longer within the new storage radius.

If the node started with a storage radius above the swarm's average, it will pull in less chunks than required to fill the reserve to at least 40% capacity. As the chunk-sync rate falls to 0 chunks/sec, the pullsync will decrease the storage radius, pulling in more chunks within the new storage radius.

The above logic will iteratively continue until the node arrives at the target reserve capacity (40% - 100%), and therefore settle on the Swarm's average storage radius.

Postage Stamps

Great! We can now pull down all these chunks, but how does a node know what is real, genuine data that should be stored in the Swarm? This is where Postage Stamps come in. These are analogous to stamps placed on old-school snail mail βœ‰οΈ, instructing the postal service that "this envelope is real and should have a service applied to it". When a user uploads data to Swarm, they attach a stamp to this data that they purchased with BZZ.

The postage stamps have two properties of interest to the Swarm: the volume of data that the stamp can be attached to, and the value, how long the Swarm should keep the data for. The stamp's value is analogous to rent (time) for a fixed volume of data on Swarm. The price of this rent is set by a PriceOracle, and the fee is denominated in PLUR (the smallest unit of BZZ). You can top up a stamp, which extends it's validity (time-to-live, or TTL), and you can also increase depth, which increases the volume of data you can store with that stamp (but results in a corresponding decrease in length of validity).

It is this rent charged via stamps that undergoes redistribution to node operators to subsidise / incentivise them to house your data - but be careful to pay your rent (top up your stamp) - otherwise your data may be evicted from it's home on the Swarm!

Phew, that's a lot to get here. The good news is, we're done on the primitives required to understand the storage incentives. Good work! πŸ’ͺ

Storage Incentives

With the release of bee v1.11.0, storage incentives were activated. These incentives are implemented using a coordination game. Broadly speaking:

  1. Every 12 mins 40 seconds (or 152 blocks @ a block time of 5s for Gnosis Chain), staked nodes in a random neighbourhood participate in the coordination game.

  2. In the commit phase, each node in the neighbourhood commits an obfuscated hash of it's reserve to the blockchain. It's obfuscated so other nodes cannot cheat from it.

  3. In the reveal phase, each node reveals their non-obfuscated hash (which is checked against their previous commit).

  4. In the claim phase, a random node is chosen to be a "truth teller". From the nodes who told this truth a random node is selected as the winner (biased towards their stake density - the amount they have staked), and the accumulated rent is transferred from the PostageStamp contract to the winner. All nodes whose hash didn't match the truth are frozen. A new random neighbourhood is chosen at this time so that nodes can begin calculating their reserve's hash before the start of the next round's commit phase.

From the above game, the following conclusions can be made:

  1. A node has an average 1/n chance of having it's neighbourhood selected for playing a round, where n = 2^r and r = storage radius.

    Example
    Storage radius r = 8
    Number of neighbourhoods: n = 2^r = 2^8 = 256
    P(Neighbourhood Chosen) = 1/n = 1/2^r = 1/256
    Round length (seconds): l = 760
    Average neighbourhood selection frequency: f = P(Neighbourhood Chosen) / l = 1 / 256 / 760 β‰ˆ 54 hrs

    Therefore, a node can expect their neighbourhood to be selected on average every ~54 hrs.

  2. The randomness at which a node's neighbourhood is chosen means a node should stay online as continuously as possible to maximise it's likelihood of being available to play.

  3. The chance of a node winning is relative to it's stake density, versus the average stake density in the neighbourhood. It is ideal to find a neighbourhood with as few neighbours as possible to minimise competition.

    Example
    Storage radius: r = 8
    P(Neighbourhood Chosen) = 1/256
    Number of neighbours: p = 5
    P(Node win) = P(Neighbourhood Chosen) / p = 1 / 2^r p = 1 / (256 x 5) = 1 / 1280
    Average node win frequency: f(w) = P(Node win) / l = 1 / 1280 x 760 β‰ˆ 270 hrs

  4. When choosing an amount to stake for a new node, it is sound to start with with a stake equal to the average within a neighbourhood. This is the classic Prisoner's dilemma.

  5. The reward expected for each round depends on the postage stamp price and the total amount of data paid for in current stamps.

    Example
    Postage Price = 24000 PLUR
    Total chunks paid for = 11401m
    Round reward: i = Price x Number of chunks x Round length
    i = 24000 x 11401000000 x 152 / 10^16 β‰ˆ 4.159 BZZ

    NOTE: It is possible that users may purchase very large postage stamps (in the terabytes of data or more), but not utilise them completely. In which case, they are effectively paying rent for something that they are not occupying / utilising. This gives rise to the expected phenomenon that Actual Storage ≀ Paid Storage.

Optimisation

If you've made it to this point, you will by now know that the only thing within your control to optimise performance in the Schelling game is through minimising your competition, and staking the average within your neighbourhood. Fortunately, unlike with most situations in life - in this case we can choose our neighbourhood!

We will use the following algorithm to determine which neighbourhood to mine an address to:

  1. Retrieve the previous day's average depth reported to the Redistribution contract (Schelling game).

  2. Retrieve all the currently staked nodes' overlay addresses.

  3. From (1), determine the number of neighbourhoods and using the list in (2) sort these by neighbourhood, determining which neighbourhood/s has the lowest population.

  4. Choose a random neighbourhood from the list from (3) if there is more than 1 neighbourhood.

  5. If there are already nodes within the neighbourhood, search within that neighbourhood at depth + 1 so that in the future if the neighbourhood splits, your node is now with reduced, or no competition.

  6. Mine an overlay address to the chosen neighbourhood and depth.

Mining overlay addresses

From the bee source code, it can be determined that an overlay address O is defined as:

O = H(ethAddr.netIDBytes.nonce)

The netIDBytes corresponds to the Swarm network ID, and the nonce is for legacy bee nodes that were migrated from pre v1.11.0. For new bee nodes, nonce is set to 32 bytes of 0 (ie. solidity type bytes32(0)).

Using this knowledge, it is possible to iterate through Ethereum addresses, mining (guessing) for an Ethereum address that corresponds to an overlay prefix that may be desired.

Swarm Tools 🧰

Researching all of the above led to the creation of swarm-tools-rs, a CLI application written in rust πŸ¦€. This tool follows conventional command-line interface design.

Requirements

  1. Your own Gnosis Chain RPC. swarm-tools-rs makes heavy use of RPC calls. IT IS STRONGLY RECOMMENDED TO RUN THIS WITH YOUR OWN RPC.

  2. A familiarity with command line environments on your operating system.

  3. An understanding of the above content so you have a better idea as to what you're doing πŸ˜ƒ.

Installation

Release binaries are built for:

  1. Linux

  2. Mac OS X (Darwin)

  3. Windows

You can get the relevant release binaries from the swarm-tools-rs repository.

CLI --help

To see what it can do:

$ swarm-tools --help
Swarm tools CLI

Usage: swarm-tools [OPTIONS] <COMMAND>

Commands:
  topology  Calculators / tools for neighbourhoods
  overlay   Calculators / miner for overlays
  game      Analyse neighbourhood distribution for the schelling game
  stamps    Analyse postage stamps
  wallet    Node funding related tools
  help      Print this message or the help of the given subcommand(s)

Options:
      --gnosis-rpc <GNOSIS_RPC>  RPC to connect to [default: ws://localhost:8545]
  -h, --help                     Print help
  -V, --version                  Print version

Recursively, each command, and sub-command can also be inspection using --help. For example, what is available in the overlay sub-command?

$ swarm-tools overlay --help
Calculators / miner for overlays

Usage: swarm-tools overlay
       swarm-tools overlay <COMMAND>

Commands:
  calculate      Calculate an overlay address from it's components
  neighbourhood  Determine which neighbourhood an overlay is in
  auto-mine      Automatically mine overlay addresses into the optimal neighbourhoods for a given radius
  manual-mine    Mine an overlay address into a specific neighbourhood
  help           Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

Game Analysis

OK, let's have a look at the distribution of nodes in the game:

$ swarm-tools --gnosis-rpc ws://your-gnosis-rpc-here:8545 game -r 8 > output.txt

The above command:

  1. Sets the Gnosis Chain RPC to ws://your-gnosis-rpc-here:545

  2. Analyses the game using a storage radius of 8.

  3. Outputs all the diagnostics data to output.txt

This will print out a CSV of all the Staked Players in the game, including their stake, and neighbourhood calculated with the specified storage radius. From here, you can import this CSV data into data visualisation tools / spreadsheet software to visualise the distribution of nodes within the game.

There will also be overview statistics output:

Total players: 1986
Total stake: 220633333000071328010
Average stake: 111094326787548503
Average neighbourhood population: 7
Lowest neighbourhoods: (4, [129, 185, 79, 215, 36, 97, 157, 104, 191, 147, 94, 254, 253, 64, 18, 125, 146, 93, 139, 133, 202, 175, 57])
Optimum neighbourhood: (10, 379)

The stake values above are in in PLUR (ie. atomic BZZ). The neighbourhoods with the lowest population (4) are [129, 185, 79, 215, 36, 97, 157, 104, 191, 147, 94, 254, 253, 64, 18, 125, 146, 93, 139, 133, 202, 175, 57] (ie. there are 23 neighbourhoods with a population of 4), and the optimum neighbourhood has been determined as neighbourhood 379 at a radius of 10 (this corresponds to neighbourhood 94 at a radius of 8).

Mining overlay addresses ⛏️

WARNING: After mining your overlays you should Stake them as soon as possible. As neighbourhood selection is deterministic, other apiarists may be mining into your neighbourhood as you read!

OK, OK. You're sick of theory. Let's automate this! πŸ€– You are a budding apiarist, and want to build your hive!

How big a hive do you want? Let's say you want 20 bees 🐝🍯:

$ swarm-tools --gnosis-rpc ws://your-gnosis-rpc-here:8545 overlay auto-mine -n 20
Mining 20 addresses...
Mining address into neighbourhood 745 for radius 11
Mining overlay address for neighbourhood 745/2047
/tmp/.tmp3pgEqH/3fe78ec9-8838-42a0-8dd1-398f6bdbbdec -> /home/mfw78/src/rndlabs/swarm/swarm-tools-rs/bees/5d328689798dac4b29f6725810438ea2dc39f74d36596de9d03b24530dfd0ffa.json
Overlay address: 5d328689798dac4b29f6725810438ea2dc39f74d36596de9d03b24530dfd0ffa
Base address: 5d20000000000000000000000000000000000000000000000000000000000000
Bitmask: ffe0000000000000000000000000000000000000000000000000000000000000
Match found after 2458 iterations...
Mining address into neighbourhood 587 for radius 10
Mining overlay address for neighbourhood 587/1023
Loaded wallet: 5d328689798dac4b29f6725810438ea2dc39f74d36596de9d03b24530dfd0ffa
/tmp/.tmpkQBCws/0e403eee-3742-4c61-801c-c02b1d58afcf -> /home/mfw78/src/rndlabs/swarm/swarm-tools-rs/bees/92d943f88a61fd84abb3d9dc4bc23a82ff879cd022d4094372a5fc18daf1cf4b.json
Overlay address: 92d943f88a61fd84abb3d9dc4bc23a82ff879cd022d4094372a5fc18daf1cf4b
Base address: 92c0000000000000000000000000000000000000000000000000000000000000
Bitmask: ffc0000000000000000000000000000000000000000000000000000000000000
Match found after 2495 iterations...

The above command will:

  1. Automatically work out the game's current storage radius.

  2. Iteratively find the optimum neighbourhoods for the number of nodes you desire.

  3. Place the nodes' corresponding encrypted JSON wallet and password in the bees folder in the current working directory.

Funding your nodes

Now that you have generated the wallets / overlays for the bees that constitute your new hive, it's best to stake these as soon as possible! Fortunately there's a wallet tool built right in to do this.

Architecture

The wallet funding system in swarm-tools-rs makes use of:

  1. A "funding wallet", which is a normal encrypted JSON wallet stored under the wallet.json in the bees directory.

  2. A Safe (formerly Gnosis Safe) that is deployed to Gnosis Chain to enable multiplexing of transactions for better gas efficiency / atomic transactions.

Before any initial use of the wallet functions, the funding wallet will be automatically generated and it will prompt you to fund it using the faucet. Just follow the prompts!

From Ethereum Mainnet

$ swarm-tools --gnosis-rpc cargo run --release -- --gnosis-rpc ws://gnosis-erigon.public.dappnode:8545 wallet fund-from-mainnet                     ξ‚²  
Loaded wallet: 5d328689798dac4b29f6725810438ea2dc39f74d36596de9d03b24530dfd0ffa
Loaded wallet: 92d943f88a61fd84abb3d9dc4bc23a82ff879cd022d4094372a5fc18daf1cf4b
Loaded wallet: 391370f05c38629bc3458dfdecd9de09a3b8e1c65ddb896e95882c7c39a3bdb2
Loaded wallet: 8b379e47e5a3cd03a9e5c21814563fb57f4a2bbd164a405488a9a6a740137450
Loaded wallet: 4fac3763a58cc2e958be504e76ff57ad4c2963d9be636f7c46fe19f64a9280e0
Loaded wallet: 5efce39888f107cf335d820f68554c9c7c4ef5bb535ba83999d195d72b325cf5
Loaded wallet: ca3b06e54fabe9d0d552a8523f23373e5cfa71843dcedc37f7f1b66d92684d34
Loaded wallet: 81fc6e521ec260e02d7908b3c26782d451027dd577a26d2216bb300054ca9454
Loaded wallet: 401a4e3b50c2b91ca2faaf74d0636bcde88de7ca189fa3e7e867fbcb1ea12b37
Loaded wallet: bf864b7649670651cff5935d7509fcdd2c6c5a530f381dfaee2a6de4877dd4b8
Loaded wallet: 68662518725d8ff48b92a5c44d82b62bb6110ef3b606824b01cf9415244bccd9
Loaded wallet: 7d62fd58ab375e29f96928392867046fa4991f702fc584ff391cf51f91dfdc2a
Loaded wallet: 1225e4d29df6fad1a145224139731df64664ea23a5ce4d9166690861a10f7add
Loaded wallet: 9d520e59229104758f52c6d47e39ba6f6af1af381beed0747fec797c1750eae9
Loaded wallet: afcf902062009cbf94a0e6fb744ff78ccc35bb5c26a24816c6d1680e9f35dfa0
Loaded wallet: b9f0013f80a0b1353d1a8ed0888e80721c86c15a9e7c3fe8fc891491290e71d5
Loaded wallet: 243d694eedb17b1de8c510df4a8a30cac798fbfa5bf59397945077d2ae9b2a1a
Loaded wallet: 8548ddb7bcba3996d17fc32a072058b588ef4f105ff037c9032c52095ab44274
Loaded wallet: 93b05f872bd605327549f9f3f57409fe151835658f37e60012904bc1eeb9d33d
Loaded wallet: fd9eda39e6ab68a01af0f2556d0337dd520c18e6f0f70ccf8370af3bc8b65b67
Creating funding wallet...
./bees/1b2cf5e4-fd27-4cdc-a185-414b0d76e79a -> ./bees/wallet.json
Funding wallet created: 0x395eb3f8344d0efc50d778fa3e3e3dbbca42afee
Password: <censored>

Please visit https://gnosisfaucet.com/ and request some xDAI for the funding wallet. Then press enter to continue...

After you've placed some gas in the funding wallet on Gnosis Chain, it'll deploy a Safe.

Creating Safe...
Deploying Safe:

Transaction Details:
  From: 0x395eb3f8344d0efc50d778fa3e3e3dbbca42afee
  To: 0xa6b71e26c5e0845f74c812102ca7114b6a896ab2
  Value: 0
  Data: <lots of data>
  Gas Limit: 259283
  Gas Price: 3.000000000
  Gas Cost: 0.000777849000000000

Send transaction? [y/N]: y
Submitting the transaction to Gnosisscan: https://gnosisscan.io/tx/0x7e731b6fc4595c74596e80ce1cf6a38bba6374cc8c0dccb6965d0420d6e59de3
Waiting for the transaction to be mined (waiting for 1 confirmations)...successful!

Once this is done, it will prompt to place funds in the funding wallet on Ethereum Mainnet. As part of this you will require:

  1. The specified amount of DAI. This will automatically swap the required amount of DAI to BZZ and bridge this to Gnosis Chain automatically.

  2. Enough gas to cover the transactions. ~0.02 ETH should be fine to cover most gas scenarios.

Safe created: gno:0xb407c83f9e2415625aaa0843f86c1e3b817a1f8b


Funding table:
0x1225e4d29df6fad1a145224139731df64664ea23a5ce4d9166690861a10f7add: 15.0000000000000000 BZZ
0x243d694eedb17b1de8c510df4a8a30cac798fbfa5bf59397945077d2ae9b2a1a: 10.0000000000000000 BZZ
0x391370f05c38629bc3458dfdecd9de09a3b8e1c65ddb896e95882c7c39a3bdb2: 10.0000000000000000 BZZ
0x401a4e3b50c2b91ca2faaf74d0636bcde88de7ca189fa3e7e867fbcb1ea12b37: 10.0000000000000000 BZZ
0x4fac3763a58cc2e958be504e76ff57ad4c2963d9be636f7c46fe19f64a9280e0: 10.0000000000000000 BZZ
0x5d328689798dac4b29f6725810438ea2dc39f74d36596de9d03b24530dfd0ffa: 10.0000000000000000 BZZ
0x5efce39888f107cf335d820f68554c9c7c4ef5bb535ba83999d195d72b325cf5: 10.5000000000000000 BZZ
0x68662518725d8ff48b92a5c44d82b62bb6110ef3b606824b01cf9415244bccd9: 10.0000000000000000 BZZ
0x7d62fd58ab375e29f96928392867046fa4991f702fc584ff391cf51f91dfdc2a: 10.0000000000000000 BZZ
0x81fc6e521ec260e02d7908b3c26782d451027dd577a26d2216bb300054ca9454: 10.0000000000000000 BZZ
0x8548ddb7bcba3996d17fc32a072058b588ef4f105ff037c9032c52095ab44274: 10.0000000000000000 BZZ
0x8b379e47e5a3cd03a9e5c21814563fb57f4a2bbd164a405488a9a6a740137450: 10.0000000000000000 BZZ
0x92d943f88a61fd84abb3d9dc4bc23a82ff879cd022d4094372a5fc18daf1cf4b: 10.0000000000000000 BZZ
0x93b05f872bd605327549f9f3f57409fe151835658f37e60012904bc1eeb9d33d: 10.0000000000000000 BZZ
0x9d520e59229104758f52c6d47e39ba6f6af1af381beed0747fec797c1750eae9: 10.0000000000000000 BZZ
0xafcf902062009cbf94a0e6fb744ff78ccc35bb5c26a24816c6d1680e9f35dfa0: 10.0000000000000000 BZZ
0xb9f0013f80a0b1353d1a8ed0888e80721c86c15a9e7c3fe8fc891491290e71d5: 10.0000000000000000 BZZ
0xbf864b7649670651cff5935d7509fcdd2c6c5a530f381dfaee2a6de4877dd4b8: 10.0000000000000000 BZZ
0xca3b06e54fabe9d0d552a8523f23373e5cfa71843dcedc37f7f1b66d92684d34: 34.7500000000000000 BZZ
0xfd9eda39e6ab68a01af0f2556d0337dd520c18e6f0f70ccf8370af3bc8b65b67: 10.0000000000000000 BZZ
Total funding required: 230.2500000000000000 BZZ
Total funding required: 20.998268885000000000 XDAI
Total DAI funding required for buying BZZ: 134.466472375017141553 DAI
Funding wallet does not have enough DAI to buy BZZ + bridge XDAI
DAI balance: 0.000000000000000000 DAI
DAI required: 134.466472375017141553 DAI

Please deposit 134.466472375017141553 DAI to the funding wallet eth:0x395eb3f8344d0efc50d778fa3e3e3dbbca42afee on Ethereum Mainnet and press enter to continue...

In the above, the tool has determined the average neighbourhood stake and specified this as the starting stake for the new nodes. You may run the command again with the -m 100000000000000000 option which will limit the maximum amount of BZZ for each node to 10 BZZ.

Follow the on-screen prompts. Once the token bridging is started, it may take up to ~10 mins for the tokens to be bridged at which point it will commence prompting you with the same prompts you will find below in "From Gnosis Chain", though you won't have to execute the command to commence funding (as it's already running!).

From Gnosis Chain

The below example assumes that the funding wallet on Gnosis Chain already has the required xDAI (1 xDAI per node) and that the Safe has the required xBZZ. If these requirements aren't met, you will be prompted.

$ swarm-tools --gnosis-rpc cargo run --release -- --gnosis-rpc ws://gnosis-erigon.public.dappnode:8545 wallet fund-from-gnosis-chain
Loaded wallet: wallet
Loaded wallet: 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b
Loaded wallet: 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580
Loaded wallet: 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81
Loaded wallet: 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8
Loaded wallet: bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3
Loaded wallet: 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136
Loaded wallet: ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae
Loaded wallet: 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871
Loaded wallet: 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6
Loaded wallet: afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0
Loading Safe 0xffaeddb34f564136d5663a20d80095584d877422...


Funding table:
0x2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b: 26.4000000000000000 BZZ
0x61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81: 10.0000000000000000 BZZ
0x684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6: 10.0000000000000000 BZZ
0x8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8: 10.0000000000000000 BZZ
0x92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136: 10.0000000000000000 BZZ
0x936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871: 10.0000000000000000 BZZ
0x9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580: 10.0000000000000000 BZZ
0xafe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0: 10.0000000000000000 BZZ
0xbffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3: 10.0000000000000000 BZZ
0xca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae: 34.7500000000000000 BZZ
Distribute BZZ and xDAI to nodes:
 - 1.000000000000000000 xDAI to 0xac51efaa50b4275019450203adbd3f78397126a9
 - 26.4000000000000000 BZZ to 0xac51efaa50b4275019450203adbd3f78397126a9
 - 1.000000000000000000 xDAI to 0x1cb2a4a9b7c5311e44cfc0b291e41212f0a8ee81
 - 10.0000000000000000 BZZ to 0x1cb2a4a9b7c5311e44cfc0b291e41212f0a8ee81
 - 1.000000000000000000 xDAI to 0xd2681d592b1d44e8fe2185f641fa2b20b982a40c
 - 10.0000000000000000 BZZ to 0xd2681d592b1d44e8fe2185f641fa2b20b982a40c
 - 1.000000000000000000 xDAI to 0x87a81f924b77779d1a438eecd4a59fed15d76f5a
 - 10.0000000000000000 BZZ to 0x87a81f924b77779d1a438eecd4a59fed15d76f5a
 - 1.000000000000000000 xDAI to 0xfcc7945669035296417fb9f548341cae3f7e3035
 - 10.0000000000000000 BZZ to 0xfcc7945669035296417fb9f548341cae3f7e3035
 - 1.000000000000000000 xDAI to 0x66af7a4fc63612e55d83b23b944637e8778342b1
 - 10.0000000000000000 BZZ to 0x66af7a4fc63612e55d83b23b944637e8778342b1
 - 1.000000000000000000 xDAI to 0x8244ab320997f7c8257b886c1808d7f56aa4622a
 - 10.0000000000000000 BZZ to 0x8244ab320997f7c8257b886c1808d7f56aa4622a
 - 1.000000000000000000 xDAI to 0xc951b93aa0a2bf727f76502d845fb16895a0a39a
 - 10.0000000000000000 BZZ to 0xc951b93aa0a2bf727f76502d845fb16895a0a39a
 - 1.000000000000000000 xDAI to 0x9a23668993475e1c6c347243e97c29b63ca4f320
 - 10.0000000000000000 BZZ to 0x9a23668993475e1c6c347243e97c29b63ca4f320
 - 1.000000000000000000 xDAI to 0x28f0d47cda47888b974bee202e6ed6dd4e86c9e7
 - 34.7500000000000000 BZZ to 0x28f0d47cda47888b974bee202e6ed6dd4e86c9e7:

Transaction Details:
  From: 0x9161e22a20280cfbc6e8d272cfac3ad6bf83f293
  To: 0xffaeddb34f564136d5663a20d80095584d877422
  Value: 10000000000000000000
  Data: <lots of data>
  Gas Limit: 507711
  Gas Price: 1.000000006
  Gas Cost: 0.000507711003046266

Send transaction? [y/N]: y
Submitting the transaction to Gnosisscan: https://gnosisscan.io/tx/0xad25ace8ff3fa40f8d4711c1fd5a091dedfe4e4f956c4115d483fe59b4ab230d
Waiting for the transaction to be mined (waiting for 1 confirmations)...successful!

The above shows the funding table, and the prompt to confirm the distribution transaction. Once this transaction is done, you will be prompted for a batch approval for all nodes' BZZ:

Batch approve spending of BZZ tokens:
 - Spenders:
   - Safe
   - StakeRegistry
 - Wallets:
   - 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b
   - 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81
   - 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6
   - 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8
   - 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136
   - 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871
   - 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580
   - afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0
   - bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3
   - ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae:

Transaction Details:
  From: 0x9161e22a20280cfbc6e8d272cfac3ad6bf83f293
  To: 0xffaeddb34f564136d5663a20d80095584d877422
  Value: 0
  Data: <lots of data>
  Gas Limit: 617339
  Gas Price: 1.000000005
  Gas Cost: 0.000617339003086695

Send transaction? [y/N]: y
Submitting the transaction to Gnosisscan: https://gnosisscan.io/tx/0x20e5d0eea239654e2ad9a22811423d09ecd46b5efae01c6aa15e9564cdae2f2c
Waiting for the transaction to be mined (waiting for 1 confirmations)...successful!

Now comes the big moment to stake! You will be prompted to confirm that you want to stake the nodes.

WARNING: STAKES CANNOT BE WITHDRAWN. THERE IS NO UNDOING THE NEXT STEP IF YOU PROCEED.

Are you sure you want to stake all the nodes? [y/N]: y
Staking 26.4000000000000000 BZZ for 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b
Staking 10.0000000000000000 BZZ for 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81
Staking 10.0000000000000000 BZZ for 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6
Staking 10.0000000000000000 BZZ for 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8
Staking 10.0000000000000000 BZZ for 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136
Staking 10.0000000000000000 BZZ for 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871
Staking 10.0000000000000000 BZZ for 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580
Staking 10.0000000000000000 BZZ for afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0
Staking 10.0000000000000000 BZZ for bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3
Staking 34.7500000000000000 BZZ for ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae
Staking for 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b completed, see Gnosisscan: https://gnosisscan.io/tx/0x4e08dad27f80456fc1f38821b0bae08af257435d23feff7134ac2261edd0f089
Staking for 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81 completed, see Gnosisscan: https://gnosisscan.io/tx/0xda9366a6c0b2ccef75a76fea552951954c51b4aec5a19ab0cd8732873d14628d
Staking for 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6 completed, see Gnosisscan: https://gnosisscan.io/tx/0xc95a174335b301b247e333c34fa0524befface003c43c80248b650c50ad406a6
Staking for 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8 completed, see Gnosisscan: https://gnosisscan.io/tx/0x006f05b0d81730cbeb29c1187118c7f1305ddcc8e88eb6141ee961bd27b03444
Staking for 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136 completed, see Gnosisscan: https://gnosisscan.io/tx/0xf6d50230044ff159ffbb2980c7fbe285eb4ba74885171b55b2f30ef4aa2e20fd
Staking for 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871 completed, see Gnosisscan: https://gnosisscan.io/tx/0xb838bd26b52e4a455975d7392d9a51fb12ca0dbfe74ad454ee7619180c2a2d13
Staking for 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580 completed, see Gnosisscan: https://gnosisscan.io/tx/0x89d92b61e674486e4035ac7201a890244e16e93f574695bca16e1939786c903b
Staking for afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0 completed, see Gnosisscan: https://gnosisscan.io/tx/0x08dcd1cc31f5e5318a8086d22afa92ef9a063a7f82a78e154ba0939811b91ffc
Staking for bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3 completed, see Gnosisscan: https://gnosisscan.io/tx/0xdc729f761ee90121675e0ab003082ad6d04dc667d23f970544036b91d83bd4d3
Staking for ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae completed, see Gnosisscan: https://gnosisscan.io/tx/0x65220d2fc9fcc6c8475193714aa6915b7f616a7327a23e6b2fde24f02fd64eb6

Congratulations, your new nodes are now staked!! πŸ₯³πŸŽ‰

Running your new bee nodes

Now that your nodes are fully funded, and staked, it is a great time to actually getting around to running your nodes!

In the bees sub-directory where the swarm-tools application was run, you will find the encrypted JSON and passwords for the nodes' wallets.

To configure a bee node:

  1. Copy the wallet to a NEW bee installation.
cp ./bees/00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff.json /path/to/bee/dir/keys/swarm.key
cp ./bees/00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff.password /path/to/bee/dir/password
  1. Set the password-file option for bee to specify the path to the password file.

Sweep your Profit πŸ€‘

You can use swarm-tools to bulk transfer all your nodes' profits back to your Safe:

$ swarm-tools --gnosis-rpc ws://127.0.0.1:8545 wallet transfer-all
Loaded wallet: wallet
Loaded wallet: 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b
Loaded wallet: 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580
Loaded wallet: 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81
Loaded wallet: 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8
Loaded wallet: bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3
Loaded wallet: 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136
Loaded wallet: ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae
Loaded wallet: 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871
Loaded wallet: 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6
Loaded wallet: afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0
Loading Safe 0xffaeddb34f564136d5663a20d80095584d877422...

Sweeping funds from nodes to Safe:
 - 2df9832d39f508d55dbff5a6770e1daff674a088768983c58350c331b6b9a22b (0.0000000000000000)
 - 61e066ef3fe48352ebad007f631a0529f840a36abf6c8991fc8cc15405f7ad81 (0.0000000000000000)
 - 684556c0e79d97619074bb32e874c01f3c736a42be6eec773f6377c7f17908b6 (0.0000000000000000)
 - 8b0a1d7f40e3a2f558a6720d7f1f0ef8a49c53f489655acf1f38d34881c08aa8 (0.0000000000000000)
 - 92e73b547f0342231b0b54b6c2110c8c251a213dd23c53ddb8e8ba9b3d3b8136 (0.0000000000000000)
 - 936bf4962fc80f211a1f3e7936d1406c76dbe4e967f222c03b5e8733a73cf871 (0.0000000000000000)
 - 9ddbdf9e7ae9de15fd6b262ce7f372d747bc2cea0b62bd62dd7eda0cffa55580 (0.0000000000000000)
 - afe8575a3153d94902e248a58f0bd598b37d9326e62d242d0edbb9464444e5b0 (0.0000000000000000)
 - bffb3eefc2e8d54460d8ec303cf3e0844e5e735c037462833c8102fd27d7a2e3 (0.0000000000000000)
 - ca202b2b511822c61a0ad6ff6f37336f8f0ea709d2c84563c01631a7649829ae (0.0000000000000000):

Transaction Details:
  From: 0x9161e22a20280cfbc6e8d272cfac3ad6bf83f293
  To: 0xffaeddb34f564136d5663a20d80095584d877422
  Value: 0
  Data: <lots of data>
  Gas Limit: 239823
  Gas Price: 1.000000000
  Gas Cost: 0.000239823000000000

Send transaction? [y/N]: y
Submitting the transaction to Gnosisscan: https://gnosisscan.io/tx/0xe3ee57e3935ec4387d363548903993926427b4f9a4ae8ce9510c913fdf3fab2a
Waiting for the transaction to be mined (waiting for 1 confirmations)...successful!

NOTE: The above example shows a transfer of 0 BZZ because the nodes' wallets were empty when creating the example.

Related links

Disclaimers

A transaction fee of 1% is collected on the DAI equivalent rate of the transaction value (when doing "Funding from Mainnet"). The smart contracts that run OpenBZZ are NOT audited. Source code is published and verified, and may be reviewed at:

NOTE: Transaction fees are configurable by smart contract, however are enforced to never exceed 1%.

Subscribe to mfw78.eth
Receive the latest updates directly to yourΒ inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.