Code Monkey home page Code Monkey logo

chain's Introduction

 

BandChain - Decentralized Data Delivery Network

Documentation »


What is BandChain?

BandChain is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts. It is designed to be compatible with most smart contract and blockchain development frameworks. It does the heavy lifting jobs of pulling data from external sources, aggregating them, and packaging them into the format that’s easy to use and verifiable efficiently across multiple blockchains.

Band's flexible oracle design allows developers to query any data including real-world events, sports, weather, random numbers and more. Developers can create custom-made oracles using WebAssembly to connect smart contracts with traditional web APIs within minutes.

Installation

Please refer to this documentation for the most up-to-date installation guide.

Building from source

We recommend the following for running a BandChain Validator:

  • 2 or more CPU cores
  • 8 GB of RAM (16 GB in case on participate in mainnet upgrade)
  • At least 100GB of disk storage

Step 1. Install Golang

Go v1.18+ or higher is required for BandChain.

If you haven't already, install Golang by following the official docs. Make sure that your GOPATH and GOBIN environment variables are properly set up.

Step 2. Get BandChain source code

Use git to retrieve BandChain from the official repo, and checkout the master branch, which contains the latest stable release. That should install the bandd binary.

git clone https://github.com/bandprotocol/chain
cd chain && git checkout v2.5.4
make install

Step 3. Verify your installation

Using bandd version command to verify that your bandd has been build successfully.

name: bandchain
server_name: bandd
version: 2.5.4
commit: e6548bbf4793829bb8e711e5ed89ba4afc710ded
build_tags: netgo,ledger
go: go version go1.19.1 darwin/amd64
build_deps:
...

If you are using Mac ARM architecture (M1, M2) and face the issue of GMP library, you can run this.

brew update && brew install gmp
sudo ln -s /opt/homebrew/lib/libgmp.10.dylib /usr/local/lib/

Useful scripts for development

  • scripts/generate_genesis.sh to create/reset the default genesis file
  • scripts/start_bandd.sh to start the bandd binary
  • scripts/start_yoda.sh to start yoda with reporter(s)

Resources

Community

License & Contributing

BandChain is licensed under the terms of the GPL 3.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 suggestions for protocol improvements, please open an issue, submit a pull request, or [drop as a line].

chain's People

Contributors

alessio avatar benzbeeb avatar bytetigers avatar colmazia avatar dependabot-preview[bot] avatar dependabot[bot] avatar evilpeach avatar faddat avatar fivecut avatar kissadada avatar mnguyen-io avatar nghuyenthevinh2000 avatar ntchjb avatar p-rial avatar perimeko avatar prin-r avatar rav-11 avatar rogerksi avatar satawatnack avatar songwongtp avatar sorawit avatar tansawit avatar taobun avatar thebevrishot avatar traviolus 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

chain's Issues

txj

もうねこ のギット バブかなんか txt まとわりついてくる 何かあるんでしょう 資産があるんでしょう返せよ
トラスト ダイスカジノでジャックポットを出した どこ行ったの LINE も LINE 前のアドレス0x4から始まって最後はeかcだったような気がする すごい 前のアドレス イーサリアムのアドレス ね

withdrawal-rewards using Ledger fails when using --commission

When running band CLI withdrawal-rewards with --commission and a ledger, the transaction fails.

signatures: [] confirm transaction before signing and broadcasting [y/N]: y code: 4 codespace: sdk data: "" events: [] gas_used: "0" gas_wanted: "0" height: "0" info: "" logs: [] raw_log: 'signature verification failed; please verify account number (12), sequence (103) and chain-id (laozi-mainnet): unauthorized' timestamp: "" tx: null txhash: 22B4443D567CF8BC0513C0A4D8D9C35A91F6DA3221F6A84EA89900E77BF85FF6

This same command works if we remove the --commission flag.

Ability to delegate oracle re-activation to another account

Given the propensity for the band oracle to deactivate if the wind blows in the wrong direction, we end up running bandcli tx oracle activate on a semi regularly basis (once or twice a month).

Given proper key handling, our platforms team do not have the ability to reactivate the oracle - as this requires possesion of the key that controls the entire validator (including the ability to withdraw / send funds, etc.)

It would be hugely beneficial, if in the next iteration, if the validator account could sign a tx to (optionally) authorise a separate sub account (with no other permissions), that could re-enable the oracle in the event of a failure (much like Terra delegates permission to their oracle feeder account).

Withdraw reward emit wrong address to reset reward

We emiited withdraw address to update reward that makes reward counter update on withdraw address, not a delegator address that makes we show the wrong amount of reward on withdraw address, and didn't reset reward of delegator address.

Unable to build `2.4.1` or `2.4.0`

It looks like there's a dependency conflict from cosmos-sdk v0.45.10 with go-metrics on these two versions.

NOTE: I am able to successfully build 2.3.6 without issue 👍🏻

Go version:

go version go1.16.6 linux/amd64

Steps to reproduce:

  1. git clone https://github.com/bandprotocol/chain
  2. cd chain
  3. git checkout 2d59c56296dd2a4c8bd919d0a278315213a50561 * Release hash for 2.4.1
  4. make install

Error log:

