Share
Embed
Transcript
30 slides
-
Content What is the Transaction ? EOA & CA Message
call Contract Creation Life Cycle of Transaction State Change -
What is transaction ͬͱςΫχΧϧʹɺɺɺ TransactionɺEthereum ্ͷঢ়ଶ(World State)Λมߋ͢Δશ୯ࣹࣸ૾ World State σ
m World State σ m+1 Transactions A transaction is a single cryptographically-signed instruction. -
What is transaction State ͷࢹ͔ΒݟΔͱɺtransactionState ChainͷChainʹͳΔɻ orld State σ m
World State σ m+1 Transactions World S σ m Transactions -
What is transaction τϥϯβΫγϣϯ͕ຬ͖ͨ݅͢ τϥϯβΫγϣϯɺRLPϑΥʔϚοτʹै͍ͬͯΔɻ (RLPrecursive length prefixͷུ) τϥϯβΫγϣϯͷॺ໊͕༗ޮͰ͋Δɻ τϥϯβΫγϣϯͷnonce͕༗ޮͰ͋Δɻɹɹɹɹɹɹɹɹɹɹɹɹɹ
ૹ৴ऀͷݱࡏͷnonceͱ͍͔͠Ͳ͏͔ݕূ͢Δɻ τϥϯβΫγϣϯʹࣄલʹఆΊΒΕ͍ͯΔGasྔΑΓɺɹɹɹɹɹɹ gas limit͕େ͖͘ઃఆ͞Ε͍ͯΔɻ ૹ৴ऀͷΞΧϯτͷߴ͕ɺࢧ͍ͷඅ༻ΑΓ্ճ͍ͬͯΔɻ ☑ ☑ ☑ ☑ ☑ -
What is transaction τϥϯβΫγϣϯͷݕূ͕ߦΘΕͨΒɺsubstate͕࡞͞ΕΔɻ substateɺ self-destruct set τϥϯβΫγϣϯมߋޙʹه͞ΕΔΞΧϯτใ log sires
τϥϯβΫγϣϯ͕Ͳ͜·Ͱ࣮ߦ͞Εͨͷ͔Λอ࣋͢Δ refund balance τϥϯαΫγϣϯྃޙʹϝϞϦʔΛݮΒͨ͠ͱͯ͠ฦ͞ΕΔeth ͔ΒͳΔɻ Substate -
EOA & CA EthereumͷAccountʹɼೋछྨ͋Δ EOA(Externally Owned Account) ֎෦ΞΧϯτ CA(Contract Account)
ίϯτϥΫτ༻ͷΞΧϯτ τϥϯβΫγϣϯɺ͜ΕΒͷΞΧϯτؒͰߦΘΕΔɻ CAɺContrac༻ͷ CodeΛ͍࣋ͬͯΔ -
EOA & CA EOA STORAGE BLANCE NONCE CODE ADDREDD CA
STORAGE BLANCE NONCE CODE ADDREDD EOAɺൿີ伴Ͱཧ͞ΕɺCodeΛ࣋ͨͳ͍ɻ CAɺEMV codeΛͪɺEVMCodeͰཧ͞ΕΔɻ -
EOA & CA def mk_contract_address(sender, nonce): return sha3(rlp.encode([normalize_address(sender), nonce]))[12:] ͪͳΈʹɺCA(Contract
Account)ͷΞυϨεɺ senderͷΞυϨεͱnonce͔Βࢉग़͞ΕΔ https://github.com/ethereum/pyethereum/blob/782842758e219e40739531a5e56fff6e63ca567b/ethereum/ utils.py -
input code Contract Creation World State σm World State σ
m+1 Transactions Init code Account State A Account State B Account State C ɾ ɾ ɾ Account State A Account State B Account State C ɾ ɾ Account State X NEW ৽͍͠CAͷΞυϨεΛੜ͠ॳظઃఆޙɺτϥϯβΫγϣϯͱͯ͠initίʔυ ΛૹΔ͜ͱͰίϯτϥΫτΞΧϯτ͕ੜ͞ΕΔ -
Message Call World State σm World State σ m+1 Transactions
Init data Account State A Account State B Account State C ɾ ɾ Account State A Account State B Account State C ɾ ɾ Account State X Update Message CallʹΑͬͯContract Accountͷσʔλupdate͞ΕΔɻ input data Account State X -
Information of Transaction blockHash: “0x3584caa04632ce227cf259ab8086d460d497067e666fdf9c5b58756f738ad51c", blockNumber: 37214317, from: “0x0eea8963fd6f19ff4299ac9ccb774266a98ba6b1", gas:
4600000, gasPrice: 100000000000, hash: “0xd59f0a4c159aa2a2058bd7d8dc4b759d1d6474d3f4b85606e3b4a3d00ff73e10", input: "0x", nonce: 42, r; “0xa4c159aa2a2058bd7d8dca4c159aa2a2058bd7d8dca4c159aa2a2058bd7d” s; “0xb759d1d6474d3f4b85606e3b4a3b759d1d6474d3f4b85606e3b4a34279a6” to: “0x0f0a4c159aa2a2058bd7d8dc4b759d1d6474d3f", transactionIndex: 3, v; “0x66” value: 5000000000 -
Information of Transaction BLOCK HASH GAS LIMIT GAS PRICE NONCE
FROM HASH BLOCK NUMBER INPUT R.S.V TO, VALUE