跳转到内容

Solidity:修订间差异

维基百科,自由的百科全书
删除的内容 添加的内容
使用DisamAssist清理消歧义链接:IDE(链接至集成开发环境)。
InternetArchiveBot留言 | 贡献
补救14个来源,并将0个来源标记为失效。) #IABot (v2.0.9.5
 
第18行: 第18行:
| website = {{URL|github.com/ethereum/solidity}}
| website = {{URL|github.com/ethereum/solidity}}
}}
}}
'''Solidity'''是一種合約導向式語言,被應用於各種不同的[[區塊鏈]]平台<ref name="IBTimes12AUG2016">{{Cite news|url=http://www.ibtimes.co.uk/pwc-blockchain-expert-pinpoints-sources-ambiguity-smart-contracts-1575778|title=PwC blockchain expert pinpoints sources of ambiguity in smart contracts|last=Allison|first=Ian|date=12 August 2016|work=IBTimes|accessdate=14 December 2016|type=News}}</ref>,其主要開發者為{{link-en|加文·伍德|Gavin Wood}},Christian Reitwiessner,Alex Beregszaszi,Liana Husikyan,Yoichi Hirai和其他幾位早期[[以太坊]]核心貢獻者。<ref name=":CoinDesk14Dec2016">{{cite web|url=http://www.coindesk.com/blockchain-veterans-unveil-secure-smart-contracts-framework/|title=Blockchain Veterans Unveil Secure Smart Contracts Framework|accessdate=14 December 2016|author=Alyssa Hertig|date=15 September 2016|work=CoinDesk}}</ref><ref name=":CCN09062016">{{cite web|url=https://www.cryptocoinsnews.com/counterparty-brings-ethereum-smart-contracts-to-the-bitcoin-blockchain/|title=Counterparty Brings Ethereum Smart Contracts to the Bitcoin Blockchain|accessdate=14 December 2016|author=Rebecca Campbell|date=6 September 2016|work=CCN}}</ref>Solidity 可使程式開發人員能在區塊鏈上(例如以太坊)編寫[[智能合約]]。<ref name="CoinDesk28Setp2016">{{Cite news|url=http://www.coindesk.com/ethereum-formal-verification-smart-contracts/|title=In Formal Verification Push, Ethereum Seeks Smart Contract Certainty|date=28 September 2016|work=CoinDesk|accessdate=12 December 2016|type=News}}</ref><ref name="TheMerkle24Nov2016">{{Cite news|url=http://themerkle.com/a-consensus-issue-between-the-geth-and-parity-ethereum-clients-caused-an-unintentional-fork-of-the-network/|title=A Consensus Issue Between The Geth and Parity Ethereum Clients Caused an Unintentional Fork of the Network|last=Gomez|first=Eduardo|date=24 November 2016|work=TheMerkle|accessdate=14 December 2016|type=News}}</ref><ref name="browning2016">{{Cite book|url=https://books.google.co.th/books?id=2zMlDAAAQBAJ&pg=PT35&dq=solidity+blockchain&hl=en&sa=X&redir_esc=y#v=onepage&q=solidity%20blockchain&f=false|title=Digital Siege: Why Young Entrepreneurs Are Winning|last=Browning|first=David|date=May 2016|accessdate=2017-01-08|isbn=978-1628652963|archive-url=https://web.archive.org/web/20170109034037/https://books.google.co.th/books?id=2zMlDAAAQBAJ&pg=PT35&dq=solidity+blockchain&hl=en&sa=X&redir_esc=y#v=onepage&q=solidity%20blockchain&f=false|archive-date=2017-01-09|dead-url=yes}}</ref>
'''Solidity'''是一種合約導向式語言,被應用於各種不同的[[區塊鏈]]平台<ref name="IBTimes12AUG2016">{{Cite news|url=http://www.ibtimes.co.uk/pwc-blockchain-expert-pinpoints-sources-ambiguity-smart-contracts-1575778|title=PwC blockchain expert pinpoints sources of ambiguity in smart contracts|last=Allison|first=Ian|date=12 August 2016|work=IBTimes|accessdate=14 December 2016|type=News|archive-date=2018-06-27|archive-url=https://web.archive.org/web/20180627005233/https://www.ibtimes.co.uk/pwc-blockchain-expert-pinpoints-sources-ambiguity-smart-contracts-1575778|dead-url=no}}</ref>,其主要開發者為{{link-en|加文·伍德|Gavin Wood}},Christian Reitwiessner,Alex Beregszaszi,Liana Husikyan,Yoichi Hirai和其他幾位早期[[以太坊]]核心貢獻者。<ref name=":CoinDesk14Dec2016">{{cite web|url=http://www.coindesk.com/blockchain-veterans-unveil-secure-smart-contracts-framework/|title=Blockchain Veterans Unveil Secure Smart Contracts Framework|accessdate=14 December 2016|author=Alyssa Hertig|date=15 September 2016|work=CoinDesk|archive-date=2018-04-06|archive-url=https://web.archive.org/web/20180406214833/https://www.coindesk.com/blockchain-veterans-unveil-secure-smart-contracts-framework/|dead-url=no}}</ref><ref name=":CCN09062016">{{cite web|url=https://www.cryptocoinsnews.com/counterparty-brings-ethereum-smart-contracts-to-the-bitcoin-blockchain/|title=Counterparty Brings Ethereum Smart Contracts to the Bitcoin Blockchain|accessdate=14 December 2016|author=Rebecca Campbell|date=6 September 2016|work=CCN|archive-date=2017-09-24|archive-url=https://web.archive.org/web/20170924093549/https://www.cryptocoinsnews.com/counterparty-brings-ethereum-smart-contracts-to-the-bitcoin-blockchain/|dead-url=no}}</ref>Solidity 可使程式開發人員能在區塊鏈上(例如以太坊)編寫[[智能合約]]。<ref name="CoinDesk28Setp2016">{{Cite news|url=http://www.coindesk.com/ethereum-formal-verification-smart-contracts/|title=In Formal Verification Push, Ethereum Seeks Smart Contract Certainty|date=28 September 2016|work=CoinDesk|accessdate=12 December 2016|type=News|archive-date=2018-02-27|archive-url=https://web.archive.org/web/20180227094312/https://www.coindesk.com/ethereum-formal-verification-smart-contracts/|dead-url=no}}</ref><ref name="TheMerkle24Nov2016">{{Cite news|url=http://themerkle.com/a-consensus-issue-between-the-geth-and-parity-ethereum-clients-caused-an-unintentional-fork-of-the-network/|title=A Consensus Issue Between The Geth and Parity Ethereum Clients Caused an Unintentional Fork of the Network|last=Gomez|first=Eduardo|date=24 November 2016|work=TheMerkle|accessdate=14 December 2016|type=News|archive-date=2018-02-26|archive-url=https://web.archive.org/web/20180226211802/http://themerkle.com/a-consensus-issue-between-the-geth-and-parity-ethereum-clients-caused-an-unintentional-fork-of-the-network/|dead-url=no}}</ref><ref name="browning2016">{{Cite book|url=https://books.google.co.th/books?id=2zMlDAAAQBAJ&pg=PT35&dq=solidity+blockchain&hl=en&sa=X&redir_esc=y#v=onepage&q=solidity%20blockchain&f=false|title=Digital Siege: Why Young Entrepreneurs Are Winning|last=Browning|first=David|date=May 2016|accessdate=2017-01-08|isbn=978-1628652963|archive-url=https://web.archive.org/web/20170109034037/https://books.google.co.th/books?id=2zMlDAAAQBAJ&pg=PT35&dq=solidity+blockchain&hl=en&sa=X&redir_esc=y#v=onepage&q=solidity%20blockchain&f=false|archive-date=2017-01-09|dead-url=yes}}</ref>


== 歷史 ==
== 歷史 ==
Solidity的語法概念最早是由{{link-en|加文·伍德|Gavin Wood}}在2014年提出,<ref>{{Cite web|url=https://stackedit.io/viewer#!url=https://gist.githubusercontent.com/gavofyork/31b35cd2252a00d0d057/raw/16de06189d2175d2e31b300f1f8531e20c927635/solidity-original|title=StackEdit Viewer|last=Benoit Schweblin|work=stackedit.io}}</ref>後期則以Christian Reitwiessner所領導的以太坊團隊Solidity接手開發。該語言是針對[[以太坊虚拟机|以太坊虛擬機]](EVM)所設計的四種語言之一(其他的還有[[Serpent]],LLL,Viper(實驗中)和Mutan(已棄用))。有關這些語言的更多信息,請參閱[[以太坊#程式語言|以太坊編程語言]]。
Solidity的語法概念最早是由{{link-en|加文·伍德|Gavin Wood}}在2014年提出,<ref>{{Cite web|url=https://stackedit.io/viewer#!url=https://gist.githubusercontent.com/gavofyork/31b35cd2252a00d0d057/raw/16de06189d2175d2e31b300f1f8531e20c927635/solidity-original|title=StackEdit Viewer|last=Benoit Schweblin|work=stackedit.io|access-date=2018-02-26|archive-date=2016-04-01|archive-url=https://web.archive.org/web/20160401170211/https://stackedit.io/viewer#!url=https://gist.githubusercontent.com/gavofyork/31b35cd2252a00d0d057/raw/16de06189d2175d2e31b300f1f8531e20c927635/solidity-original|dead-url=yes}}</ref>後期則以Christian Reitwiessner所領導的以太坊團隊Solidity接手開發。該語言是針對[[以太坊虚拟机|以太坊虛擬機]](EVM)所設計的四種語言之一(其他的還有[[Serpent]],LLL,Viper(實驗中)和Mutan(已棄用))。有關這些語言的更多信息,請參閱[[以太坊#程式語言|以太坊編程語言]]。


Solidity是目前在以太坊及其他以太坊競爭平台中的主要編程語言,例如Monax及其Burrow Hyperledger的區塊鏈就是使用Tendermint完成共識機制。 SWIFT亦已經使用Solidity在Burrow上完成了概念驗證。<ref name="finops">{{Cite news|url=http://finops.co/operations/blockchains-smart-contracts-what-smart-whats-not/|title=Blockchain’s Smart Contracts: What’s Smart, What’s Not|last=KENTOURIS|first=CHRIS|date=13 December 2016|work=Finops|accessdate=14 December 2016|type=News}}</ref>
Solidity是目前在以太坊及其他以太坊競爭平台中的主要編程語言,例如Monax及其Burrow Hyperledger的區塊鏈就是使用Tendermint完成共識機制。 SWIFT亦已經使用Solidity在Burrow上完成了概念驗證。<ref name="finops">{{Cite news|url=http://finops.co/operations/blockchains-smart-contracts-what-smart-whats-not/|title=Blockchain’s Smart Contracts: What’s Smart, What’s Not|last=KENTOURIS|first=CHRIS|date=13 December 2016|work=Finops|accessdate=14 December 2016|type=News|archive-date=2018-02-27|archive-url=https://web.archive.org/web/20180227153614/https://finops.co/operations/blockchains-smart-contracts-what-smart-whats-not/|dead-url=no}}</ref>


[[康奈爾大學]]的研究人員指出,Solidity即是導致DAO在2016年被駭客攻擊的部分原因之一。他表示:“這實際上並不是DAO合同本身的缺陷或漏洞;技術上來說,DAO確實是在EVM上如預期般地被執行,反而是Solidity將安全上的漏洞引入了合約之中,而這些漏洞不僅沒被開發社群察覺,Solidity語言的設計者們也忽略了。<ref name="CCN19June2016">{{Cite news|url=https://www.cryptocoinsnews.com/ethereum-solidity-flaw-dao/|title=Ethereum’s Solidity Flaw Exploited in DAO Attack Says Cornell Researcher|last=Quentson|first=Andrew|date=19 June 2016|work=CryptocoinNews|accessdate=14 December 2016|type=News}}</ref><ref name="wiredjune18th2016">{{Cite news|url=https://www.wired.com/2016/06/50-million-hack-just-showed-dao-human/|title=A $50 MILLION HACK JUST SHOWED THAT THE DAO WAS ALL TOO HUMAN|last=Finley|first=Klint|date=18 June 2016|work=Wired|accessdate=18 February 2017|type=News|archive-date=2016-07-26|archive-url=https://web.archive.org/web/20160726195036/http://www.wired.com/2016/06/50-million-hack-just-showed-dao-human|dead-url=no}}</ref>
[[康奈爾大學]]的研究人員指出,Solidity即是導致DAO在2016年被駭客攻擊的部分原因之一。他表示:“這實際上並不是DAO合同本身的缺陷或漏洞;技術上來說,DAO確實是在EVM上如預期般地被執行,反而是Solidity將安全上的漏洞引入了合約之中,而這些漏洞不僅沒被開發社群察覺,Solidity語言的設計者們也忽略了。<ref name="CCN19June2016">{{Cite news|url=https://www.cryptocoinsnews.com/ethereum-solidity-flaw-dao/|title=Ethereum’s Solidity Flaw Exploited in DAO Attack Says Cornell Researcher|last=Quentson|first=Andrew|date=19 June 2016|work=CryptocoinNews|accessdate=14 December 2016|type=News|archive-date=2017-07-19|archive-url=https://web.archive.org/web/20170719195604/https://www.cryptocoinsnews.com/ethereum-solidity-flaw-dao/|dead-url=no}}</ref><ref name="wiredjune18th2016">{{Cite news|url=https://www.wired.com/2016/06/50-million-hack-just-showed-dao-human/|title=A $50 MILLION HACK JUST SHOWED THAT THE DAO WAS ALL TOO HUMAN|last=Finley|first=Klint|date=18 June 2016|work=Wired|accessdate=18 February 2017|type=News|archive-date=2016-07-26|archive-url=https://web.archive.org/web/20160726195036/http://www.wired.com/2016/06/50-million-hack-just-showed-dao-human|dead-url=no}}</ref>


== 描述 ==
== 描述 ==
Solidity是一種靜態型別的[[程式語言]],用於開發在EVM上執行的智能合約。 Solidity被編譯為可在EVM上執行的[[位元組碼]]。<ref>{{Cite book|url=https://books.google.com/books?id=CEsPDAAAQBAJ&pg=PT58&dq=solidity+ethereum&hl=en&sa=X&ved=0ahUKEwi3lsC-mdLMAhUCLmMKHY_9DtwQ6AEIKzAA#v=onepage&q=solidity%20ethereum&f=false|title=The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology|last=Mougayar|first=William|date=2016-04-26|publisher=[[Wiley Publishing]]|isbn=978-1119300311}}</ref><ref name="ibtimes.co.uk">{{Cite web|url=http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|title=Microsoft adds Ethereum language Solidity to Visual Studio|date=2016-03-30|last=Allison|first=Ian|publisher=[[International Business Times]]|website=|access-date=2016-05-11}}</ref> 藉由Solidity,開發人員能夠編寫出可自我執行其欲實現之商業邏輯的應用程式,該程式可被視為一份具權威性且永不可悔改的交易合約。<ref>{{Cite web|url=https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|title=Ethereum's Solidity Now Available in Microsoft Visual Studio|accessdate=2016-05-11|date=2016-05-04|last=Bradley|first=Joseph|publisher=Cryptocoinnews}}</ref><ref name="Allison">{{Cite web|url=http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|title=Microsoft adds Ethereum language Solidity to Visual Studio|accessdate=11 May 2016|date=30 March 2016|last=Allison|first=Ian|work=[[International Business Times]]}}</ref>對已具備程式編輯能力的人而言,編寫Solidity的難易度就如同編寫一般的程式語言。<ref name="Mougayar2016">{{Cite book|url=https://books.google.co.th/books?id=CEsPDAAAQBAJ&pg=PT58&dq=solidity+blockchain&hl=en&sa=X&ved=0ahUKEwiu6Lrk87TRAhULpY8KHaprC-8Q6AEILjAE#v=onepage&q=solidity%20blockchain&f=false|title=The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology Hardcover|last=Mougayar|first=William|date=May 9, 2016|publisher=[[Wiley Publishing]]|accessdate=2017-01-09|isbn=978-1119300311}}</ref>
Solidity是一種靜態型別的[[程式語言]],用於開發在EVM上執行的智能合約。 Solidity被編譯為可在EVM上執行的[[位元組碼]]。<ref>{{Cite book|url=https://books.google.com/books?id=CEsPDAAAQBAJ&pg=PT58&dq=solidity+ethereum&hl=en&sa=X&ved=0ahUKEwi3lsC-mdLMAhUCLmMKHY_9DtwQ6AEIKzAA#v=onepage&q=solidity%20ethereum&f=false|title=The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology|last=Mougayar|first=William|date=2016-04-26|publisher=[[Wiley Publishing]]|isbn=978-1119300311}}</ref><ref name="ibtimes.co.uk">{{Cite web|url=http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|title=Microsoft adds Ethereum language Solidity to Visual Studio|date=2016-03-30|last=Allison|first=Ian|publisher=[[International Business Times]]|website=|access-date=2016-05-11|archive-date=2016-05-29|archive-url=https://web.archive.org/web/20160529164519/http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|dead-url=no}}</ref> 藉由Solidity,開發人員能夠編寫出可自我執行其欲實現之商業邏輯的應用程式,該程式可被視為一份具權威性且永不可悔改的交易合約。<ref>{{Cite web|url=https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|title=Ethereum's Solidity Now Available in Microsoft Visual Studio|accessdate=2016-05-11|date=2016-05-04|last=Bradley|first=Joseph|publisher=Cryptocoinnews|archive-date=2016-04-18|archive-url=https://web.archive.org/web/20160418015636/https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|dead-url=no}}</ref><ref name="Allison">{{Cite web|url=http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|title=Microsoft adds Ethereum language Solidity to Visual Studio|accessdate=11 May 2016|date=30 March 2016|last=Allison|first=Ian|work=[[International Business Times]]|archive-date=2016-05-29|archive-url=https://web.archive.org/web/20160529164519/http://www.ibtimes.co.uk/microsoft-adds-ethereum-language-solidity-visual-studio-1552171|dead-url=no}}</ref>對已具備程式編輯能力的人而言,編寫Solidity的難易度就如同編寫一般的程式語言。<ref name="Mougayar2016">{{Cite book|url=https://books.google.co.th/books?id=CEsPDAAAQBAJ&pg=PT58&dq=solidity+blockchain&hl=en&sa=X&ved=0ahUKEwiu6Lrk87TRAhULpY8KHaprC-8Q6AEILjAE#v=onepage&q=solidity%20blockchain&f=false|title=The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology Hardcover|last=Mougayar|first=William|date=May 9, 2016|publisher=[[Wiley Publishing]]|accessdate=2017-01-09|isbn=978-1119300311}}</ref>


Gavin Wood最初在規劃Solidity語言時參照了[[ECMAScript]]的語法概念,使其對現有的Web開發者更容易入門;與ECMAScript不同的地方在於Solidity具有靜態型別和可變返回型別。而與目前其他EVM目標語言(如Serpent和Mutan)相比,其重要的差異在於Solidity具有一組複雜的成員變數使得合約可支援任意階層的映射和結構。Solidity也支援繼承,包含C3線性化多重繼承。 另外還引入了一個[[應用程序二進制接口]](ABI),該接口(ABI)可在單一合同中實現多種類型安全的功能。 
Gavin Wood最初在規劃Solidity語言時參照了[[ECMAScript]]的語法概念,使其對現有的Web開發者更容易入門;與ECMAScript不同的地方在於Solidity具有靜態型別和可變返回型別。而與目前其他EVM目標語言(如Serpent和Mutan)相比,其重要的差異在於Solidity具有一組複雜的成員變數使得合約可支援任意階層的映射和結構。Solidity也支援繼承,包含C3線性化多重繼承。 另外還引入了一個[[應用程序二進制接口]](ABI),該接口(ABI)可在單一合同中實現多種類型安全的功能。 
第63行: 第63行:
* {{URL|https://remix.ethereum.org|Remix}},Solidity官方[[集成开发环境|IDE]]
* {{URL|https://remix.ethereum.org|Remix}},Solidity官方[[集成开发环境|IDE]]
* {{URL|https://chainide.com/|ChainIDE}}
* {{URL|https://chainide.com/|ChainIDE}}
* [[Microsoft Visual Studio]]<ref>{{Cite web|url=https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|title=Ethereum's Solidity Now Available in Microsoft Visual Studio|accessdate=1 May 2016|work=CCN: Financial Bitcoin & Cryptocurrency News}}</ref><ref>{{Cite web|url=http://www.coindesk.com/microsoft-ethereum-3-million-developers/|title=Microsoft Adds Ethereum to Windows Platform For Over 3 Million Developers|accessdate=1 May 2016|work=CoinDesk}}</ref>
* [[Microsoft Visual Studio]]<ref>{{Cite web|url=https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|title=Ethereum's Solidity Now Available in Microsoft Visual Studio|accessdate=1 May 2016|work=CCN: Financial Bitcoin & Cryptocurrency News|archive-date=2016-04-18|archive-url=https://web.archive.org/web/20160418015636/https://www.cryptocoinsnews.com/ethereums-solidity-now-available-in-microsoft-visual-studio/|dead-url=no}}</ref><ref>{{Cite web|url=http://www.coindesk.com/microsoft-ethereum-3-million-developers/|title=Microsoft Adds Ethereum to Windows Platform For Over 3 Million Developers|accessdate=1 May 2016|work=CoinDesk|archive-date=2018-01-09|archive-url=https://web.archive.org/web/20180109181245/https://www.coindesk.com/microsoft-ethereum-3-million-developers/|dead-url=no}}</ref>
* [[ConsenSys]] Enterprise
* [[ConsenSys]] Enterprise
* Tendermint 
* Tendermint 
第79行: 第79行:
== 参考文献 ==
== 参考文献 ==
{{Reflist|30em
{{Reflist|30em
<ref name = Allison-2016-12-20>
<ref name = Allison-2016-12-20>{{cite web
|url = http://www.ibtimes.co.uk/blockchain-big-data-worth-watching-2017-1596721
{{cite web
|date = December 20, 2016
| url = http://www.ibtimes.co.uk/blockchain-big-data-worth-watching-2017-1596721
|title = Blockchain and big data worth watching in the coming year
| date = December 20, 2016
|department = [[Business]]
| title = Blockchain and big data worth watching in the coming year
| department = [[Business]]
|website = [[International Business Times]]
|language = en
| website = [[International Business Times]]
| language = en
|access-date = 2017-09-28
|archive-url = https://web.archive.org/web/20220812145515/https://www.ibtimes.co.uk/blockchain-big-data-worth-watching-2017-1596721
| access-date = 2017-09-28
| archive-url =
|dead-url = no
|archive-date = 2022-08-12
| dead-url = no
| archive-date =
}}</ref>
}}</ref>
* [http://cat.lib.unimelb.edu.au/search~S42?/aInternational+Conference+on+Applicable+Algebra%2C+Error-Correcting+Codes%2C+Combinatorics+and+Computer+Algebra%2C+AAECC+%284+%3A+1986+-+26-09-1986+%3A+Karlsruhe%2C+FRG%29/ainternational+conference+on+applicable+algebra+error+correcting+codes+combinatorics+and+computer+algebra+aaecc++++++++4+++++1/47,-1,0,B/browse International Conference on Applications of Natural Language to Information Systems (13th : 2008 : London, England)], NLDB 2008, London, UK, June 24-27, 2008 : proceedings / Epaminondas Kapetanios, Vijayan Sugumaran, Myra Spiliopoulou (eds.), ISBN 978-3-540-69857-9
* [http://cat.lib.unimelb.edu.au/search~S42?/aInternational+Conference+on+Applicable+Algebra%2C+Error-Correcting+Codes%2C+Combinatorics+and+Computer+Algebra%2C+AAECC+%284+%3A+1986+-+26-09-1986+%3A+Karlsruhe%2C+FRG%29/ainternational+conference+on+applicable+algebra+error+correcting+codes+combinatorics+and+computer+algebra+aaecc++++++++4+++++1/47,-1,0,B/browse International Conference on Applications of Natural Language to Information Systems (13th : 2008 : London, England)], NLDB 2008, London, UK, June 24-27, 2008 : proceedings / Epaminondas Kapetanios, Vijayan Sugumaran, Myra Spiliopoulou (eds.), ISBN 978-3-540-69857-9

2023年6月14日 (三) 18:11的最新版本

Solidity
Solidity的標誌
当前版本
  • 0.8.28(2024年10月9日;穩定版本)[1]
編輯維基數據鏈接
網站github.com/ethereum/solidity
啟發語言
JavaScriptC++PythonPowerShell

Solidity是一種合約導向式語言,被應用於各種不同的區塊鏈平台[2],其主要開發者為加文·伍德英语Gavin Wood,Christian Reitwiessner,Alex Beregszaszi,Liana Husikyan,Yoichi Hirai和其他幾位早期以太坊核心貢獻者。[3][4]Solidity 可使程式開發人員能在區塊鏈上(例如以太坊)編寫智能合約[5][6][7]

歷史

[编辑]

Solidity的語法概念最早是由加文·伍德英语Gavin Wood在2014年提出,[8]後期則以Christian Reitwiessner所領導的以太坊團隊Solidity接手開發。該語言是針對以太坊虛擬機(EVM)所設計的四種語言之一(其他的還有Serpent,LLL,Viper(實驗中)和Mutan(已棄用))。有關這些語言的更多信息,請參閱以太坊編程語言

Solidity是目前在以太坊及其他以太坊競爭平台中的主要編程語言,例如Monax及其Burrow Hyperledger的區塊鏈就是使用Tendermint完成共識機制。 SWIFT亦已經使用Solidity在Burrow上完成了概念驗證。[9]

康奈爾大學的研究人員指出,Solidity即是導致DAO在2016年被駭客攻擊的部分原因之一。他表示:“這實際上並不是DAO合同本身的缺陷或漏洞;技術上來說,DAO確實是在EVM上如預期般地被執行,反而是Solidity將安全上的漏洞引入了合約之中,而這些漏洞不僅沒被開發社群察覺,Solidity語言的設計者們也忽略了。[10][11]

描述

[编辑]

Solidity是一種靜態型別的程式語言,用於開發在EVM上執行的智能合約。 Solidity被編譯為可在EVM上執行的位元組碼[12][13] 藉由Solidity,開發人員能夠編寫出可自我執行其欲實現之商業邏輯的應用程式,該程式可被視為一份具權威性且永不可悔改的交易合約。[14][15]對已具備程式編輯能力的人而言,編寫Solidity的難易度就如同編寫一般的程式語言。[16]

Gavin Wood最初在規劃Solidity語言時參照了ECMAScript的語法概念,使其對現有的Web開發者更容易入門;與ECMAScript不同的地方在於Solidity具有靜態型別和可變返回型別。而與目前其他EVM目標語言(如Serpent和Mutan)相比,其重要的差異在於Solidity具有一組複雜的成員變數使得合約可支援任意階層的映射和結構。Solidity也支援繼承,包含C3線性化多重繼承。 另外還引入了一個應用程序二進制接口(ABI),該接口(ABI)可在單一合同中實現多種類型安全的功能。 

以下為使用Solidity編寫的程式範例:

contract GavCoin
{
  mapping(address=>uint) balances;
  uint constant totalCoins = 100000000000;

  /// Endows creator of contract with 1m GAV.
  function GavCoin(){
      balances[msg.sender] = totalCoins;
  }

  /// Send $((valueInmGAV / 1000).fixed(0,3)) GAV from the account of $(message.caller.address()), to an account accessible only by $(to.address()).
  function send(address to, uint256 valueInmGAV) {
    if (balances[msg.sender] >= valueInmGAV) {
      balances[to] += valueInmGAV;
      balances[msg.sender] -= valueInmGAV;
    }
  }

  /// getter function for the balance
  function balance(address who) constant returns (uint256 balanceInmGAV) {
    balanceInmGAV = balances[who];
  }

}

開發平台

[编辑]

區塊鏈平台

[编辑]

Solidity可在下列平台中運作:

参考文献

[编辑]
  1. ^ Release 0.8.28. 2024年10月9日 [2024年10月27日]. 
  2. ^ Allison, Ian. PwC blockchain expert pinpoints sources of ambiguity in smart contracts. IBTimes (News). 12 August 2016 [14 December 2016]. (原始内容存档于2018-06-27). 
  3. ^ Alyssa Hertig. Blockchain Veterans Unveil Secure Smart Contracts Framework. CoinDesk. 15 September 2016 [14 December 2016]. (原始内容存档于2018-04-06). 
  4. ^ Rebecca Campbell. Counterparty Brings Ethereum Smart Contracts to the Bitcoin Blockchain. CCN. 6 September 2016 [14 December 2016]. (原始内容存档于2017-09-24). 
  5. ^ In Formal Verification Push, Ethereum Seeks Smart Contract Certainty. CoinDesk (News). 28 September 2016 [12 December 2016]. (原始内容存档于2018-02-27). 
  6. ^ Gomez, Eduardo. A Consensus Issue Between The Geth and Parity Ethereum Clients Caused an Unintentional Fork of the Network. TheMerkle (News). 24 November 2016 [14 December 2016]. (原始内容存档于2018-02-26). 
  7. ^ Browning, David. Digital Siege: Why Young Entrepreneurs Are Winning. May 2016 [2017-01-08]. ISBN 978-1628652963. (原始内容存档于2017-01-09). 
  8. ^ Benoit Schweblin. StackEdit Viewer. stackedit.io. [2018-02-26]. (原始内容存档于2016-04-01). 
  9. ^ KENTOURIS, CHRIS. Blockchain’s Smart Contracts: What’s Smart, What’s Not. Finops (News). 13 December 2016 [14 December 2016]. (原始内容存档于2018-02-27). 
  10. ^ Quentson, Andrew. Ethereum’s Solidity Flaw Exploited in DAO Attack Says Cornell Researcher. CryptocoinNews (News). 19 June 2016 [14 December 2016]. (原始内容存档于2017-07-19). 
  11. ^ Finley, Klint. A $50 MILLION HACK JUST SHOWED THAT THE DAO WAS ALL TOO HUMAN. Wired (News). 18 June 2016 [18 February 2017]. (原始内容存档于2016-07-26). 
  12. ^ Mougayar, William. The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology. Wiley Publishing. 2016-04-26. ISBN 978-1119300311. 
  13. ^ Allison, Ian. Microsoft adds Ethereum language Solidity to Visual Studio. International Business Times. 2016-03-30 [2016-05-11]. (原始内容存档于2016-05-29). 
  14. ^ Bradley, Joseph. Ethereum's Solidity Now Available in Microsoft Visual Studio. Cryptocoinnews. 2016-05-04 [2016-05-11]. (原始内容存档于2016-04-18). 
  15. ^ Allison, Ian. Microsoft adds Ethereum language Solidity to Visual Studio. International Business Times. 30 March 2016 [11 May 2016]. (原始内容存档于2016-05-29). 
  16. ^ Mougayar, William. The Business Blockchain: Promise, Practice, and Application of the Next Internet Technology Hardcover. Wiley Publishing. May 9, 2016 [2017-01-09]. ISBN 978-1119300311. 
  17. ^ Ethereum's Solidity Now Available in Microsoft Visual Studio. CCN: Financial Bitcoin & Cryptocurrency News. [1 May 2016]. (原始内容存档于2016-04-18). 
  18. ^ Microsoft Adds Ethereum to Windows Platform For Over 3 Million Developers. CoinDesk. [1 May 2016]. (原始内容存档于2018-01-09). 
  19. ^ Blockchain and big data worth watching in the coming year. Business. International Business Times. December 20, 2016 [2017-09-28]. (原始内容存档于2022-08-12) (英语). 
  20. ^ Schneier, Karthikeyan; Schneier, Antoine; Bhargavan, Cedric; Delignat-Lavaud, Anitha; Fournet, Gollamudi; Schneier, Bruce; Rastogi, Nadim; Sibut-Pinote, Aseem; Rastogi1, Thomas; Swamy, Nikhil; Zanella-Beguelin, Santiago. Short Paper: Formal Verification of Smart Contracts (PDF). Microsoft Research, French Institute for Research in Computer Science and Automation, Harvard University. August 27, 2016. (原始内容存档 (PDF)于August 23, 2017) (英语). 

批評

[编辑]

智慧型合約的許多安全屬性本質上很難直接推理,而 Solidity 的圖靈完備性意味著任意屬性的驗證無法確定地自動化。目前用於智慧型合約安全分析的自動化解決方案可能會遺漏掉一些嚴重的違規行為,產生誤報,並且無法在現實合約上達到足夠的程式碼覆蓋率。由於其違反直覺的性質、缺乏處理區塊鏈領域特定方面的結構以及缺乏已知漏洞的中心化文件,Solidity 被批評為以太坊智能合約的實施容易出錯。

2016 年,康奈爾大學的一位研究人員表示,Solidity 是當年發生的 DAO 駭客攻擊的部分原因。他表示:“這實際上不是 DAO 合約本身的缺陷或漏洞:就技術而言,以太坊虛擬機 (EVM) 正在按預期運行,但 Solidity 將安全漏洞導入到合約中,這些漏洞不僅被社區遺漏,還包括原本的語言設計人。”

外部連結

[编辑]