> For the complete documentation index, see [llms.txt](https://docs.metalx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metalx.com/developers-dex/examples/installation-+-initialization.md). Agents can also search and read this documentation through its [MCP server](https://docs.metalx.com/~gitbook/mcp).

# Installation + Initialization

DEX orders can be submitted through both JS and python library. Below are the instructions to install.

**Install:**

{% tabs %}
{% tab title="JavaScript" %}

```
npm i @proton/js
npm i node-fetch@2
```

{% endtab %}

{% tab title="Python" %}
[pyeoskit](https://github.com/learnforpractice/pyeoskit) **is the library used for DEX.**

Below are the instructions to install it on different Operating Systems.

**MAC and Linux(ubuntu):**

```
python3 -m pip install -U pip
python3 -m pip install pyeoskit
```

\
**Windows:**

```
python -m pip install -U pip
python -m pip install pyeoskit
```

####

#### M1/M2 Mac:

```
brew install go cython
python3 -m pip install cmake

xcode-select --install
in case if you see the error message "xcode-select: error: command line tools are already installed, use "Software Update" to install updates" for above command, fix the with the following command
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

python3 -m pip install -U pip
python3 -m pip install pyeoskit
```

```
python3 -m pip install -U pip
python3 -m pip install pyeoskit
```

{% endtab %}
{% endtabs %}

**Initialize API:**

{% tabs %}
{% tab title="Javascript" %}

```javascript
const {JsonRpc, Api, JsSignatureProvider} = require('@proton/js')

// For testnet use https://rpc.api.testnet.metalx.com/
const ENDPOINTS = [
   'https://rpc.api.mainnet.metalx.com',
]

// To export private key from your wallet, follow:
// https://help.xprnetwork.org/hc/en-us/articles/4410313687703-How-do-I-backup-my-private-key-in-the-WebAuth-Wallet-
const PRIVATE_KEY = 'PVT_K1_2fdW4UGdbgG59mUaTiMXLy1rFv3afbmSWEZGWFz6zF8dR1VZPb'

// Authorization
const username = 'metaltest1'
const authorization = [{
    actor: 'pbonblockc',
    permission: 'active'
}]

// Initialize
const rpc = new JsonRpc(ENDPOINTS)

const api = new Api({
   rpc,
   signatureProvider: new JsSignatureProvider([PRIVATE_KEY])
})

const transact = (actions) => api.transact({actions}, {
    blocksBehind: 300,
    expireSeconds: 3000,
})
```

{% endtab %}

{% tab title="Python" %}

```python
import os
from pyeoskit import eosapi, wallet
#import your account private key here
wallet.import_key('mywallet', 'PVT_K1_2fdW4UGdbgG59mUaTiMXLy1rFv3afbmSWEZGWFz6zF8dR1VZPb')

username = "user1"
#For testnet use https://rpc.api.testnet.metalx.com
eosapi.set_node('https://rpc.api.mainnet.metalx.com')
info = eosapi.get_info()
print(info)
```

{% endtab %}
{% endtabs %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.metalx.com/developers-dex/examples/installation-+-initialization.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
