Moralis Nitro Beta Testing

Moralis Nitro Upgrade

We have quite a big update to Moralis.
This update will improve the performance and reliability of Moralis infrastructure.
It also has a few new features.

How to test

Go to https://beta.moralis.io
Login with your normal moralis account
Create new beta server with branch that has public core services in the name

Wait for the server to start…

Read the To Test sections in this post and follow them.
Report your feedback as comments in this thread.

What to test

Performance improvements

Most of the changes are behind the scenes improvements that have to do with how smart contract events and user transactions are synced.

To test: sync smart contract events and user addresses and ensure all data syncs

Token Balances and NFT Owners removed

We noticed that most developers are using Moralis.Web3API to get token balances and nft owners. Therefore these tables will be removed from the database as it’s a heavy job for the server to track token balances and nft owners. Instead API should be used to fetch this data.

You could for example fetch user nft balances and token balances each time they login or do a Job that does it regularly and puts the data into the User row in the database.

Better default settings (not yet implemented…)

Before Moralis Nitro we synced all user transactions into the database when a user signs in.

This created some issues with many new users logged in at the same time and user historic sync was enabled. If 1000 users sign up with 100 tx each - server needs to handle 100k transactions all at once. While we always had a setting in the dashboard to turn this off we’ve noticed that some dapps missed to set that setting resulting in downtime when many users signed up all at once and in most cases the developer didn’t even need full user history.

Now with Moralis Nitro only 50 user tx for each category (native, token, nft) and chain are synced.

And this can be adjusted in the admin settings for the particular server.

To test: Sign in a user - only 50tx for each category for each chain should be synced. Try to adjust this in server settings to some other number.

Smart contract event filters

beforeConsume function is now deprecated and removed.
Instead when you setup a smart contract event sync you can specify logical conditions that will give you only events that comply with the conditions.

For example the filter below will only sync event instances where the variable price is equal to 80000000000000000:

{"eq": ["price", "80000000000000000"]}

Below are some more filter examples. You can set conditions for any variable in the event.

If sender = 0x0 AND receiver = 0x0

{ 
  "and": [
    { "eq": ["sender", "0x0"] },
    { "eq": ["receiver", "0x0"] }
  ] 
}

If sender = 0x0 OR receiver = 0x0

{ 
  "or": [
    { "eq": ["sender", "0x0"] },
    { "eq": ["receiver", "0x0"] }
  ] 
}

If (sender = 0x0 AND amount = 1000 ) OR (receiver = 0x0 AND amount = 100 )

{ 
  "or": [
    { 
      "and": [
       { "eq": ["sender", "0x0"] },
       { "eq": ["amount", "1000"]}
      ]
    },
    {
      "and": [
       { "eq": ["receiver", "0x0"] },
       { "eq": ["amount", "1000"]}
      ]
    }
  ] 
}

If an event has wei denominated values you can use <name>_decimals fields to run comparisons (like gt/lt):

{ 
  "and": [
    { "eq": ["sender", "0x0"] },
    { "gt": ["amount_decimals", "1000"]}
  ]

}

To test: try to sync a smart contract event with filters

Wei numbers are stored as numbers (not only strings)

When syncing transactions and smart contract events - all onchain numbers are represented as wei 256 numbers which don’t fit in traditional databases which meant that before Moralis Nitro update all such number were stored as strings in Moralis DB. This made it impossible to sort, sum, aggregate or run other queries such as LT or GT.

With Moralis Nitro - all events and transactions have a decimal column for each wei number where the actual decimal number is stored representing the wei value.

So for example if 10 ETH was transfered in a transaction Moralis would previously only show the wei value as a string. While now we also include “10” as a sortable and queryable number.

Example below:

To test: either sync smart contract events that have wei values or user transactions and see that decimals are represented correctly.

Note: the decimal value can only hold 128 bits - meaning that everything above 34 characters long will lose precision. For exact 256 bit precision - use the string values.

For example:
256 original wei string: “12345678901234567890123456789012334567890”
128 decimal number: 12345678901234567890123456789000000000000

As you can see the decimal value will lose precision - but for most use-cases that include sorting/aggregation/LT and GT queries still would do the job


The beta servers may get removed at any time during the beta.

Don’t get surprised if your server disappears.

We need to remove them in case we have a breaking change or see some fatal errors.

2 Likes

First bug report: Trying to track an address

  1. In the sync/watch-address configuration screen, if you pick all chains, it only syncs fantom. Looks like it can only watch one chain for one address at a time.

  2. If you then “edit” it and uncheck fantom, check polygon, hit save, it doesn’t save. Still stuck on fantom. The only way to get back to watching polygon is to delete and watch a new address/chain.

1 Like

Hi there,

currently testing the nitro update - thats the things I got so far:

EVENT SYNC

CLOUD FUNCTIONS

LOGS

  • If you have a lot of events going on it is kind of hard to read them since they autoscroll - would be nice to stop them somehow.
1 Like

Creating new servers which have Mumbai & Ropsten fails (NY site). Server stuck in creating , cannot delete. Only hard reset works but does not resolve the issue.

1 Like

we have temporarily disabled creation of Moralis Nitro servers

need to patch a bug

should be back tomorrow :raised_hands:

5 Likes

GREAT!!! Thought I was going crazy for a second - followed the instruction to the letter but 80 attempts latter - back at square one! Appreciate the update - a simply cut and paste of the ABI one Etherscan would help,