简体   繁体   中英

How to use Blockchain for storing data

So basically I'm building a webapp, which I make requests to PHP to READ/WRITE a MySQL database, looking in Google I found a Quora blog post about Blockchain databases, I've seen one (it looks pretty good) it's BigchainDB the thing is I am on a shared hosting, and obviously I can't run Python and anything just simple and plain PHP scripts and else.

My question is: Is there any way to host a database on Blockchain from a shared hosting (free) or use Blockchain in MySQL in any form?

So the answer is no. Here are the reasons I think you can adopt to add security to your APIs.

  1. You can use Oauth2.0 for your api that is doing all the CRUD operations.Here is a reference https://oauth.net/code/php/ .

  2. If i assume that you host your db in some good hosting like was, Heroku I think its sufficient. Only thing that you need to do is securing the APIs that talk to this database.

The reasons why you should not be using Blockchain is because your applications don't need it.Blockchain fits the case where there are multiple parties involve in a business process and they don't trust each other and each one has some contributions which is crucial for the proper functioning of the business.For example crude oil to usable fuel in oil/gas industry.

As added by a horse with no name you severely limit the through output when you are using blockchain.A typical read/write will take more time as it will not be limited to simple network calls but rather much more.

Is there any way to host a database on Blockchain from a shared hosting (free) or use Blockchain in MySQL in any form?

It appears that you're asking two questions in one. Here's how I might divide up:

  1. Can I host a database on a blockchain?
  2. How would I use MySQL with blockchain?

Let's look at these questions in order.

1. Can I host a database on a blockchain?

Yes, you can. A blockchain is basically a shared ledger that contains data entries. So when you host a blockchain, you are naturally hosting a database. For instance, the Bitcoin blockchain is a database of Bitcoin transactions.

hosting (free)

You may not find free hosting, especially since blockchain mining can computationally expensive depending on the consensus algorithm. However, you can always use your own computer to host simulate a network of blockchain nodes, setting up several instances of a Docker container that communicates with each other.

2. Use Blockchain with MySQL

Before I answer this, let me assume a situation. Perhaps, you want to host a MySQL DB that contains entries from the blockchain. You may be motivated to do this to get better query performance on your local environment.

In this case, I think you would have two kinds of databases in your system

  1. Blockchain (Shared Ledger)
  2. MySQL DB

You would address your problem by replicating the entries on the blockchain to MySQL. You would also replicate the difference periodically to make sure your MySQL DB is in sync with the contents of the blockchain. Once you sync, you can use your MySQL DB with your app by using an ORM (Object-relation manager) on PHP.

Interestingly, bitcoind , the bitcoin-core daemon, builds its local database (powered by BerkeleyDB) to reference transactions on a full node.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM