Estimate a transaction
Estimate the fee (and gas, energy, bandwidth) of a transaction using the tx/build body.
# Estimate a transaction
`POST https://api.rarebl.com/open/tx/estimate`
Estimates the fee of a transaction without building digests. It takes the same body as tx/build.
**Rate class:** compute (2 requests per second, burst 10, per IP). **Available since:** Open API v2.
## Request
Send a JSON body (`Content-Type: application/json`). No API key is needed: `X-API-KEY` is reserved and ignored.
Example: `curl -X POST "https://api.rarebl.com/open/tx/estimate" -H "Content-Type: application/json" -d '{"chain":"dash","from":"[\"XnL1FvTKqe6aWfB8NrvgbUMuWCEA3dNxfF\"]","to":"[{\"address\":\"XiM9Afap6UEb5LDkcWrg2YyA28hifkZZKM\",\"amount\":\"0.01\"}]","priority":"standard"}'`
## Parameters
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | Yes | The chain to build for. One of: btc, ltc, bch, dash, eth, tron. |
| `from` | array \| string | No | UTXO chains: an array of addresses we may spend from (watched on BTC/LTC/BCH, any on DASH). ETH and TRON: the sender address (one address). Use `from` or `inputs` on UTXO chains. |
| `inputs` | array | No | UTXO chains: exact inputs `[{"txid","vout"}]`, verified unspent with `gettxout`. Any UTXO chain. At most 10 inputs on the hosted endpoints. |
| `to` | array \| string | Yes | UTXO chains: recipients `[{"address","amount"}]` (one entry only). ETH and TRON: the recipient address (one recipient). `amount: "max"` sends everything less the fee. |
| `amount` | string | No | ETH and TRON: the amount in whole units (or `"max"`), as the SDKs send it. UTXO chains put the amount inside each `to` entry. |
| `change` | string | No | UTXO change address. Default: the first `from` address. |
| `feeRate` | string | No | Fee rate in sat/vB (UTXO). Use `feeRate` or `priority`. |
| `priority` | string | No | Fee choice instead of `feeRate`. One of: slow, standard, fast. |
| `rbf` | boolean | No | Signal replace-by-fee (BTC and LTC). Default true. One of: true, false. |
| `opReturn` | string | No | Optional OP_RETURN payload as hex. At most 80 bytes; UTXO chains. |
| `token` | string | No | ERC-20 (ETH) or TRC-20 (TRON) contract address for a token transfer. |
| `gasLimit` | string | No | ETH: gas limit. |
| `maxFeePerGas` | string | No | ETH: max fee per gas, Gwei. |
| `maxPriorityFeePerGas` | string | No | ETH: max priority fee per gas, Gwei. |
| `feeLimit` | integer | No | TRON: fee limit in sun. |
## Responses
### API200 (HTTP 200): OK
A Dash estimate.
```json
{
"status": 1,
"code": "API200",
"message": "success",
"data": {
"fee": "0.00000226",
"feeSats": "226",
"vsize": 226,
"feeRate": "1"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
| Field | Type | Description |
| --- | --- | --- |
| `data.fee` | string | The fee in whole native units. |
| `data.feeSats` | string \| null | The fee in the integer base unit. |
| `data.vsize / feeRate` | number / string | UTXO: virtual size and the fee rate in sat/vB. |
| `data.gasLimit` | string | ETH only. |
| `data.energy / bandwidth` | number | TRON only. |
### API200 (HTTP 200): OK (TRON)
A TRON TRC-20 transfer estimate (energy and bandwidth).
```json
{
"status": 1,
"code": "API200",
"message": "success",
"data": {
"fee": "13.9",
"feeSats": "13900000",
"energy": 65000,
"bandwidth": 345
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API400 (HTTP 400): Bad Request
A parameter is missing or malformed. `data.param` names it (here `chain`).
```json
{
"status": 0,
"code": "API400",
"message": "Unknown or missing chain.",
"data": {
"param": "chain"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API409 (HTTP 409): Conflict
BTC, LTC or BCH: a `from` address is not watched and active yet. Start a watch with [address/watch](https://docs.rarebl.com/api/address/watch).
```json
{
"status": 0,
"code": "API409",
"message": "This address is not watched yet.",
"data": {
"reason": "not_watched"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API422 (HTTP 422): Unprocessable Entity
The selected inputs cannot pay the outputs plus the fee.
```json
{
"status": 0,
"code": "API422",
"message": "The inputs do not cover the amount and the fee.",
"data": {
"reason": "insufficient_funds"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API422 (HTTP 422): Unprocessable Entity
An output (often the change) is too small to be relayed.
```json
{
"status": 0,
"code": "API422",
"message": "An output is below the dust limit.",
"data": {
"reason": "dust_output"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API429 (HTTP 429): Too Many Requests
Rate limited (compute class: 2 requests per second, burst 10, per IP). A `Retry-After` header says how long to wait, in seconds.
```json
{
"status": 0,
"code": "API429",
"message": "Too many requests. Please retry shortly.",
"data": null,
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API502 (HTTP 502): Bad Gateway
The node is unavailable, still syncing or timed out. Retry later with a short back-off.
```json
{
"status": 0,
"code": "API502",
"message": "The node is unavailable or timed out. Please try again.",
"data": null,
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
## Notes
- Same body as [Build a transaction](https://docs.rarebl.com/api/tx/build), without signing. Use it to show a fee before the user commits.
- For network-wide fee levels, use [Recommended fees](https://docs.rarebl.com/api/fees/recommended).