yegor256/sibit

CLI's `Sibit::Bin#client` never passes a key to `Sibit::Blockchair.new` at `lib/sibit/bin.rb:159`

Open

#267 opened on Jun 23, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Ruby (6 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (27 stars)
PR merge metrics
 (PR metrics pending)

Description

`Sibit::Blockchair.new` accepts a `key:` keyword argument that the constructor stores at `lib/sibit/blockchair.rb:22-26` and that `balance`, `push`, and the rest of the adapter append to the upstream URL when it is set. The CLI builds Blockchair at `lib/sibit/bin.rb:159` with `Sibit::Blockchair.new(http: http, log: log)` and never reads the key from any source, so a user who runs `sibit --api=blockchair balance ...` against an authenticated Blockchair endpoint can only hit the unauthenticated tier and gets the lower rate limit.

The same file already wires `Sibit::Cryptoapis` to an environment variable at `lib/sibit/bin.rb:164`: `Sibit::Cryptoapis.new(ENV.fetch('SIBIT_CRYPTOAPIS_KEY', nil), http: http, log: log)`. Blockchair has no equivalent, so the `key:` parameter added together with the URL-fragment fix in issue #256 stays inaccessible from the command line.

Read the key from a `SIBIT_BLOCKCHAIR_KEY` environment variable (mirroring the `SIBIT_CRYPTOAPIS_KEY` convention) and forward it: `Sibit::Blockchair.new(key: ENV.fetch('SIBIT_BLOCKCHAIR_KEY', nil), http: http, log: log)`. A short README note next to the existing `SIBIT_CRYPTOAPIS_KEY` mention would document the new variable.

Contributor guide