DeFi operates through a combination of smart contracts and decentralized applications (dApps). Smart contracts are self-executing contracts with the terms of the agreement directly written into code. These contracts run on blockchain platforms like Ethereum, ensuring that transactions are automated and free from third-party interference. DeFi applications enable users to lend, borrow, trade, and invest assets without the need for traditional intermediaries.