Code Monkey home page Code Monkey logo

bandchain's Introduction

BandChain - Decentralized Data Delivery Network

This repository is a monorepo containing the reference implementation of BandChain and its various supporting tools. See below for the breakdown and explanation of each module. README for each of the modules.

Table of Contents

Module Description
chain ๐Ÿ”— BandChain blockchain reference implementation
bridges ๐Ÿ“ก Lite client bridges on other smart contract platforms
lambda ๐Ÿ‘ทโ€โ™‚๏ธ AWS Lambda package for running data source executables
go-owasm ๐Ÿ€ Go library for executing oracle scripts with Wasmer
helpers ๐Ÿ”ช Client-side utility libraries
obi ๐Ÿ“ฆ Oracle binary encoding implementations
owasm ๐Ÿ”ฎ WebAssembly library for writing oracle scripts
scan ๐Ÿ” Web interface to explore D3N network

Running with Docker

There are 2 ways to run bandchain

Run on 4 validators

./chain/docker-config/generate-genesis.sh && docker-compose up multi-validator

Run 1 validator (for development)

./chain/docker-config/single-validator/generate-genesis.sh && docker-compose up single-validator

(Optional) Run Owasm Studio

docker-compose up <single or multi> owasm-studio

Tear down

docker-compose down -v

Running a Validator Node

๐Ÿ“š Guide to Becoming a Validator

License & Contributing

All modules are licensed under the terms of the Apache 2.0 License unless otherwise specified in the LICENSE file at module's root.

We highly encourage participation from the community to help with D3N development. If you are interested in developing with D3N or have suggestion for protocol improvements, please open an issue, submit a pull request, or drop as a line.

bandchain's People

Contributors

alessio avatar benzbeeb avatar dependabot-preview[bot] avatar dependabot[bot] avatar evilpeach avatar joaopbini avatar ntchjb avatar perimeko avatar pitchanai avatar prin-r avatar pzshine avatar rav-11 avatar smiled0g avatar sorawit avatar tansawit avatar taobun avatar thebevrishot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bandchain's Issues

Stop using vague `prefixes` in BytesLib / StoreProofLib

prefixes is rather confusing, and is not even prefix. It's actually the combination of whether a proof is going on the left or right direction and a variable length data for a merkle internal node that is not relevant to Merkle proof (such as subtree version / subtree size / etc). Additionally, it's a uint256[] even though it has nothing to do with integers!

So, let's remove prefixes and introduce two new things:

  • uint256 mask: This is a uint256 bitmask that encoded Merkle proof direction, kinda similar to Sparse Merkle Tree
  • bytes[] extraInternalNodeData: Using, ABIEncoderV2, we can just directly accept bytes array. If it proves to be inefficient, we can always go back to the old approach, but I doubt it.

Add minting module

Introduce the inflation of BANDs. Adding minting features that will inflate BANDs to blockchain validators for every block produced, using the same parameters as the Cosmos chain.

Document on how to use d3n docker

What to do

  • Explain how to run docker correctly
  • Explain how to upgrade code and run with new upgraded images
  • Explain how to restart chain to the genesis state

On-chain code storage

Currently a compiled Wasm code needs to be sent with a data request transaction, causing a transaction to be huge. This is silly if the same source code is sending over and over. This epic is about creating messages and handlers to add code storage functionality.

Support parsing value of zoracle Merkle tree

The value actually consists of multiple things, including code hash, valid block number, actual data value, etc. Let's make smart contract on Ethereum able to parse the information.

Change d3n server to use Tendermint/Cosmos struct

Currently it re-defines some data types that should just have been imported from Tendermint. Let's do that to reduce the amount of code we need to maintain. Note that this means we need to use the same mechanism to encode/decode data to JSON (most likely involved amino/codec).

Implement `i64` array encoding on Owasm

We updated the way an array can be encoded by using just one 64 bit integer (top 32 encoding the size, and bottom 32 encoding the location of data). Let's update owasm code base to work like that.

Change address prefix to `band`

Currently the address prefix is cosmos. We should change it to band.

  • Change prefix to band, including prefix of user address, validator address, etc
  • Update and verify that docker related scripts are still working

[Bug] Tx subscriber `Server error: subscription was cancelled (reason: client is not pulling messages fast enough)

Event subscriber from tendermint stop subscribe after listen 4 reports in one block

How to produce?
Run chain with 4 validators when request has been executed. All 4 validators send report to chain in the same block, but tendermint server cannot handle report event correctly. (Internal buffer is full with capacity = 1)

Possible root cause
After experiment error come from https://github.com/tendermint/tendermint/blob/master/libs/pubsub/pubsub.go in send function. Code cannot push new event to channel because it's full. Consumer is https://github.com/tendermint/tendermint/blob/master/rpc/core/events.go that consume data after new event push make pubsub return error and try to cancel subscription.

  • But ws client have code to resub after got error but code doesn't work out as expect. It return error told that already subscribe

Way to solve

  • Make sure consumer consume event fast enough (?) for new event
  • Increase buffer size of buffer
  • Make resubscription work as code expected

Research on how to do pubkey recover when `v` is missing

v is missing ๐Ÿ˜จ.

Deliverables:

  • Presentation on what research has been done
  • Present potential solutions and their tradeoffs
  • Plan on how to proceed with on-chain address recovery

Potential Solutions

  • Try two different vs on-chain
  • Compute for v off-chain
  • Something else???

Some pointers:

Rename every file and folder from `oracle` to `zoracle`

We decided to go with the module name from oracle to zoracle to simplify the steps required to perform multistore proof checking. Now that we did this, let's change every occurrence of oracle name to zoracle to avoid confusion down the line.

Change coin unit to `BAND`

Currently the coin address is stake. We want to change it to BAND to celebrate the existence of Band token on its own sovereign chain.

  • Update necessary code to change coin unit to BAND
  • Verify and update that the genesis file and its generating script still works

Implement code storage keeper and handler

Code storage keeper and handler allows the blockchain to process code storage messages. D3N should handle MsgStoreCode by keeping the code in a long term storage, using code hash as lookup key. MsgDeleteCode should remove the code from the storage. As simple as that!

  • Implement keeper(s)
  • Implement handler(s)
  • Add tests

Remove `config.toml` from hard-coded docker config

Instead of hardcoding the whole config.toml for seed/persistent peers. We can pass them directly as the command line arguments when running bandd start. That way, we have one less (quite big) file to maintain!

Add `MsgStoreCode` and `MsgDeleteCode`

The messages allow user to store and delete code from the blockchain long term storage. The code can be referred later with code hash.

  • Implement the messages data structure to zoracle module
  • Add necessary test cases

Make provider run command inside of docker

To prevent potential exploit directly to the host, all commands should be run inside of a one-time-purpose docker instance. This also helps with having one consistent docker runtime for all data providers to support similar programs with similar versions / environments.

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.