A smart contract is a type of blockchain record that contains externally written code, and controls blockchain-based digital assets. When triggered by a specified blockchain write event, a smart contract immutably executes its code and may result in another blockchain event.