Giter VIP home page Giter VIP logo

bux's Introduction

BUX

⚠️ This repository is deprecated. ⚠️

Release Build Status Report codecov Mergify Status

Go Gitpod Ready-to-Code standard-readme compliant Makefile Included

Bitcoin UTXO & xPub Management Engine

Table of Contents


About

TLDR;

Application developers should focus on their applications and should not be bogged down with managing UTXOs or XPubs. Developers should be able to use an open-source, easy to install solution to rapidly build full-featured Bitcoin applications.



DISCLAIMER

BUX is still considered "ALPHA" and should not be used in production until a major v1.0.0 is released.



BUX: Out-of-the-box Features:

Project Assumptions: MVP

  • No private keys are used, only the xPub (or access key) is given to bux
  • (BYOX) Bring your own xPub
  • Signing a transaction is outside this application (IE: bux-server or bux-client)
  • All transactions need to be submitted to the bux service to effectively track utxo states
  • Database can be backed up, but not regenerated from chain
    • Certain data is not on chain, plus re-scanning an xPub is expensive and not easily possible with 3rd party limitations

Installation

bux requires a supported release of Go.

go get -u github.com/BuxOrg/bux

Documentation

View the generated documentation

GoDoc


Repository Features

This repository was created using MrZ's go-template

Built-in Features

Package Dependencies
Library Deployment

Releases are automatically created when you create a new git tag!

If you want to manually make releases, please install GoReleaser:

goreleaser for easy binary or library deployment to GitHub and can be installed:

  • using make: make install-releaser
  • using brew: brew install goreleaser

The .goreleaser.yml file is used to configure goreleaser.


Automatic Releases on Tag Creation (recommended)

Automatic releases via GitHub Actions from creating a new tag:

make tag version=1.2.3

Manual Releases (optional)

Use make release-snap to create a snapshot version of the release, and finally make release to ship to production (manually).


Makefile Commands

View all makefile commands

make help

List of all current commands:

all                           Runs multiple commands
clean                         Remove previous builds and any cached data
clean-mods                    Remove all the Go mod cache
coverage                      Shows the test coverage
diff                          Show the git diff
generate                      Runs the go generate command in the base of the repo
godocs                        Sync the latest tag with GoDocs
help                          Show this help message
install                       Install the application
install-all-contributors      Installs all contributors locally
install-go                    Install the application (Using Native Go)
install-releaser              Install the GoReleaser application
lint                          Run the golangci-lint application (install if not found)
release                       Full production release (creates release in GitHub)
release                       Runs common.release then runs godocs
release-snap                  Test the full release (build binaries)
release-test                  Full production test release (everything except deploy)
replace-version               Replaces the version in HTML/JS (pre-deploy)
tag                           Generate a new tag and push (tag version=0.0.0)
tag-remove                    Remove a tag if found (tag-remove version=0.0.0)
tag-update                    Update an existing tag to current commit (tag-update version=0.0.0)
test                          Runs lint and ALL tests
test-all-db                   Runs all tests including embedded database tests
test-all-db-ci                Runs all tests including embedded database tests (CI)
test-ci                       Runs all tests via CI (exports coverage)
test-ci-no-race               Runs all tests via CI (no race) (exports coverage)
test-ci-short                 Runs unit tests via CI (exports coverage)
test-no-lint                  Runs just tests
test-short                    Runs vet, lint and tests (excludes integration tests)
test-unit                     Runs tests and outputs coverage
uninstall                     Uninstall the application (and remove files)
update-contributors           Regenerates the contributors html/list
update-linter                 Update the golangci-lint package (macOS only)
vet                           Run the Go vet application

Usage

Examples & Tests

Checkout all the examples!

All unit tests and examples run via GitHub Actions and uses Go version 1.19.x. View the configuration file.


Run all unit tests (excluding database tests)

make test

Run database integration tests

make test-all-db

Run tests (excluding integration tests)

make test-short

Benchmarks

Run the Go benchmarks:

make bench

Code Standards

Read more about this Go project's code standards.


Usage

func main() {
	client, err := bux.NewClient(
		context.Background(), // Set context
	)
	if err != nil {
		log.Fatalln("error: " + err.Error())
	}

	defer func() {
		_ = client.Close(context.Background())
	}()

	log.Println("client loaded!", client.UserAgent())
}

Checkout all the examples!


Contributing

All kinds of contributions are welcome!
To get started, take a look at code standards.
View the contributing guidelines and follow the code of conduct.


License

License

bux's People

Contributors

arkadiuszos4chain avatar chris-4chain avatar dependabot[bot] avatar dorzepowski avatar galt-tr avatar icellan avatar jakubmkowalski avatar kuba-4chain avatar mergify[bot] avatar mrz1836 avatar nazarii-4chain avatar pawellewandowski98 avatar rohenaz avatar wregulski 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

Watchers

 avatar  avatar  avatar  avatar  avatar

bux's Issues

[Question]: What is the reason to treat broadcast providers differently?

Context

Currently in bux/chainstate/broadcast.go, line 67: broadcast( (...) ) the system tries to broadcast tx to several different providers:

  1. few providers via mAPI
  2. WhatsOnChain
  3. NowNodes

