Cryptocurrencies & Security on the Blockchain
- Prof. Tom Austin
San José State University
Oracles and Tokens Prof. Tom Austin San Jos State University - - PowerPoint PPT Presentation
Cryptocurrencies & Security on the Blockchain Oracles and Tokens Prof. Tom Austin San Jos State University Oracles Motivation EVM execution must be deterministic. Cannot rely on outside information But sometimes that
San José State University
– Cannot rely on outside information
– Supply chain tracking – Exchange rate data – Weather data
– Data stored in contract – E.g. academic certificates, club membership, etc.
– Used for frequently changing data
– Off-chain daemons watch for updates on-chain
– Data too large to store on blockchain – Co-ordinates with off-chain system on demand
contract MyToken { mapping (address => uint256) public balanceOf; constructor(uint256 initialSupply) public { balanceOf[msg.sender] = initialSupply; } function transfer(address _to, uint256 _value) public returns (bool) { require(balanceOf[msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; return true; } }
– Proposed by Fabian Vogelsteller – Assigned issue #20 by Github automatically
– Smart contracts – Exchanges
approve, allowance, and transferFrom illustrated (courtesy of Mastering Ethereum)