# Initializing the client

```typescript
import { ChainvineUser } from '@chainvine/sdk';

const config = {
   apiKey: 'S3CR37C0D3Z',
   testMode: true,
   logToConsole: true,
}

const client = new ChainvineClient(config)

// By default we assume you are dealing with an ethereum wallet address 
const userClient = await client.syncUser('0x393849393430')

// If your users are uniquely identified by an email address or you would like to
// use your own internal unique identifier you may instead use either of the following
const userClient = await client.syncUserWithEmail('user@test.xyz')
const userClient = await client.syncUserWithExternalId('myOwnInternalId123')
```

You may provide an optional configuration parameters in order to override the [default settings of the Client](https://docs.chainvine.xyz/developers/sdk/classes-and-functions/chainvineuser/broken-reference).

You may then use the userClient to perform actions specific to the user it was synced with

## Examples

### **For your Testing environment**

{% tabs %}
{% tab title="Node.js/JavaScript" %}

<pre class="language-javascript"><code class="lang-javascript">import { ChainvineClient } from '@chainvine/sdk';

const config = {
   apiKey: 'S3CR37C0D3Z',
   testMode: true,
   logToConsole: true,
}

const userWalletAddress = '0x393849393430'

const client = new ChainvineUser(config);

// Create your ChainvineUser client
const userClient = new ChainvineUser(
   userWalletAddress, 
   config
);

// or by using the syncUser method (note this will create or fetch the user
// on ChainVine
const userClientFromClient = await client.<a data-footnote-ref href="#user-content-fn-1">syncUser</a>(userWalletAddress);
<strong>
</strong><strong>// sync does not need to be called again as long as this instance exists
</strong><strong>console.log(userClientFromClient.id); // > ABC123
</strong></code></pre>

{% endtab %}
{% endtabs %}

### For your Production environment

{% tabs %}
{% tab title="Node.js/JavaScript" %}

```javascript
import { ChainvineClient } from '@chainvine/sdk';

const config = {
   apiKey: 'S3CR37C0D3Z',
   logToConsole: true, //can also be false or ommited depending on your needs
}

const userWalletAddress = '0x393849393430'

const client = new ChainvineClient(config);

// Create your ChainvineUser client
const userClient = await client.syncUser(userWalletAddress);
```

{% endtab %}
{% endtabs %}

[^1]:
