|
智能合約可以用來(lái)做什么
智能合約可用于各種不同的環(huán)境,但最直接的用法可能是您已經(jīng)熟悉的一種:加密貨幣。
"We usually think that cryptocurrency is actually the simplest form of smart contract,"Boder said."Cryptocurrency is a smart contract.Its use case is to send and receive funds,or more accurately,tokens.In this sense,smart contracts are the generalization of cryptocurrency.It supports more use cases,not just sending tokens back and forth."
智能合約的其他一些流行用例包括:
啟用數字資產(chǎn)的轉移。那些轉讓NFT等數字資產(chǎn)所有權的人是智能合約的自然使用!霸谶@種情況下,特定數字藝術(shù)作品的權利在特定條件或規則下從一方轉移到另一方,”面向游戲玩家的Web3平臺Xchange Monster的首席執行官Felix Honigwachs說(shuō)。
運行byfn測試網(wǎng)的準備工作,也是搭建開(kāi)發(fā)環(huán)境的過(guò)程,最終,測試網(wǎng)能成功運行也說(shuō)明環(huán)境搭建成功。
新建一個(gè)目錄并進(jìn)入:
$mkdir hyperledger&&cd hyperledger
1
下載執行腳本,此腳本用來(lái)自動(dòng)化下載fabric鏡像、程序和測試網(wǎng)運行腳本等工具:
$wget https://raw.githubusercontent.co ... cripts/bootstrap.sh
--2020-12-15 14:07:12--https://raw.githubusercontent.co ... cripts/bootstrap.sh
Resolving raw.githubusercontent.com(raw.githubusercontent.com)...151.101.76.133
Connecting to raw.githubusercontent.com(raw.githubusercontent.com)|151.101.76.133|:443...connected.
HTTP request sent,awaiting response...200 OK
Length:6521(6.4K)[text/plain]
Saving to:‘bootstrap.sh’
bootstrap.sh 100%[==================================>]6.37K--.-KB/s in 0s
2020-12-15 14:07:12(102 MB/s)-‘bootstrap.sh’saved[6521/6521]
去中心化金融。智能合約使開(kāi)發(fā)人員能夠構建金融應用程序,Allow users to borrow or trade securities,etc.Gambling.Developers can use smart contracts to provide access to their games,while users can trade digital content in the game with other users,and so on.
“如果你想在無(wú)需信任的環(huán)境中做更多事情,而不僅僅是來(lái)回匯款,你需要智能合約,”API3的Boder說(shuō)。
編寫(xiě)和部署智能合約的工具
Mist Browser——它是一個(gè)瀏覽和使用dApp的工具。它是一個(gè)單獨的瀏覽器,可用于瀏覽dApp并與之交互。
Truffle Framework——Truffle是一個(gè)流行的以太坊開(kāi)發(fā)框架。它具有內置的智能合約編譯、鏈接、部署和二進(jìn)制管理。
Metamask——MetaMask是一座橋梁,允許人們今天在他們的瀏覽器中訪(fǎng)問(wèn)明天的分布式網(wǎng)絡(luò )。它允許用戶(hù)直接在瀏覽器中運行以太坊dApp,而無(wú)需運行完整的以太坊節點(diǎn)。
Remix——Remix是一個(gè)基于Web瀏覽器的IDE,允許用戶(hù)編寫(xiě)Solidity智能合約,然后部署和運行智能合約。
fabric-samples目錄下包含多個(gè)測試用例,最簡(jiǎn)單的測試用例即為first-network下的byfn.sh腳本的測試網(wǎng)絡(luò ):
|
|