以太坊区块链_MetaMask:使用以太坊区块链的简单方法

以太坊区块链

This introduction to MetaMask was originally published at Bruno’s Bitfalls website, and is reproduced here with permission.

MetaMask的简介最初在Bruno的Bitfalls网站上发布 ,并在获得许可的情况下在此处复制。

In this article, we’ll explain what MetaMask is, what it’s used for, and how to use it.

在本文中,我们将解释什么是MetaMask,它的用途以及使用方法。



For a better understanding of the content that follows, please read:

为了更好地理解以下内容,请阅读:



MetaMask简介 (Introduction to MetaMask)

MetaMask is a Google Chrome, Vivaldi, Opera and Firefox extension for the browser which makes it easy for web applications to communicate with the Ethereum blockchain. In other words, MetaMask is a wallet for your browser.

MetaMask是浏览器的Google Chrome,Vivaldi,Opera和Firefox扩展,它使Web应用程序可以轻松地与以太坊区块链通信。 换句话说,MetaMask是您的浏览器的钱包

You can download it from the official website or you can get the Brave browser which is a fork of Google Chrome and comes with some very cryptocurrency-friendly features (a built-in MetaMask among others).

您可以从官方网站下载它,也可以获取Brave浏览器 ,该浏览器是Google Chrome的一个分支 ,并提供一些对加密货币非常友好的功能(内置的MetaMask)。

MetaMask installation screen

Immediately before installing it, MetaMask will request some rather liberal permissions:

在安装前,MetaMask将立即请求一些相当宽松的权限:

MetaMask permissions

It wants full control over copy-paste commands, permission to talk to external resources (websites and nodes of the blockchain), and the option to look at and modify the contents of every website you visit. In other words, it wants everything. For as long as a reputable company is behind it, this is nothing to worry about. Still, these permissions are worth keeping in mind; it wouldn’t be the first time a malicious actor got hold of a popular extension and wreaked havoc.

它希望完全控制复制粘贴命令,与外部资源(区块链的网站和节点)对话的权限以及查看和修改您访问的每个网站内容的选项。 换句话说,它想要一切 。 只要有信誉良好的公司在后面,就不必担心。 不过,这些权限仍然值得牢记; 这不是恶意演员首次掌握流行扩展并造成严重破坏

建立 (Setup)

After installing, the extension’s icon will become available in the toolbar. Clicking it will reveal the popup with the user interface. The first screen will warn us that we’re dealing with beta software and that the address we generate and use with MetaMask is visible to every page we visit, unless we sign out of MetaMask before visiting it.

安装后,扩展程序的图标将在工具栏中变为可用。 单击它将显示带有用户界面的弹出窗口。 第一个屏幕将警告我们,我们正在使用Beta版软件,并且我们访问的每个页面都可以看到我们使用MetaMask生成和使用的地址,除非我们在访问MetaMask之前先退出该页面。

MetaMask beta

The following screen warns us about Terms of Service and the fact that MetaMask is not to be blamed for anything bad that happens, should something bad happen.

以下屏幕警告我们有关服务条款的事实,以及如果发生任何不好的事情,不要责怪MetaMask。

MetaMask terms of service

Scrolling the text to the bottom will make the Accept option available. We then proceed to the password selection screen.

将文本滚动到底部将使“接受”选项可用。 然后,我们进入密码选择屏幕。

MetaMask password

The password will, just like with Mist, encrypt the JSON file that gets generated which contains information about our wallet. The password will be required of the user every time the user signs into MetaMask.

就像Mist一样,该密码将加密所生成的JSON文件,其中包含有关我们钱包的信息。 每次用户登录MetaMask时,都将要求用户输入密码。

After inputting the password, MetaMask will show a seed — a list of words from which generated addresses can be regenerated if we lose access to the browser or the wallet files due to a hardware or software error.

输入密码后,MetaMask将显示一个种子 -如果由于硬件或软件错误而无法访问浏览器或钱包文件,则可以重新生成生成的地址的单词列表。

MetaMask seed

The list should be printed and stored in a safe location if you intend to keep using these wallets. Consider it a paper wallet.

如果您打算继续使用这些钱包,则应将清单打印并保存在安全的位置。 考虑一下它是一个纸钱包

帐目 (Accounts)

After this process has been completed, a new screen with a single account will open: Account 1.

完成此过程后,将打开一个具有单个帐户的新屏幕:帐户1。

Account 1

Should you place the mouse cursor on the account name, the Edit option will appear, letting you rename it.

如果将鼠标光标放在帐户名上,将显示“编辑”选项,以便您对其进行重命名。

Account renamed

