|
智能合约可以用来做什么
智能合约可用于各种不同的环境,但最直接的用法可能是您已经熟悉的一种:加密货币。
"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."
智能合约的其他一些流行用例包括:
启用数字资产的转移。那些转让NFT等数字资产所有权的人是智能合约的自然使用。“在这种情况下,特定数字艺术作品的权利在特定条件或规则下从一方转移到另一方,”面向游戏玩家的Web3平台Xchange Monster的首席执行官Felix Honigwachs说。
运行byfn测试网的准备工作,也是搭建开发环境的过程,最终,测试网能成功运行也说明环境搭建成功。
新建一个目录并进入:
$mkdir hyperledger&&cd hyperledger
1
下载执行脚本,此脚本用来自动化下载fabric镜像、程序和测试网运行脚本等工具:
$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]
去中心化金融。智能合约使开发人员能够构建金融应用程序,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.
“如果你想在无需信任的环境中做更多事情,而不仅仅是来回汇款,你需要智能合约,”API3的Boder说。
编写和部署智能合约的工具
Mist Browser——它是一个浏览和使用dApp的工具。它是一个单独的浏览器,可用于浏览dApp并与之交互。
Truffle Framework——Truffle是一个流行的以太坊开发框架。它具有内置的智能合约编译、链接、部署和二进制管理。
Metamask——MetaMask是一座桥梁,允许人们今天在他们的浏览器中访问明天的分布式网络。它允许用户直接在浏览器中运行以太坊dApp,而无需运行完整的以太坊节点。
Remix——Remix是一个基于Web浏览器的IDE,允许用户编写Solidity智能合约,然后部署和运行智能合约。
fabric-samples目录下包含多个测试用例,最简单的测试用例即为first-network下的byfn.sh脚本的测试网络:
|
|