Frequently Asked Questions
What is nonce? What is it used for?
The nonce is the number of transactions sent from a given address. It is provided with every transaction data being sent to STRATO for execution.
It is used for three purposes: - Transactions must be in order (transaction with higher nonce cannot be executed before transaction with lower nonce.) - Transactions must not be skipped (each subsequent transaction posted from one address must have a nonce number incremented exactly by 1 compared to the nonce of a previous transaction.) - Transactions must not be double-posted (transactions with the nonce that was already used are rejected)
I am getting a nonce mismatch error, how do I resolve it?
Each subsequent transaction posted from one address must have a nonce number incremented exactly by 1 compared to the nonce of a previous transaction. By default,
STRATO Nonce handling
By default, STRATO handles nonce automatically by auto-incrementing a number for each transaction. This behavior can be overridden by manually providing the
nonce value (number) in
txParams object in the body of
POST /transactions API call.
app test files might overwrite
cacheNonce option in BlockApps Rest
BlockApps Rest will will call STRATO's
POST /transactions/parallel API endpoint when
cacheNonce=true is in the provided
options object. However,
cacheNonce might be overwritten from the default configuration of the client app and transactions will not be posted in parallel. this will typically happen if you receive a VMError "rejected transaction because of a more lucrative one in the mempool". To resolve this, add
cacheNonce=true inside the
options object explictly in the
options of the failing transaction. Alternatively, ensure that the
cacheNonce option is never overwritten by any other application code.
When posting multiple transactions at the same time by making separate API calls in parallel, transactions are posted in the order in which the requests are processed by STRATO (larger transactions take longer to process) but not the order they are received by STRATO API when the nonces are assigned. This causes a race condition which may lead to transactions being rejected due to nonce mismatch.
The solution is to either add a transaction queue on the Application side and batch multiple transactions into one STRATO API request
(list all transactions in a single request to
POST /transactions) or execute API requests sequentially one after another after checking the results for each of the transactions.
Starting with v.5.4 and above STRATO has the API endpoint
POST /transactions/parallel which caches the nonce numbers on main chain for each address which helps
workaround the race condition caused by making parallel calls to
POST /transactions. This endpoint can be used to make parallel API calls to create transactions on main chain, avoiding the potential nonce mismatch issue.
As of STRATO v7.4, the
POST /transactions/parallel endpoint only handles parallel transactions posted to the main chain. For transactions posted to private chains, its behavior is similar to behavior of
POST /transaction endpoint.
This endpoint does not prevent the transaction double-posting if called twice with the same transaction.
How to obtain an access token to access STRATO API?
STRATO relies on the OAuth 2.0 protocol for authorization.
What is the query syntax for Cirrus API?
Cirrus API uses the PostgREST query syntax for complex data queries in STRATO.
Refer to Reporting & Analytics section for more detailed information.
How to implement OAuth 2.0 authentication in the application's code?
Please refer to the Obtain Access Token in NodeJS section for the design pattern and the example of how the OAuth 2.0 grant flows can be implemented in your application's code (using blockapps-rest and with token caching.)
What is SolidVM and how is it compared to EVM?
SolidVM is BlockApps' in-house Solidity interpreter, an alternative to EVM (Ethereum Virtual Machine). STRATO supports both of them. For more information about SolidVM and its differences with EVM, refer to Pluggable VM