6 changed files with 379 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
# Minimal makefile for Sphinx documentation
|
||||
|
#
|
||||
|
|
||||
|
# You can set these variables from the command line.
|
||||
|
SPHINXOPTS = |
||||
|
SPHINXBUILD = sphinx-build |
||||
|
SPHINXPROJ = ElectrumX |
||||
|
SOURCEDIR = . |
||||
|
BUILDDIR = _build |
||||
|
|
||||
|
# Put it first so that "make" without argument is like "make help".
|
||||
|
help: |
||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
||||
|
|
||||
|
.PHONY: help Makefile |
||||
|
|
||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
|
%: Makefile |
||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
@ -0,0 +1,155 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# |
||||
|
# Configuration file for the Sphinx documentation builder. |
||||
|
# |
||||
|
# This file does only contain a selection of the most common options. For a |
||||
|
# full list see the documentation: |
||||
|
# http://www.sphinx-doc.org/en/stable/config |
||||
|
|
||||
|
# -- Path setup -------------------------------------------------------------- |
||||
|
|
||||
|
# If extensions (or modules to document with autodoc) are in another directory, |
||||
|
# add these directories to sys.path here. If the directory is relative to the |
||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here. |
||||
|
# |
||||
|
# import os |
||||
|
# import sys |
||||
|
# sys.path.insert(0, os.path.abspath('.')) |
||||
|
|
||||
|
|
||||
|
# -- Project information ----------------------------------------------------- |
||||
|
|
||||
|
project = 'ElectrumX' |
||||
|
copyright = '2018, Neil Booth' |
||||
|
author = 'Neil Booth' |
||||
|
|
||||
|
# The short X.Y version |
||||
|
version = '' |
||||
|
# The full version, including alpha/beta/rc tags |
||||
|
release = '1.2.1' |
||||
|
|
||||
|
|
||||
|
# -- General configuration --------------------------------------------------- |
||||
|
|
||||
|
# If your documentation needs a minimal Sphinx version, state it here. |
||||
|
# |
||||
|
# needs_sphinx = '1.0' |
||||
|
|
||||
|
# Add any Sphinx extension module names here, as strings. They can be |
||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
||||
|
# ones. |
||||
|
extensions = [ |
||||
|
] |
||||
|
|
||||
|
# Add any paths that contain templates here, relative to this directory. |
||||
|
templates_path = ['_templates'] |
||||
|
|
||||
|
# The suffix(es) of source filenames. |
||||
|
# You can specify multiple suffix as a list of string: |
||||
|
# |
||||
|
# source_suffix = ['.rst', '.md'] |
||||
|
source_suffix = '.rst' |
||||
|
|
||||
|
# The master toctree document. |
||||
|
master_doc = 'index' |
||||
|
|
||||
|
# The language for content autogenerated by Sphinx. Refer to documentation |
||||
|
# for a list of supported languages. |
||||
|
# |
||||
|
# This is also used if you do content translation via gettext catalogs. |
||||
|
# Usually you set "language" from the command line for these cases. |
||||
|
language = None |
||||
|
|
||||
|
# List of patterns, relative to source directory, that match files and |
||||
|
# directories to ignore when looking for source files. |
||||
|
# This pattern also affects html_static_path and html_extra_path . |
||||
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
||||
|
|
||||
|
# The name of the Pygments (syntax highlighting) style to use. |
||||
|
pygments_style = 'sphinx' |
||||
|
|
||||
|
|
||||
|
# -- Options for HTML output ------------------------------------------------- |
||||
|
|
||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for |
||||
|
# a list of builtin themes. |
||||
|
# |
||||
|
html_theme = 'alabaster' |
||||
|
|
||||
|
# Theme options are theme-specific and customize the look and feel of a theme |
||||
|
# further. For a list of options available for each theme, see the |
||||
|
# documentation. |
||||
|
# |
||||
|
# html_theme_options = {} |
||||
|
|
||||
|
# Add any paths that contain custom static files (such as style sheets) here, |
||||
|
# relative to this directory. They are copied after the builtin static files, |
||||
|
# so a file named "default.css" will overwrite the builtin "default.css". |
||||
|
html_static_path = ['_static'] |
||||
|
|
||||
|
# Custom sidebar templates, must be a dictionary that maps document names |
||||
|
# to template names. |
||||
|
# |
||||
|
# The default sidebars (for documents that don't match any pattern) are |
||||
|
# defined by theme itself. Builtin themes are using these templates by |
||||
|
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
||||
|
# 'searchbox.html']``. |
||||
|
# |
||||
|
# html_sidebars = {} |
||||
|
|
||||
|
|
||||
|
# -- Options for HTMLHelp output --------------------------------------------- |
||||
|
|
||||
|
# Output file base name for HTML help builder. |
||||
|
htmlhelp_basename = 'ElectrumXdoc' |
||||
|
|
||||
|
|
||||
|
# -- Options for LaTeX output ------------------------------------------------ |
||||
|
|
||||
|
latex_elements = { |
||||
|
# The paper size ('letterpaper' or 'a4paper'). |
||||
|
# |
||||
|
# 'papersize': 'letterpaper', |
||||
|
|
||||
|
# The font size ('10pt', '11pt' or '12pt'). |
||||
|
# |
||||
|
# 'pointsize': '10pt', |
||||
|
|
||||
|
# Additional stuff for the LaTeX preamble. |
||||
|
# |
||||
|
# 'preamble': '', |
||||
|
|
||||
|
# Latex figure (float) alignment |
||||
|
# |
||||
|
# 'figure_align': 'htbp', |
||||
|
} |
||||
|
|
||||
|
# Grouping the document tree into LaTeX files. List of tuples |
||||
|
# (source start file, target name, title, |
||||
|
# author, documentclass [howto, manual, or own class]). |
||||
|
latex_documents = [ |
||||
|
(master_doc, 'ElectrumX.tex', 'ElectrumX Documentation', |
||||
|
'Neil Booth', 'manual'), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
# -- Options for manual page output ------------------------------------------ |
||||
|
|
||||
|
# One entry per manual page. List of tuples |
||||
|
# (source start file, name, description, authors, manual section). |
||||
|
man_pages = [ |
||||
|
(master_doc, 'electrumx', 'ElectrumX Documentation', |
||||
|
[author], 1) |
||||
|
] |
||||
|
|
||||
|
|
||||
|
# -- Options for Texinfo output ---------------------------------------------- |
||||
|
|
||||
|
# Grouping the document tree into Texinfo files. List of tuples |
||||
|
# (source start file, target name, title, author, |
||||
|
# dir menu entry, description, category) |
||||
|
texinfo_documents = [ |
||||
|
(master_doc, 'ElectrumX', 'ElectrumX Documentation', |
||||
|
author, 'ElectrumX', 'One line description of project.', |
||||
|
'Miscellaneous'), |
||||
|
] |
@ -0,0 +1,21 @@ |
|||||
|
.. ElectrumX documentation master file, created by |
||||
|
sphinx-quickstart on Mon Mar 5 22:39:16 2018. |
||||
|
You can adapt this file completely to your liking, but it should at least |
||||
|
contain the root `toctree` directive. |
||||
|
|
||||
|
Welcome to ElectrumX's documentation! |
||||
|
===================================== |
||||
|
|
||||
|
.. toctree:: |
||||
|
:maxdepth: 2 |
||||
|
:caption: Contents: |
||||
|
|
||||
|
protocol-new |
||||
|
|
||||
|
|
||||
|
Indices and tables |
||||
|
================== |
||||
|
|
||||
|
* :ref:`genindex` |
||||
|
* :ref:`modindex` |
||||
|
* :ref:`search` |
@ -0,0 +1,36 @@ |
|||||
|
@ECHO OFF |
||||
|
|
||||
|
pushd %~dp0 |
||||
|
|
||||
|
REM Command file for Sphinx documentation |
||||
|
|
||||
|
if "%SPHINXBUILD%" == "" ( |
||||
|
set SPHINXBUILD=sphinx-build |
||||
|
) |
||||
|
set SOURCEDIR=. |
||||
|
set BUILDDIR=_build |
||||
|
set SPHINXPROJ=ElectrumX |
||||
|
|
||||
|
if "%1" == "" goto help |
||||
|
|
||||
|
%SPHINXBUILD% >NUL 2>NUL |
||||
|
if errorlevel 9009 ( |
||||
|
echo. |
||||
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx |
||||
|
echo.installed, then set the SPHINXBUILD environment variable to point |
||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you |
||||
|
echo.may add the Sphinx directory to PATH. |
||||
|
echo. |
||||
|
echo.If you don't have Sphinx installed, grab it from |
||||
|
echo.http://sphinx-doc.org/ |
||||
|
exit /b 1 |
||||
|
) |
||||
|
|
||||
|
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
|
goto end |
||||
|
|
||||
|
:help |
||||
|
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% |
||||
|
|
||||
|
:end |
||||
|
popd |
@ -0,0 +1,15 @@ |
|||||
|
.. method:: mempool.get_fee_histogram() |
||||
|
|
||||
|
Return a histogram of the fee rates paid by transactions in the |
||||
|
memory pool, weighted by transaction size. |
||||
|
|
||||
|
**Response** |
||||
|
|
||||
|
The histogram is an array of [*fee*, *vsize*] pairs, where *vsize_n* is |
||||
|
the cumulative virtual size of mempool transactions with a fee rate |
||||
|
in the interval [*fee*_(n-1), *fee*_n)], and *fee*_(n-1) > *fee*_n. |
||||
|
|
||||
|
Fee intervals may have variable size. The choice of appropriate |
||||
|
intervals is currently not part of the protocol. |
||||
|
|
||||
|
.. versionadded:: 1.2 |
@ -0,0 +1,132 @@ |
|||||
|
Electrum Protocol |
||||
|
================= |
||||
|
|
||||
|
This is intended to be a reference for client and server authors |
||||
|
alike. |
||||
|
|
||||
|
|
||||
|
Message Stream |
||||
|
-------------- |
||||
|
|
||||
|
Clients and servers communicate using **JSON RPC** over an unspecified |
||||
|
underlying stream transport protocol, typically TCP or SSL. |
||||
|
|
||||
|
`JSON RPC 1.0 <http://www.jsonrpc.org/specification_v1>` and `JSON RPC |
||||
|
2.0 <http://www.jsonrpc.org/specification>` are specified; use of |
||||
|
version 2.0 is encouraged but not required. Server support of batch |
||||
|
requests is encouraged for version 1.0 but not required. Clients |
||||
|
making batch requests should limit their size depending on the nature |
||||
|
of their query, because servers will limit response size as an |
||||
|
anti-DoS mechanism. |
||||
|
|
||||
|
Eeach RPC call, and each response, is separated by a single newline in |
||||
|
their respective streams. The JSON specification does not permit |
||||
|
control characters within strings, so no confusion is possible there. |
||||
|
However it does permit newlines as extraneous whitespace between |
||||
|
elements; client and server MUST NOT use newlines in such a way. |
||||
|
|
||||
|
If using JSON RPC 2.0's feature of parameter passing by name, the |
||||
|
names shown in the description of the method in question MUST be used. |
||||
|
|
||||
|
A server advertising support for a particular protocol version MUST |
||||
|
support each method documented for that protocol version, unless the |
||||
|
method is explicitly marked optional. It may support other methods or |
||||
|
additional parameters with unspecified behaviour. Use of additional |
||||
|
parameters is discouraged as it may conflict with future versions of |
||||
|
the protocol. |
||||
|
|
||||
|
|
||||
|
Notifications |
||||
|
------------- |
||||
|
|
||||
|
Some RPC calls are subscriptions, which, after the initial response, |
||||
|
will send a :dfn:`notification` each time the thing subscribed to |
||||
|
changes. The `method` of the notification is the same as the method |
||||
|
of the subscription, and the `params` of the notification (and their |
||||
|
names) are given in the documentation of the method. |
||||
|
|
||||
|
|
||||
|
Protocol Negotiation |
||||
|
-------------------- |
||||
|
|
||||
|
It is desirable to have a way to enhance and improve the protocol |
||||
|
without forcing servers and clients to upgrade at the same time. |
||||
|
Protocol negotiation is not implemented in any client or server at |
||||
|
present to the best of my knowledge, so care is needed to ensure |
||||
|
current clients and servers continue to operate as expected. |
||||
|
|
||||
|
Protocol versions are denoted by dotted "a.b" strings, where *m* is |
||||
|
the major version number and *n* the minor version number. For |
||||
|
example: "1.5". |
||||
|
|
||||
|
A party to a connection will speak all protocol versions in a range, |
||||
|
say from `protocol_min` to `protocol_max`, which may be the same. |
||||
|
When a connection is made, both client and server must initially |
||||
|
assume the protocol to use is their own `protocol_min`. |
||||
|
|
||||
|
The client should send a :func:`server.version` RPC call as early as |
||||
|
possible in order to negotiate the precise protocol version; see its |
||||
|
description for more detail. All responses received in the stream |
||||
|
from and including the server's response to this call will use the |
||||
|
negotiated protocol version. |
||||
|
|
||||
|
|
||||
|
Script Hashes |
||||
|
------------- |
||||
|
|
||||
|
A :defn:`script hash` is the hash of the binary bytes of the locking |
||||
|
script (ScriptPubKey), expressed as a hexadecimal string. The hash |
||||
|
function to use is given by the "hash_function" member of |
||||
|
:func:`server.features` (currently "sha256" only). Like for block and |
||||
|
transaction hashes, when converting the big-endian binary hash to a |
||||
|
hexadecimal string the least-significant byte appears first, and the |
||||
|
most-significant byte last. |
||||
|
|
||||
|
For example, the legacy Bitcoin address from the genesis block:: |
||||
|
|
||||
|
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa |
||||
|
|
||||
|
has P2PKH script:: |
||||
|
|
||||
|
76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac |
||||
|
|
||||
|
with SHA256 hash:: |
||||
|
|
||||
|
6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b |
||||
|
|
||||
|
which is sent to the server reversed as:: |
||||
|
|
||||
|
8b01df4e368ea28f8dc0423bcf7a4923e3a12d307c875e47a0cfbf90b5c39161 |
||||
|
|
||||
|
By subscribing to this hash you can find P2PKH payments to that address. |
||||
|
|
||||
|
One public key for that address (the genesis block public key) is:: |
||||
|
|
||||
|
04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb |
||||
|
649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f |
||||
|
|
||||
|
which has P2PK script:: |
||||
|
|
||||
|
4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb |
||||
|
649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac |
||||
|
|
||||
|
with SHA256 hash:: |
||||
|
|
||||
|
3318537dfb3135df9f3d950dbdf8a7ae68dd7c7dfef61ed17963ff80f3850474 |
||||
|
|
||||
|
which is sent to the server reversed as:: |
||||
|
|
||||
|
740485f380ff6379d11ef6fe7d7cdd68aea7f8bd0d953d9fdf3531fb7d531833 |
||||
|
|
||||
|
By subscribing to this hash you can find P2PK payments to that public |
||||
|
key. |
||||
|
|
||||
|
.. note:: The Genesis block coinbase is unspendable and therefore not |
||||
|
indexed. It will not show with the above P2PK script hash subscription. |
||||
|
|
||||
|
|
||||
|
.. toctree:: |
||||
|
:maxdepth: 1 |
||||
|
:caption: Methods: |
||||
|
|
||||
|
mempool_fee_get_histogram |
Loading…
Reference in new issue