filecoin-project / replication-game

Compete on the fastest replication algorithm
http://replication-game.herokuapp.com/
Other
59 stars 8 forks source link

The Replication Game

Compete on the fastest replication algorithm - Participate here!

Introduction

What is this "game"? The Replication Game is a competition where participants compete to outperform the default implementation of Proof-of-Replication. To participate in the game, you can run the current replication algorithm (or your own implementation) and post your proof on our server.

What is Proof-of-Replication? Proof of Replication is the proof that: (1) the Filecoin Storage Market is secure: it ensures that miners cannot lie about storing users' data, (2) the Filecoin Blockchain is secure: it ensures that miners cannot lie about the amount of storage they have (remember, miners win blocks based on their storage power!). In Filecoin, we use the Proof of Replication inside "Sealing" during mining.

How does Proof of Replication work? The intuition behind Proof of Replication is the following: the data from the Filecoin market is encoded via a slow sequential computation that cannot be parallelized.

How can I climb up in the leaderboard? There are some strategies to replicate "faster", some are practical (software and hardware optimizations), some are believe to be impractical or impossible (get ready to win a price and be remembered in the history of cryptography if you do so!)

Play the Replication Game

This executes an actual game, using rust-proofs, feel free to implement your own version.

Make sure you have all required dependencies installed:

From the replication-game/ directory, compile the game binary:

cargo +nightly build --release --bin replication-game

Play the game from the command line

There are two ways to play:

Method 1: Run the play helper script

From the replication-game/ directory, run the play helper script in bin/, specifying:

# Run like this:
# bin/play NAME SIZE TYPE

# E.g.

# Zigzag 10MiB
bin/play NAME 10240 zigzag

# Zigzag 1GiB
bin/play NAME 1048576 zigzag

# DrgPoRep 10MiB
bin/play NAME 10240 drgporep

# DrgPoRep 1GiB
bin/play NAME 1048576 drgporep

The play script will retrieve the seed from the game server, replicate the data, generate a proof, and then post that proof to the game server. The script runs each of the commands in Method 2, but wraps them in an easy-to-use shell script.

Method 2: Run each individual command

Set your player name:

export REPL_GAME_ID="ReadyPlayerOne"

Get the seed from our server:

curl https://replication-game.herokuapp.com/api/seed > seed.json
export REPL_GAME_SEED=$(cat seed.json| jq -r '.seed')
export REPL_GAME_TIMESTAMP=$(cat seed.json| jq -r '.timestamp')

Play the game:

./target/release/replication-game \
    --prover $REPL_GAME_ID \
    --seed $REPL_GAME_SEED \
    --timestamp $REPL_GAME_TIMESTAMP \
    --size 10240 \
    zigzag > proof.json

Send your proof:

curl -X POST -H "Content-Type: application/json" -d @./proof.json https://replication-game.herokuapp.com/api/proof

Check the current leaderboard

There are three ways to check the leaderboard, two from the command line and one from the browser:

Method 1: Run the show-leaderboard helper script

From the replication-game/ directory, run the show-leaderboard helper script in bin/, specifying SIZE, which is the size in KB by which you want to filter the leaderboard results. The leaderboard shows all results across all parameters in a single list, so filtering by SIZE allows you to see only those results that match a particular size.

bin/show-leaderboard SIZE

Method 2: Curl the leaderboard

To check the current leaderboard using curl:

curl https://replication-game.herokuapp.com/api/leaderboard | jq

Method 3: View the leaderboard in the browser

You can also directly view the leaderboard in the browser at https://replication-game.herokuapp.com/.

FAQ

What parameters should I be using for the replication?

Our leaderboard will track the parameters you will be using, feel free to experiment with many. We are targeting powers of two, in particular: 1GiB (--size 1048576), 16GiB (--size 16777216), 1TB (--size 1073741824)

How do I know what the parameters mean?

./target/debug/replication-game --help

What do I win if I am first?

So far, we have no bounty set up for this, but we are planning on doing so. If you beat the replication game (and you can prove it by being in the leaderboard), reach out to filecoin-research@protocol.ai.


Replication Game Server

$ cargo +nightly run --bin replication-game-server

This server requires Postgresql to work. The details of the expected configuration can be found in Rocket.toml. The default environment is development.

API

License

The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms: