Giter Site home page Giter Site logo

chain-db's Introduction

Chain DB

History-driven Database

Chain DB is a history-driven database. This system uses a chain of blocks with stored data. Each change generates a transaction that is saved in a block. The network works centrally, so persistent data is not decentralized.

The generated blocks are immutable. New data or updated data are saved in newer blocks, in this way, it is possible to recover all data from a table throughout its life.

This database has some features by default, such as: create user account, get user account, transfer units and get transfer records as well as the main feature that is tables.

The unit property present in each user's account can be anything the project wants, it can be a type of currency, item, resource.

We are just at the beginning of the implementation of this database. Let me know if you want to contribute to this project, contact me here or via my email: [email protected].

Download

Go to Releases page and download the binary according to the desired architecture.

Binary OS Devices
chain-db-osx macOS 11+ Apple
chain-db-arm64 Linux Raspberry Pi3, Raspberry Pi4, Others

Libraries (client)

Below are links to libraries (client) to be used with your preferred programming language.

Although some libraries work on the client side, it is recommended to use it on the server side since it is a database transiting sensitive data.

Platform Repository
Rust chain-db-rs
TypeScript, JavaScript chain-db-ts

Temporary Server (test)

Use this server to test ChainDB while testing your application or while creating a new Client.

Chain DB Test Server: https://gull-dominant-mistakenly.ngrok-free.app. This server may not be always available.

Rust using chain-db-rs:

#[tokio::main]
async fn main() {
  // 1 - DB connection: server | db-name | user | password
  let db = ChainDB::connect(Some("https://gull-dominant-mistakenly.ngrok-free.app"), "test-db", "root", "1234");

  // 2 - Init a table
  let mut greetingTable = db.get_table("greeting", GreetingTable::new).await;
  println!("{:?}", greetingTable.table.greeting); // "Hi"

  // 3 - Mutate the table values and persist on chain
  greetingTable.table.greeting = String::from("Hello my dear!");
  greetingTable.persist().await; // Persist data on chain

  // 4 - See the most updated values of the table
  println!("{:?}", greetingTable.table.greeting); // "Hello my dear!"
}

TypeScript / JavaScript using chain-db-ts:

import { connect } from 'chain-db-ts'
import { GreetingTable } from './tables'

const main async () {
  // 1 - DB connection: server | db-name | user | password
  const db = connect("https://gull-dominant-mistakenly.ngrok-free.app", 'test-db', 'root', '1234')

  // 2 - Init a table
  const greetingTable = await db.get_table('greeting', new GreetingTable())
  console.log(greetingTable.table.greeting) // 'Hi'

  // 3 - Mutate the table values and persist on chain
  greetingTable.table.greeting = "Hello my dear!"
  await greetingTable.persist() // Data is persisted on the blockchain

  // 4 - See the most updated values of the table
  console.log(greetingTable.table.greeting) // 'Hello my dear!'
}
main()

chain-db's People

Contributors

wpdas avatar

Stargazers

Hassani Mohammed avatar Elliot Braem avatar

Watchers

 avatar Davi Pires de Castro avatar Lucas Alves avatar  avatar

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.