Search code examples
nearprotocol

What is local receipt in NEAR Protocol?


According to nomicon, local receipts are only created during transaction-to-receipt conversion; is this accurate?

Is the only reason for its existence is optimization of [at least] one block delay when transaction sender account id is equal to the receiver account id?


Solution

  • There are 2 reasons:

    1. Optimize the execution for transactions on the same account. This saves us a few reads and serialization and executes faster.
    2. Original goal: Allow to execute staking operation on a congested shard. Because the staking operation is performed on your own account, such transaction will be executed in front of the delayed queue of the receipts. This assumption is likely to change if NEAR Protocol switches to different receipt priority, e.g. based on gas price or some premium.

    EDIT: To answer the first question. The local receipt can only be created from a conversion of a transaction to a receipt.