# store

### Overview

The `store` RPC method allows you to upload and store files on the Lynx blockchain. This command is part of Lynx's decentralized file storage system, enabling users to persistently store data in a distributed manner.

### Syntax

```
store <filepath> [uuid]
```

### Description

When you invoke the `store` method, the Lynx daemon reads the specified file from your filesystem, processes it for blockchain storage, and initiates a storage transaction. The file is sharded appropriately and stored across multiple blockchain transactions, with a unique identifier (UUID) assigned to enable future retrieval.

### Parameters

<table><thead><tr><th>Parameter</th><th width="130">Type</th><th width="117">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>filepath</code></td><td>string</td><td>Yes</td><td>The full path to the file you want to store on the blockchain (e.g., <code>/home/username/documents/research.pdf</code>). The file must exist and have a size greater than zero bytes.</td></tr><tr><td><code>uuid</code></td><td>string</td><td>No</td><td>An optional custom unique identifier for the file. If provided, it must be 32 characters in hexadecimal format and must not already exist on the blockchain. If omitted, a random UUID will be automatically generated.</td></tr></tbody></table>

### Returns

The method returns an array containing a single object with the following fields:

<table><thead><tr><th width="201">Field</th><th width="142">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>result</code></td><td>string</td><td>Indicates whether the operation succeeded (<code>success</code>) or failed (<code>failure</code>).</td></tr><tr><td><code>message</code></td><td>string</td><td>Provides additional information about the result. For successful operations, returns <code>n/a</code>. For failures, indicates the reason (e.g., <code>Not authenticated as tenant</code>, <code>Not authenticated</code>, <code>A duplicate unique identifier was discovered</code>, <code>The custom unique identifier provided has an invalid length</code>, <code>Invalid UUID hex notation</code>, <code>Zero length asset filesize</code>).</td></tr><tr><td><code>identifier</code></td><td>string</td><td>The UUID assigned to the file. For successful operations, this is either the custom UUID you provided or an automatically generated one. For failures, returns <code>n/a</code> unless the failure is related to an invalid custom UUID.</td></tr><tr><td><code>tenant</code></td><td>string</td><td>The authenticated user's public key hash. For authentication failures, returns <code>n/a</code>.</td></tr><tr><td><code>filesize</code></td><td>number</td><td>The size of the stored file in bytes. For failures, returns <code>0</code>.</td></tr><tr><td><code>storagefee</code></td><td>string/number</td><td>The storage transaction fee in Lynx. The fee is calculated as one liv per byte (filesize / 100,000,000 Lynx). For failures, returns <code>0</code>.</td></tr><tr><td><code>storagetime</code></td><td>string</td><td>The timestamp when the storage operation was performed, in <code>YYYY-MM-DD HH:MM:SS</code> format. For failures, returns <code>n/a</code>.</td></tr><tr><td><code>currentblock</code></td><td>number</td><td>The current blockchain height at the time of the operation.</td></tr><tr><td><code>stakingstatus</code></td><td>string</td><td>Indicates whether staking is currently <code>enabled</code> or <code>disabled</code> on the node.</td></tr></tbody></table>

### Authentication Requirements

The `store` method requires authentication:

* The Tenant must authenticate using the appropriate credentials before using this command
* Authentication sessions expire after 6 hours (21,600 seconds)

### Error Handling

The method will return a failure result in the following scenarios:

* The user is not authenticated or the authentication session has expired
* The custom UUID already exists on the blockchain
* The custom UUID has an invalid length (must be 32 characters)
* The custom UUID contains non-hexadecimal characters
* The file has zero length or doesn't exist

### Examples

#### Store a file with an automatically generated UUID

```
lynx-cli store /home/username/documents/research.pdf
```

Or using JSON-RPC:

```
curl --user username --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "store", "params": ["/home/username/documents/research.pdf"]}' -H 'content-type: text/plain;' http://127.0.0.1:9332/
```

#### Store a file with a custom UUID

```
lynx-cli store /home/username/documents/research.pdf 00112233445566778899aabbccddeeff
```

### Implementation Notes

* The method adds the storage task to a queue rather than performing a synchronous upload
* Files are stored with one liv per byte as the transaction fee
* The system automatically generates a UUID if none is provided
* Custom UUIDs are validated for length, hexadecimal format, and uniqueness
* The current blockchain height and staking status are included in all responses


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getlynx.io/lynx-core/data-storage/store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
