Please enable JavaScript.
Coggle requires JavaScript to display documents.
Week 6: Ethereum & Smart Contracts: Enabling a decentralized future -…
Week 6: Ethereum & Smart Contracts: Enabling a decentralized future
Ethereum
Smart Contracts
definition
Framework for running smart contracts
execution of arbitrary computation (?) on a blockchain
contract: spoken or written agreement
codes to facilitate, verify, enforce the negotiation or execution of a digital contract
specified conditions must be fulfilled
specified terms must be executed
through algorithm
for us to reach consensus, a trusted entity (?) must run this code
addressing the needs of
Bitcoin's special features
identity
authentication
integrity
unique
private key
randomly generated by Elliptic curve digital signature algorithm
a hashed and key stretched brain wallet mnemonic
then using one way function to generate public faced address
pseudonymous
transactions
UTXOs
the address specified in the output of the transaction control which recipient could receive and spend the fund
sum of all your UTXOs is the balance of your account
satoshis
record keeping
blockchain
in a tamper evident manner
each block header contains the hash of the previous block header
each block header consists of a merkle root
as a temper evident summary of all transactions in the block
any changes on a transaction in the block
it will cause a change on the Merkle root
1 more item...
immutable records
full node(s) should have a copy of the blockchain on the network
consensus
resolution: proof of work
the first to solve and prove the solution to the given cryptographic puzzle
entitled to propose an update on the blockchain
so, higher computation power would get a higher voting influence
the issue of easily generated digital anonymous identity on Bitcoin network
uncensorable to transactions
no one can control the large portion of the network
no centralized sites
decentralized miners around the Internet
creations of decentralized apps (DApps)
overview
features
democratic nature of software
possessing bitcoin properties
trustless
pseudonymous
validating by consensus & one cpu one vote policy
no central point of failure
uncensorable
immutable
account based
account based, rather than transaction UTXO based
efficient to check account balance, instead of summing all UTXOs as in Bitcoin
easier to check account balance and make transactions
two types of accounts
externally owned accounts (external parties outside Ethereum network)
could be anything like a person, people, organization, ...
consists of addresses for collecting fund and account balance
transfer Ether or trigger contract codes
contract accounts
owned by smart contracts
poked by transaction, or specific functions
consists of an address, associated contract code, persistent storage (with direct control)
triggered by code's function call
private key to prove the account which track the account balance
native asset is Ether
fund computations
align incentives
a distributed computer spread among a multitude of nodes across the world
people could feed codes to it for executions
can run unstoppable applications
applications can be run exactly as programmed with any downtime, fraud, censorship, intervention from 3rd parties
complex and feature rich
planning to move to proof of stake
not about optimizing efficiency of computation
parallel processing is redundantly parallel
efficient way to reach consensus
contract executions are redundantly replicated across nodes
open source community
mass consumption
creator: Vitalik Buterin
proposed Bitcoin should support more general purpose scripting language
his Ethereum supports a turing complete scripting language
JavaScript serving as a runtime environment with script execution
solidity is based on JavaScript
(a decentralized platform) to run smart contracts
store and maintain data
represent something useful, e.g. fund, or membership ...
provide additional functionality to other contracts
a contract calls another contract to provide software functionalities, as a software library
complex authentication use case
e.g. m of n multisignature
allow decentralized and distributed executions of smart contract under Ethereum platform
written in Solidity or Vyper
compiled, then EVM codes for executions
every nodes of Ethereum execute EVM codes as part of its block verification procedure
consensus to a new network state, assuming all the nodes have the up to date EVM versions
proof of work
block creation time: 15 sec whereas Bitcoin 10 mins
1 more item...
algorithm is Ethash
2 more items...
only one miner is able to add a block to the Ethereum blockchain & claim associated reward
1 more item...
competition
so it is trustless
EVM codes are low level stack based bytecode language
every node execute the codes in the same deterministic way
nodes come to consensus on a new state
but, the issue of potential infinite looping codes
infinite loop denial of service attack
resolution
1 more item...
manage the contract or relationship between untrusting users
function as Ethereum Virtual Machine (EVM)
distributed state machine
a global world computer
a transaction on the network changes the state of such a global system
the state includes the data about who owns what
underlying state transition mechanism
beginning: blank genesis state
start with current block state, the gas required, the current memory, the transaction calling a contract, message containing transaction meta data, the code of contract, the stack and program counter
new block state, updated account balances, internal state, new gas value
use case
smart asset
token system implementation
build your own currency on top of another one
requirements
authenticated
no double spending
ensure sufficient fund for transfer
two main functions
a storage structure for associating addresses
send() function to transfer assets
written in high level EVM language
contract oriented
solidity
build apps to tap into the protocols and procedures of existing blockchain
secure logic is hard to achieve
MultiSignature Wallet
make use of built in authentication protocols
multiparty authentication wallet
requiring M (threshold) sign off out of N (# of owners) for the transaction
not one in total control of the fund
simple logic but hard coding in solidity
e.g. Parity, a multisSig company was hacked twice due to undiscovered vulnerabilities
proof of existence
leverage
public audibility and immutability of the blockchain
prove the existence of some piece of information at some point in time
store a hash of your document onto the chain
we prove we own some document at some time through a commitment scheme
reveal the inputs later to prove the ownership
Decentralized Land Titles
prediction Market
supply Chain
provenance of diamond