> ## Documentation Index
> Fetch the complete documentation index at: https://sequence-0fb8d9e6-codex-update-discord-invite.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sidekick Quickstart

> Quickstart guide for getting started with Sidekick

There is a public docker image available on [GitHub Container Registry](https://github.com/0xsequence/sidekick/pkgs/container/sidekick).

```shell theme={null}
docker run -p 7500:7500 -e SEQUENCE_PROJECT_ACCESS_KEY=... ghcr.io/0xsequence/sidekick:latest
```

This will get you started with a local Sidekick backend running on port 7500 with the minimal features.

<Note>
  We recommend setting SEQUENCE\_PROJECT\_ACCESS\_KEY as well but for testing purposes we provide a default one, you can get yours from [Sequence Builder](https://sequence.build/).
</Note>

## Backend wallet

Sidekick creates a Sequence Smart Contract Wallet based on the `BACKEND_WALLET_PV_KEY` or `AWS / GCP KMS` signer you provide, this allows gas-sponsorship, batching and other optimizations.

To configure the backend wallet, you can:

* Declare your [BACKEND\_WALLET\_PV\_KEY](https://github.com/0xsequence-demos/sequence-sidekick/blob/e76a47d0b9ef19f23736c1e8f863ed4795b855a8/.env.example#L16) in the .env file for a local setup (not recommended for production) or don't provide it and get a random one generated for you, you can find it in the auto generated `dev.key` file.
* Use the recommended method: setting up [AWS](https://aws.amazon.com/kms/) or [GCP](https://cloud.google.com/kms) KMS and adding the necessary credentials in the .env file.

<Note>
  To find out what are the required credentials for local, AWS, or GCP wallet configurations, please refer to the [env.example](https://github.com/0xsequence-demos/sequence-sidekick/blob/master/.env.example) file.
</Note>

<Note>
  Make sure you choose the correct key types in AWS KMS and GCP KMS.

  * AWS KMS: `ECC_NIST_P256_KEY_ALIAS`
  * GCP KMS: `GCP_KEY_RING_NAME`
</Note>

Sidekick is built to integrate seamlessly with AWS and GCP KMS, allowing you to use your KMS signer. We've developed [adapters](https://github.com/orgs/0xsequence/repositories?q=kms) that make AWS/GCP KMS compatible with the ethers signer type, ensuring compatibility with the latest version.

Sequence Sidekick empowers developers with a scalable, plug-and-play backend solution for blockchain-based applications, allowing you to focus on building without backend complexities.

<Callout type="warning">
  When using the Sequence Sidekick:

  * `msg.sender` will be the Sequence Wallet address of your EOA, not your EOA address
  * `tx.origin` will be one of the Sequence Relayer addresses
  * Ensure proper permissions are granted for contract function calls to the Sequence Wallet address
  * View active relayer addresses in the [mainnet status page](https://mainnet-relayer.sequence.app/status)
</Callout>

## Start Sidekick in dev mode

<Steps>
  <Step title="Clone the Sidekick repository">
    ```shell theme={null}
    git clone https://github.com/0xsequence/sidekick
    ```
  </Step>

  <Step title="Setup the required environment variables">
    ### Required Environment Variables

    | Variable             | Description                               |
    | -------------------- | ----------------------------------------- |
    | PROJECT\_ACCESS\_KEY | Access key from Sequence Builder API Keys |

    ### Optional Environment Variables

    | Variable                     | Description                                                                  |
    | ---------------------------- | ---------------------------------------------------------------------------- |
    | BACKEND\_WALLET\_PV\_KEY     | Private key for the EOA used to sign transactions                            |
    | PORT                         | Port for the Sidekick server (default: 7500)                                 |
    | HOST                         | Host address for the server (default: 0.0.0.0)                               |
    | REDIS\_HOST                  | Redis server host (default: localhost)                                       |
    | REDIS\_PORT                  | Redis server port (default: 6379)                                            |
    | REDIS\_PASSWORD              | Password for Redis server (optional)                                         |
    | DATABASE\_URL                | PostgreSQL connection string for Sidekick database                           |
    | SIDEKICK\_API\_SECRET\_KEY   | Secret key required for write access to the Sidekick API                     |
    | ETHERSCAN\_API\_KEY          | API key for Etherscan to enable contract verification                        |
    | VERIFY\_CONTRACT\_ON\_DEPLOY | Enable automatic contract verification on deployment (set to true to enable) |
    | DEBUG                        | Enable debug logging (set to true for verbose output)                        |
    | SIGNER\_TYPE                 | Type of signer to use (local, aws\_kms, google\_kms)                         |
    | AWS\_REGION                  | AWS account region                                                           |
    | AWS\_ACCESS\_KEY\_ID         | AWS access key ID                                                            |
    | AWS\_SECRET\_ACCESS\_KEY     | AWS secret access key                                                        |
    | AWS\_KMS\_KEY\_ID            | ID of the KMS key to use                                                     |
    | PROJECT                      | GCP project name                                                             |
    | LOCATION                     | GCP project location                                                         |
    | KEY\_RING                    | Key ring name                                                                |
    | CRYPTO\_KEY                  | Crypto key name                                                              |
    | CRYPTO\_KEY\_VERSION         | Crypto key version                                                           |

    ### Wallet Configuration Variables

    Choose one of the following configurations:

    #### For local wallet:

    | Variable                 | Description |            |
    | ------------------------ | ----------- | ---------- |
    | SIGNER\_TYPE             | local       |            |
    | BACKEND\_WALLET\_PV\_KEY | 0x...       | (optional) |

    #### For AWS KMS:

    | Variable                 | Description              |
    | ------------------------ | ------------------------ |
    | SIGNER\_TYPE             | aws\_kms                 |
    | AWS\_REGION              | AWS account region       |
    | AWS\_ACCESS\_KEY\_ID     | AWS access key ID        |
    | AWS\_SECRET\_ACCESS\_KEY | AWS secret access key    |
    | AWS\_KMS\_KEY\_ID        | ID of the KMS key to use |

    #### For GCP KMS:

    | Variable             | Description          |
    | -------------------- | -------------------- |
    | SIGNER\_TYPE         | google\_kms          |
    | PROJECT              | GCP project name     |
    | LOCATION             | GCP project location |
    | KEY\_RING            | Key ring name        |
    | CRYPTO\_KEY          | Crypto key name      |
    | CRYPTO\_KEY\_VERSION | Crypto key version   |
  </Step>

  <Step title="Make sure you have Docker installed">
    Get it from [here](https://www.docker.com/get-started/)
  </Step>

  <Step title="Start Sidekick in a Docker container">
    ```shell theme={null}
    pnpm docker:start
    ```
  </Step>

  <Step title="Check your backend wallet address">
    ```shell theme={null}
    curl -X GET 'http://localhost:3000/sidekick/smart-account-address'
    ```
  </Step>
</Steps>

## Dev mode without Docker

If you want to make changes to the codebase and test them without Docker

```shell theme={null}
pnpm install
pnpm dev:withRedis
```

This will run Sidekick and also start a Redis server.

## Gas Sponsorship

On testnet, we sponsor all the transactions. However, on mainnet - you will want to ensure that you sponsor the transactions in order to ensure that they process correctly by sponsoring the contract itself. You can take a deeper look at our [Gas Sponsorship](/solutions/builder/gas-sponsorship) solution to learn how to do this.
