Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3d2aea2
history db: change schema, and rm compaction
SomberNight Oct 22, 2020
9adcc07
history db: change schema: prefix entries with b'H'
SomberNight Oct 28, 2020
0dcf9fe
history db: store a tx_hash->tx_num map
SomberNight Oct 28, 2020
143b139
history db: sort key insertion order
SomberNight Oct 29, 2020
152fd63
utxo db: change schema: no longer use compressed txid
SomberNight Oct 28, 2020
6ea6283
db: rm upgrade logic
SomberNight Oct 28, 2020
9f19429
session: blockchain.transaction.get_merkle: make "height" optional
SomberNight Oct 29, 2020
76f2369
env: add new cfg option "DAEMON_HAS_TXINDEX", and support "False"
SomberNight Oct 29, 2020
b741f2c
history db: store a (prev_txnum, prev_idx)->spender_txnum map
SomberNight Oct 30, 2020
85456ce
(trivial) make TXNUM_PADDING a global
SomberNight Oct 30, 2020
363a1ab
db: add parameter for TXOUTIDX_LEN
SomberNight Oct 30, 2020
7c6ab1e
db: change TXOUTIDX_LEN from 4 to 3, to save db storage size
SomberNight Oct 30, 2020
060452c
session: implement "blockchain.outpoint.subscribe" RPC
SomberNight Nov 3, 2020
2738276
"blockchain.outpoint.subscribe" RPC: add optional "spk_hint" argument
SomberNight Jan 19, 2021
c4208ec
"blockchain.outpoint.subscribe" RPC: implement notifications
SomberNight Nov 4, 2020
a8ab7c9
"blockchain.outpoint.subscribe" RPC: distinguish heights "-1" and "0"
SomberNight Jan 27, 2021
05ebe00
protocol change: server.version must be the first message on the wire
SomberNight Nov 5, 2020
612a570
session: wait for protocol ver negotiation to finish before other reqs
SomberNight Jan 19, 2021
de837e7
(bugfix) db: change tx_num endianness (LE->BE) to match db comparator
SomberNight Nov 16, 2020
26af80a
protocol change: define order of mempool txs in status of scripthash
SomberNight Dec 15, 2020
2627947
DB storage: implement iterator.seek(key)
SomberNight Feb 3, 2021
eabaaf2
[AuxPow] Add Support for individual block headers instead of a combin…
ahmedbodi Jun 28, 2020
a26bebc
Array headers: Refactor AuxPoW
JeremyRand Mar 18, 2021
d3eb07e
Array headers: Refactor AuxPoW truncation
JeremyRand Mar 18, 2021
20bb70f
session: add "blockchain.scriptpubkey.*" RPCs
SomberNight Feb 26, 2025
d54c151
session: add "method_flavours" to "server.features"
SomberNight Feb 26, 2025
9000d93
session: add 'block_hash' field to 'transaction.get_merkle'
SomberNight Feb 26, 2025
717c1af
implement new "server.ping" semantics for protocol 1.6
SomberNight Feb 26, 2025
afa307f
implement 'blockchain.transaction.get_merkle_witness' RPC
SomberNight Mar 10, 2025
6370b49
follow-up prev
SomberNight Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/HOWTO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ functions. For example, `dash_hash`_ is required for DASH. Scrypt coins
require a Python interpreter compiled and/or linked with OpenSSL 1.1.0
or higher.

You **must** be running a non-pruning bitcoin daemon with::
You **must** be running a non-pruning bitcoin daemon.
It is also recommended to have::

txindex=1

set in its configuration file. If you have an existing installation
of bitcoind and have not previously set this you will need to reindex
the blockchain with::
set in its configuration file, for better performance when serving many sessions.
If you have an existing installation of bitcoind and have not previously set this
but you do now, you will need to reindex the blockchain with::

bitcoind -reindex

which can take some time.
If you intend to use a bitcoind without txindex enabled, you need to configure the
`DAEMON_HAS_TXINDEX` :ref:`environment variable <environment>`.

While not a requirement for running ElectrumX, it is intended to be
run with supervisor software such as Daniel Bernstein's
Expand Down
14 changes: 8 additions & 6 deletions docs/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,14 @@ These environment variables are optional:
version string. For example to drop versions from 1.0 to 1.2 use
the regex ``1\.[0-2]\.\d+``.