Question

What is the reason to call WhatsOnChain and NowNodes api without a set timeout for the connection, while timeout is set for requests to mAPI?

Code

Call to mAPI broadcast:
obraz

Call to WhatsOnChain broadcast:
obraz

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

[Bug]: possibility to create many identical paymails

What happened?

There is possibility to create many paymails with this same alias and domain, example: [email protected]

Solution proposal:

  • Check if paymail already exist before creating new one

How can we reproduce this?

Use endpoint from bux-server:

  • POST /v1/paymail

With data:

{
  "key": "...",
  "address": "[email protected]",
  "public_name": "test",
  "avatar": "test"
}

Call it many times and many this same paymails will be created

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

Ability to Start and Stop a Monitor

Similar to other clients, we need the ability to do: monitor.Start() or monitor.Stop()

  • close the active web sockets
  • close any running go routines

Cachestore improvements

  • Remove mCache (not thread safe) (or fork and try to fix?)
  • Create a interface for cachestore so someone else can extend
  • Implement freecache

[Bug]: Transaction seems to be synced, not found on chain

What happened?

Example: f850a716343651a227fb755a2da903790c249cd2fe2e068cab6e25a6a3e3bffb

Screenshot 2022-09-06 at 20 55 14

Another problem with this one is that the sync tries forever and fills the results field in MySQL with JSON that at a certain moment is not readable anymore.

How can we reproduce this?

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

[Bug]: Syncing transactions on-chain fails with inputs missing

What happened?

Transactions are broadcast in order, if a transaction is successfully broadcast, the next one should also succeed.

How can we reproduce this?

It's sporadic

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

BUX Admin Console to MVP

  • Admin Paymail support
  • Admin Xpub, Destination, Utxo etc. support
  • Admin dashboard
    • Status (nr of xpubs, destinations, utxos, paymail)
    • Nr transactions per week

Feature: Import an existing xPub

  • New import package in bux
  • Import an existing xPub
  • Builds all data models: xpub, transaction, destinations, utxos
  • Test the importer (same balance, all utxos, correct state)
  • Save the block height and block hash
  • Save additional metadata from the import

Support Multiple Servers for Monitoring

  • Add a locking mechanism when Monitor is loaded (establish a lock if not found)
  • Create a heart beat, write into the lock
  • On disconnect or close, remove the lock
  • All servers that are not monitoring are try to see if a lock is established, if not, create and start Monitoring

Feature: mAPI support / auto-quote gathering

  • mAPI service provider
  • Auto-fetch quotes per miner
  • Use the user provided fee/rate/token (or use a strategy: best quote, fastest)
  • How to handle if a quote/miner is lower then the failover miner for broadcast?

Feature: Broadcasting & On-chain Sync Support

REQUIRED:

  • Config option to turn off/on broadcasting (entire bux client vs per tx)
  • Bring your own client(s) (Minercraft) (WOC) (MatterCloud)
  • Basic state management of TX (broadcast or not, state of the broadcast, in-block etc)
  • Mocking of all providers
  • Use your own mAPI tokens
  • Broadcast using: mAPI
  • Broadcast using: WhatsOnChain
  • Broadcast using: MatterCloud
  • Broadcast using: NowNodes
  • Use your own fees (rework: GetFeeUnit())
  • No fee set? How do we auto-get fees?
  • Finalize the mvp SyncConfig rules
  • Create new task: broadcast
  • Create new task: sync
  • Understanding if it's a P2P TX (use paymail broadcasting)

Feature: test-net support

  • Requires new go-bitcoin v2
  • Update any models that are looking at addresses, destinations or other strings that might be different
  • Broadcasting package support
  • Paymail (internal support - IE: running a paymail server)
  • Paymail (external support - IE: interacting with external service providers, like MoneyButton)

[Bug]: 422 Error when xpub current_balance gets below 0 - sqlite

What happened?

I'm not 100% on repro steps yet in terms of causing the xpub current_balance to get below 0, but if it does happen with sqlite then you can see error as shown in the attached logs when go-datastore attempts to read the value.

How can we reproduce this?

Set xpub current_balance below 0 and run a command with bux that would select the xpub and read its current_balance field and watch it panic.

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

2022/09/19 23:02:26 type="error" file="[email protected]/models.go" method="go-datastore.(*Client).IncrementModel.func1" line="111" message="error executing query" file="/home/galt/go/pkg/mod/github.com/mrz1836/[email protected]/models.go:111" error="sql: Scan error on column index 5, name "current_balance": converting driver.Value type int64 ("-15") to a uint64: invalid syntax" duration="0.116ms" rows="1" sql="SELECT * FROM `xapi_xpubs` WHERE id = "7bd748da2721f4bcc7908a987c0c700c55b93deb55f02bae50777bc97882190b" ORDER BY `xapi_xpubs`.`id` LIMIT 1 "
2022/09/19 23:02:26 type="info" file="bux/models_internal.go" method="bux.(*Model).DebugLog" line="38" message="save tx error: sql: Scan error on column index 5, name "current_balance": converting driver.Value type int64 ("-15") to a uint64: invalid syntax"

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.