Hot answers tagged

78

Both Peer to peer Data sharing network in which files are addressed by the hash of their content (Content-addressable) Decentralized file transfer systems Can be used to store the HTML, CSS and JavaScript that implement an application on top of the other decentralized systems. Can be used to store (arbitrary) static files. Some imply that Swarm may be ...


37

Your example shows storing an IPFS identity using it's alphanumeric encoding (Qm...), which is the same Base58 encoding that Bitcoin uses. However, what it's representing at its core is a number (the hash). Storing the identifier in the Base58 format needs to be a String because it includes letters (and what actually gets saved is the ASCII code for each ...


33

Basically, you store any file into IPFS and then you store the IPFS hash in the Ethereum contract. Any user with an IPFS node is going to be able to access the file using that hash. You can store data, images, the front end, etc. whatever you want. Here you have an example: https://github.com/AdrianClv/ethereum-ipfs No. Even if your DAPP frontend (the HTML/...


26

Adding to tayvano's answer, the main author of Swarm has written a detailed perspective. Here are some parts of his answers (edited for clarity): Similarities Swarm and IPFS both offer comprehensive solutions for efficient decentralised storage layer for the next generation internet. Both high level goals and technology used are very similar... As a ...


20

Here's one illustration of distributed and decentralized systems: Distributed computing has a long history in computer science ("became its own branch of computer science in the late 1970s and early 1980s"). A distributed system is a model in which components located on networked computers communicate and coordinate their actions by passing messages. ...


18

I can only answer for libp2p coming from the IPFS project (and not devp2p coming from Ethereum). libp2p is a modular P2P networking stack used to connect to other peers, finding and transferring content. You can see it as a collection of protocol that can use different routing, discovery and transports, depending on your needs. It began its development ...


17

LIBP2P is a protocol implementation toolset or library that allows you to build software for different P2P networks and scenarios. DEVP2P and RLPx are presented in the Ethereum documentation as something separate, but in fact: They are the same thing if you are talking about a protocol They are different things if you are talking about message formats The ...


13

While I mainly agree with eth's answer, I would like to spin up some confusion and since you are writing a paper, it's worth to mention that older literature is not consent on that determination of decentralized and distributed. In that context, Baran (1962) is often quoted, from "On Distributed Communication Networks", explaining it like that:


13

Note that putting the blockchain (and state etc) on swarm is already planned and thought out. Integration with IPFS is also in the plan but may have some difficulties. If and when solved this answers your question. Purely IPFS solution, full nodes can simply add their chaindata subdirectory to IPFS, while light clients download by hash, see this reddit ...


13

No, you will have to store your data somewhere else and store the hash of this data and its location in the blockchain. You should have enough space to store it but remember the shorter your data is the less gas you need. So use URL shorteners. Storing data into a transaction costs gas an blocks have a dynamic gas limit. You would have to make the gas limit ...


13

I don't agree at all. Plus, @Meije is from Storj Team. IPFS and Swarm are not just an idea but the most advanced technologies/protocols in decentralised blockchain based storage. IPFS and Swarm are being used by the blockchain community. Swarm: Swarm is part of the Ethereum stack http://swarm-guide.readthedocs.io/en/latest/ IPFS: https://github.com/...


12

Read the documentation: Every command usable from the cli is also available through the HTTP API. For example: ipfs swarm peers curl http://127.0.0.1:5001/api/v0/swarm/peers So for the command: USAGE ipfs add ... - Add a file to ipfs. ARGUMENTS < path >... - The path to a file to be added to IPFS. https://ipfs.io/docs/...


12

If I understand your question correctly, what you are referring to is called secure multi-party computation which is not a current capability of smart contracts. In fact, it's a challenging problem that is probably best done off the blockchain as it can be computationally intensive. I'd recommend looking at MIT's enigma and openPDS projects for starters. ...


10

It's basically the other way around. The Ethereum blockchain will store a hash that points to a file in either Swarm, IPFS or something similar. From a DApp point of view the following could happen in a theoretical distributed twitter-clone: You go to my-awesome-app.eth in the Mist browser. The domain gets translated to a unique Swarm hash. Swarm ...


9

The short answer is no. There's a term for computing on encrypted data: homomorphic encryption. This is currently not usable for regular applications. If it were possible it would have huge positive implications for security. The idea of homomorphic encryption is the ability to carry out computation on ciphertext, so that the result when decrypted would be ...


9

You can store a struct in a struct. pragma solidity ^0.4.11; contract Nest { struct IpfsHash { bytes32 hash; uint hashSize; } struct Member { IpfsHash ipfsHash; } mapping(uint => Member) members; function addMember(uint id, bytes32 hash, uint size) public returns(bool success) { members[id].ipfsHash.hash = hash; ...


9

Whilst I have not worked with IPFS hashes, the solidity types documentation states that you can store fixed size byte arrays up to 32 bytes. As such if you want to store the whole hash in one data property you have to use the dynamic array type bytes. This is outlined here. If you want to store them separately, it seems perverse to me to implement the ...


8

Ethereum is too heavy/expensive to store large blobs like images, video, etc.. Hence some external storage is necessary to store such objects. This is where IPFS comes in. The Ethereum DAPP could hold smaller state variables. You can host static pages, data required for your app etc.. on IPFS. etherface.io is a DAPP built on Ethereum and IPFS Frontend is not ...


7

bytes because they are more than 32 bytes. An IPFS hash: itself specifies the hash function and length of the hash in the first two bytes of the multihash. In the examples above the first two bytes in hex is 1220, where 12 denotes that this is the SHA256 hash function and 20 is the length of the hash in bytes - 32 bytes. Source Although SHA2-256 ...


7

As per the documentation Set the provider: EmbarkJS.Messages.setProvider('orbit', {server: 'localhost', port: 5001}) Saving Text EmbarkJS.Storage.saveText("hello world").then(function(hash) {}); Retrieving Data/Text EmbarkJS.Storage.get(hash).then(function(content) {}); Deploying to IPFS To deploy a dapp to IPFS, all you need to do is run a local IPFS ...


7

IPFS uses multihash where the format is the following: base58(<varint hash function code><varint digest size in bytes><hash function output>) The list of hash function codes can be found in this table. Here's some pseudocode of the process using SHA2-256 as the hashing function. sha2-256 size sha2-256("hello world") 0x12 0x20 ...


6

Sure, you can definitely prove that both parties made the agreement; the simplest approach would be to create a contract that contains a signAgreement(bytes32 hash) function which allows each party to send a transaction that registers agreement with the given hash (and ideally pushes out a log), and put the doc with that hash on IPFS.


6

When storing data on the Ethereum blockchain, each computation task has a cost (in gas unit) and you usually want to reduce as much as possible the cost of the transaction for your application. You want to store an IPFS hash (or Multihash) (or CID) like QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u in a smart contract First: Read this to understand ...


5

Just to point out, you don't need the public gateway. When you have a swarm node running, you have your own gateway at http://localhost:8500/bzz:/. (I'd post this as a comment but stackexchange won't let me. Apologies.)


5

UPDATE: swarm-guide at RTD http://swarm-guide.readthedocs.io/en/latest/usage.html (Work in progress, expect decent status by mid december 2017) but native to which level? so there three levels that support the bzz family of uri schemes there is mist with builtin support or in your normal browser https://github.com/ethereum/go-ethereum/blob/swarm/swarm/...


5

Watch this demo to setup IPFS node https://www.youtube.com/watch?v=8CMxDNuuAiQ Once Node is setup and you are able to create files in your node and access it then follow these steps. Command to install the ipfs js library npm install ipfs --global Here is the sample code to perform operations on an IPFS node https://github.com/ipfs/js-ipfs/blob/master/...


5

IPFS specifies that the hash should be a multihash. This consists of a byte indicating the hashing algorithm, followed by another byte for length. This is then base58-encoded. The hashing algorithm is normally sha256, identified by 0x12, with a length of 0x20. This encodes as "Qm". In theory other algorithms are legal in IPFS, so if you've got code you ...


5

Here are some js functions for stripping and re-adding the first two bytes containing the hash function and size, suitable for web3. import bs58 from 'bs58' // Return bytes32 hex string from base58 encoded ipfs hash, // stripping leading 2 bytes from 34 byte IPFS hash // Assume IPFS defaults: function:0x12=sha2, size:0x20=256 bits // E.g. "...


5

Got a reply from an Infura member. At the moment if you pin objects on their nodes they won't be removed. Unpinned objects are garbage collected when the data store needs to reclaim space. File size is not explicitly limited but you might encounter gateway timeout for very large files.


4

What I've done in a previous project is simply to add the data to IPFS first then send the Ethereum transaction with the IPFS hash of the newly-created content once that appears to have happened correctly. In some circumstances if something goes wrong before the Ethereum transaction completes this will leave "orphan" data in the form of newly-created content ...


Only top voted, non community-wiki answers of a minimum length are eligible