.. envvar:: DROP_CLIENT_UNKNOWN
.. envvar:: DAEMON_HAS_TXINDEX

Set to anything non-empty to deny serving clients which do not
identify themselves first by issuing the server.version method
call with a non-empty client identifier. The connection is dropped
on first actual method call. This might help to filter out simple
robots. This behavior is off by default.
Set this environment variable to empty if the connected bitcoind
does not have txindex enabled. Defaults to True (has txindex).
We rely on bitcoind to lookup arbitrary txs, regardless of this setting.
Without txindex, tx lookup works as in `bitcoind PR #10275`_.
Note that performance when serving many sessions is better with txindex
(but initial sync should be unaffected).


Resource Usage Limits
Expand Down Expand Up @@ -512,3 +513,4 @@ your available physical RAM:

.. _lib/coins.py: https://github.com/spesmilo/electrumx/blob/master/src/electrumx/lib/coins.py
.. _uvloop: https://pypi.python.org/pypi/uvloop
.. _bitcoind PR #10275: https://github.com/bitcoin/bitcoin/pull/10275
11 changes: 0 additions & 11 deletions electrumx_compact_history

This file was deleted.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Repository = "https://github.com/spesmilo/electrumx"
[project.scripts]
electrumx_server = "electrumx.cli.electrumx_server:main"
electrumx_rpc = "electrumx.cli.electrumx_rpc:main"
electrumx_compact_history = "electrumx.cli.electrumx_compact_history:main"

[tool.setuptools.dynamic]
version = { attr = 'electrumx.__version__' }
Expand Down
83 changes: 0 additions & 83 deletions src/electrumx/cli/electrumx_compact_history.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/electrumx/lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def privkey_WIF(cls, privkey_bytes, compressed):
return cls.ENCODE_CHECK(payload)

@classmethod
def header_hash(cls, header):
def header_hash(cls, header: bytes) -> bytes:
'''Given a header return hash'''
return double_sha256(header)

Expand Down
7 changes: 7 additions & 0 deletions src/electrumx/lib/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ def serialize(self):
))


@dataclass(kw_only=True, slots=True)
class TXOSpendStatus:
prev_height: Optional[int] # block height TXO is mined at. None if the outpoint never existed
spender_txhash: bytes = None
spender_height: int = None


class Deserializer:
'''Deserializes blocks into transactions.

Expand Down
7 changes: 5 additions & 2 deletions src/electrumx/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import sys
from collections.abc import Container, Mapping
from struct import Struct
from typing import Set
from typing import Set, Optional

import aiorpcx

Expand Down Expand Up @@ -166,7 +166,7 @@ def chunks(items, size):
yield items[i: i + size]


def resolve_limit(limit):
def resolve_limit(limit: Optional[int]) -> int:
if limit is None or limit < 0:
return -1
assert isinstance(limit, int)
Expand Down Expand Up @@ -320,6 +320,7 @@ def protocol_version(client_req, min_tuple, max_tuple):
struct_le_Q = Struct('<Q')
struct_be_H = Struct('>H')
struct_be_I = Struct('>I')
struct_be_Q = Struct('>Q')
structB = Struct('B')

unpack_le_int32_from = struct_le_i.unpack_from
Expand All @@ -333,6 +334,7 @@ def protocol_version(client_req, min_tuple, max_tuple):
unpack_le_uint32 = struct_le_I.unpack
unpack_le_uint64 = struct_le_Q.unpack
unpack_be_uint32 = struct_be_I.unpack
unpack_be_uint64 = struct_be_Q.unpack

pack_le_int32 = struct_le_i.pack
pack_le_int64 = struct_le_q.pack
Expand All @@ -341,6 +343,7 @@ def protocol_version(client_req, min_tuple, max_tuple):
pack_le_uint64 = struct_le_Q.pack
pack_be_uint16 = struct_be_H.pack
pack_be_uint32 = struct_be_I.pack
pack_be_uint64 = struct_be_Q.pack
pack_byte = structB.pack

hex_to_bytes = bytes.fromhex
Expand Down
Loading