Lynx Blockchain
  • Welcome
  • Technical Evolution and Architecture Overview
  • History of Lynx
    • Evolution of a Blockchain
    • Hybrid Proof of Work (HPoW) Protocol
    • Pioneering Blockchain Data Storage
    • Evolution to Proof of Stake
    • Next Generation Data Storage Architecture
    • Preserving Knowledge
  • Lynx Core
    • Hardware and System Requirements
    • Lynx Dynamics
    • Open Source
    • Core Parameters and Strategy
    • Sustainability
    • Circulating Supply Analysis
    • Locked Addresses
    • Data Storage
      • auth
      • fetch
      • fetchall
      • store
      • status
      • list
    • Understanding the Encryption Option
    • Understanding Lynx Staking Wait Times
    • Understanding Asset Retrieval Times
    • Understanding Block Time Targeting in the Lynx Blockchain
    • Understanding the Lynx Blockchain Statistics Report
  • Lynx Administration
    • Public Peer Nodes
    • Understanding Blockchain Bootstrap Files
      • Bootstrap Extraction Script
      • Bootstrap Creation Script
    • How to Sweep a Lynx Wallet
    • Enable/Disable Staking
  • Clevver
    • Revolutionizing Digital Preservation
    • Permanent Storage for Digital Assets
    • Permanent Digital Archives for Journalism
    • How did Clevver originate?
    • Shortened URL Support
    • Assigning Tags to Assets
    • How to delete content
    • Clevver Terms of Service Agreement
  • Clevver API
    • Public Methods
      • Batches
      • Files
      • User
  • ElectrumX
    • Lynx ElectrumX nodes
    • Build Script Details
  • External Links
    • Lynx Explorer
    • Lynx Github
    • Lynx Uptime Report
    • Clevver Website
  • Lynx Bootstraps
  • Wallet Links
    • Komodo Wallet
    • Wally.id Wallet
    • Lynx Paper Wallet
  • Social Links
    • Lynx Discord
    • Lynx on Bluesky
    • Clevver on Bluesky
  • Exchange Links
    • FreiXLite (LYNX/LTC)
  • FreiExchange (LYNX/BTC)
  • Komodo Wallet (SWAP)
  • XredX (LYNX/LTC)
  • XredX (LYNX/DOGE)
  • XredX (LYNX/IL8P)
Powered by GitBook
On this page
  • Overview
  • Syntax
  • Description
  • Parameters
  • Returns
  • Authentication Requirements
  • Examples
  • Error Handling
  • Implementation Notes
  1. Lynx Core
  2. Data Storage

fetchall

Published: March 2025 | Last updated: March 2025

Overview

The fetchall RPC method allows you to retrieve multiple files from the Lynx blockchain in reverse chronological order (newest first). This command is useful for backing up or migrating data, as it can download either a specific number of the most recent files or all files stored on the blockchain for the authenticated tenant. Authentication is required to execute this function.

Syntax

fetchall <count> <path>

Description

When you invoke the fetchall method, the Lynx daemon searches the blockchain for the most recent files and downloads them to your designated location. The files are retrieved in reverse chronological order, meaning the newest files are fetched first. This method requires authentication and is designed for bulk retrieval operations.

Parameters

Parameter
Type
Required
Description

count

string/integer

Yes

The number of most recent assets to fetch. Enter 0 to retrieve all assets stored on the blockchain.

path

string

Yes

The full filesystem path where the retrieved files should be stored (e.g., /home/username/downloads). This path must exist before calling the method.

Returns

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

Field
Type
Description

result

string

Indicates whether the operation succeeded (success) or failed (failure).

message

string

Provides additional information about the result. For successful operations, shows the number of assets fetched (e.g., Number of assets fetched: 5). For failures, indicates the reason (e.g., Invalid path: /path/to/directory., Not authenticated., Invalid count: abc.).

Authentication Requirements

The fetchall command requires authentication:

  • You must authenticate using the auth command before using fetchall

  • If not authenticated, the method will return a "Not authenticated" error

Examples

Retrieve the 5 most recent files

lynx-cli fetchall 5 /home/username/downloads

Output:

[
  {
    "result": "success",
    "message": "Number of assets fetched: 5"
  }
]

Retrieve all files stored on the blockchain

lynx-cli fetchall 0 /home/username/downloads

Using JSON-RPC:

curl --user username --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "fetchall", "params": ["5", "/home/username/downloads"]}' -H 'content-type: text/plain;' http://127.0.0.1:9332/

Error Handling

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

  • The user is not authenticated

  • The specified path doesn't exist on the filesystem

  • The count parameter is not a valid integer

Implementation Notes

  • There is a 2-second pause between each file retrieval to prevent overwhelming the system

  • The count parameter is converted to an integer with input validation to prevent errors

PreviousfetchNextstore

Last updated 2 months ago

Page cover image