TAO Virtual Machine (TVM)
The TAO Virtual Machine (TVM) is the computation engine for Bittensor that manages the state of the blockchain and enables smart contract functionality.
The TVM executes as a stack machine with a depth of 1024 items. Each item is a 256-bit word, which was chosen for the ease of use with 256-bit cryptography (such as Keccak-256 hashes or secp256k1 signatures).
During execution, the TVM maintains a transient memory (as a word-addressed byte array), which does not persist between transactions.
Contracts, however, do contain a Merkle Patricia storage trie (as a word-addressable word array), associated with the account in question and part of the global state.
Compiled smart contract bytecode executes as a number of TVM opcodes, which perform standard stack operations like XOR
, AND
, ADD
, SUB
, etc. The TVM also implements a number of blockchain-specific stack operations, such as ADDRESS
, BALANCE
, BLOCKHASH
, etc.
Last updated