In the upper left corner, you can switch networks. Click Main Network and choose another one like Ropsten. You can find out more about these testnets here.

在左上角,您可以切换网络。 单击主网络,然后选择另一个,例如Ropsten。 您可以在此处找到有关这些测试网的更多信息。

The three dots next to the account name are a menu. They offer some options about the account like checking the account on Etherscan (possible only when MetaMask is connected to the Mainnet or a public testnet), showing the QR code of the address for easy scanning with a phone or printing a paper wallet, copying the address to the clipboard (i.e. for pasting into a wallet software) and Export Private Key which lets you create a private key from an open account — a collection of numbers and letters not unlike a password. This can be used instead of the encrypted JSON file many wallet tools generate to import the wallet into another software.

帐户名称旁边的三个点是一个菜单。 他们提供了有关该帐户的一些选项,例如在Etherscan上检查该帐户(仅当MetaMask连接到Mainnet或公共测试网时才可能),显示该地址的QR码以便于用手机轻松扫描或打印纸钱包,剪贴板上的地址(例如,粘贴到钱包软件中)和导出私钥 ,该私钥使您可以从打开的帐户中创建私钥-一组数字和字母,与密码不同。 可以使用它代替许多钱包工具生成的加密的JSON文件,以将钱包导入另一个软件。

MetaMask Private Key

There are two buttons above the three dots: three horizontal lines leading us to the settings menu (currently not interesting to us) and an icon of a human silhouette surrounded by curved arrows. That’s the Account menu which lets us create new accounts or import previously created ones.

三个点上方有两个按钮:三个水平线将我们引向设置菜单(当前对我们而言并不有趣),以及一个由弯曲箭头包围的人体轮廓图标。 那是“ 帐户”菜单,它使我们可以创建新帐户或导入先前创建的帐户。

alt

The Create Account option instantly creates a new account, making it available in the UI.

创建帐户”选项会立即创建一个新帐户,使其在用户界面中可用。

New account available

The Import Account option leads us to the screen which lets us import JSON files or private keys (like the one exported via the option mentioned before). JSON files will usually be generated with programs like MyEtherWallet or Mist. Concretely, this means that any of those wallets can generate data that is compatible for consumption by any other wallet, thereby keeping your funds safe and portable across software.

导入帐户选项将引导我们转到屏幕,该屏幕使我们可以导入JSON文件或私钥(例如通过前面提到的选项导出的文件或私钥)。 JSON文件通常将通过MyEtherWallet或Mist之类的程序生成。 具体来说,这意味着这些钱包中的任何一个都可以生成兼容于任何其他钱包使用的数据,从而使您的资金在整个软件中安全可移植。

发送和接收 (Sending and Receiving)

Let’s try sending and receiving some Ether now.

让我们现在尝试发送和接收一些以太币。

First, let’s switch to the Ropsten network. If you haven’t already, select Ropsten from the top left menu in MetaMask. Notice that the address remains the same: that’s because the algorithm used to generate a pair of keys is identical and technology-dependent, not network-dependent. A private key on one network can unlock the wallet on another network, so be careful about sharing even a Testnet private key! Only the balances of these accounts differ. Learn more about this here.

首先,让我们切换到Ropsten网络。 如果还没有,请从MetaMask的左上方菜单中选择Ropsten 。 请注意,地址保持不变:这是因为用于生成一对密钥的算法是相同的,并且与技术有关,而与网络无关。 一个网络上的私钥可以解锁另一个网络上的钱包,因此即使共享Testnet私钥也要小心! 仅这些帐户的余额不同。 在这里了解更多信息。

Next, let’s select Copy Address to Clipboard for that account.

接下来,让我们选择该帐户的“ 将地址复制到剪贴板 ”。

Copy address to clipboard

Then, let’s get some free Ether from one of the faucet sites — sites made specifically for that purpose.

然后,让我们从其中一个水龙头站点获得一些免费的以太坊,这些站点是专门为该目的而创建的。

  • https://faucet.metamask.io automatically reads the MetaMask address of your browser and sends Ether to it.

    https://faucet.metamask.io自动读取您的浏览器的MetaMask地址,并将Ether发送给它。
  • http://faucet.ropsten.be:3001 requires you to manually input the address to which to send the Ether. Use the first field to paste the previously copied address into it if you’re using this site.

    http://faucet.ropsten.be:3001要求您手动输入将以太币发送到的地址。 如果您使用此站点,请使用第一个字段将以前复制的地址粘贴到其中。

Either of these options is fine. Because these faucets use the real Ethereum blockchain (but on a Testnet), it can take up to a minute for the funds to arrive.

