> For the complete documentation index, see [llms.txt](https://supraoracles.gitbook.io/supra/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://supraoracles.gitbook.io/supra/network/move/learn-move/reading-resource-data-with-borrow_global.md).

# Reading Resource Data with borrow\_global

borrow\_global allows you to read an existing resource struct from a specific address without needing a signer, but the function must declare that it accesses the resource using acquires ResourceName.

{% hint style="info" %}
For the latest RPC URL, please refer to the [Supra Network Information](https://docs.supra.com/network-information) page.
{% endhint %}

## `borrow_global`: read an existing resource struct

We just need to call `borrow_global` with the right resource type and address. The address can be passed into the function as an argument or referred to specifically with @ such as `@0xcafe`. A signer is not required here. If the resource is not found at the address, the function will error when the code is run on the blockchain. The function that calls `borrow_global` also needs to declare that it does so by adding “`acquires ResourceName`” at the end.

**Let’s write a new function named get\_Gendna\_digits that returns the Gendna\_digits field of the DinosaurGendna resource stored at 0xcafe:**

```toml
module 0xcafe::Dinosaur_nest {
    use std::vector;

    struct DinosaurGendna has key {
        Gendna_digits: u64,
        Gendna_modulus: u64,
    }

    struct Dinosaur has store {
        Gendna: u64,
    }

    struct DinosaurSwarm has key {
        Dinosaurs: vector<Dinosaur>,
    }

    fun init_module(cafe_signer: &signer) {
        let Gendna_digits = 10;
        let Gendna_modulus = 10 ^ Gendna_digits;
        move_to(cafe_signer, DinosaurGendna {
            Gendna_digits,
            Gendna_modulus: (Gendna_modulus as u256),
        });
        move_to(cafe_signer, DinosaurSwarm {
            Dinosaurs: vector[],
        });
    }

    public fun spawn_Dinosaur(Gendna: u64): Dinosaur {
        Dinosaur {
            Gendna,
        }
    }

public fun get_Gendna_digits(): u64 acquires DinosaurGendna {
borrow_global<DinosaurGendna>(@0xcafe).Gendna_digits
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://supraoracles.gitbook.io/supra/network/move/learn-move/reading-resource-data-with-borrow_global.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
