Giter VIP home page Giter VIP logo

electrumx's Introduction

Electron Cash - Lightweight Bitcoin Cash client

Licence: MIT Licence
Author: Electron Cash Developers
Language: Python
Homepage: https://electroncash.org/
Help translate Electron Cash online GitHub Actions Tests GitHub Actions Build GitHub Actions Python Audit

Getting started

Note: If running from source, Python 3.7 or above is required to run Electron Cash. If your system lacks Python 3.7, you have other options, such as the AppImage / binary releases or running from source using pyenv (see section Running from source on old Linux below).

macOS: It is recommended that macOS users run the binary .dmg as that's simpler to use and has everything included. Otherwise, if you want to run from source, see section Running from source on macOS below.

Electron Cash is a pure python application forked from Electrum. If you want to use the Qt interface, install the Qt dependencies:

sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg

If you downloaded the official package (tar.gz), you can run Electron Cash from its root directory (called Electron Cash), without installing it on your system; all the python dependencies are included in the 'packages' directory. To run Electron Cash from its root directory, just do:

./electron-cash

You can also install Electron Cash on your system, by running this command:

sudo apt-get install python3-setuptools
python3 setup.py install

Compile the icons file for Qt (normally you can skip this step, run this command if icons are missing):

sudo apt-get install pyqt5-dev-tools
pyrrc5 icons.qrc -o electroncash_gui/qt/icons.py

This will download and install the Python dependencies used by Electron Cash, instead of using the 'packages' directory.

If you cloned the git repository, you need to compile extra files before you can run Electron Cash. Read the next section, "Development Version".

Hardware Wallet - Ledger Nano S

Electron Cash natively support Ledger Nano S hardware wallet. If you plan to use you need an additional dependency, namely btchip. To install it run this command:

sudo pip3 install btchip-python

If you still have problems connecting to your Nano S please have a look at this troubleshooting section on Ledger website.

Development version

Check your python version >= 3.7, and install pyqt5, as instructed above in the Getting started section above or Running from source on old Linux section below.

If you are on macOS, see the Running from source on macOS section below.

Check out the code from Github:

git clone https://github.com/Electron-Cash/Electron-Cash
cd Electron-Cash

Install the python dependencies:

pip3 install -r contrib/requirements/requirements.txt --user

Create translations (optional):

sudo apt-get install python-requests gettext
./contrib/make_locale

Compile libsecp256k1 (optional, yet highly recommended):

sudo apt-get install libtool automake
./contrib/make_secp

For plugin development, see the plugin documentation.

Running unit tests (very optional, advanced users only):

pip install tox
tox

Tox will take care of building a faux installation environment, and ensure that the mapped import paths work correctly.

Running from source on old Linux

If your Linux distribution has a different version of python 3 (such as python 3.5 in Debian 9), it is recommended to do a user dir install with pyenv. This allows Electron Cash to run completely independently of your system configuration.

  1. Install pyenv in your user account. Follow the printed instructions about updating your environment variables and .bashrc, and restart your shell to ensure that they are loaded.
  2. Run pyenv install 3.11.1. This will download and compile that version of python, storing it under .pyenv in your home directory.
  3. cd into the Electron Cash directory. Run pyenv local 3.11.1 which inserts a file .python-version into the current directory.
  4. While still in this directory, run pip install pyqt5.
  5. If you are installing from the source file (.tar.gz or .zip) then you are ready and you may run ./electron-cash. If you are using the git version, then continue by following the Development version instructions above.

Running from source on macOS