#20 0.244 Cloning into 'chain'...
#20 7.565 Note: checking out '2d59c56296dd2a4c8bd919d0a278315213a50561'.
#20 7.565 
#20 7.565 You are in 'detached HEAD' state. You can look around, make experimental
#20 7.565 changes and commit them, and you can discard any commits you make in this
#20 7.565 state without impacting any branches by performing another checkout.
#20 7.565 
#20 7.565 If you want to create a new branch to retain commits you create, you may
#20 7.565 do so (now or later) by using -b with the checkout command again. Example:
#20 7.565 
#20 7.565   git checkout -b <new-branch-name>
#20 7.565 
#20 7.567 HEAD is now at 2d59c562 Merge pull request #264 from bandprotocol/bump-cosmos-sdk
#20 7.757 go install -mod=readonly -tags "ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=bandchain -X github.com/cosmos/cosmos-sdk/version.AppName=bandd -X github.com/cosmos/cosmos-sdk/version.Commit=2d59c56296dd2a4c8bd919d0a278315213a50561 -X github.com/cosmos/cosmos-sdk/version.Version=2.4.1 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=ledger"' ./cmd/bandd
#20 69.06 go: github.com/cosmos/[email protected] requires
#20 69.06       github.com/armon/[email protected]: missing go.sum entry; to add it:
#20 69.06       go mod download github.com/armon/go-metrics
#20 69.09 Makefile:24: recipe for target 'install' failed
#20 69.09 make: *** [install] Error 1

Issues installing bandd

Hello,
i have some issues installing bandd.
I cloned the chain repository and executed cd which worked fine.
Then i executed "make install" which downloaded many things but where i also got these issues and results.
How do i solve this ?
Feedback and solutions would be really nice.
Thanks

go install -mod=readonly -tags "ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=bandchain -X github.com/cosmos/cosmos-sdk/version.AppName=bandd -X github.com/cosmos/cosmos-sdk/version.Commit=4fe19638b33043eed4dec9861cda40962fb5b2a7 -X github.com/cosmos/cosmos-sdk/version.Version=2.3.0 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=ledger"' ./cmd/bandd
..\go\pkg\mod\github.com\rcrowley\[email protected]\runtime.go:5:2: found packages pprof (elf.go) and proto (proto.go) in C:\Users\anton\go\GO Language\src\runtime\pprof
make: *** [Makefile:24: install] Error 1

Can not use txs/encode api for encodeTx

Hi, is there a big upgrade for band?

I used to encode tx using this api txs/encode and sent it successfully in testnet2 and guanyu-mainnet
But it got error when in laozi mainnet and I did not change anything
The api returned this error:

  "code": 12,
  "message": "Not Implemented",
  "details": [
  ]
}

How can I use the txs/encode now? I need to build tx body offline and use rest api to send, looking forward to your reply

About usage of floating point in the oracle script

Hi, while reading the documentation, I found the usage of f64 in the following oracle script example:

https://docs.bandchain.org/core-concepts/oracle-webassembly

You mentioned that your script is run on-chain instead of off-chain, but Cosmos cosmwasm doesn't support floating points because they are not safe. So I was wondering what's the trick with Owasm? Is the script really run on chain, or there might be misunderstanding of concepts from my side?

Better gas error management inside `PrepareRequest`

Context

At Desmos we would like to integrate the usage of Band oracles through IBC in order to allow our users to connect their centralized social network accounts (eg. Twitter, Instagram, GitHub, etc) to their decentralized Desmos profile. In order to do this, we have already created the proper data sources as well as the oracle script.

Yesterday we were testing the integration from a local Desmos chain towards the Laozi Band testnet. While performing some test requests we realized that there is a case in which any blockchain that sends a packet towards Band might not receive any response and thus is left hanging.

This happens particularly when we send a OracleRequestPacketData which does not contain a sufficient amount of gas to execute the transaction. Then, the following happens:

  1. The execute gas is subtracted from the overall gas amount.
  2. Since the overall gas amount is not sufficient, the ctx.GasMeter().ConsumeGas method panics with ErrOutOfGas.
  3. The whole transaction is marked as invalid, but no acknowledgment is sent to the source chain (ie Desmos).
  4. The relayer will continuously try to accept the packet inside the Band chain, but the transaction will continue to fail.

This causes an infinite loop inside which the relayer continues to pay the fees to receive the packet, the packet is never executed properly and no acknowledgment is sent back.

You can see a lot of ReceivePacket transactions here.

Proposed solution

While exploring the Band codebase, I found that you often use the following method:

ctx.GasMeter().ConsumeGas

As described above, this will panic if the overall gas is not sufficient to consume the amount given.

What I propose is to create a new method named safeConsumeGas that acts as follows:

// safeConsumeGas consumes the given amount of gas associating it with the provided descriptor.
// If the gas consumption would error, returns such error instead of panicking.
func (k Keeper) safeConsumeGas(ctx sdk.Context, amount sdk.Gas, descriptor string) error {
	a := ctx.GasMeter().GasConsumed()
	b := amount

	// check overflow
	if math.MaxUint64-a < b {
		return sdkerrors.Wrapf(sdkerrors.ErrLogic, "gas overflow in location: %s", descriptor)
	}

	// check if the gas consume will panic
	futureConsumed := a + b
	if futureConsumed > ctx.GasMeter().Limit() {
		return sdkerrors.Wrapf(sdkerrors.ErrOutOfGas, "out of gas in location: %s", descriptor)
	}

	ctx.GasMeter().ConsumeGas(amount, descriptor)
	return nil
}

Then, inside PrepareRequest all the ctx.GasMeter().ConsumeGas usages should be replaced as follows:

// Consume gas for data requests.
err := k.safeConsumeGas(ctx, askCount*k.PerValidatorRequestGas(ctx), "PER_VALIDATOR_REQUEST_FEE")
if err != nil {
	return 0, err
}

This approach would allow the PrepareRequest method to fail gracefully if any problem related to the gas is raised. Also, it would allow the OnRecvPacket method to properly handle the error and return an ErrorAcknowledgement to the source chain.

When ibc/v2 is upgraded?

Hello,
I am building a cosmwasm contract that will interact with band through ibc.
However, current ibc version of band is somewhat lacking.
When will band protocol is updated to ibc/v2? and testnet as well?

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.