# Retrieve data

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 lotus daemon.

  1. Open a terminal window.

  2. Start a Lotus lite-node and connect to api.chain.love:

    FULLNODE_API_INFO=wss://api.chain.love lotus daemon --lite
  3. 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.

  1. List all the addresses on this Lotus lite-node:

    lotus wallet list

    Lotus will output something like:

    > 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.

Check out the Managing assets section for information on withdrawing FIL from an exchange.

# Get the deal information

Before you can send a retrieval request, you need to collect some information to structure the command. You will need:

Variable Description
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.

  1. Copy this address to your clipboard: f16wc2ees6nkmk4pguoaaly4zdkeemaajjbv7aqgq.

    Using a different address

    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 list and copy it to your clipboard.

    Remember, you will not be able to retrieve data stored less than 24 hours ago.

  2. Go to filecoin.tools (opens new window).

  3. Paste the address in the search bar and press ENTER to search for deals made by that address:

    Filecoin.tools showing all the deals made by a single address.

    Using a different 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 (opens new window). 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.

  4. Click anywhere on a row to view information about that specific deal:

    Information about a particular deal.

  5. 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

  1. Using the template above, create the command substituting <MINER ID> and <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

    The output-file is 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
  2. 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)
    > ...
  3. 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)


    You must keep the lotus daemon running for the duration of this process.

  4. That's it!

# Next steps

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 (opens new window) for help.