这些选项都可以。 由于这些水龙头使用真实的以太坊区块链(但在Testnet上),因此资金可能需要一分钟才能到达。

Now that we have Ether on one of our accounts, let’s try sending it to another. First, we pick the account we created and copy its address. Then we switch to the account with Ether and go to Send.

现在,我们在其中一个帐户上有了以太币,让我们尝试将其发送到另一个帐户。 首先,我们选择创建的帐户并复制其地址。 然后,我们切换到Ether帐户,然后转到Send

Funds have arrived

This is the screen on which we input the recipient’s address. Under amount, let’s put something like 0.1 and we’ll leave the transaction data field as it. Click Next.

这是我们输入收件人地址的屏幕。 在金额之下,让我们输入类似0.1的值,然后将交易数据字段保留为原样。 点击下一步。

MetaMask will generate a transaction (TX) for signing and present it to you.

MetaMask将生成用于签名的交易(TX)并将其呈现给您。

Send screen

Gas Price and Gas Limit are changeable and depend on the busyness of the network, as explained in this article. On the Ropsten network, both values are fine at their defaults. Pressing Reject will cancel the TX and return to the previous screen, Reset will return default values if you changed anything, and Submit will send it.

天然气价格和天然气限制是可变的,取决于网络的繁忙程度,如本文所述 。 在Ropsten网络上,两个值均为默认值即可。 按拒绝将取消发送并返回上一屏幕,如果您进行了任何更改, 则按重置将返回默认值,然后按发送将其发送。

Transaction suggestion

After a few minutes at most, the transaction should be confirmed.

最多几分钟后,应确认交易。

Sent transaction

代币 (Tokens)

Support for tokens in MetaMask is limited at best. They currently only support standard ERC20 tokens and only partially: they’re not easy to send from MetaMask, only relatively easy to view. Luckily, for as long as the MetaMask account is unlocked and open, visiting any of the three pages below will allow sending of tokens from the currently open address:

MetaMask中对令牌的支持最多是有限的。 他们目前仅支持标准ERC20令牌,并且仅部分支持:从MetaMask发送不容易,仅相对容易查看。 幸运的是,只要已解锁并打开MetaMask帐户,访问以下三个页面中的任何一个都将允许从当前打开的地址发送令牌:

Web3 (Web3)

It’s important to keep in mind that MetaMask injects Web3.js into every website you open while you have your MetaMask extension unlocked. Web3 is a software library which allows websites to easily communicate with the Ethereum blockchain.

重要的是要记住,在解锁MetaMask扩展程序时,MetaMask会将Web3.js注入到您打开的每个网站中。 Web3是一个软件库,可让网站轻松与以太坊区块链进行通信。

While Web3 injection isn’t a security risk in and of itself, it doesn’t mean it can’t become one. Not only do all visited websites see your MetaMask Ethereum address when you’re logged in, but it’s also possible that if someone should ever inject some malicious code into Web3, MetaMask itself, or even the web page you’re visiting, they could glean more private information than you’d be willing to share (your user account on a website and its connection to an Ethereum address, effectively identifying you).

尽管Web3注入本身并不是安全风险,但这并不意味着它不能成为一个安全隐患。 登录后,不仅所有访问的网站都能看到您的MetaMask以太坊地址,而且如果有人将某些恶意代码注入Web3,MetaMask本身甚至您访问的网页中,它们也可能会收集到比您愿意分享的私人信息更多(您在网站上的用户帐户及其与以太坊地址的连接,可以有效地识别您的身份)。

Therefore, it’s recommended to keep trivial amounts of Ether on your MetaMask wallet, and to use MetaMask only in a clean browser without any other extensions.

因此,建议在您的MetaMask钱包中保留少量的以太币,并且仅在没有任何其他扩展名的干净浏览器中使用MetaMask。

We’ll cover Web3 in detail in an upcoming post.

我们将在下一篇文章中详细介绍Web3。

结论 (Conclusion)

MetaMask is a very practical solution for using the Ethereum blockchain and keeping Ether in your browser. While it may have some security implications, MetaMask contributes greatly to the mainstream-ization of blockchain technology and cryptocurrency in general with its simplicity and ease of use — something you’ll see in our post about running your own private blockchain.

MetaMask是使用以太坊区块链并将以太币保留在您的浏览器中的非常实用的解决方案。 尽管它可能会带来一些安全隐患,但是MetaMask的简单性和易用性总体上为区块链技术和加密货币的主流化做出了巨大贡献-您将在我们的文章中看到有关运行自己的私有区块链的信息。

翻译自: https://www.sitepoint.com/metamask-ethereum-blockchain/

以太坊区块链

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值