[學習筆記] 智能合約 20190423

in #cn5 years ago


source: http://ggllaw.net/areas-of-practice/

最近,因為某些因素,想要更進一步多了解智能合約的運行實際情況,想起往年的文章,回頭找出這兩篇合作文章 (由失聯已久的 @antonsteemit執筆)

DA-ChainTalk #1 — State,從宏觀到微觀:以太坊如何將智能合約帶入區塊鏈世界
DA-ChainTalk #3 — 智能合約之前世今生

再讀一次,才發現自己當時其實沒有完全吸收,事隔一年再看,還是頗有收穫。不過,這樣的理解程度,還不能滿足我的需求,所以,去找了一位作開發的朋友,問他一下,這是最快的方式。

果然,寫代碼的朋友,頭腦都蠻清楚的,他跟我聊了十多分鐘,我收穫蠻大的。如果要自己看書來理解,恐怕是非常困難的。

以下,我把我學習到的基本概念,整理出來。也可能因為我理解錯誤而有錯,有專業的讀者們,歡迎指正我,繼續教導我更多關於智能合約的知識吧!^^

關於智能合約(smart contracts)

  • 智能合約,可以被視為在區塊鏈上執行的程式,但比起一般程式,智能合約所受到的制約更多,所能達成的功能也比較有限。

  • 智能合約的佈署(deploy),是透過一個EOA帳戶來上傳區塊鏈,把compile過的Solidity原始碼,記錄到一個智能合約帳戶裡去。

  • 每個智能合約內可以有各種寫好的functions以及variables,variables的state可以更新,但智能合約本身結構,在上傳後就是不可更改的。

  • 智能合約的地址,就是其上傳的那一個區塊地址,後面呼叫此合約,就會到此一地址來取得執行代碼。

  • 智能合約的執行是必須依靠外界的觸發,且其執行具有atomic的概念,亦即所有程式都在這一次執行完成,完成後的更新狀態,紀錄為transaction

  • 每個Ethereum礦工執行的結果是否符合該合約應該有的結果,可以輕易由其他礦工驗證,正如比特幣區塊鏈上,交易的結果是否正確,可以輕易由後續礦工所驗證。

  • 因此,智能合約無法做到諸如:每個週一定時,自動地,由帳戶A轉帳1 Ether到帳戶B,這樣的自動化程序。

如果大家有推薦什麼好的文章連結,可以深入淺出地解釋智能合約的運作(不能太淺,但也不能技術性),請多多推薦給我吧!

danbo-2495978_1280.jpg
Image Source: pixabay

Sort:  

恭喜你!您的这篇文章入选 @justyy 今日 (2019-04-24) 榜单 【优秀的文章】, 回复本条评论24小时内领赏,点赞本评论将支持 @dailychina 并增加将来您的奖赏。
@justyy 是CN区的见证人,请支持他,给他投票,感谢!

Congratulations! This post has been selected by @justyy as today's (2019-04-24) 【Good Posts】, Steem On! Reply to this message in 24 hours to get rewards. Upvote this comment to support the @dailychina and increase your future rewards! ^_^

SteemIt 工具、API接口、机器人和教程
SteemIt Tools, Bots, APIs and Tutorial
*Join cnsteem Discord channel: *https://discord.gg/SnNaaYS

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

突然想起去年跟着你的post学python,结果学到一半放弃了😂

Posted using Partiko Android

呵呵,別提了,我自己都沒學好呢,現在全部都忘了.... >_<

Hi, @deanliu!

You just got a 16.91% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @deanliu!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 5.861 which ranks you at #402 across all Steem accounts.
Your rank has improved 16 places in the last three days (old rank 418).

In our last Algorithmic Curation Round, consisting of 227 contributions, your post is ranked at #7.

Evaluation of your UA score:
  • You've built up a nice network.
  • The readers appreciate your great work!
  • Great user engagement! You rock!

Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 63718.61
ETH 3390.60
USDT 1.00
SBD 2.62