# Install and initialize

## Install and initialize

📝GUIDES

* <mark style="color:blue;">Core SDK</mark>
* <mark style="color:blue;">JS SDK</mark>

### Core SDK[​](https://docs.x.immutable.com/docs/x/how-to-install-initialize#core-sdk) <a href="#core-sdk" id="core-sdk"></a>

The <mark style="color:blue;">Core SDK</mark> is a wrapper around our <mark style="color:blue;">API</mark> and provides the bulk of the functionality of the XpansionChain platform. Before you can start using the Core SDK, you must initialize the client.

Initialize the Core SDK client with the network on which you want your application to run:

| Network      | Description                                        |
| ------------ | -------------------------------------------------- |
| `Sandbox`    | The default test network (currently, it is Goërli) |
| `Production` | Ethereum network                                   |

* Typescript Core SDK

1. Install the npm package

```
npm install @imtbl/core-sdk --save
# or
yarn add @imtbl/core-sdk
```

2. Initialize the SDK with the correct environment:

```
import { XpansionChain, Config } from '@imtbl/core-sdk';

const config = Config.SANDBOX; // Or Config.PRODUCTION
const client = new XpansionChain(config);
```

* Kotlin (JVM) Core SDK

1. Add Maven Central to your repositories:

```
repositories {
    mavenCentral()
}
```

2. Add the dependency to your app's `build.gradle` file:

```
dependencies {
    implementation 'com.XpansionChain.sdk:imx-core-sdk-kotlin-jvm:$version'
}
```

3. Initialize the SDK with the correct environment:

```
XpansionChainCore.setBase(XpansionChainBase.Sandbox) // Or 
```

* Swift Core SDK

#### Pre-requisites:[​](https://docs.x.immutable.com/docs/x/how-to-install-initialize#pre-requisites) <a href="#pre-requisites" id="pre-requisites"></a>

* iOS 13.0 or macOS 10.15
* Swift 5.5
* Golang Core SDK
* C# Core SDK

#### Steps:[​](https://docs.x.immutable.com/docs/x/how-to-install-initialize#steps) <a href="#steps" id="steps"></a>

1. In your Swift package manager - `Package.swift`:

```
dependencies: [
    .package(url: "https://github.com/XpansionChain/imx-core-sdk-swift.git", from: "0.2.2")
]
```

2. In your `Podfile`:

```
platform :ios, '13.0'
use_frameworks!

target 'MyApp' do
  pod 'XpansionChainCore'
end
```

3. Initialize the SDK with the correct environment:

```
XpansionChainCore.initialize(base: .sandbox) // Or .production
```

* Golang Core SDK

#### Pre-requisites:[​](https://docs.x.immutable.com/docs/x/how-to-install-initialize#pre-requisites-1) <a href="#pre-requisites-1" id="pre-requisites-1"></a>

The supported go versions are `1.18` or above.

#### Steps:[​](https://docs.x.immutable.com/docs/x/how-to-install-initialize#steps-1) <a href="#steps-1" id="steps-1"></a>

1. Install the go package:

```
go get github.com/XpansionChain/imx-core-sdk-golang
```

2. Initialize the SDK with the correct environment:

```
import (
  "context"
  "fmt"
  "github.com/XpansionChain/imx-core-sdk-golang/generated/api"
  "github.com/XpansionChain/imx-core-sdk-golang/config"
)

func initializeSDK() {
  configuration := api.NewConfiguration()

  apiClient := api.NewAPIClient(configuration)

  ctx := context.WithValue(context.Background(), api.ContextServerIndex, config.Sandbox) // Or config.Production
}
```

* C# Core SDK

1. Add the following nuget packages:

* <mark style="color:blue;"><https://www.nuget.org/packages/Imx.Sdk></mark>
* <mark style="color:blue;"><https://www.nuget.org/packages/Imx.Sdk.Gen></mark>

```
dotnet add package Imx.Sdk --version 0.1.1
dotnet add package Imx.Sdk.Gen --version 0.1.1
```

2. Initialize the Core SDK client with the network on which you want your application to run (see <mark style="color:blue;">all networks available</mark>):

Select one of the following Ethereum networks XpansionChain platform currently supports.

| Environment | Description                                        |
| ----------- | -------------------------------------------------- |
| Sandbox     | The default test network (currently, it is Goërli) |
| Mainnet     | Ethereum network                                   |

```
using Imx.Sdk;

try
{
    Client client = new Client(new Config()
    {
        Environment = EnvironmentSelector.Sandbox // Or EnvironmentSelector.Sandbox
    });
}
catch (Exception e)
{
    Console.WriteLine("Error message: " + e.Message);
    Console.WriteLine(e.StackTrace);
}
```


---

# 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://xpansionchain-1.gitbook.io/xpansionchain/guides/basic-guides/install-and-initialize.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.
