> For the complete documentation index, see [llms.txt](https://signum-network.gitbook.io/signumjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://signum-network.gitbook.io/signumjs/getting-started/usage.md).

# Usage

Once you have added SignumJS to your application you usually want to connect to one of the Signum Network nodes to interact with the blockchain.&#x20;

All you need is to create an API instance to get access to the methods of the blockchain API.

The following example shows how to get an account from the chain.

{% tabs %}
{% tab title="Javascript" %}
{% code title="index.js" %}

```javascript
const {composeApi} = require('@signumjs/core');

(async () => {
    const api = composeApi({
        nodeHost: 'https://europe.signum.network',
    });

    const account = await api.account.getAccount({accountId: '16107620026796983538'});
    console.log('Account', account);
})();

```

{% endcode %}

{% endtab %}

{% tab title="Typescript" %}
{% code title="index.ts" %}

```typescript
import {composeApi} from '@signumjs/core';

(async (): Promise<void> => {
    const api = composeApi({
        nodeHost: 'https://europe.signum.network',
    });

    const account = await api.account.getAccount({accountId: '16107620026796983538'});
    console.log('Account', account);
})();
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
It is essential to understand the concept of [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) and [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) in Javascript. Many functions of SignumJS require to communicate with remote servers and therefore you need to be familiar with asynchronous Javascript.
{% endhint %}

## Usage with bundles

When using the bundles imported via [\<script/>](/signumjs/getting-started/installation.md#install-via-less-than-script-greater-than), you need to use the respective *namespace* to get access to the any of the functions within a module.&#x20;

{% code title="index.html" %}

```html
<html lang="en">
<head>
    <link rel="stylesheet" href="css/styles.css">
    <!-- Importing the bundles from the CDN -->
    <script type="application/javascript"
            src='https://cdn.jsdelivr.net/npm/@signumjs/core/dist/signumjs.min.js'></script>
</head>
<body>
    <!-- your body -->
    <script type="application/ecmascript" src="src/main.js"></script>
</body>
```

{% endcode %}

{% code title="main.js" %}

```javascript
(async () => {
    // the 'namespace' of @signum/core is sig$
    const api = sig$.composeApi({
        nodeHost: 'https://europe.signum.network',
    });

    const account = await api.account.getAccount({accountId: '16107620026796983538'});
    console.log('Account', account);
})();
```

{% endcode %}

{% hint style="info" %}
The modules are bundled using [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE), to avoid global naming collisions with your application. Keep also in mind, that the bundles do not contain any type information, so your IDE cannot help you with auto-completion.&#x20;
{% endhint %}

Each module of SignumJS comes with its own *namespace*

<table><thead><tr><th width="174.63100576553495">Module</th><th width="174.81838919534852">Namespace</th><th>Example</th></tr></thead><tbody><tr><td>core</td><td><code>sig$</code></td><td><pre class="language-javascript"><code class="lang-javascript">const api = sig$.composeApi({
        nodeHost: 'https://europe.signum.network',
    });
</code></pre></td></tr><tr><td>contracts</td><td><code>sig$contracts</code></td><td><p></p><pre class="language-javascript"><code class="lang-javascript">const dataView = new sig$contracts.ContractDataView(contract)
</code></pre></td></tr><tr><td>crypto</td><td>si<code>g$crypto</code></td><td><p></p><pre class="language-javascript"><code class="lang-javascript">const hash = sig$crypto.hashSHA256("test")
</code></pre></td></tr><tr><td>http</td><td><code>sig$http</code></td><td><p></p><pre class="language-javascript"><code class="lang-javascript">const client = new sig$http.HttpClientFactory.createHttpClient('https://jsonplaceholder.typicode.com/');
</code></pre></td></tr><tr><td>monitor</td><td><code>sig$monitor</code></td><td><p></p><pre class="language-javascript"><code class="lang-javascript">const monitor = new sig$monitor.Monitor&#x3C;Account>({
    asyncFetcherFn: tryFetchAccount,
    compareFn: checkIfAccountExists,
    intervalSecs: 10, 
        key: 'monitor-account',
    timeoutSecs: 2 * 240 
})
</code></pre></td></tr><tr><td>util</td><td><code>sig$util</code></td><td><p></p><pre class="language-javascript"><code class="lang-javascript">const value = sig$util.Amount.fromSigna("1000")
</code></pre></td></tr></tbody></table>


---

# 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://signum-network.gitbook.io/signumjs/getting-started/usage.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.