You need to install either MacPorts or HomeBrew. Follow the instructions on either site for installing (Xcode from Apple's developer site is required for either).

  1. After installing either HomeBrew or MacPorts, clone this repository and switch to the directory: git clone https://github.com/Electron-Cash/Electron-Cash && cd Electron-Cash
  2. Install python 3.7 or later. For brew: brew install python3 or if using MacPorts: sudo port install python311
  3. Install PyQt5: python3 -m pip install --user pyqt5
  4. Install Electron Cash requirements: python3 -m pip install --user -r contrib/requirements/requirements.txt
  5. Compile libsecp256k1 (optional, yet highly recommended): ./contrib/make_secp. This requires GNU tools and automake, install with brew: brew install coreutils automake or if using MacPorts: sudo port install coreutils automake
  6. At this point you should be able to just run the sources: ./electron-cash

Creating Binaries

Linux AppImage & Source Tarball

See contrib/build-linux/README.md.

Mac OS X / macOS

See contrib/osx/.

Windows

See contrib/build-wine/.

Android

See android/.

iOS

See ios/.

electrumx's People

Contributors

bauerj avatar cculianu avatar cipig avatar cluelessperson avatar cryptcoin-junkey avatar cunhasb avatar elmora-do avatar erasmospunk avatar eukreign avatar fr3aker avatar fujicoin avatar gdassori avatar jeremyrand avatar joesixpack avatar kyuupichan avatar laodc avatar lclc avatar markblundeberg avatar peerchemist avatar pooler avatar protonn avatar shsmith avatar sombernight avatar subpar42 avatar thelazier avatar valesi avatar wakiyamap avatar wilsonmeier avatar wo01 avatar zebra-lucky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electrumx's Issues

blockchain.estimatefee doesn't work for Bitcoin Cash

See this GitHub issue for reference: kyuupichan#845

Bitcoin Cash has removed estimatesmartfee (https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/doc/release-notes/release-notes-0.17.2.md)

Bitcoin Cash still has estimatefee but returns error upon being provided arguments. It requests calling estimatefee without arguments. ElectrumX protocol requires blockchain.estimatefee to have arguments.

Based on this code in the codebase:

    async def estimatefee(self, block_count):
        '''Return the fee estimate for the block count.  Units are whole
        currency units per KB, e.g. 0.00000995, or -1 if no estimate
        is available.
        '''
        args = (block_count, )
        if await self._is_rpc_available('estimatesmartfee'):
            estimate = await self._send_single('estimatesmartfee', args)
            return estimate.get('feerate', -1)
        return await self._send_single('estimatefee', args)

Although the Electrum server will default to estimatefee if estimatesmartfee doesn't exist, it is not possible to call estimatefee without an argument.

This fork of the Electrum server should be adjusted accordingly to match the RPC response. Preferably by ignoring the arguments sent to it from Electrum clients and returning the result of estimatefee without arguments.

Issues with Peers dissapearing

Hi,

Been having an issue with having no peers after looking into it it seems it may be an issue with the duplicite IP protection. My log is fulled of the following when this occurs;

May 23 20:40:28 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[bchx.disdev.org:50002 SSL] dupe peer: Peer bchx.disdev.org is a dupe! 1 other peers with IP 193.37.152.144 were found!
May 23 20:40:28 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[blackie.c3-soft.com:50002 SSL] dupe peer: Peer blackie.c3-soft.com is a dupe! 1 other peers with IP 78.97.206.149 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[electron.jochen-hoenicke.de:51002 SSL] dupe peer: Peer electron.jochen-hoenicke.de is a dupe! 1 other peers with IP 88.198.39.205 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[electroncash.dk:50002 SSL] dupe peer: Peer electroncash.dk is a dupe! 1 other peers with IP 5.103.137.146 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[electrumx-bch.cryptonermal.net:50002 SSL] dupe peer: Peer electrumx-bch.cryptonermal.net is a dupe! 1 other peers with IP 18.233.20.36 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[electrumx.hillsideinternet.com:50002 SSL] dupe peer: Peer electrumx.hillsideinternet.com is a dupe! 1 other peers with IP 162.220.47.150 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[bch0.kister.net:50002 SSL] dupe peer: Peer bch0.kister.net is a dupe! 1 other peers with IP 100.11.124.171 were found!
May 23 20:40:29 bitcoin-cash electrumx_server[12484]: ERROR:PeerManager:[bch.imaginary.cash:50002 SSL] dupe peer: Peer bch.imaginary.cash is a dupe! 1 other peers with IP 198.27.66.168 were found!

Not sure what is causing this to occur but once they are all flagged as dupes my peers go to 0. Any ideas what could be causing it to check already connected and existing peers and then making themselfs as duplicates?

Thanks

exception "struct.error: 'H' format requires 0 <= number <= 65535" during block processing

@400000005da97e4a08284b84 ERROR:root:task crashed: <Task finished coro=<Controller.serve() done, defined at /home/nick/electronx/electrumx/server/controller.py:81> exception=error("'H' format requires 0 <= number <= 65535",)>
@400000005da97e4a08285354 Traceback (most recent call last):
@400000005da97e4a0828573c   File "/usr/local/lib/python3.6/site-packages/aiorpcx/util.py", line 118, in check_task
@400000005da97e4a08285b24     task.result()
@400000005da97e4a08285b24   File "/home/nick/electronx/electrumx/server/controller.py", line 134, in serve
@400000005da97e4a08288dec     await group.spawn(wait_for_catchup())
@400000005da97e4a082891d4   File "/usr/local/lib/python3.6/site-packages/aiorpcx/curio.py", line 238, in __aexit__
@400000005da97e4a082895bc     await self.join()
@400000005da97e4a082895bc   File "/usr/local/lib/python3.6/site-packages/aiorpcx/curio.py", line 207, in join
@400000005da97e4a082899a4     raise task.exception()
@400000005da97e4a082899a4   File "/home/nick/electronx/electrumx/server/block_processor.py", line 667, in fetch_and_process_blocks
@400000005da97e4a0828ad2c     await self.flush(True)
@400000005da97e4a0828b114   File "/home/nick/electronx/electrumx/server/block_processor.py", line 335, in flush
@400000005da97e4a0828b4fc     await self.run_in_thread_with_lock(flush)
@400000005da97e4a0828b4fc   File "/home/nick/electronx/electrumx/server/block_processor.py", line 191, in run_in_thread_with_lock
@400000005da97e4a08290ed4     return await asyncio.shield(run_in_thread_locked())
@400000005da97e4a08290ed4   File "/home/nick/electronx/electrumx/server/block_processor.py", line 190, in run_in_thread_locked
@400000005da97e4a082912bc     return await run_in_thread(func, *args)
@400000005da97e4a082916a4   File "/usr/local/lib/python3.6/site-packages/aiorpcx/curio.py", line 68, in run_in_thread
@400000005da97e4a08292644     return await get_event_loop().run_in_executor(None, func, *args)
@400000005da97e4a08292a2c   File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
@400000005da97e4a08292e14     result = self.fn(*self.args, **self.kwargs)
@400000005da97e4a082931fc   File "/home/nick/electronx/electrumx/server/block_processor.py", line 334, in flush
@400000005da97e4a082931fc     self.estimate_txs_remaining)
@400000005da97e4a08293db4   File "/home/nick/electronx/electrumx/server/db.py", line 200, in flush_dbs
@400000005da97e4a0829419c     self.flush_history()
@400000005da97e4a08294584   File "/home/nick/electronx/electrumx/server/db.py", line 269, in flush_history
@400000005da97e4a08294584     self.history.flush()
@400000005da97e4a0829496c   File "/home/nick/electronx/electrumx/server/history.py", line 128, in flush
@400000005da97e4a08294d54     flush_id = pack_be_uint16(self.flush_count)
@400000005da97e4a0829590c struct.error: 'H' format requires 0 <= number <= 65535
@400000005da985fb0b519b1c WARNING:Controller:received SIGTERM signal, initiating shutdown

this is on current master branch

on restart it continues processing blocks fine. the exception happened 2 times so far while processing around 10000 blocks (rough guess)

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.