Skip to main content

Implements A Bitcoin Core API which querying an Electrum

Project description

Spectrum - Specter Desktop + Electrum

This is a electrum-adapter. It exposes a Bitcoin-Core style API while using an electron API in the backend. It might be useful in specific usecases, e.g. having better performance when connecting to a electrum-server via Tor. In order to do that, it needs a Database. Quite easily you can use a kind of builtin SQLite. Depending on your usecase, you might want to use an external DB.

Modes of usage

This can be used either in standalone mode or as a specter-extension. The second option is probably the main use-case.

Standalone

Get this to work with something like that:

python3 --version # Make sure you have at least 3.8. Might also work with lower versions though
virtualenv --python=python3 .env
. ./.env/bin/activate
pip3 install -e .

# If you have a electrum server running on localhost:
python3 -m cryptoadvance.spectrum server --config cryptoadvance.spectrum.config.NigiriLocalElectrumLiteConfig

# If you want to run on mainnet and use emzy's Server
python3 -m cryptoadvance.spectrum server --config cryptoadvance.spectrum.config.EmzyElectrumLiteConfig

# Using Emzy's server but with a postgres
export DB_USERNAME=bla
export DB_PASSWORD=blub
python3 -m cryptoadvance.spectrum server --config cryptoadvance.spectrum.config.EmzyElectrumPostgresConfig

Check the config.py for the env-vars which need to be exported in order to connect to something different than localhost.

Specter Extension

In order to get a development environment:

virtualenv --python=python3 .env
. ./.env/bin/activate
pip3 install -e .
pip3 install cryptoadvance.specter
python3 -m cryptoadvance.specter server --config DevelopmentConfig --debug

TODO:

  • refill keypool when address is used or new address is requested
  • flask debug=True flag creates two electrum sockets that notify twice - this causes duplications in the database
  • reconnect with electrum on disconnect
  • add support for credentials / cookie file for RPC calls

Run the Tests

pip3 install -e ".[test]"
pytest

Development

Before your create a PR, make sure to blackify all your changes. In order to automate that, there is a git pre-commit hook which you can simply install like this:

pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cryptoadvance_spectrum-0.8.0.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptoadvance_spectrum-0.8.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file cryptoadvance_spectrum-0.8.0.tar.gz.

File metadata

  • Download URL: cryptoadvance_spectrum-0.8.0.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cryptoadvance_spectrum-0.8.0.tar.gz
Algorithm Hash digest
SHA256 d3a53b21ca13d8e6a014ff2c0b0e68f8d4eef2c1efbe6383ae018c15409c67c1
MD5 e295a68ab152ead2226e05163367e694
BLAKE2b-256 c242b778ccfb49372d6b6604a8652ffd19896104e58adcbc2325fe4e6c694b45

See more details on using hashes here.

Provenance

The following attestation bundles were made for cryptoadvance_spectrum-0.8.0.tar.gz:

Publisher: pypi-publish.yml on cryptoadvance/spectrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cryptoadvance_spectrum-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cryptoadvance_spectrum-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc91eef05f6417898e735b793b91135ddd989fe223ff51aeaa4bc278eb15c3ed
MD5 3ec1ddf5b70bda760fde2558f878a789
BLAKE2b-256 ea2274dfa20bcceae8d99059b41328c4d23f0bf767c25bdfb68e773fd63fc6a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cryptoadvance_spectrum-0.8.0-py3-none-any.whl:

Publisher: pypi-publish.yml on cryptoadvance/spectrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page