For example, if a database table’s Phone Number column can only contain numerals, then consistency dictates that any transaction attempting to enter an alphabetical letter may not commit. In other words, the transaction cannot break the database’s constraints. Both either happen together or do not happen-it's all or nothing.Ĭonsistency: The transaction must be fully compliant with the state of the database as it was prior to the transaction. A sale in a retail store database illustrates a scenario which explains atomicity, e.g., the sale consists of an inventory reduction and a record of incoming cash. The ACID acronym defines the properties of a database transaction, as follows:Ītomicity: A transaction must be fully complete, saved (committed) or completely undone (rolled back). ' - the transaction or receipt hasn't been processed yet.In traditional relational database design, transactions are completed by COMMIT or ROLLBACK SQL statements, which indicate a transaction’s beginning or end. However, one caveat is that a function call transaction, unlike other transactions, can spawn an indefinite amount of receipts, and while each receipt is atomic, the success or failure of one receipt doesn't necessarily affect the status of other receipts spawned by the same transaction. Receipt execution is atomic, meaning that either all the actions are successfully executed or none are. Since transactions are converted to receipts before they are applied, it suffices to talk about receipt atomicity. You can find more about the technical details of Receipts in the NEAR nomicon. returning a promise (related to cross-contract calls).There are several ways of creating Receipts: And a Transaction is an externally issued request to create the Receipt (there is a 1-to-1 relationship). Therefore, when we talk about "processing a transaction" on the NEAR platform, this eventually means "applying receipts" at some point.Ī good mental model is to think of a Receipt as a paid message to be executed at the destination ( receiver). Receipt Ī Receipt is the only actionable object in the system. You can find more about the technical details of Actions in the NEAR nomicon. Stake to express interest in becoming a validator at the next available opportunity.DeleteKey to delete an existing key from an account.AddKey to add a key to an account (either FullAccess or FunctionCall access).DeleteAccount to delete an account (and transfer the balance to a beneficiary account).CreateAccount to make a new account (for a person, contract, refrigerator, etc.).Transfer to move tokens from between accounts.FunctionCall to invoke a method on a contract (and optionally attach a budget for compute and storage).There are currently 8 supported Action types: uniqueness ( nonce must be unique for a given signer AccessKey)Īn Action is a composable unit of operation that, together with zero or more other Actions, defines a sensible Transaction.recency ( block_hash from recent block within acceptable limits - 1 epoch).destination or intention (sent or applied to receiver).origin (cryptographically signed by signer).Transaction Ī Transaction is a collection of Actions that describe what should be done at the destination (the receiver account).Įach Transaction is augmented with critical information about its: On this page we give an overview of the important aspects of transactions on NEAR. You can use NEAR Blockchain Explorer to inspect and see all actions and receipts related to a transaction.Īn in depth documentation about transactions can be found in NEAR Protocol Specifications (nomicon.io). The Blockchain may be seen as a series of Transactions, but it's also a series of Receipts. An action may result in one or more receipts. All cross-contract communication is done through receipts. There is also a concept of Receipt, which is either "request to apply an Action" or "result of the Action". Since transactions are the smallest units of work, they are also atomic, but again, asynchronous actions do not necessarily cascade their success or failure the whole transaction. A transaction with more than one action is referred to as a "batch transaction". A transaction is composed of one or more Actions. "Work" in this case means compute (executing a function) or storage (reading/writing data). This article covers possible scenarios for this.Ī transaction is the smallest unit of work that can be assigned to the network. For example, if a transaction contains a cross-contract call, it may be marked as successful, but the other contract execution might fail. Transactions in NEAR may contain actions that do asynchronous work, in such cases keep in mind the possible outcomes of success or failure of the transaction. While it opens a wide range of possibilities for smart contracts implementations, it may also add to confusion among beginners and newcomers from other blockchain platforms.
0 Comments
Leave a Reply. |