Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5179906
history db: change schema, and rm compaction
SomberNight Oct 22, 2020
33ab897
history db: change schema: prefix entries with b'H'
SomberNight Oct 28, 2020
a7eaffa
history db: store a tx_hash->tx_num map
SomberNight Oct 28, 2020
0bfb1c6
history db: sort key insertion order
SomberNight Oct 29, 2020
bd618d6
utxo db: change schema: no longer use compressed txid
SomberNight Oct 28, 2020
6ff6133
db: rm upgrade logic
SomberNight Oct 28, 2020
fbceb86
session: blockchain.transaction.get_merkle: make "height" optional
SomberNight Oct 29, 2020
19314f9
env: add new cfg option "DAEMON_HAS_TXINDEX", and support "False"
SomberNight Oct 29, 2020
e702e9a
history db: store a (prev_txnum, prev_idx)->spender_txnum map
SomberNight Oct 30, 2020
b300257
(trivial) make TXNUM_PADDING a global
SomberNight Oct 30, 2020
570aa43
db: add parameter for TXOUTIDX_LEN
SomberNight Oct 30, 2020
ad45933
db: change TXOUTIDX_LEN from 4 to 3, to save db storage size
SomberNight Oct 30, 2020
cb3568e
session: implement "blockchain.outpoint.subscribe" RPC
SomberNight Nov 3, 2020
d49694e
"blockchain.outpoint.subscribe" RPC: add optional "spk_hint" argument
SomberNight Jan 19, 2021
a8fcacf
"blockchain.outpoint.subscribe" RPC: implement notifications
SomberNight Nov 4, 2020
5b00b27
"blockchain.outpoint.subscribe" RPC: distinguish heights "-1" and "0"
SomberNight Jan 27, 2021
90b2fa4
(bugfix) db: change tx_num endianness (LE->BE) to match db comparator
SomberNight Nov 16, 2020
4b01755
DB storage: implement iterator.seek(key)
SomberNight Feb 3, 2021
819b46e
session: add "blockchain.scriptpubkey.*" RPCs
SomberNight Feb 26, 2025
bc9f2cd
session: add "method_flavours" to "server.features"
SomberNight Feb 26, 2025
dc7e03c
session: add 'block_hash' field to 'transaction.get_merkle'
SomberNight Feb 26, 2025
89d0631
implement new "server.ping" semantics for protocol 1.7
SomberNight Feb 26, 2025
525d000
implement 'blockchain.transaction.get_merkle_witness' RPC
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
10 changes: 10 additions & 0 deletions docs/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ 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:: DAEMON_HAS_TXINDEX

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 @@ -504,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 @@ -234,7 +234,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, Any
from typing import Set, Any, 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 @@ -333,6 +333,7 @@ def is_hex_str(text: Any) -> bool:
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 @@ -346,6 +347,7 @@ def is_hex_str(text: Any) -> bool:
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 @@ -354,6 +356,7 @@ def is_hex_str(text: Any) -> bool:
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