Skip to content

About

The official wallet of the FACTOR Blockchain Project based on the electrum wallet.

Resources

Security policy

Stars

9 stars

Watchers

1 watching

Forks

Repository files navigation

Lightweight FactWallet

Licence: MIT Licence
Language: Python (>= 3.10)
Homepage: https://www.projectfactor.io

Getting started

Based on the Bitcoin Electrum Lightweight wallet. See the Contributing section below. There is still a lot of work that needs to be done.

FactWallet is the FACTOR wallet fork. Its Python package is still named Electrum, its import directory is electrum/, its source launcher is run_electrum, and installing it provides the electrum command, as defined in setup.py. Use this repository's source, rather than installing upstream Electrum from PyPI.

setup.py and run_electrum require Python >= 3.10. The CI configuration lists Python 3.10 and 3.11. Compatibility with other Python versions is not established by that configuration.

The commands below use a Linux shell and Debian/Ubuntu package names. There are also Windows and macOS source notes. Platform build scripts are listed below; their presence does not establish current platform compatibility. The macOS CI build is disabled in .cirrus.yml.

FactWallet and most dependencies are Python, but native libraries are also needed. For the virtual environments used below, install the basic tools first:

$ sudo apt-get install python3-venv python3-pip

Not pure-python dependencies

The Qt interface requires PyQt5. The gui extra in the installation commands below installs it in the virtual environment. Headless commands, including --help and --version, do not require Qt; use the crypto extra for a headless installation. When running a bundled tarball with the system Python, the system package is an alternative:

$ sudo apt-get install python3-pyqt5

For elliptic curve operations, libsecp256k1 is a required dependency:

$ sudo apt-get install libsecp256k1-dev

The loader prefers bundled library versions, then tries system libraries, including names discovered by ctypes.util.find_library. It checks the required symbols and recovery module. For source use, the maintained script builds the pinned libsecp256k1 version into the inner electrum/ directory for ./run_electrum:

$ sudo apt-get install build-essential automake libtool
$ ./contrib/make_libsecp256k1.sh

Due to the need for fast symmetric ciphers, cryptography is required. The crypto extra below installs it in the virtual environment; alternatively, for the system Python:

$ sudo apt-get install python3-cryptography

The FACTOR hashing dependencies, sympy and mpmath, are declared in the runtime requirements and included in the normal tarball's packages/ directory.

The repository retains upstream hardware-wallet plugins and a hardware extra. These do not establish FACTOR device/firmware compatibility: for example, the Trezor and KeepKey plugins still select the Bitcoin coin name. The upstream Linux hardware setup notes are a dependency reference, not confirmation of hardware-wallet support for FACTOR.

Running from tar.gz

Use a tarball built from ProjectFactor/FactWallet, not an upstream Electrum archive. The tarball build scripts produce both a normal tarball with a packages/ dependency directory and a source-only tarball without it. GitHub's automatically generated source archives also lack that bundled directory.

From the extracted normal tarball's root, after installing libsecp256k1 above, you can run without installing the wallet package:

$ python3 -m venv .venv
$ . .venv/bin/activate
$ python3 -m pip install PyQt5 cryptography
$ ./run_electrum --help

For a source-only tarball or GitHub source archive, create and activate the virtual environment as above. The source-only build also omits electrum/paymentrequest_pb2.py. If that file is absent, generate it before installation using ./contrib/generate_payreqpb2.sh and a protoc compiler compatible with the project's protobuf>=3.20,<4 runtime requirement. The generated file is already tracked in a git checkout.

Then install the wallet and dependencies from the extracted root. This is also an option for the normal tarball:

$ python3 -m pip install ".[gui,crypto]"
$ electrum --help

Installation downloads the declared Python dependencies and places the executable named electrum in the virtual environment's bin/ directory, which activation adds to PATH. A non-editable installation needs a compatible libsecp256k1 available to the installed package, for example through the system loader; use ./run_electrum when relying on a library built into the extracted source tree. The package and command names retain their upstream names. Run the project identification check below before starting the GUI with ./run_electrum (or electrum after installation).

Development version (git clone)

Check out this fork from GitHub (install git if needed):

$ git clone https://github.com/ProjectFactor/FactWallet.git
$ cd FactWallet
$ git submodule update --init

The locale and payserver submodules intentionally retain their upstream Electrum repositories. Install this checkout in editable mode, including the GUI, crypto, and FACTOR hashing dependencies:

$ python3 -m venv .venv
$ . .venv/bin/activate
$ python3 -m pip install -e ".[gui,crypto]"
$ ./run_electrum --help

Create translations (optional):

$ sudo apt-get install gettext qttools5-dev-tools
$ python3 -m pip install requests
$ ./contrib/pull_locale

After the project identification check below, start FactWallet with:

$ ./run_electrum

Verify the project without creating a wallet

From the checkout or extracted tarball root, with its dependencies available, run this check. It follows the launcher's use of packages/ when present, prints the local module path and version, and checks FACTOR's mainnet address prefix. The version alone does not distinguish this fork from upstream Electrum.

python3 - <<'PY'
import sys
sys.path.insert(0, "packages")
import electrum
from electrum.constants import BitcoinMainnet
assert BitcoinMainnet.SEGWIT_HRP == "fact", "Expected the FACTOR fork"
print("FactWallet", electrum.__version__, "mainnet prefix:", BitcoinMainnet.SEGWIT_HRP)
print("Loaded from:", electrum.__file__)
PY

This imports the package without starting the GUI, connecting to servers, or creating, restoring, or funding a wallet. The path should point into the FactWallet source tree and the prefix should be fact.

Run tests

Run unit tests from the git checkout, with the virtual environment active and libsecp256k1 installed. Source distributions exclude electrum/tests. Install the declared test extras and pytest first:

$ python3 -m pip install -e ".[tests]"
$ pytest electrum/tests -v

To run a single file, specify it directly like this:

$ pytest electrum/tests/test_bitcoin.py -v

The electrum/tests path is correct for this fork. tox.ini uses the same pytest target with coverage, and .cirrus.yml invokes it through tox.

Creating Binaries

Contributing

Any help testing the software, reporting or fixing bugs, reviewing pull requests and recent changes, writing tests, or helping with outstanding issues is very welcome. Implementing new features, or improving/refactoring the codebase, is of course also welcome, but to avoid wasted effort, especially for larger changes, we encourage discussing these on the issue tracker or Discord first.

Besides GitHub, most communication about Electrum development happens on Discord, in the FACTOR server.

About

The official wallet of the FACTOR Blockchain Project based on the electrum wallet.

Resources

Security policy

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages