# Ell

## ell\_send

Send a transaction. Send ELL from one account to another account.&#x20;

{% hint style="info" %}
**Private**: Requires authentication.
{% endhint %}

**Curl Example:**&#x20;

```bash
curl \ 
    -H "Authorization: Bearer xxxx.fQ.bk6c9uBbEUBDAwnPY_Gs5p7m4zgwY" 
    -X POST \
    127.0.0.1:8987 \
    --data '{"jsonrpc":"2.0",
                "method":"ell_send", 
                "params": { 
                    "fee":"0.01",
                    "from":"e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx",
                    "hash":"0x073a2bca8dbbac9b2dff4020314d53faa18f0530fa1c57ae9d8a7355317cda93",
                    "nonce":22,
                    "senderPubKey":"49EqPSyUhz8XnQfPajpFthKKkFUevM5CV13VgjRu8TAY9sgeYD2",
                    "sig":"0xa2cdbed94b8a30563a92fe038a112a232c68a68a06fd161b7335a635960e26bbff2b7a28b691a56b906f62738c44907a9598dd08dfa02afe0356cacab6647704",
                    "timestamp":1541769498,
                    "to":"e2Zs2nsmocrQcE1tPyVgm4deVSVVYppxum",
                    "type":1,
                    "value":"1"} , 
                "id":21}'
```

#### Console Example

```javascript
> ell.send({
  "fee": "0.01",
  "from": "e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx",
  "hash": "0x073a2bca8dbbac9b2dff4020314d53faa18f0530fa1c57ae9d8a7355317cda93",
  "nonce": 22,
  "senderPubKey": "49EqPSyUhz8XnQfPajpFthKKkFUevM5CV13VgjRu8TAY9sgeYD2",
  "sig": "0xa2cdbed94b8a30563a92fe038a112a232c68a68a06fd161b7335a635960e26bbff2b7a28b691a56b906f62738c44907a9598dd08dfa02afe0356cacab6647704",
  "timestamp": 1541769498,
  "to": "e2Zs2nsmocrQcE1tPyVgm4deVSVVYppxum",
  "type": 1,
  "value": "1"
})
```

#### Console Example (Using Transaction Builder)

```javascript
> ell.balance().
    senderPubKey("49EqPSyUhz8XnQfPajpFthKKkFUevM5CV13VgjRu8TAY9sgeYD2").
    from("e2MAm5dZS9biD31gENCoqTQd8DeTMrxoEo").
    to("e2Zs2nsmocrQcE1tPyVgm4deVSVVYppxum").
    value("1").
    fee("0.01").
    nonce("1").
    send()
```

{% hint style="info" %}
By default, when `from()` is not called, the address of the loaded account is used.&#x20;
{% endhint %}

{% hint style="info" %}
By default, then `senderPubKey()` is not called, the public key of the loaded account is used.&#x20;
{% endhint %}

{% hint style="info" %}
Calling `nonce()` is optional. The current sender account's nonce will be automatically determined and set.&#x20;
{% endhint %}

#### Returns:

`Object`&#x20;

| Field | Type   | Description          |
| ----- | ------ | -------------------- |
| id    | String | The transaction hash |

#### Output:

```javascript
{
  "id": 21,
  "jsonrpc": "2.0",
  "result": {
    "id": "0xe6167c8d32ca075eb2c5bbc6e87d9941bf4b2e564e85d0c447d91e98dd0bef2e"
  }
}
```

## ell.balance

Returns a transaction builder that can be used to create a balance transaction using chain-able methods interface. The transaction builder calls `ell_send` when the built transaction is ready to be sent to the node.&#x20;

#### Create a new builder

```javascript
> var myBuilder = ell.balance()
```

#### Transaction Builder Methods

The build is an object that includes methods required to conveniently construct and sign a full transaction.  These are the available methods:

