Overview of the Runtime crate
Runtime crate encapsulates the logic for handling transactions and receipts. It processes account-level actions (like account creation) in-place and delegates smart contract calls to near-vm-runner.website·Indexed 33 days ago
https://nomicon.io/Technical documentation and architecture guides for the NEAR Protocol and nearcore. Covers core components including the Blockchain Layer, Network Specification, Runtime Specification, gas profiles, transaction routing, cross-shard transactions, and the Merkle-Patricia Trie storage system.
Runtime crate encapsulates the logic for handling transactions and receipts. It processes account-level actions (like account creation) in-place and delegates smart contract calls to near-vm-runner.The nearcore development guide is intended for developers working on the nearcore codebase itself. It is organized into four primary sections:
For those starting out, it is recommended to begin with the Architecture Overview and the guide on how to run a node.
near-vm-runner.neard versions or features without the noise of real-world traffic. The tooling is located in benchmarks/synth-bm.NEAR utilizes two types of producers to balance decentralization and security during its 'Simple Nightshade' phase:
Selection is based on stake: larger stakes are preferred, and the frequency of selection is proportional to the participant's stake. All selected producers are intended to produce at least one chunk/block per epoch.
NEAR transactions consist of a list of actions performed on a receiver_id. These actions are converted to receipts during processing. For several actions—specifically DeployContract, Stake, AddKey, DeleteKey, and DeleteAccount—the predecessor_id and receiver_id must be equal.
Special Case: If the first action in a list is CreateAccount, the predecessor_id becomes the receiver_id for all subsequent actions until DeleteAccount, allowing a creator account to act on the newly created account.
pub enum Action {
CreateAccount(CreateAccountAction),
DeployContract(DeployContractAction),
FunctionCall(FunctionCallAction),
Transfer(TransferAction),
Stake(StakeAction),
AddKey(AddKeyAction),
DeleteKey(DeleteKeyAction),
DeleteAccount(DeleteAccountAction),
Delegate(SignedDelegateAction),
DeployGlobalContract(DeployGlobalContractAction),
UseGlobalContract(UseGlobalContractAction),
DeterministicStateInit(DeterministicStateInitAction),
}In NEAR, transactions consist of a list of actions performed on the receiver_id side. These actions are converted to receipts during processing. For certain actions—specifically DeployContract, Stake, AddKey, DeleteKey, and DeleteAccount—the predecessor_id and receiver_id must be equal.
Special Case: If the first action in a list is CreateAccount, the predecessor_id becomes the receiver_id for all subsequent actions until DeleteAccount is encountered, allowing a creator account to perform initial setup on the new account.
pub enum Action {
CreateAccount(CreateAccountAction),
DeployContract(DeployContractAction),
FunctionCall(FunctionCallAction),
Transfer(TransferAction),
Stake(StakeAction),
AddKey(AddKeyAction),
DeleteKey(DeleteKeyAction),
DeleteAccount(DeleteAccountAction),
Delegate(SignedDelegateAction),
DeployGlobalContract(DeployGlobalContractAction),
UseGlobalContract(UseGlobalContractAction),
DeterministicStateInit(DeterministicStateInitAction),
}DelegateAction off-chain. A third party, known as a relayer, submits this signed action as part of a standard transaction, paying the required gas fees on behalf of the user. The protocol verifies the user's signature and nonce before executing the inner actions, ensuring that the predecessor_id remains the original user.