---
# System prepended metadata

title: Hyperspace File Upload

---

# Hyperspace File Upload

## 1. Start lite node

```
FULLNODE_API_INFO=wss://wss.hyperspace.node.glif.io/apigw/lotus lotus daemon --lite
```


## 2. Generate CAR

### 2.1 Create sample file

For hyperspace we can use some sample image since deals are not as strict.

```
dd if=/dev/urandom of=520mb-filecoin-payload.bin bs=1M count=520
```

### 2.2 Create CAR file

```
$ lotus client import mario.jpeg
Import ..., Root bafykbzacebj47nl7u37knizcpzr6cgawifnvv3xb4ezlxiruqvz7skjhxzvw6
```

## 3. Store Data (with erros atm..)

Currently we are able to initiate a deal and upload the file to the miner. The deal end in an error state but we are still able to download it.

### 3.1 Create deal

```
$ lotus client deal
Data CID (from lotus client import): bafykbzacebj47nl7u37knizcpzr6cgawifnvv3xb4ezlxiruqvz7skjhxzvw6
.. calculating data size
Deal duration (days): 180
Miner Addresses (f0.. f0..), none to find: t01130
.. querying miner asks
-----
Proposing from t14tg3p2tjxr6wzu6f4p7xzrndk23wdkygfcnnepi
        Balance: 5 FIL

Piece size: 4MiB (Payload size: 3.565MiB)
Duration: 4320h0m0s
Total price: ~0 FIL (0 FIL per epoch)
Verified: false

Accept (yes/no): yes
.. executing
Deal (t01130) CID: bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu
```

### 3.2 Deal eventually fails

File gets uploaded but deal eventually gets to `StorageDealError` because 

```
$ lotus client list-deals --show-failed
DealCid      DealId  Provider  State             On Chain?        Slashed?  PieceCID     Size       Price  Duration  Verified
...muyanimu  828     t01130    StorageDealError  Y (epoch 25562)  N         ...5ffijqiy  3.969 MiB  0 FIL  521709    false
Message: error waiting for deal pre-commit message to appear on chain: handling applied event: failed to get dealinfo: looking for publish deal message
bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found
```

Some output from the lite node:

```
2023-01-24T22:36:55.346Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "ClientEventWaitForDealState", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealCheckForAcceptance", "message": "Provider state: StorageDealPublishing"}
2023-01-24T22:36:57.521Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "ClientEventWaitForDealState", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealCheckForAcceptance", "message": "Provider state: StorageDealPublishing"}
2023-01-24T22:36:59.761Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "ClientEventWaitForDealState", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealCheckForAcceptance", "message": "Provider state: StorageDealPublishing"}
2023-01-24T22:37:01.452Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "ClientEventDealAccepted", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealProposalAccepted", "message": ""}
2023-01-24T22:37:01.463Z        INFO    storageadapter  storageadapter/client.go:148    DEAL ACCEPTED!
2023-01-24T22:37:02.799Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "ClientEventDealPublished", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealAwaitingPreCommit", "message": ""}
found dealIdx 0
2023-01-24T22:37:38.503Z        INFO    net/identify    identify/id.go:369      failed negotiate identify protocol with peer    {"peer": "12D3KooWHZhBjW2P5kXx23fe34cvFSPz3e9vkdP88VjZK2f5Hsio", "error": "stream reset"}
2023-01-24T22:37:38.503Z        WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWHZhBjW2P5kXx23fe34cvFSPz3e9vkdP88VjZK2f5Hsio: stream reset
2023-01-24T22:38:55.489Z        WARN    watchdog        go-watchdog@v1.3.0/watchdog.go:350      system-driven watchdog triggering GC; 16325562368/16320875724 bytes (used/threshold)
2023-01-24T22:38:55.489Z        INFO    watchdog        go-watchdog@v1.3.0/watchdog.go:369      watchdog is forcing GC
2023-01-24T22:38:55.513Z        INFO    watchdog        go-watchdog@v1.3.0/watchdog.go:383      watchdog-triggered GC finished; notifications took: 709ns, took: 24.213041ms; current heap allocated: 318145488 bytes
2023-01-24T22:43:30.652Z        WARN    watchdog        go-watchdog@v1.3.0/watchdog.go:350      system-driven watchdog triggering GC; 16329265152/16320875724 bytes (used/threshold)
2023-01-24T22:43:30.652Z        INFO    watchdog        go-watchdog@v1.3.0/watchdog.go:369      watchdog is forcing GC
2023-01-24T22:43:30.685Z        INFO    watchdog        go-watchdog@v1.3.0/watchdog.go:383      watchdog-triggered GC finished; notifications took: 1.208µs, took: 32.571667ms; current heap allocated: 318153368 bytes
2023-01-24T22:46:02.334Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "", "proposal CID": "bafyreibvhv7xpxan2lqkh7vdpsmzr5tn7hagqc5vx66dxpp3vf3hzpxipu", "state": "StorageDealError", "message": "error waiting for deal pre-commit message to appear on chain: handling applied event: failed to get dealinfo: looking for publish deal message bafy2bzaceb254rdeyhdhnyekmegu4w6liy7m7k6xqx6ggqz6hyvv76bgkedqq: not found"}
2023-01-24T22:46:02.332Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceb254rdeyhdhnyekmegu4w6liy7m7k6xqx6ggqz6hyvv76bgkedqq: not found
2023-01-24T22:46:02.874Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found
2023-01-24T22:46:02.879Z        INFO    markets loggers/loggers.go:16   storage client event    {"name": "", "proposal CID": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu", "state": "StorageDealError", "message": "error waiting for deal pre-commit message to appear on chain: handling applied event: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found"}
2023-01-24T22:46:03.413Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceb254rdeyhdhnyekmegu4w6liy7m7k6xqx6ggqz6hyvv76bgkedqq: not found
2023-01-24T22:46:04.028Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found
2023-01-24T22:46:04.565Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceb254rdeyhdhnyekmegu4w6liy7m7k6xqx6ggqz6hyvv76bgkedqq: not found
2023-01-24T22:46:05.110Z        ERROR   events  events/events_called.go:230     chain trigger (@H 25046, triggered @ 25052) failed: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found
```

