Autonomi
LearnBuildWho we ArePublicationsGet ANTStart a Node
  • Learn
  • Node
  • ANT Token
  • Developers
  • Developer Documentation
  • Getting Started
    • Installation Guide
  • Core Concepts
    • Data Types
    • Data Storage
    • BLS Keys
  • How To Guides
    • Quick Start Guide
    • Local Network Setup Guide
    • Payments Guide
    • Build Apps with Python
    • Build Apps with Rust
  • API Reference
    • API Reference Overview
    • Client API
      • Chunks
      • GraphEntry
      • Pointer
      • Register
      • Scratchpad
      • BLS Keys
      • Analyze
    • Node API
    • BLS Threshold Crypto
    • Self Encryption
    • Rust Crate API Reference
    • Python API Reference
Powered by GitBook

Get Involved

  • Start a Node
  • Discord
  • Forum

Follow Us

  • X
  • Reddit
  • LinkedIn
On this page
  • Client Methods
  • Example
Export as PDF
  1. API Reference
  2. Client API

Analyze

The analyze module provides functionality for analyzing data addresses on the Autonomi Network.

This can also be used with the CLI to analyze data addresses:

ant analyze a7d2fdbb975efaea25b7ebe3d38be4a0b82c1d71e9b89ac4f37bc9f8677826e0

Client Methods

  • analyze_address Analyzes an address on the Autonomi Network.

Example

use autonomi::Client;
use autonomi::client::payment::PaymentOption;
use autonomi::client::chunk::{Chunk, Bytes};
use autonomi::client::analyze::Analysis;
use test_utils::evm::get_funded_wallet;
use eyre::Result;

async fn analyze_address_example() -> Result<()> {
    // initialize a local client and test wallet
    let client = Client::init_local().await?;
    let wallet = get_funded_wallet();
    let payment_option = PaymentOption::from(&wallet);

    // create a Chunk with some data
    let chunk = Chunk::new(Bytes::from("Chunk content example"));
    let (_cost, addr) = client.chunk_put(&chunk, payment_option).await?;
    let chunk_addr = addr.to_hex();

    // analyze the chunk address
    let analysis = client.analyze_address(&chunk_addr, true).await?;

    // the analysis detects that the address is a Chunk
    assert_eq!(analysis, Analysis::Chunk(chunk));

    Ok(())
}
PreviousScratchpadNextNode API

Last updated 3 months ago