> For the complete documentation index, see [llms.txt](https://docs.cheesecakelabs.com/stellar-plus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheesecakelabs.com/stellar-plus/reference/account/default-account-handler.md).

# Default Account Handler

Extending the 'AccountHandler', the '**DefaultAccountHandler'** class allows for an account to be loaded through its secret key, enabling its management capabilities. This account can then be used in transaction invocation as a 'signer' parameter to integrate into the transactions pipeline.

### How to use

There are a few different options to initialize an account with the Default account that can be used depending on the use case.

#### Initializing with the secret key

The main way of initializing a default account handler is by providing its secret key to an object during the instantiation of the class as the following:

{% code overflow="wrap" lineNumbers="true" %}

```typescript
const myAccount = new StellarPlus.Account.DefaultAccountHandler({secretKey:"SCGCPZYE24NMPOXAH3E3VZMMN4AIQSCXPN4K6MWZ7FLYVA57H26C5NWY”})
```

{% endcode %}

This is used when you already have an existing account and want to handle it after loading it secret key from a different source.

#### Initializing a new account

Whenever the default account handler is instantiated without providing a secret key, it automatically generates a new random keypair and uses it.

{% code overflow="wrap" lineNumbers="true" %}

```typescript
const myAccount = new StellarPlus.Account.DefaultAccountHandler({})
```

{% endcode %}

When using this option, be aware that the keys are merely generated locally, the account still won't exist in the Stellar network until a 'create account' operation is performed. For this, when using test networks that have a Friendbot, one can make use of the 'Friendbot' helper for Accounts to initialize the account with some lumens funds. Refer to the article [Broken mention](broken://pages/k1nqg1VBsbDjs9AIuEKH) for more detail.


---

# 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.cheesecakelabs.com/stellar-plus/reference/account/default-account-handler.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.
