问题标签 [js-ipfs]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
140 浏览

javascript - UnhandledPromiseRejectionWarning: InvalidRepoVersionError: 不兼容的 repo 版本。(IPFS-JS 0.55.3)-(节点 JS 14.17.0)

我刚刚了解了 ipfs js,我安装的版本是 0.55.3 版https://www.npmjs.com/package/ipfs),此外我还在使用版本14.17.0(LTS)的 node js和MacOS BigSur 11.4

当我按照链接https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101上的教程进行操作时,我总是会收到如下错误:

这是我的 index.js 中的代码:

这是我的 package.json:

你能帮我找到解决这个问题的方法吗?

0 投票
0 回答
119 浏览

ipfs - Determining the CID of larger (> 256KB) files

I'm setting up a repo to be used in projects where CID (related) data needs to be transacted on-chain and where I'm following a work-flow of:

1.) Establishing the CID data; 2.) Transacting said data; 3.) Publishing/Importing data in to IPFS after a successful transaction.

The main purpose of the repo is to reliably determine CIDs without importing data into IPFS(step 1). The workflow is aimed at avoiding the risk of front-running, based on data becoming publicly available before the transaction sub 2 is completed (or even initiated). My thoughts on this perceived risk, basically run down to this:

The purpose of the on-chain transaction is not only to uniquely identify content (say NFT material), but also to establish/determine its provenance, or create some form of connection with its creator/(original) owner. Cleary the public availability of such content, detracts from the core purpose of such a transaction, since it allows for - let's call it - NFT front running; one could monitor the network/specific nodes generally involved in publishing NFT(like material)to the IPFS network, for announcements on data that has been added, and claim the mentioned connection for oneself.

Question: Is this "problem" as practical as I am perceiving it? I can only find very limited information on mitigating this risk, although 1.) the practice of creating gas-less NFT's is increasingly popular and 2.) most of the data will likely enter the IPFS through pinning services (with presumably short announcement intervals) are increasingly popular (instead of via self-managed nodes where one could programatically decouple adding(pre-transaction) and pinning/announcement(post-transaction).

Issue(the main reason of this entry): I'm having difficulties establishing the CID for content exceeding the block-size.

Creating a DAG Node and adding children to it:

The Links property of the created DAG matches that of the DAG retrieved from the local ipfs node and that from Infura (of course based on same content). The problem is that, unlike the retrieved DAG Nodes, the data field of the created DAGNode is empty(and therefore yielding a diff CID):

DAGNode retrieved: Data property containing data

DAGNode created: Data property is Empty

I'm adding to IPFS like so:

and subsequently getting the DAG (from both Local Node and Infura Node) like so(, to compare them with the created DAG):

IPFS Docs on the issue of work with blocks state that "A given file's 'hash' is actually the hash of the root (uppermost) node in the DAG."

You could suspect that the DAG node's Data field plays a role in this. On the other hand, looking at the length of "Data", the js-ipfs examples on dag.put ('Some data') and the IPLD DAG-PB specifications ("Data may be omitted or a byte array with a length of zero or more"), this property seems more arbitrary. (The Data array/buffer from both the infura and local ipfs node have the same content)

How can I create a root DAG node (using a content buffer and CID options), with not only the same Links property, but also the same Data property as the DAG root I'm getting after adding the same content buffer to an ipfs instance?

0 投票
0 回答
82 浏览

node.js - 如何阻止 IPFS Http 客户端中的重复文件?

我试图用 nodejs构建一个IPFS上传器。但我可以多次上传同一个文件。我如何阻止像桌面 IPFS 客户端一样的重复项?

0 投票
0 回答
169 浏览

javascript - pinFileToIPFS 400(错误请求)

我的目标是创建一个反应应用程序,允许用户使用 PINATA 上传图像并将其固定到 IPFS。我尝试了几次,但我不明白为什么我的请求被拒绝了。我明白了

POST https://api.pinata.cloud/pinning/pinFileToIPFS 400(错误请求)

我按照这个说明(https://github.com/PinataCloud/Pinata-SDK):pinFileToIPFS想要一个“可读流”,我认为我的“streamFile”是一个可读流(streamFile instanceof stream.Readable是TRUE),所以我不知道为什么会被拒绝。

我所做的是

然后我编辑了 App.js 文件如下:

谢谢你们

0 投票
1 回答
123 浏览

blockchain - 从网页上传数据到 IPFS

我们如何将数据从网页上传到 IPFS 服务器?在 IPFS 中,我已经上传了一个 .txt/JSON 空文件。该文件可以是 .txt 或 JSON 文件。

0 投票
0 回答
56 浏览

ipfs - 如何向 ipfs 端点发出请求?

我有一个 ipfs 端点,它在 ipfs 浏览器中打开(勇敢)。但是,当我向 axios 之类的东西发出请求时,它会返回一个 cors 错误。我不控制 ipfs 端点,因此无法更改标头。有没有办法在js中访问ipfs端点?怎么做?似乎有 js-ipfs,但我不确定如何使用它来获取该端点的内容。

0 投票
0 回答
89 浏览

blockchain - 如何构建 IPFS 基础元数据 URI?

我需要将 ipfs 文件作为 ipfs.io/ipfs/Qmabcdefgh/1.png

ipfs.io/ipfs/Qmabcdefgh/2.png 等

我已经看到上面的一些 NFT 元数据的哈希没有改变,只有 tokenId 改变了。怎么做?。

0 投票
1 回答
510 浏览

blockchain - 如何通过保持相同的 CID 将文件上传到 IPFS

  1. 将2 个图像存储在 IPFS 中并将其固定
  2. IPFS URI 应该像

ipfs://ipfs.io/hashCID/O.png

ipfs://ipfs.io/hashCID/1.png

  1. 这里的 hashCID 应该是一样的。只需更改下一个令牌 ID,您就可以检索图像。
0 投票
0 回答
21 浏览

reactjs - 通过反应应用程序调用 ipf 永远挂起

我正在尝试使用ipfs-http-client包将小 JSON 添加到 IPFS,我可以看到 IPFS 在本地机器中作为守护进程运行而没有任何问题,而且我还可以通过 linux 控制台向 IPFS 添加字符串但是当我从 react 应用程序尝试相同的事情时它是不工作

0 投票
1 回答
85 浏览

node.js - 使用 Node.js 将 IPFS 文件保存到磁盘

我正在尝试使用 Node.js 中的 ipfs-core 模块将文件保存到磁盘。

我试过了

但我无法打开保存的文件。node.get() 似乎也不起作用。有谁知道我在哪里滑倒?