Skip to content

Instantly share code, notes, and snippets.

@aashidham
Last active March 5, 2023 02:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashidham/2534a39ac3d1f8f1ae8c85e2fc6177f1 to your computer and use it in GitHub Desktop.
Save aashidham/2534a39ac3d1f8f1ae8c85e2fc6177f1 to your computer and use it in GitHub Desktop.
Quick and Dirty Guide to Hyperspace Deal Making

Run Lotus

  1. Make sure you have all defaults installed. At the very least:
brew install go  jq pkg-config rustup hwloc

See more here

  1. Get the Hyperspace version of Lotus. Build with make clean hyperspacenet.
git clone https://github.com/filecoin-project/lotus
cd ./lotus
git checkout v1.20.0-hyperspace-txidmap
make clean hyperspacenet

See more here

  1. Run Lotus as a lite client, like this:
FULLNODE_API_INFO=wss://wss.hyperspace.node.glif.io/apigw/lotus/ lotus daemon --lite

You can also run as a full client.

  1. Get an address and add some funds to your wallet.
lotus wallet new

Get funds through https://hyperspace.yoga/#faucet

Convert to/from your FIL address through https://www.glif.io/

Make A Storage Deal

  1. Make some fake data and add to running Lotus daemon.
dd if=/dev/urandom of=filecoin-payload.bin bs=1k count=5200
lotus client import filecoin-payload.bin > payload_cid
  1. Make a deal from the data you created (keep payload_cid handy and use t01129 for Miner ID).
lotus client deal
[answer prompts..]

Use lotus client list-deals --show-failed to determine whether or not the deal went through. You want StorageDealActive.

Incentivize the creation of new storage deals

  1. If you have predetermined data that you want replicated, use the pattern demonstrated in https://github.com/lotus-web3/deal-bounty-contract. In particular...

    a. Determine the data's PieceCID through the following:

    lotus client generate-car filecoin-payload.bin <car>
    lotus client commP <car> > piece_cid
    

    b. Deploy DealRewarder.sol on Hyperspace using Remix.

    c. Call AddCID with your data's PieceCID. Fund the contract by sending 1 FIL to fund.

  2. Allow others to claim a bounty on your data by calling claim_bounty with a valid deal ID that shows the data has been replicated.

@aashidham
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment