> ## Documentation Index
> Fetch the complete documentation index at: https://atomictoolkit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Server-side Usage

> Use Atomic Toolkit in Server Environments.

This section guides you through initializing Atomic Toolkit within a server environment like a backend application. Currently Atomic toolkit can be initializing in the following ways:

1. Using Arweave Wallet
2. Using Irys SDK

## Using Arweave Wallet

It uses the Arweave Wallet to sign transactions and interact with the Arweave network.

```ts theme={null}
import { readFileSync } from 'fs';
import AtomicToolkit from 'atomic-toolkit';

const key = JSON.parse(readFileSync('wallet.json').toString());

const toolkit = new AtomicToolkit({
    key: key,
});
```

### Input Parameters

The following params are available for this function and they must be passed in as an object:

* **warp (optional)**: `Warp`: A Warp Instance to use with Deploy Plugin. If not provided, the default Warp instance for Mainnet will be used.
* **arweave (optional)**: `Arweave`: An Arweave Instance to use. If not provided, the default Arweave instance with gateway [arweave.net](arweave.net) will be used.
* **key**: `JWKInterface`: The Key to use for signing transactions. Should be a JWK object.

<Warning>
  Private keys must be kept secure at all times. Please ensure that the
  `wallet.json` file is not pushed to a version control (eg. GitHub). If you
  are using a CI/CD pipeline, ensure that the wallet.json file is not stored
  in the repository.
</Warning>

<Note>
  The Warp instance should use the `DeployPlugin`. It is neccessary to
  register Atomic Assets
</Note>

### Default Values

```ts theme={null}
/**
 * Default Warp instance
 */
const warp = WarpFactory.forMainnet().use(new DeployPlugin());

/**
 * Default Arweave configuration.
 */
const defaultArweave = new Arweave({
    host: 'arweave.net',
    port: 443,
    protocol: 'https',
});
```

### Custom Instance Example

```ts theme={null}
import Arweave from 'arweave';
import { readFileSync } from 'fs';
import AtomicToolkit from 'atomic-toolkit';
import { DeployPlugin } from 'warp-contracts-plugin-deploy';
import { WarpFactory, defaultCacheOptions } from 'warp-contracts';

const key = JSON.parse(readFileSync('wallet.json').toString());

const warp = WarpFactory.forMainnet({
    ...defaultCacheOptions,
    inMemory: true,
}).use(new DeployPlugin());

const arweave = new Arweave({
    host: 'arweave.net',
    port: 443,
    protocol: 'https',
});

const warp = WarpFactory.forMainnet({
    ...defaultCacheOptions,
    inMemory: true,
}).use(new DeployPlugin());

const toolkit = new AtomicToolkit({
    warp,
    arweave,
    key: key,
});
```

## Using Irys SDK

This uses the Irys SDK to sign transactions and interact with the Arweave network.

```ts theme={null}
import AtomicToolkit from 'atomic-toolkit';
import Irys from '@irys/sdk';

const irys = new Irys({
    url: 'https://node2.irys.xyz',
    token: 'matic',
    key: 'your-ethereum-private-key',
});

await irys.ready();

const toolkit = new AtomicToolkit({
    irys,
});
```

### Input Parameters

The following params are available for this function and they must be passed in as an object:

* **warp (optional)**: `Warp`: A Warp Instance to use with Deploy Plugin. If not provided, the default Warp instance for Mainnet will be used.
* **irys**: `Irys`: The Irys SDK instance to use.

<Note>
  The Warp instance should use the `DeployPlugin`. It is neccessary to
  register Atomic Assets
</Note>

### Default Values

```ts theme={null}
/**
 * Default Warp instance
 */
const warp = WarpFactory.forMainnet().use(new DeployPlugin());
```

### Custom Instance Example

```ts theme={null}
import Irys from '@irys/sdk';
import AtomicToolkit from 'atomic-toolkit';
import { DeployPlugin } from 'warp-contracts-plugin-deploy';
import { WarpFactory, defaultCacheOptions } from 'warp-contracts';

const warp = WarpFactory.forMainnet({
    ...defaultCacheOptions,
    inMemory: true,
}).use(new DeployPlugin());

const irys = new Irys({
    url: 'https://node2.irys.xyz',
    token: 'matic',
    key: 'your-ethereum-private-key',
});

await irys.ready();

const toolkit = new AtomicToolkit({
    irys,
    warp,
});
```

## Using Turbo SDK

```ts theme={null}
import { TurboFactory } from '@ardrive/turbo-sdk';
import AtomicToolkit from 'atomic-toolkit';
import fs from 'fs';

const jwk = JSON.parse(fs.readFileSync('./KeyFile.json'));

const turbo = TurboFactory.authenticated({ privateKey: jwk });
const toolkit = new AtomicToolkit({ turbo });
```

### Input Parameters

The following params are available for this function and they must be passed in as an object:

* **warp (optional)**: `Warp`: A Warp Instance to use with Deploy Plugin. If not provided, the default Warp instance for Mainnet will be used.
* **turbo**: An authenticated Turbo instance to use for uploading with Turbo.
