Skip to content

Commit

Permalink
Merge pull request #283 from MoralisWeb3/streams-pricing-update
Browse files Browse the repository at this point in the history
new streams pricing changes
  • Loading branch information
Nazeim authored Oct 18, 2023
2 parents 51ff258 + ac1850e commit 83335aa
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 144 deletions.
8 changes: 8 additions & 0 deletions docs/01-web3-data-api/evm/reference/08-compute-units-cu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,11 @@ Your output for the API request will be as follows:
```
where `price` refers to how much CU does the API request cost in terms of billing and `rateLimitCost` refers to how much CU does the API request cost in terms of rate limits.
## Streams and Compute Units
For [Moralis Streams](/streams-api/evm#what-is-the-streams-api), it is important to note that each [record](/streams-api/evm/records-and-pricing#what-is-the-record) has a fixed cost of 15 Compute Units.
:::tip
You can read the article [Records and Pricing](/streams-api/evm/records-and-pricing) to understand how records play a crucial role in the Streams API, allowing you to make the right decisions regarding usage and pricing.
:::
107 changes: 19 additions & 88 deletions docs/02-streams-api/evm/getting-started/faq.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
title: "🙋 FAQ"
sidebar_position: 20
description: "This FAQ page provides answers to common questions about our product. Learn more about features, compatibility, installation, and more."
description: "This FAQ page helps you to get answers about our Web3 API, Streams, and product features, enhancing your API integration experience."
---

This article is a Frequently Asked Questions (FAQ) page providing answers to common questions about the Moralis Streams API and its pricing, covering topics such as production status, pricing, configurations, and usage details.

## Is Streams API in production?

Yes, our Streams API is in production now.

## How are Streams priced?

Please see [Records and pricing](/streams-api/evm/records-and-pricing)
Streams consume [Compute Units](/web3-data-api/evm/reference/compute-units-cu) similar to our other APIs. You can read the article [Records and Pricing](/streams-api/evm/records-and-pricing) to understand how records play a crucial role in the Streams API, allowing you to make the right decisions regarding usage and pricing.

## Can I disable the unconfirmed webhook requests?

Expand All @@ -36,9 +38,11 @@ Enterprise plans can have fully customized limits with no hard caps - the Stream

## How many separate streams can I create?

You can create up to 20 streams on a Free account and up to 200 streams with an upgraded account, and multiple addresses can be added to a single stream config, "listen to all addresses" feature can also be used with a single stream config for Business and Enterprise plans.
On Moralis' paid plans, you can have up to 200 active streams, and each stream can support listening to millions of addresses in a single configuration.

The free plan is limited to 1 active stream.

You can contact our support team at [[email protected]](mailto:[email protected]) if you need a higher limit, we can support an unlimited number of streams.
If you require more streams than your current plan allows, reach out to our support team at [[email protected]](mailto:[email protected]), as we can support an unlimited number of streams to suit your needs.

## Are there any events lost when a stream or the filters for a stream get updated?

Expand Down Expand Up @@ -89,100 +93,27 @@ If you still require support, please contact us in your Slack channel, or drop a

## What is a record?

**Summary**
Records are the basic unit for calculating your Streams usage, with charges applied only to webhooks with the field `confirmed:true`. Webhooks set to `withconfirmed:false` and decoded logs are both free of charge.

- A record is either a transaction (`txs`), log (`logs`) or internal transactions (`txsInternal`) in the webhook response.
- Records is the base for usage of Streams
- Records are only counted towards your usage for webhooks with `confirmed:true` so webhooks `withconfirmed:false` are **free**
- Decoded logs are also free they do NOT count as `Records`.

## What is a record?
In Moralis Streams, a **record** refers to either a transaction (`txs` in response), a log (`logs` in response), or an internal transaction (`txsInternal` in response). The total number of records within a webhook is calculated as the sum of `txs + logs + txsInternal`.

A record is either a transaction (`txsin` response), log (`logs`in response) or internal transaction (`txsInternalin` response). The number of records in a webhook is the sum of `txs + logs + txsInternal`.
For every record within a webhook, your account will be charged 15 [Compute Units](/web3-data-api/evm/reference/compute-units-cu). To identify the total number of records in a webhook, check the `x-records-charged` field within the webhook's header.

In the header of a webhook, you can find the total number of records in that webhook in the header `x-records-charged`.
:::tip
Please note that only confirmed blocks will require charges, with unconfirmed blocks having `'x-records-charged': '0'`.
:::

In this example, the `x-records-charged` is `20` so the webhook contains 20 records.
In the following code example, `x-records-charged` is set to `20`, indicating the presence of 20 records:

```json
headers: {
'x-region': 'us-west-2',
'x-queue-size': '0',
'x-records-charged': ‘20’
'x-records-charged': '20',
'x-signature': '0xdf49163b5273b50a8da48e82b7254b45d81aeee9a02f1909a45d7aaea240e9c2',
}
```

Only confirmed blocks will be charged, unconfirmed blocks will have `'x-records-charged': ‘0’`

**Records determine usage**

Records handle the usage of Streams API. In your plan, you have an included amount of records for free. You can find your included limits under your [billing page](https://admin.moralis.io/account/billing).

For each transaction, you get two webhooks (read more [here](/streams-api/evm)), records are only counted towards your usage for webhooks with Confirmed status True.

**Check your total consumed record for a period**

By using /status ([see API reference](/streams-api/evm/reference/get-stats)) you will get a summary of `totalLogsProcessed`, `totalTxsProcessed`, and `totalTxsInternalProcessed` for your current billing period.

**Example:**

```json
{
"totalWebhooksDelivered": 1288,
"totalWebhooksFailed": 17,
"totalLogsProcessed": 4257,
"totalTxsProcessed": 0,
"totalTxsInternalProcessed": 0
}
```

Where your total consumed records for the current billing period would be `"totalLogsProcessed": 4257`+`"totalTxsProcessed": 0`+`"totalTxsInternalProcessed": 0`. In this case total consumption is 4257.

**Check one streams total consumed records for a period**

By using /stats/{streamId} (see [API reference](/streams-api/evm/reference/get-stats-by-streamid)) you will get a summary of `totalLogsProcessed`,`totalTxsProcessed`, and `totalTxsInternalProcessed` for that specific stream.

**Example:**

```json
{
"totalWebhooksDelivered": 0,
"totalWebhooksFailed": 0,
"totalLogsProcessed": 0,
"totalTxsProcessed": 0,
"totalTxsInternalProcessed": 0,
"createdAt": "2022-10-25T08:21:00.877Z",
"updatedAt": "2022-10-25T08:21:00.877Z"
}
```

Where your total consumed records for the current billing period would be `totalLogsProcessed`+`totalTxsProcessed`+`totalTxsInternalProcessed`.

**Records per transaction type**

It depends on the selected address activity how many records will be charged

- Contract Interactions (logs)
- Native Transactions (txs)
- Internal Transactions (txsInternal)

| Description | Number of records\* |
| :------------------------------------------------------------------------------------------ | :------------------ |
| Stream with txs, logs and a erc20 transfer event is emitted | 2 |
| Stream with txs, logs and 10 NFT Tokens (ERC721) were transferred in one transaction | 11 |
| Stream with txs, logs and 30 NFT Tokens (ERC1155 Batch) were transferred in one transaction | 2 |
| Stream with logs and a ERC721 NFT is minted with 100 Tokens | 100 |
| Stream with txs and a native transfer takes place | 1 |

\*The number of records for logs depends on the contract emitting the events, more complex contracts could emit more records

**Decoded logs**

Moralis will decode and enrich standardized contracts (ERC20/ERC721/ERC1155), for each log that matches one of those contracts, a decoded log will be generated, currently, the decoded logs are:

- erc20Transfers
- erc20Approvals
- nftTransfers

Decoded logs are **free** they do NOT count as `Records`.
:::tip
You can read the article [Records and Pricing](/streams-api/evm/records-and-pricing) to understand how records play a crucial role in the Streams API, allowing you to make the right decisions regarding usage and pricing.
:::
114 changes: 58 additions & 56 deletions docs/02-streams-api/evm/records-and-pricing.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
---
title: "Records and pricing"
title: "Records and Pricing"
slug: "records-and-pricing"
sidebar_position: 4
description: "Discover how Records are used in Streams API to determine usage and pricing. Records are either a transaction (txs), log (logs) or internal transactions (txsInternal) in the webhook response."
description: "How Records are used in Streams API to determine usage and pricing. Records are either a transaction, log, or internal transactions in the webhook response."
---

Discover how Records are used in Streams API to determine usage and pricing. Records are either a transaction (txs), log (logs) or internal transactions (txsInternal) in the webhook response.
This article explains the Record, its pricing, how to check the total records for a specific period, how each record cost depends on the transaction type, and finally the current decoded logs.

## Summary
## What is the Record?

- A record is either a transaction (`txs`), log (`logs`) or internal transactions (`txsInternal`) in the webhook response.
- Records is the base for usage of Streams
- Records are only counted towards your usage for webhooks with `confirmed:true` so webhooks with `confirmed:false` are **free**
- Decoded logs are also **free** they do NOT count as `Records`.
Records are the basic unit for calculating your Streams usage, with charges applied only to webhooks with the field `confirmed:true`. Webhooks set to `withconfirmed:false` and decoded logs are both free of charge.

## What is the record?
In Moralis Streams, a **record** refers to either a transaction (`txs` in response), a log (`logs` in response), or an internal transaction (`txsInternal` in response). The total number of records within a webhook is calculated as the sum of `txs + logs + txsInternal`.

A record is either a transaction (`txs` in response), log (`logs` in response) or internal transaction (`txsInternal` in response). The number of records in a webhook is the sum of `txs + logs + txsInternal`.
For every record within a webhook, your account will be charged 15 [Compute Units](/web3-data-api/evm/reference/compute-units-cu). To identify the total number of records in a webhook, check the `x-records-charged` field within the webhook's header.

In the header of a webhook, you can find the total number of records in that webhook in the header `x-records-charged`.
:::tip
Please note that only confirmed blocks will require charges, with unconfirmed blocks having `'x-records-charged': '0'`.
:::

In this example, the `x-records-charged` is `20` so the webhook contains 20 records.
In the following code example, `x-records-charged` is set to `20`, indicating the presence of 20 records:

```json
headers: {
'x-region': 'us-west-2',
'x-queue-size': '0',
'x-records-charged': ‘20’
'x-records-charged': '20',
'x-signature': '0xdf49163b5273b50a8da48e82b7254b45d81aeee9a02f1909a45d7aaea240e9c2',
}
}
```

Only confirmed blocks will be charged, unconfirmed blocks will have `'x-records-charged': ‘0’ `
## Records Pricing

For each record you consume, your account will be charged 15 compute units.

:::note
Note that each Moralis plan has a certain number of included compute units.
:::

### Records determine usage
For each transaction, you will get two webhooks:

Records handle the usage of Streams API. In your plan, you have an included amount of records for free. You can find your included limits under your [billing page](https://admin.moralis.io/account/billing).
* One once the transaction is added to a block
* One once the transaction is confirmed

For each transaction, you get two webhooks (read more [here](/streams-api/evm/webhooks-transactions)), records are only counted towards your usage for webhooks with Confirmed status True.
Records are only counted towards your usage for webhooks with the field `confirmed:true`. Webhooks set to `withconfirmed:false` and decoded logs are both free of charge.

### Check your total consumed record for a period
:::tip
You can read the article [Webhooks Transactions](/streams-api/evm/webhooks-transactions) to understand more.
:::

By using /status (see API [reference](/streams-api/evm/reference/get-stats)) you will get a summary of `totalLogsProcessed`, `totalTxsProcessed`, and `totalTxsInternalProcessed` for your current billing period.
### Checking Total Records Consumed for a Specific Period

**Example:**
You can monitor your total record consumption for a specific billing period by utilizing the `/status` endpoint. You can use it to receive a summary of `totalLogsProcessed`, `totalTxsProcessed`, and `totalTxsInternalProcessed`.

The following code example is a response of using the [getStats](/streams-api/evm/reference/get-stats) endpoint:

```json
{
Expand All @@ -55,52 +65,44 @@ By using /status (see API [reference](/streams-api/evm/reference/get-stats)) you
}
```

Where your total consumed records for the current billing period would be `"totalLogsProcessed": 4257` + `"totalTxsProcessed": 0` + `"totalTxsInternalProcessed": 0`. In this case total consumption is 4257.

### Check one streams total consumed records for a period

By using /stats/{streamId} (see API [reference](/streams-api/evm/reference/get-stats-by-streamid)) you will get a summary of `totalLogsProcessed`, `totalTxsProcessed`, and `totalTxsInternalProcessed` for that specific stream.
To calculate the total records consumed for the current billing period, add together the values of `totalLogsProcessed`, `totalTxsProcessed`, and `totalTxsInternalProcessed`.

**Example:**
:::note
Make sure to refer to the [getStats API reference](/streams-api/evm/reference/get-stats) for additional details on using the `/status` endpoint.
:::

```json
{
"totalWebhooksDelivered": 0,
"totalWebhooksFailed": 0,
"totalLogsProcessed": 0,
"totalTxsProcessed": 0,
"totalTxsInternalProcessed": 0,
"createdAt": "2022-10-25T08:21:00.877Z",
"updatedAt": "2022-10-25T08:21:00.877Z"
}
```
### Records Per Transaction Type

Where your total consumed records for the current billing period would be `totalLogsProcessed` + `totalTxsProcessed` + `totalTxsInternalProcessed`.
The number of records charged depends on the type of transaction activity associated with the selected address. Records are categorized into three transaction types:

### Records per transaction type
- **Contract Interactions (logs)**
- **Native Transactions (txs)**
- **Internal Transactions (txsInternal)**

It depends on the selected address activity how many records will be charged
:::tip
The number of records for logs can vary based on the complexity of the contract emitting the events, with more complex contracts potentially generating additional records.
:::

- Contract Interactions (logs)
- Native Transactions (txs)
- Internal Transactions (txsInternal)
Below is a breakdown of the number of records typically charged for various transaction scenarios:

| Description | Number of records\* |
| Description | Number of Records\* |
| :------------------------------------------------------------------------------------------ | :------------------ |
| Stream with txs, logs and a erc20 transfer event is emitted | 2 |
| Stream with txs, logs and 10 NFT Tokens (ERC721) were transferred in one transaction | 11 |
| Stream with txs, logs and 30 NFT Tokens (ERC1155 Batch) were transferred in one transaction | 2 |
| Stream with logs and a ERC721 NFT is minted with 100 Tokens | 100 |
| Stream with txs and a native transfer takes place | 1 |
| Stream with txs, logs, and an ERC20 transfer event | 2 |
| Stream with txs, logs, and the transfer of 10 NFT Tokens (ERC721) in one transaction | 11 |
| Stream with txs, logs, and the transfer of 30 NFT Tokens (ERC1155 Batch) in one transaction | 2 |
| Stream with logs and the minting of an ERC721 NFT with 100 Tokens | 100 |
| Stream with txs and a native transfer | 1 |

\*The number of records for logs depends on the contract emitting the events, more complex contracts could emit more records
### Decoded Logs

### Decoded logs
Moralis decodes and enhances standardized contracts such as ERC20, ERC721, and ERC1155. Whenever a log matches one of these contracts, Moralis generates a decoded log.

Moralis will decode and enrich standardized contracts (ERC20/ERC721/ERC1155), for each log that matches one of those contracts, a decoded log will be generated, currently, the decoded logs are:
The current Decoded Logs are:

- erc20Transfers
- erc20Approvals
- nftTransfers
* erc20Transfers
* erc20Approvals
* nftTransfers

::note
Decoded logs are **free** they do NOT count as `Records`.
:::

1 comment on commit 83335aa

@vercel
Copy link

@vercel vercel bot commented on 83335aa Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.