以太坊ipfs_动手:Infura和以太坊上的IPFS入门

以太坊ipfs

by Niharika Singh

由Niharika Singh

动手:Infura和以太坊上的IPFS入门 (Hands On: Get Started With Infura and the IPFS on Ethereum)

为什么选择Infura? (Why Infura?)

There are a lot of pain points being faced by blockchain which may be solved by Infura and/or the InterPlanetary File System (IPFS), to some extent. These are the main challenges:

区块链面临很多难题,Infura和/或行星际文件系统(IPFS)可以在一定程度上解决这些难题。 这些是主要挑战:

  1. It’s expensive to store data on the Ethereum blockchain

    在以太坊区块链上存储数据非常昂贵
  2. It’s tough to configure an Ethereum geth client

    配置以太坊geth客户端很困难
  3. It’s tough to scale the infrastructure

    扩展基础架构非常困难

If you use Infura, access to the Ethereum network and the IPFS becomes a lot faster. It no longer takes hours to sync up the geth client which uses up a huge chunk of memory and bandwidth while the entire blockchain gets downloaded.

如果您使用Infura,则访问以太坊网络和IPFS的速度将大大提高。 同步geth客户端不再花费数小时,该客户端在下载整个区块链时会占用大量内存和带宽。

Here are some other advantages that come with using Infura:

以下是使用Infura的其他一些优点:

  • Huge amounts of data can be stored on the IPFS, and just the hash of the file can be stored on Ethereum.

    大量数据可以存储在IPFS上,而只是文件的哈希可以存储在以太坊上。
  • Infura provides secure, reliable, scalable, and easy to use APIs to access the Ethereum network and the IPFS. Developers do not have to worry about the infrastructure of an Ethereum node or an IPFS node. That is taken care of by Infura.

    Infura提供安全,可靠,可扩展且易于使用的API来访问以太坊网络和IPFS。 开发人员不必担心以太坊节点或IPFS节点的基础架构。 这由Infura负责。
  • Infura provides TLS enabled public endpoints.

    Infura提供启用TLS的公共端点。
  • The code is portable on Ethereum’s interface using JSON RPC, Web3.

    该代码可使用JSON RPC Web3在以太坊的界面上移植。
  • Infura is practically a developer’s Swiss Army knife, and also saves the deployment team from the hell of scalability issues.

    Infura实际上是开发人员的瑞士军刀,也使部署团队免于遭受可扩展性问题的困扰。
  • And finally, Infura is trusted:

    最后,Infura值得信赖:

dApp说明 (dApp Description)

Our dApp will take a file as input from a user and upload it to the IPFS by invoking an Ethereum contract. The hash of the file will be stored on Ethereum.

我们的dApp将从用户那里获取文件作为输入,并通过调用以太坊合约将其上传到IPFS。 文件的哈希值将存储在以太坊上。

This is the process we’ll go through:

这是我们要经历的过程:

  1. Take file as an input

    将文件作为输入
  2. Convert file to buffer

    将文件转换为缓冲区
  3. Upload buffer to IPFS

    将缓冲区上传到IPFS
  4. Store hash of file returned by IPFS

    存储IPFS返回的文件的哈希
  5. Get user’s Metamask Ethereum address

    获取用户的Metamask以太坊地址
  6. User confirms transaction to Ethereum via Metamask

    用户通过Metamask确认与以太坊的交易
  7. IPFS hash is written on Ethereum

    IPFS哈希值写在以太坊上

涉及的技术栈 (Tech Stack Involved)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值