What is ipfs and ethereum? - blockchain

I just got a chance to work on the block-chain based platform. Could anybody help me understand the differences between IPFS and Ethereum?

You cannot store large blobs like images, pdf, videos so on the Ethereum. The Ethereum Dapp can hold a small amount of data, whereas for
saving anything more or bigger such as images, word, PDF files, and so on,
we can rely on Interplanetary File System (IPFS).
Basically, you store any file in IPFS, and then you store the IPFS hash in
the Ethereum contract. Any user with an IPFS node will be able to access
the file using that hash.
You can store data, images, the front end, and whatever you want.
IPFS is a protocol that can be used independently and not necessarily
in a blockchain. However, in real life, IPFS and the blockchain are a
perfect match! With the support of IPFS, data can remain immutable
and permanent, and just like any other content database, you can link
the address of the file stored to the Ethereum blockchain. With IPFS, the
Ethereum user has to focus only on the contract without having to put the
data on the chain itself.

Blockchain and IPFS are based on similar concepts of decentralized networks, but that's where their similarities end.
While blockchain shares a ledger with its nodes, IPFS is a peer to peer file-sharing system that hashes files (similar to the way blockchain hashes transactions), and then allows users to search for files based on those hashes.
IPFS and Blockchain are very different, and in fact you can use IPFS to store files while the hashes are kept on the blockchain. It would be like comparing Stack Overflow to Facebook. Both are websites living on the internet, but they accomplish very different tasks for their users.

Related

Which blockchain is best to implement tamper proof document?

I am just starting out as a blockchain developer and I want a blockchain service except Ethereum (already implemented) to store a hash (SHA256 and ISCC hashes) of a document in a blockchain so that it can verify its validity and is tamper proof. There is already a UI to generate hashes and I need a blockchain to store the hashes
My need is:
I want to have a blockchain service with low transaction cost and high transaction speed. Also, I want that the hashes be stored in the blockchain for a long period of time (5 years). Which blockchain would be best fit for this usecase?
To answer your question, you need to understand who will be the users of your project. Accordingly, it is necessary to use the public or private blockchain further. For public blockchains, the choice is quite small - of those that will live for 5 years, these are most likely Bitcoin and Ethereum. For private blockchains, the choice is much wider: Ethereum / Quorum, Hyper Ledger Fabic, Corda and many others. Each of them has its own complexity of deployment, development and support.
But the very first question - why do you need blockchain? To store hashes of files, you can use IPFS or cloud storages, certifying them with a digital signature of a certain "notary" participant or, for example, the owner of the file. In terms of performance and low cost, these are the most efficient solutions.
I want to have a blockchain service with low transaction cost and high transaction speed.
Everyone wants this, so you are not along with your requirements.
Also, I want that the hashes be stored in the blockchain for a long period of time (5 years). Which blockchain would be best fit for this usecase?
Currently all blockchains assume the state is stored permanently - or to the end of the world or until nobody runs nodes anymore. Whichever comes first. There is a risk of dead chain, so whatever you pick might not be around after five years. However this is a business discussion, so it is hard to answer to this one on StackOverflow.
For your use case, it does sound you do not need a blockchain at all, but just having a public data storage that is prepaid for up to five years.
You can use Emercoin NVS for upload your hashes. Service emernotar.io already does so. Also, you can use File Validator service, all scripts are open source and available on Github.

Handling user data and storage in Ethereum Dapps-Understanding

