1

Sorry for a newbie question. I am learning etheream and would like to know if it's possible to setup ethereum blockchain where tokens represent database records and not currrency for e.g. user information ? I think storing data on blockchain is not safe and expensive.

0

On the Ethereum blockchain, you can deploy a program called "Smart contract". In this program, you can define data structures (which will be stored in the blockchain) and functions (to execute logic and interact with this data stored in your smart contract).

It exists several programming languages for Ethereum smart contracts but the most famous is Solidity (here is the documentation).

For example, this contract below allows to store a simple integer into an Ethereum blockchain. Any address/account can send transactions to this contract to set or get the stored data.

pragma solidity ^0.4.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) {
        storedData = x;
    }

    function get() constant returns (uint retVal) {
        return storedData;
    }
}

To answer your question, you can setup your own Ethereum blockchain (private blockchain) or use the public one to store data. By definition, these is safe because your data history is immutable, the contract is decentralized and transparent. So that way, it's cheap because you don't really need anymore a complex and expensive backend infrastructure. Your smart contract (aka database) is deployed on this peer2p network with redundancy and scalability. But it's not free, the reading transactions are free but the writing transactions have transaction fees called gas.

I really advice you to have a look on the official documentation

  • It's a great explanation. I've started writing a contract which will hold certain user attributes i.e. a record as in database. I'm wondering what happens if this contract is used by many consumers through a DAPP and if they all starts writing their own users. What about performance and scalability (I'm talking of a million users here) ?. – adhiman Oct 16 '16 at 21:59
  • In term of performance and scalability. It's not really a matter of your smart contract, but a matter of the Ethereum platform itself. You need to know that every user will be considered as a node (full or light) on this peep2p network, so every node has locally the blockchain, that's why read data will always be fast (less than 1 second). For writing data (transaction), it's a bit longer because the transaction has to be mined by miners (proof of work: validation of the whole blockchain) and at the moment, on Ethereum it takes about 14 seconds. on Bitcoin it's 10 minutes. – Greg Jeanmart Oct 17 '16 at 12:40
  • So, lets say, a struct array of around 1 billion entries in the smart contract, Do you think it's possible or do I need a separate database somewhere which link to the smart contract.? Afterall, it requires storage but I don't know from where this memory will come from. (miners ?) – adhiman Oct 17 '16 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.