### 3.3 Deal details

```
$ lotus client get-deal bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu
```
```json
{
  "DealInfo: ": {
    "ProposalCid": {
      "/": "bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu"
    },
    "State": 26,
    "Message": "error waiting for deal pre-commit message to appear on chain: handling applied event: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found",
    "DealStages": {
      "Stages": [
        {
          "Name": "StorageDealReserveClientFunds",
          "Description": "Reserving client funds",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:29:51.05206Z",
          "UpdatedTime": "2023-01-24T22:29:51.05206Z",
          "Logs": [
            {
              "Log": "funds reserved, amount \u003c0\u003e",
              "UpdatedTime": "2023-01-24T22:29:51.05206Z"
            }
          ]
        },
        {
          "Name": "StorageDealFundsReserved",
          "Description": "FundsReserved",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:29:51.708583Z",
          "UpdatedTime": "2023-01-24T22:29:51.708583Z",
          "Logs": [
            {
              "Log": "opening data transfer to storage provider",
              "UpdatedTime": "2023-01-24T22:29:51.708583Z"
            }
          ]
        },
        {
          "Name": "StorageDealStartDataTransfer",
          "Description": "Starting data transfer",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:29:51.774885Z",
          "UpdatedTime": "2023-01-24T22:29:51.774885Z",
          "Logs": [
            {
              "Log": "provider data transfer request added to client's queue: channel id \u003c12D3KooWNRnuEsg41c8MMUzmhBB7Nt1X3iySgczA37Uw2DNovEF7-12D3KooWHh1mUwb827kFC27zvmvKc13XtKRFRDQgAkHBecn6anx9-1674597766896679004\u003e",
              "UpdatedTime": "2023-01-24T22:29:51.774885Z"
            }
          ]
        },
        {
          "Name": "StorageDealTransferQueued",
          "Description": "",
          "ExpectedDuration": "",
          "CreatedTime": "2023-01-24T22:29:51.782049Z",
          "UpdatedTime": "2023-01-24T22:29:51.782049Z",
          "Logs": [
            {
              "Log": "data transfer initiated on channel id \u003c12D3KooWNRnuEsg41c8MMUzmhBB7Nt1X3iySgczA37Uw2DNovEF7-12D3KooWHh1mUwb827kFC27zvmvKc13XtKRFRDQgAkHBecn6anx9-1674597766896679004\u003e",
              "UpdatedTime": "2023-01-24T22:29:51.782049Z"
            }
          ]
        },
        {
          "Name": "StorageDealCheckForAcceptance",
          "Description": "Checking for deal acceptance",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:29:54.214532Z",
          "UpdatedTime": "2023-01-24T22:37:01.452535Z",
          "Logs": [
            {
              "Log": "waiting for provider to publish the deal on-chain",
              "UpdatedTime": "2023-01-24T22:29:54.214532Z"
            },
            {
              "Log": "provider has submitted the deal on-chain and is waiting for confirmation",
              "UpdatedTime": "2023-01-24T22:30:55.137891Z"
            },
            {
              "Log": "deal has been accepted by storage provider",
              "UpdatedTime": "2023-01-24T22:37:01.452535Z"
            }
          ]
        },
        {
          "Name": "StorageDealProposalAccepted",
          "Description": "Proposal accepted",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:37:02.799643Z",
          "UpdatedTime": "2023-01-24T22:37:02.799643Z",
          "Logs": null
        },
        {
          "Name": "StorageDealAwaitingPreCommit",
          "Description": "Awaiting a PreCommit message on chain",
          "ExpectedDuration": "a few minutes",
          "CreatedTime": "2023-01-24T22:46:02.875122Z",
          "UpdatedTime": "2023-01-24T22:46:02.875122Z",
          "Logs": [
            {
              "Log": "error waiting for deal pre-commit message to appear on chain: handling applied event: failed to get dealinfo: looking for publish deal message bafy2bzaceccukv5j37crxxx6lhf4jireiu6v3o3cmhakq4lhmk2j3etvzf5m4: not found",
              "UpdatedTime": "2023-01-24T22:46:02.875122Z"
            }
          ]
        }
      ]
    },
    "Provider": "t01130",
    "DataRef": {
      "TransferType": "graphsync",
      "Root": {
        "/": "bafykbzacebj47nl7u37knizcpzr6cgawifnvv3xb4ezlxiruqvz7skjhxzvw6"
      },
      "PieceCid": {
        "/": "baga6ea4seaql3zzi4ctxekhmudaaca2qbz4yqzylq3dtarid424l7n25ffijqiy"
      },
      "PieceSize": 4161536,
      "RawBlockSize": 0
    },
    "PieceCID": {
      "/": "baga6ea4seaql3zzi4ctxekhmudaaca2qbz4yqzylq3dtarid424l7n25ffijqiy"
    },
    "Size": 4161536,
    "PricePerEpoch": "0",
    "Duration": 521709,
    "DealID": 828,
    "CreationTime": "2023-01-24T22:29:51.030872Z",
    "Verified": false,
    "TransferChannelID": {
      "Initiator": "12D3KooWNRnuEsg41c8MMUzmhBB7Nt1X3iySgczA37Uw2DNovEF7",
      "Responder": "12D3KooWHh1mUwb827kFC27zvmvKc13XtKRFRDQgAkHBecn6anx9",
      "ID": 1674597766896679004
    },
    "DataTransfer": {
      "TransferID": 1674597766896679004,
      "Status": 6,
      "BaseCID": {
        "/": "bafykbzacebj47nl7u37knizcpzr6cgawifnvv3xb4ezlxiruqvz7skjhxzvw6"
      },
      "IsInitiator": true,
      "IsSender": true,
      "Voucher": "{\"Proposal\":{\"/\":\"bafyreihoslfpcgk6moeugyx5uuexwfg6oionbquc4fqeu4uphymuyanimu\"}}",
      "Message": "",
      "OtherPeer": "12D3KooWHh1mUwb827kFC27zvmvKc13XtKRFRDQgAkHBecn6anx9",
      "Transferred": 3737905,
      "Stages": {
        "Stages": [
          {
            "Name": "Requested",
            "Description": "",
            "CreatedTime": "2023-01-24T22:29:51.720982Z",
            "UpdatedTime": "2023-01-24T22:29:51.779068Z",
            "Logs": null
          },
          {
            "Name": "Ongoing",
            "Description": "",
            "CreatedTime": "2023-01-24T22:29:51.78497Z",
            "UpdatedTime": "2023-01-24T22:29:51.874904Z",
            "Logs": [
              {
                "Log": "sending data",
                "UpdatedTime": "2023-01-24T22:29:51.800887Z"
              }
            ]
          },
          {
            "Name": "TransferFinished",
            "Description": "",
            "CreatedTime": "2023-01-24T22:29:52.034548Z",
            "UpdatedTime": "2023-01-24T22:29:52.034548Z",
            "Logs": null
          },
          {
            "Name": "Completing",
            "Description": "",
            "CreatedTime": "2023-01-24T22:29:52.041887Z",
            "UpdatedTime": "2023-01-24T22:29:52.041887Z",
            "Logs": null
          }
        ]
      }
    }
  },
  "OnChain": {
    "Proposal": {
      "PieceCID": {
        "/": "baga6ea4seaql3zzi4ctxekhmudaaca2qbz4yqzylq3dtarid424l7n25ffijqiy"
      },
      "PieceSize": 4194304,
      "VerifiedDeal": false,
      "Client": "t02779",
      "Provider": "t01130",
      "Label": "mAXCg5AIgU8+1f6b+pqMifmPhGBZBW1ru4eEyu6I0hXP5KSe+a28",
      "StartEpoch": 48059,
      "EndEpoch": 569768,
      "StoragePricePerEpoch": "0",
      "ProviderCollateral": "0",
      "ClientCollateral": "0"
    },
    "State": {
      "SectorStartEpoch": 25562,
      "LastUpdatedEpoch": -1,
      "SlashEpoch": -1,
      "VerifiedClaim": 0
    }
  }
}
```

### 3.4 Retrieving the file works

https://hyperspace.filecoin.tools/828

```
$ lotus client retrieve --provider t01130 mAXCg5AIgU8+1f6b+pqMifmPhGBZBW1ru4eEyu6I0hXP5KSe+a28 mario.jpeg

Recv 0 B, Paid 0 FIL, Open (New), 0s [1674909107209474001|0]
Recv 0 B, Paid 0 FIL, DealProposed (WaitForAcceptance), 17ms [1674909107209474001|0]
Recv 0 B, Paid 0 FIL, DealAccepted (Accepted), 103ms [1674909107209474001|0]
Recv 0 B, Paid 0 FIL, PaymentChannelSkip (Ongoing), 103ms [1674909107209474001|0]
Recv 217 B, Paid 0 FIL, BlocksReceived (Ongoing), 151ms [1674909107209474001|217]
Recv 1 MiB, Paid 0 FIL, BlocksReceived (Ongoing), 728ms [1674909107209474001|1048793]
Recv 2 MiB, Paid 0 FIL, BlocksReceived (Ongoing), 858ms [1674909107209474001|2097369]
Recv 3 MiB, Paid 0 FIL, BlocksReceived (Ongoing), 957ms [1674909107209474001|3145945]
Recv 3 MiB, Paid 0 FIL, Complete (CheckComplete), 989ms [1674909107209474001|3145945]
Recv 3.565 MiB, Paid 0 FIL, BlocksReceived (CheckComplete), 994ms [1674909107209474001|3737905]
Recv 3.565 MiB, Paid 0 FIL, WaitForLastBlocks (WaitingForLastBlocks), 1.003s [1674909107209474001|3737905]
Recv 3.565 MiB, Paid 0 FIL, AllBlocksReceived (FinalizingBlockstore), 1.003s [1674909107209474001|3737905]
Recv 3.565 MiB, Paid 0 FIL, BlockstoreFinalized (Completed), 1.003s [1674909107209474001|3737905]
Success
```

