# Connecting to the Network

Dag4.js provides reasonable configuration values by default for accessing Constellation Network versions 1.0 and 2.0.

#### Minimal network configuration[​](https://docs.constellationnetwork.io/hypergraph/dag4-network#minimal-network-configuration) <a href="#minimal-network-configuration" id="minimal-network-configuration"></a>

```typescript
dag4.account.connect({
  networkVersion: '2.0',
  testnet: true
});
```

#### Custom network configuration[​](https://docs.constellationnetwork.io/hypergraph/dag4-network#custom-network-configuration) <a href="#custom-network-configuration" id="custom-network-configuration"></a>

You can provide custom values for each the three network API endpoints to set up a custom connection.

```typescript
dag4.account.connect({
  networkVersion: '2.0',
  beUrl: 'https://be-mainnet.constellationnetwork.io/',
  l0Url: 'http://13.52.246.74:9000',
  l1Url: 'http://13.52.246.74:9010'
});
```

#### Default Endpoints[​](https://docs.constellationnetwork.io/hypergraph/dag4-network#default-endpoints) <a href="#default-endpoints" id="default-endpoints"></a>

The following endpoints are used by default by Dag4.

**IntegrationNet**[**​**](https://docs.constellationnetwork.io/hypergraph/dag4-network#20-integrationnet)

* Block Explorer API: [https://be-integrationnet.constellationnetwork.io](https://be-integrationnet.constellationnetwork.io/)
* L0 API: [https://l0-lb-integrationnet.constellationnetwork.io](https://l0-lb-integrationnet.constellationnetwork.io/)
* L1 API: [https://l1-lb-integrationnet.constellationnetwork.io](https://l1-lb-integrationnet.constellationnetwork.io/)

```
dag4.account.connect({
  id: 'integration2',
  networkVersion: '2.0',
  beUrl: 'https://be-integrationnet.constellationnetwork.io',
  l0Url: 'https://l0-lb-integrationnet.constellationnetwork.io',
  l1Url: 'https://l1-lb-integrationnet.constellationnetwork.io'
}, false);
```

**MainNet**[**​**](https://docs.constellationnetwork.io/hypergraph/dag4-network#20-mainnet)

* Block Explorer API: [https://be-mainnet.constellationnetwork.io](https://be-mainnet.constellationnetwork.io/)
* L0 API: [https://l0-lb-mainnet.constellationnetwork.io](https://l0-lb-mainnet.constellationnetwork.io/)
* L1 API: [https://l1-lb-mainnet.constellationnetwork.io](https://l1-lb-mainnet.constellationnetwork.io/)

```
dag4.account.connect({
  networkVersion: '2.0',
  testnet: false
});
```

{% hint style="warning" %}
TestNet usage is not recommended as it is expected to be unstable. Use IntegrationNet as the preferred testnet.&#x20;
{% endhint %}

**TestNet**[**​**](https://docs.constellationnetwork.io/hypergraph/dag4-network#20-testnet)

* Block Explorer API: [https://be-testnet.constellationnetwork.io](https://be-testnet.constellationnetwork.io/)
* L0 API: [https://l0-lb-testnet.constellationnetwork.io](https://l0-lb-testnet.constellationnetwork.io/)
* L1 API: [https://l1-lb-testnet.constellationnetwork.io](https://l1-lb-testnet.constellationnetwork.io/)

```typescript
dag4.account.connect({
  networkVersion: '2.0',
  testnet: true
});
```


---

# Agent Instructions: 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:

```
GET https://docs.constellationnetwork.io/network-apis/api-reference/dag4.js/connecting-to-the-network.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
