> For the complete documentation index, see [llms.txt](https://docs.constellationnetwork.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.constellationnetwork.io/network-apis/api-reference/dag4.js/interacting-with-wallets.md).

# Interacting with Wallets

{% hint style="info" %}
**Accounts and Keys**

Want more detailed information about accounts are handled on the Hypergraph? Read about [Accounts and Keys](/network-fundamentals/accounts-and-keys.md).
{% endhint %}

### Interacting with Wallets[​](https://docs.constellationnetwork.io/hypergraph/dag4-wallets#interacting-with-wallets) <a href="#interacting-with-wallets" id="interacting-with-wallets"></a>

A wallet consists of a private key, a public key, and an address. You can create a new private key like this.

```typescript
const pk = dag4.keyStore.generatePrivateKey();
```

#### Login with a PK[​](https://docs.constellationnetwork.io/hypergraph/dag4-wallets#login-with-a-pk) <a href="#login-with-a-pk" id="login-with-a-pk"></a>

Before accessing methods on dag4.account specific to a wallet, you'll need to log in with a private key or seed phrase.

```typescript
dag4.account.loginPrivateKey(pk);
```

#### Login with a seed phrase[​](https://docs.constellationnetwork.io/hypergraph/dag4-wallets#login-with-a-seed-phrase) <a href="#login-with-a-seed-phrase" id="login-with-a-seed-phrase"></a>

If you already have a pneumonic phrase generated by a web wallet or somewhere else you can log in with that as well.

```typescript
dag4.account.loginSeedPhrase('disco foxtrot calm appleseed trinity organ putter waldorf ordinary shatter green portion');
```

#### Check DAG address[​](https://docs.constellationnetwork.io/hypergraph/dag4-wallets#check-dag-address) <a href="#check-dag-address" id="check-dag-address"></a>

```typescript
const address = dag4.account.address;
```

#### Get wallet public key[​](https://docs.constellationnetwork.io/hypergraph/dag4-wallets#get-wallet-public-key) <a href="#get-wallet-public-key" id="get-wallet-public-key"></a>

```typescript
dag4.account.publicKey;
```


---

# 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://docs.constellationnetwork.io/network-apis/api-reference/dag4.js/interacting-with-wallets.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.