## 4. Upload from IPFS

### 4.1 Install IPFS node

`$ brew install ipfs  # or alternative to your OS`

### 4.2 Configure IPFS node
```
$ ipfs init
$ ipfs daemon
# stop lotus lite node
```

### 4.2 Configure Lotus lite node to use IPFS

Restart the node after editing the config. Make sure the IPFS node is running.
```
# edit config file (maybe ~/.lotus/config.toml)
[Client]
UseIpfs = true
```

### 4.3 Upload file to IPFS

```
$ ipfs add -r testfile.jpeg
added QmfDJ2aYoKEP4cTNMoyXxNbdRbBRC49pxvSbqzUJBT73VU C6675BE8-76DB-4821-A820-8E44FE642F37_1_105_c.jpeg
 219.95 KiB / 219.95 KiB [====================================================================] 100.00%
```

### 4.4 Create deal

```
$ lotus client deal
Data CID (from lotus client import): QmfDJ2aYoKEP4cTNMoyXxNbdRbBRC49pxvSbqzUJBT73VU
.. calculating data size
Deal duration (days): 180
Miner Addresses (f0.. f0..), none to find: t01129
.. querying miner asks
-----
Proposing from t14tg3p2tjxr6wzu6f4p7xzrndk23wdkygfcnnepi
        Balance: 7 FIL

Piece size: 256KiB (Payload size: 220.1KiB)
Duration: 4320h0m0s
Total price: ~0 FIL (0 FIL per epoch)
Verified: false

Accept (yes/no): yes
.. executing
Deal (t01129) CID: bafyreidviebrk3d65rey6hg5nr3mvhqotvgrias5nsqpcfbicch4622u5q

```

## 5. Useful commands

### 5.1 Check current deals

```
$ lotus client list-deals
DealCid      DealId  Provider  State                          On Chain?  Slashed?  PieceCID     Size       Price  Duration  Verified
...3hzpxipu  827     t01130    StorageDealAwaitingPreCommit   N          N         ...bfd7h4da  1016 MiB   0 FIL  521750    false
...muyanimu  0       t01130    StorageDealCheckForAcceptance  N          N         ...5ffijqiy  3.969 MiB  0 FIL  521709    false
  Message: Provider state: StorageDealPublishing

```

### 5.2 Check transfers

This can be used to check downloads/uploads from/to miners

```
lotus client list-transfers

```