GithubHelp home page GithubHelp logo

muraneth / db3.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dbpunk-labs/db3.js

0.0 0.0 0.0 11.12 MB

DB3 Network Javascript API

Home Page: https://db3-network-crud-todomvc-demo.imotai.repl.co/

License: Apache License 2.0

Shell 0.05% TypeScript 99.79% Makefile 0.17%

db3.js's Introduction

What is db3.js

GitHub release (latest by date) npm Coveralls branch

db3.js is the db3 network javascript API and you can use it to write and query JSON documents against the db3 network. and you can build fully decentralized applications combining web3.js and db3.js

Play with db3.js

Install db3.js

yarn add db3.js

Use db3.js in action

const account = createRandomAccount()
const client = createClient('http://127.0.0.1:26619', '', account)
const nonce = await syncAccountNonce(client)
// create a database
const { db, result } = await createDocumentDatabase(client, 'desc')
const index: Index = {
      path: '/name',
      indexType: IndexType.StringKey,
}
// create a collection
const { collection, result } = await createCollection(
       db,
      'col',
      [index]
)
// add a document
const [txId, block, order] = await addDoc(collection, {
    name: 'book1',
    author: 'db3 developers',
    tag:'web3',
    time: 1686285013,
})
// query document
const query = '/[name = book1]'
const resultSet = await queryDoc<Book>(
                      collection,
                      query)   

Show Your Support

Please ⭐️ this repository if this project helped you!

Contribution

1. Checkout

git clone https://github.com/dbpunk-labs/db3.js.git
git submodule update --recursive

2. Run DB3 Localnet

cd tools && bash start_localnet.sh

3. Run Testcase

git submodule update
# install the dependency
yarn
# generate the protobuf
make
# run test
yarn test
# format the code
yarn prettier --write src
# run benchmark
yarn benny-sdk

db3.js's People

Contributors

imotai avatar jingchen2222 avatar xiyangjun avatar dependabot[bot] avatar jtsang4 avatar xuman2019 avatar omahs 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.