I've just started writing smart contracts and developing Dapps on the Ethereum Blockchain, basically users interacting with the smart contract and storing some lightweight data into the blockchain.
I have a general but very vague idea on how to do all of this so I simply wanted to make sure that I got stuff right, so please beare with me .
What I want to do:
User Login : I am not very sure about this. Should I handle it as a traditional user login ( database) or I could use the blockchain for that? and if so , how would I be able to do so?
Store data (Strings, boolean and an Image) into the blockchain via a web interface: I've seen some tutorials but most of them don't 'store' the data, I want to be able to show this data to my user . So maybe I should use a JSON file? I read about IPFS fo image storing but I dont know how to associate a hash to my Eth account.
What I did :
Set up my own private Ethereum Blockchain
Written a contract that handles a string ( user's name) and then returns it on the GUI
Written the web interface
TL;DR: I am trying to store user's data into the blockchain so that I can show it again but I dont know how to proceed. I am also confused about the user Login . Please help me ( any links would be greatly appreciated) or at least tell me if I'm on the right path.
For login you can have a user to sign a message using the private key in their wallet on web or mobile Then on the server-side you can verify this message came from a certain Ethereum address and create the database record for the matching address in fly
You can store data in a transactional blockchain, but it is discouraged and not the purpose of a blockchain. The data storage cost on a public Ethereum blockchain will be millions of times more than in a database or other dedicated storaeg. If you do this for learning I suggest you try products like Storj or Sia for decentralised file storage.

Are decentralised applications storing full underlying blockchain on my device?

Let's say I have few dapps installed on my smartphone. Are they storing full blockchain they are using on my device, or where it's stored?
No, your device doesn't hold the whole blockchain on it's storage (a blockchain is typically counted in GBs, while your app is probably a few MBs).
The key is IFPS (from How do dApps store data ? on Hackernoon)
Store only the content hashes on the blockchain. So, while the
blockchain stores only the hashes, the hashes themselves provide an
easy way to retrieve the large files being stored.
How it works (from ipfs.io):
Each file and all of the blocks within it are given a unique fingerprint called a cryptographic hash.
IPFS removes duplications across the network.
Each network node stores only content it is interested in, and some indexing information that helps figure out who is storing what
When looking up files, you're asking the network to find nodes
storing the content behind a unique hash.
Every file can be found by human-readable names using a decentralized naming system called IPNS.
I suggest you to read the whole Hackernoon article if you want to understand it deeper.
It is highly unlikely that the entirety of a blockchain is being stored on your device, nor is it likely that the blockchain data needs to exist on your device especially if you are simply using a DApp. The only real necessity for having the entirety of a blockchain or even snapshots of a blockchain stored on your mobile device would be if you are running a full or light node directly on your mobile device.
DApps are simply a user interface for subsequent interaction with a blockchain network. The blockchain network data is "stored" on a series of nodes which the DApp is interacting with via APIs. Think of this in terms of the Stack Overflow application. Your machine does not store the entire database of Stack Overflow, it simply requests and updates data via a series of APIs.

How to store data on the ethereum using decentralized application

I am trying to build a Decentralized application on ethereum using the solidity language.
How can i use Ethereum as database?
I mean i just want store image file on Ethereum using decentralized application.
Is that possible?
And how will it be in solidity?
you can use IPFS (checkout here : https://ipfs.io) to store data like images on the chain. Also you can checkout BigchainDB, put I assume that the first will be more suitable for your case
Storing the data on Blockchain is a costly affair.It can cost you approx.5 dollars even for the smallest kb(e.g.1 kb),calculated upon the basis of gas price.We normally store hashes of the data.
You can use 2 techniques depends upon your problem:
Storing hashes of data.
Combination of data and hashes.
We can use IPFS (https://ipfs.io/) for storing hashes to the blockchain and we can use GPG encryption to make it secure.

Permissions within a blockchain?

Everything I've been reading about blockchain from my understanding says that even on a private blockchain, every participant can view all transactions. I've seen it mentioned that a use case for block chain could be the sharing of medical data. So for example if I had a blockchain that holds the medical history of every person from birth to death in a country. Is there no way of setting up permissions so that only data relating to a person and those who have been given permission to that person's data can view it? If the data is stored on every node in a blockchain, how is a person's computer supposed to have the capacity to store the medical data of every person in a country?
I would advise looking up Medrec when related to health care. Most of the research is geared towards dealing with keeping the data off the chain. In addition, there are other blockchains that might provide a better solution, for more privacy, for example, I would look up quorum by JP Morgan. There are different formats being looked at but these can give you two possible solutions. Also, check out Health Nexus' whitepaper, it deals with medical blockchain technology. Let me know if you need more.
https://www.pubpub.org/pub/medrec
https://github.com/jpmorganchase/quorum
There are blockchains that allow defining permissions. Hyperledger Fabric is one of them. You have the ability to configure channels with data stored in the ledger of the participants in the channel only.
to pass the scalability problem of blockchains and their solutions for this purpose, you should concentrate on off-chain architecture.
right now this scenario should be considered:
save tx's to the blockchain(it should be formal)
save hashed data to an off-chain repository like DB's.
save the address of that data-hash to blockchain for future access.
yeah, you pointed to the right thing. a central point of access as an admin-node or god should be the opposite of blockchain as a distributed dream.
for this issue, the mechanism like secret-sharing or re-encrypt proxy should be realized to guarantee the privacy and security of data-hashed.
for more information read this article:
https://www.sciencedirect.com/science/article/pii/S2210670717310685
GoQuorum has an 'enhanced permissioning' model where you can do all that, and at the same time stay compatible with Ethereum standards.
Check this out: https://consensys.net/docs/goquorum/en/latest/configure-and-manage/manage/enhanced-permissions/