Git Product home page Git Product logo

rust-bcli's Introduction

rust-bcli

Bitcoin CLI in Rust.

The problem

The main tool provided by Bitcoin-core is bitcoind, a daemon that implements full node, wallet and mining logic.

Some of the shortcomings of bitcoin-cli:

  • Nonstandard single dash long arguments, e.g., -datadir, when most other CLI tools would use --datadir.
  • Argument values must be given with an equals sign, e.g., -datadir=foo, when most other tools would accept both --datadir=foo and --datadir foo.
  • No colored help output, and help text formatting could be improved.
  • By default, arguments are passed as JSON which is verbose and hard to get right, especially when values must be quoted.
  • Passing arguments by name is not the default, when it probably should be.
  • Arguments are not validated up-front, but instead passed along to the RPC server as-is, which leads to poor error messages.
  • No completion script.
  • bitcoin-cli is a bit long to type.
  • Like the rest of Bitcoin Core, bitcoin-cli is written in C++, which deters potential contributors, increases review burden, and is error prone and unsafe.

Improvements:

  • The new binary could be written in Rust, which has excellent libraries for argument parsing and JSON serialization, including Bitcoin-specific libraries, namely rust-bitcoin and rust-bitcoincore-rpc, for parsing bitcoin types and interacting with bitcoind's RPC interface.
  • Many people want to learn Rust, write Rust, and use Rust-written CLI tools. Adding a way for people to contribute to Bitcoin Core using Rust would open the door to a lot of new contributors, and a rewite of bitcoin-cli in particular would provide an extremely approachable way for them to do so.
  • The new binary could be called bitcoin or even btc, so it's easier to type.
  • Eventually, the binary could support a subcommand to invoke bitcoind, e.g., bitcoin daemon, to improve the same issues with bitcoind that bitcoin-cli has, e.g., argument parsing, argument validation, help text formatting, and completion script support.
  • Long arguments could be accepted with --arg and short arguments with -a, which is standard and familiar among the vast majority of CLI tools.
  • Values could be passed as standard named arguments, e.g., --address foo, instead of as JSON. The ability to pass JSON arguments could be retained with a subcommand for making arbitrary RPC calls which takes a single json argument: bitcoin rpc --name generateblock --json SOME_JSON_BLOB.
  • Arguments could be validated up-front, instead of being passed to the RPC server. This would allow the binary to report which argument failed, specifically, instead of receiving a somewhat inscrutable error from the RPC server.

rust-bcli's People

Contributors

edilmedeiros avatar itornaza 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.