Giter VIP home page Giter VIP logo

tiny-storage's Introduction

TinyStorage

Decentralized storage in Tinychain, based on IPFS.

Why we need decentralized storage

  • Centralized storage is always not reliable.
    • The keys to some centralized database are always forgottern, which means we lost these data.
    • Centralized storage service providers always struggle for the commercial competition, and cannot promise to store our data forever.
    • Centralized databases suffer from the hacker attack.
  • Make full use of existing network upper-layer infrastructure to store and retrieve data at a low cost.
    • CDN(content delivery network).
    • Node network built for some blockchain projects like Bitcoin and Ethereum.

Decentralized storage in blockchain

In blockchain project, we met some demands that can improve the performance of blockchain:

  • Old block data can be archived as single or several compressed files, to release more disk storage. And these archived files don't need storing in every node.
  • Some event data made by Oracle need to be stored in blockchain for a certain time. It's the best way to store these kind of data in decentralized storage.
  • Blockchain can provide storage service based on tokens model as an upper-layer application.

Examples with Blockchain

Scenario 1: Trusted File Storage

Alice created a music and wants to sell it through blockchain network. She deploys(or use) a smart contract, which allows Bob to upload their public keys and call the file demand as an order. Then Alice uses the public key from Bob to encrypt the music file, uploads it to the IPFS, and transfers the content hash to the smart contract. The contract will automatically check the content hash and verify its corresponding file's existence in network. If pass, contract will transfer the token from Bob's account to Alice's account.

Scenario 2: Copyright Protection

Alice created a music and wants to declare her copyright. She uploads the file to private IPFS network provided by blockchain, and signs the content hash IPFS returned. Also Alice deploys(or use) a smart contract, and send the signature, content hash of her work, her public key, and the current timestamp to the contract. Other people will find the content hash and its signature with earliest timestamp, verify it with the a list of public key that belongs to different copyright declarers, and find out which declarer is the one holding the copyright.

Scenario 3: Temporary Oracle Event Data

A contract calls the demand of data from reality throught off-chain event. It calls a oracle service node, and this node retrieves the data from its data source, uploads it to the IPFS and signs the content hash. Other oracle service nodes retrieve that data from IPFS, compare it with the data retrieve from their own data source, and sign its content hash if passed. The contract collects enough signatures and public keys, and verify the content hash, and retrieve from IPFS with it.

Scenario 4: IOT(Internet of Things)

The sensors play an important role in IOT. They collect the data from outside, compute with given algorithms, and send the results back. When we combine IOT with blockchain, we have to consider the size of dataset sensors collect. If the specific data of one sensor is just stored in that, it's very easy losing, because a sensor is not a reliable device. If we upload all the data sensors hold to a centralized storage, it's a huge dataset and the risk of hack attack arises. So it's a better way to upload them to the IPFS network, provided by thousands of sensors around the area. At the same time, we can retrieve the data we need from every sensor at low cost.

Features

TinyStorage provides several necessary capabilities for blockchain

  • read and write data with IPFS.
  • verify the data existness in IPFS.
  • expose interface and interact with smart contract.

For more details, please read design.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.