In the previous step, you stored some data on the Filecoin network. It takes up to 24 hours for a storage provider to seal the data. If it’s been more than 24 hours since you completed the last section, great! If not, don’t worry; you can still follow this page to retrieve some example data that’s already on the Filecoin network.
Restart the Lotus
If you closed Lotus or shutdown your computer since you completed the previous section, you’ll need to restart the
Open a terminal window.
Start a Lotus lite-node and connect to
FULLNODE_API_INFO=wss://api.chain.love lotus daemon --lite
The Lotus daemon will continue to run. You must run further commands from a separate terminal window.
Next up is checking your balance ↓
Check address balance
Before you can retrieve data from a storage provider, you need to check that you have enough FIL to pay for the retrieval.
List all the addresses on this Lotus lite-node:
lotus wallet list
> Address Balance Nonce Default > f16mwizoeloamhp4dea4uy367mlihddw2mflnb5vy 10 FIL 0 X
Any balance above 0.1 FIL is enough to retrieve the data we are requesting in this tutorial.
Low or no balance
If you do not have enough FIL, you need to transfer some FIL to this account. You can either do this by using a cryptocurrency exchange or having a friend send you FIL. The address
f1... listed when you run
lotus wallet list is your public address; use this when requesting money from an exchange or your friend.
Get the deal information
Before you can send a retrieval request, you need to collect some information to structure the command. You will need:
|Miner ID||This is the ID of the storage provider where the data is stored.|
|Data CID||This variable is also sometimes called the Payload CID.|
|Address||The public address that was initially used to create the storage deal.|
We’re going to gather this information now.
Copy this address to your clipboard:
If you want to retrieve data that you stored you can use that address in place of the one we’re using in this tutorial. If you’d like to use the address on your local Lotus note, run
lotus wallet listand copy it to your clipboard. You will not be able to retrieve data stored less than 24 hours ago.
Go to filecoin.tools.
Paste the address in the search bar and press
ENTERto search for deals made by that address:
The default address supplied in this tutorial
f16wc2ees...has only submitted one storage deal, so you’ll only see one row in filecoin.tools. If you are using a different address, you may see multiple rows. If you don’t see any rows, the address you searched for has not yet completed a deal. The address may have submitted a deal, but the storage provider is yet to seal the data. Deals will only show up here once the storage provider has completed sealing the data.
Click anywhere on a row to view information about that specific deal:
Make a note of the Payload CID and the Miner ID. You’ll need both of these to create the retrieval command in the next step.
Send a retrieval request
Next up is creating the command for Lotus to run. The structure for a retrieval command is:
lotus client retrieve --miner <MINER ID> <DATA CID> ~/output-file
Using the template above, create the command substituting
<DATA CID>with the variables you got in the previous step. Your command should look something like this:
lotus client retrieve --miner f07709 mAVWg5AIgFw51hfKzfy8nRsKHlMtT8/DPBJhn1f9eFyOSeldlAiE output-file
output-fileis the name of the file that you’d like to save. You can also add a path to this variable:
lotus client retrieve --miner f0100 mAVW...lAiE ~/Downloads/filecoin-download.tar
Run the command. After submitting this command, your Lotus lite-node will send the retrieval request to the storage provider and wait for a response:
> Recv: 0 B, Paid 0 FIL, ClientEventOpen (DealStatusNew) > Recv: 0 B, Paid 0 FIL, ClientEventDealProposed (DealStatusWaitForAcceptance) > Recv: 0 B, Paid 0 FIL, ClientEventDealAccepted (DealStatusAccepted) > ...
Wait for the process to finish:
> Recv: 66.33 KiB, Paid 0.00000000000013584 FIL, ClientEventPaymentSent (DealStatusFinalizing) > Recv: 66.33 KiB, Paid 0.00000000000013584 FIL, ClientEventComplete (DealStatusFinalizingBlockstore) > Recv: 66.33 KiB, Paid 0.00000000000013584 FIL, ClientEventBlockstoreFinalized (DealStatusCompleted) Success
You must keep the
lotus daemonrunning for the duration of this process.
This marks the end of the Filecoin Store and Retrieve tutorial series! By now you should have a good understanding of how the storage and retrieval process works on the Filecoin network, and also have some ideas on how to integrate this process into your projects! Feel free to carry on playing around with storing and retrieving data using Lotus and Filecoin. If you need a hand or get stuck, check out the Filecoin Slack for help.