| Method       | Argument Type | Return Type                                                           | Required | Description                                                                          |
| ------------ | ------------- | --------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------ |
| senderPubKey | String        | TxBuilder                                                             | False    | Set the public key of the sender/signer. (Default: Public key of the loaded account) |
| from         | String        | TxBuilder                                                             | False    | Set the sender's address. (Default: Address of the loaded account)                   |
| to           | String        | TxBuilder                                                             | True     | The recipients address.                                                              |
| value        | String        | TxBuilder                                                             | True     | The amount of ELL to send.                                                           |
| fee          | String        | TxBuilder                                                             | True     | The amount of fee to pay.                                                            |
| nonce        | String        | TxBuilder                                                             | False    | The next nonce of the account (current nonce + 1).                                   |
| send         |               | [TxResult](https://docs.ellcrys.org/object-references/txresult)       |          | Finalizes and sends the transaction.                                                 |
| payload      | Boolean       | [Transaction](https://docs.ellcrys.org/object-references/transaction) |          | Returns the internal transaction that's being built.                                 |
| packed       |               | <p>Base58Check</p><p>String</p>                                       |          | Finalizes and returns Base58 encoded version of the transaction                      |
| reset        |               |                                                                       |          | Clears all collected data. Restore the builder to its zero state.                    |

#### Full Console Example

```javascript
> ell.balance().
    senderPubKey("49EqPSyUhz8XnQfPajpFthKKkFUevM5CV13VgjRu8TAY9sgeYD2").
    from("e2MAm5dZS9biD31gENCoqTQd8DeTMrxoEo").
    to("e2Zs2nsmocrQcE1tPyVgm4deVSVVYppxum").
    value("1").
    fee("0.01").
    nonce("1").
    send() // or payload() or packed(true)
```

{% hint style="info" %}
When`from()`is not called, the address of the loaded account is used.&#x20;
{% endhint %}

{% hint style="info" %}
When`senderPubKey()`is not called, the public key of the loaded account is used.&#x20;
{% endhint %}

{% hint style="info" %}
Calling `nonce()` is optional. The current sender account's nonce will be automatically determined and set.&#x20;
{% endhint %}

{% hint style="info" %}
By default, the transaction type is set to 1 = Balance Transaction.
{% endhint %}

#### Returns:

`Object`&#x20;

| Field | Type   | Description          |
| ----- | ------ | -------------------- |
| id    | String | The transaction hash |

#### Output:

```javascript
{
  "id": 21,
  "jsonrpc": "2.0",
  "result": {
    "id": "0xe6167c8d32ca075eb2c5bbc6e87d9941bf4b2e564e85d0c447d91e98dd0bef2e"
  }
}
```

## ell\_getBalance

Get the ELL balance of an account.

**Parameters:**

| Argument | Type   | Required | Description                 |
| -------- | ------ | -------- | --------------------------- |
| address  | String | True     | The address of the account. |

**Curl Example:**&#x20;

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"ell_getBalance", "params": "e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx", "id":21}'
```

#### Console Example

```javascript
> ell.getBalance("e2MhrMh7xvpByj3G3pKdHPfwFfNS7yRaRx")
```

#### Returns:

`String`&#x20;

#### Output:

```javascript
{
  "id": 21,
  "jsonrpc": "2.0",
  "result": "100.000000000000000000"
}
```

## ell\_sendRaw <a href="#ell_getbalance" id="ell_getbalance"></a>

Send a base58 encoded transaction to the client for processing.

**Parameters:**

| Argument  | Type   | Required | Description                    |
| --------- | ------ | -------- | ------------------------------ |
| encodedTx | String | True     | The base58 encoded transaction |

**Curl Example:**

```javascript
curl -X POST --data '{"jsonrpc":"2.0","method":"ell_sendRaw", "params": "2ZRcZJ4LGqyMBEuAD8Cspa9h3sAoAs6vgifKEXM...ZXd9ubdWgBCkjCLewqu", "id":21}'
```

#### Console Example <a href="#console-example-1" id="console-example-1"></a>

```javascript
> ell.sendRaw("2ZRcZJ4LGqyMBEuAD8Cspa9h3sAoAs6vgifKEXM1BSRtz" + 
                 "v2C5gshUL15zuv2x4FLDY9DywEMMLZKDWe3gUgAUWQnsfib" + 
                 "bRywBur4WApyZmBsZNjayy6zft6JnUjzv5XRbUe2UzvCwKkeRQ" + 
                 "r686p4zutSCjTK4L3cqp7Gv1LaiZT8WwdCr6ZcXxTkUPeoZyq2paZ" + 
                 "E856e27iqTWdecbeoEeR1UqK7RZZdqqJafYuUq8XaJ3MkqNznT2eD" + 
                 "jEmnwQhRH2WHCHGuCMdZHQUZ6WK7J9sgB9GoWgy3K3Q459JpjxFNw" +
                 "zJErVqnmnazZwdqmtCK5zq4kfXj9AbL86zxeKFx7xiN87raXJ6oWAQL" + 
                 "GYAphTSuWG1FgBy4d7SyUrDuDHfZwLeMPE2RZxCeHUGUrgpkiofPPpeb" + 
                 "p5SXeJiaTvJRAGntJgEXEpDBFxTpKxhaDZn1AUcYohyPXg71pCvuTc7sa" + 
                 "CmtFgWzWrQKfWXDKYeJF5RCA8LyQ4LRVheQuPTQXbQNDkcynGdkVZ2zuZLp" +
                 "qJhoFoeYrnB8u5bxzKoo4BiFfKjLVSh1RRuEZ2XzJRPKaqHYL9xBGA2cB2U6Z" +
                 "Xd9ubdWgBCkjCLewqu")
```

#### Returns:

`Object`&#x20;

| Field | Type   | Description          |
| ----- | ------ | -------------------- |
| id    | String | The transaction hash |

#### Output:

```javascript
{
  "id": 21,
  "jsonrpc": "2.0",
  "result": {
    "id": "0xe6167c8d32ca075eb2c5bbc6e87d9941bf4b2e564e85d0c447d91e98dd0bef2e"
  }
}
```


---

# 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://ellcrys.gitbook.io/ellcrys/api/ell-apis.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.
