---
title: The Ledger Client
slug: signum/the-ledger-client
docTags: 
createdAt: 2022-09-07T18:36:24.000Z
---

To post or get data to/from the Signum Blockchain you need to create a ledger client instance. Once instantiated you have access to all the functions provided by the [Node HTTP API](docId\:YynXYcqbLmbWflxZoM4C6) in a comfortable and intuitive way.

:::hint{type="info"}
It is highly recommended to use SignumJS within a decent IDE like [VSCode](https://code.visualstudio.com/download) or [WebStorm](https://www.jetbrains.com/webstorm/) to take full advantage of the auto-completion feature, making developing for Signum a breeze.
:::

The client organizes the calls into groups according their functionality, i.e.

- account
- alias
- asset
- block
- contract
- message
- network
- transaction

Each of this subgroup provides a set of functions (see [API Reference](docId\:kFMWpwRRP1gEf3SDg5V4W) for complete documentation). For example, network related functionality like getting a list of connected peers are in `network`, while balance information are inside the `account` subgroup.&#x20;

Instantiating a ledger client is very easy:

```javascript
    const ledger = LedgerClientFactory.createClient({
        nodeHost: "https://europe3.testnet.signum.network"
    });
```

## Networks

At this time of writing Signum runs two major networks: Main Net and Test Net

### Test Net

As a general rule, **all development should be done on Test Net** first. The Signum Core Team provides a public Test Net Node: `https://europe3.testnet.signum.network` and a public explorer under `https://t-chain.signum.network` . But best is to run a local Test Net host `http://localhost:6876`

See how to [Starting a Signum-Node](docId\:tf9YKi9wUh7rFQJaHQOsz) for development purposes.&#x20;

### Main Net

The Main Net consists of hundreds of nodes, but some of them are considered as Featured Nodes, which are maintained by the Signum Core Team and further community members and guarantee better up times.

A full list of feature nodes can be found in the [Main Net Explorer.](https://chain.signum.network/peers/)

### Automatic Node Selection

As a blockchain is a distributed ledger, you can connect the ledger client with any of the nodes. If you provide an application and want to offer better user experience through better loading times, it would be good if the application could be capable of selecting the "best" node. SignumJS provides such a functionality, which tests the response times of a set of given node urls. To auto-select the "best" node do the following:

```javascript
const {LedgerClientFactory} = require("@signumjs/core");

async function selectBestHost() {
    try {
        const featuredNodes = [
            'http://localhost:8125', // local main net host
            'https://europe.signum.network',
            'https://europe1.signum.network',
            'https://europe2.signum.network',
            'https://europe3.signum.network',
            'https://brazil.signum.network',
            'https://australia.signum.network',
            'https://us-east.signum.network',
        ]

        const ledger = LedgerClientFactory.createClient({
            nodeHost: featuredNodes[0], // default node
            reliableNodeHosts: featuredNodes // set this list, when you plan to use the `selectBestHost` method
        })

        // by calling this method all nodes from `reliableNodeHosts` will be requested to see who's responding fastest
        // We want the ledger to be re-configured to the best node automatically, that's why we pass `true` as first argument
        const selectedHost = await ledger.service.selectBestHost(true)

        console.log('Fastest Responding Node', selectedHost)
        // you can also get the current selected host from the ledger client, like this
        // ledger.service.settings.nodeHost
    } catch (e) {
        // If the API returns an exception,
        // the return error object is of type HttpError
        handleError(e);
    }
}

(async () => {
    await selectBestHost();
})();

```





