Ethereum
January 27, 2022Ethereum is a blockchain with a currency and smart contracts. Like bitcoin, each user is identified by a public key. There are transactions. But transactions are not only payments from one account to another, but also a function call. A function in a smart contract will be called and that changes the state of the blockchain. A smart contract also has an address. It is written using Solidity or other languages that is compiled to a runtime format. You can instantiate as many smart contracts using the same code. That is like a class and a contract is like an object, using OOP analogy. The code is usually a class. There is inheritance possible. One contract can call another contract. A user has to send some ether for transactions based on the computation the contract can take. The amount of computation is measured in gas and the gas to ether rate is a varying thing. Solidity is a lot similar to OOP. There are instance variables. They can be primitives or arrays or maps and the usual things. There are access modifiers. Some of the thing stay in memory but some can be put on external storage. There are ways to indicate that on the code. There are decorator like things that check if something is allowed or not. There is built in assertion things. You can track the owner of the contract and then using these modifiers, you can limit accesses. There are various runtime variables. You need to mark the transaction that incolves receiving money as payable or something. All the transactions are immutable.