From 43c73b9abfa244a63ba0d638627b7788714ae9e0 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 19 Mar 2018 13:31:05 -0400 Subject: [PATCH 01/15] fix slow sqlite query --- lbrynet/database/storage.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lbrynet/database/storage.py b/lbrynet/database/storage.py index 4dce4b477..a77a8dae8 100644 --- a/lbrynet/database/storage.py +++ b/lbrynet/database/storage.py @@ -423,12 +423,14 @@ class SQLiteStorage(object): if only_completed: lengths = transaction.execute( "select b.blob_hash, b.blob_length from blob b " - "inner join stream_blob s ON b.blob_hash=s.blob_hash and b.status='finished'" + "inner join stream_blob s ON b.blob_hash=s.blob_hash and b.status='finished' and s.stream_hash=?", + (stream_hash, ) ).fetchall() else: lengths = transaction.execute( "select b.blob_hash, b.blob_length from blob b " - "inner join stream_blob s ON b.blob_hash=s.blob_hash" + "inner join stream_blob s ON b.blob_hash=s.blob_hash and s.stream_hash=?", + (stream_hash, ) ).fetchall() blob_length_dict = {} From f94a9e8729fe1de7ef1bfd8a0df7d9e734dff058 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 19 Mar 2018 13:34:33 -0400 Subject: [PATCH 02/15] start lbry files in parallel --- lbrynet/file_manager/EncryptedFileManager.py | 63 +++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/lbrynet/file_manager/EncryptedFileManager.py b/lbrynet/file_manager/EncryptedFileManager.py index 96b56c0ab..581dfe2a2 100644 --- a/lbrynet/file_manager/EncryptedFileManager.py +++ b/lbrynet/file_manager/EncryptedFileManager.py @@ -96,41 +96,48 @@ class EncryptedFileManager(object): suggested_file_name=suggested_file_name ) + @defer.inlineCallbacks + def _start_lbry_file(self, file_info, payment_rate_manager): + lbry_file = self._get_lbry_file( + file_info['row_id'], file_info['stream_hash'], payment_rate_manager, file_info['sd_hash'], + file_info['key'], file_info['stream_name'], file_info['file_name'], file_info['download_directory'], + file_info['suggested_file_name'] + ) + yield lbry_file.get_claim_info() + try: + # verify the stream is valid (we might have downloaded an invalid stream + # in the past when the validation check didn't work) + stream_info = yield get_sd_info(self.storage, file_info['stream_hash'], include_blobs=True) + validate_descriptor(stream_info) + except InvalidStreamDescriptorError as err: + log.warning("Stream for descriptor %s is invalid (%s), cleaning it up", + lbry_file.sd_hash, err.message) + yield lbry_file.delete_data() + yield self.session.storage.delete_stream(lbry_file.stream_hash) + else: + try: + # restore will raise an Exception if status is unknown + lbry_file.restore(file_info['status']) + self.storage.content_claim_callbacks[lbry_file.stream_hash] = lbry_file.get_claim_info + self.lbry_files.append(lbry_file) + if len(self.lbry_files) % 500 == 0: + log.info("Started %i files", len(self.lbry_files)) + except Exception: + log.warning("Failed to start %i", file_info.get('rowid')) + @defer.inlineCallbacks def _start_lbry_files(self): files = yield self.session.storage.get_all_lbry_files() b_prm = self.session.base_payment_rate_manager payment_rate_manager = NegotiatedPaymentRateManager(b_prm, self.session.blob_tracker) - log.info("Trying to start %i files", len(files)) - for i, file_info in enumerate(files): - if len(files) > 500 and i % 500 == 0: - log.info("Started %i/%i files", i, len(files)) + log.info("Starting %i files", len(files)) + dl = [] + for file_info in files: + dl.append(self._start_lbry_file(file_info, payment_rate_manager)) + + yield defer.DeferredList(dl) - lbry_file = self._get_lbry_file( - file_info['row_id'], file_info['stream_hash'], payment_rate_manager, file_info['sd_hash'], - file_info['key'], file_info['stream_name'], file_info['file_name'], file_info['download_directory'], - file_info['suggested_file_name'] - ) - yield lbry_file.get_claim_info() - try: - # verify the stream is valid (we might have downloaded an invalid stream - # in the past when the validation check didn't work) - stream_info = yield get_sd_info(self.storage, file_info['stream_hash'], include_blobs=True) - validate_descriptor(stream_info) - except InvalidStreamDescriptorError as err: - log.warning("Stream for descriptor %s is invalid (%s), cleaning it up", - lbry_file.sd_hash, err.message) - yield lbry_file.delete_data() - yield self.session.storage.delete_stream(lbry_file.stream_hash) - else: - try: - # restore will raise an Exception if status is unknown - lbry_file.restore(file_info['status']) - self.storage.content_claim_callbacks[lbry_file.stream_hash] = lbry_file.get_claim_info - self.lbry_files.append(lbry_file) - except Exception: - log.warning("Failed to start %i", file_info.get('rowid')) log.info("Started %i lbry files", len(self.lbry_files)) if self.auto_re_reflect is True: safe_start_looping_call(self.lbry_file_reflector, self.auto_re_reflect_interval) From b28bdbd752fd36de95c6c6555c01482886421b99 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 19 Mar 2018 13:36:53 -0400 Subject: [PATCH 03/15] rename existing reupload.reflect_stream --> reupload.reflect_file, add a reupload.reflect_stream function --- lbrynet/daemon/Daemon.py | 4 +- lbrynet/file_manager/EncryptedFileManager.py | 4 +- lbrynet/reflector/client/client.py | 50 +++++--------------- lbrynet/reflector/reupload.py | 24 ++++++++-- lbrynet/tests/functional/test_reflector.py | 10 +--- 5 files changed, 38 insertions(+), 54 deletions(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 0494badf9..c5e7d0e22 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -719,7 +719,7 @@ class Daemon(AuthJSONRPCServer): claim_out = yield publisher.create_and_publish_stream(name, bid, claim_dict, file_path, claim_address, change_address) if conf.settings['reflect_uploads']: - d = reupload.reflect_stream(publisher.lbry_file) + d = reupload.reflect_file(publisher.lbry_file) d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name), log.exception) self.analytics_manager.send_claim_action('publish') @@ -3010,7 +3010,7 @@ class Daemon(AuthJSONRPCServer): raise Exception('No file found') lbry_file = lbry_files[0] - results = yield reupload.reflect_stream(lbry_file, reflector_server=reflector_server) + results = yield reupload.reflect_file(lbry_file, reflector_server=reflector_server) defer.returnValue(results) @defer.inlineCallbacks diff --git a/lbrynet/file_manager/EncryptedFileManager.py b/lbrynet/file_manager/EncryptedFileManager.py index 581dfe2a2..5f91eae01 100644 --- a/lbrynet/file_manager/EncryptedFileManager.py +++ b/lbrynet/file_manager/EncryptedFileManager.py @@ -7,7 +7,7 @@ import logging from twisted.internet import defer, task, reactor from twisted.python.failure import Failure from lbrynet.core.Error import InvalidStreamDescriptorError -from lbrynet.reflector.reupload import reflect_stream +from lbrynet.reflector.reupload import reflect_file from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory @@ -254,7 +254,7 @@ class EncryptedFileManager(object): sem = defer.DeferredSemaphore(self.CONCURRENT_REFLECTS) ds = [] for lbry_file in self.lbry_files: - ds.append(sem.run(reflect_stream, lbry_file)) + ds.append(sem.run(reflect_file, lbry_file)) yield defer.DeferredList(ds) @defer.inlineCallbacks diff --git a/lbrynet/reflector/client/client.py b/lbrynet/reflector/client/client.py index d70e531a2..cd52adc14 100644 --- a/lbrynet/reflector/client/client.py +++ b/lbrynet/reflector/client/client.py @@ -33,26 +33,14 @@ class EncryptedFileReflectorClient(Protocol): self.file_sender = None self.producer = None self.streaming = False + + self.blob_manager = self.factory.blob_manager + self.protocol_version = self.factory.protocol_version + self.stream_hash = self.factory.stream_hash + d = self.load_descriptor() d.addCallback(lambda _: self.send_handshake()) - d.addErrback( - lambda err: log.warning("An error occurred immediately: %s", err.getTraceback())) - - @property - def file_name(self): - return self.factory.file_name - - @property - def blob_manager(self): - return self.factory.blob_manager - - @property - def protocol_version(self): - return self.factory.protocol_version - - @property - def stream_hash(self): - return self.factory.stream_hash + d.addErrback(lambda err: log.warning("An error occurred immediately: %s", err.getTraceback())) def dataReceived(self, data): self.response_buff += data @@ -131,7 +119,7 @@ class EncryptedFileReflectorClient(Protocol): len(filtered)) return filtered - d = self.factory.blob_manager.storage.get_blobs_for_stream(self.factory.stream_hash) + d = self.factory.blob_manager.storage.get_blobs_for_stream(self.stream_hash) d.addCallback(self.get_validated_blobs) if not self.descriptor_needed: d.addCallback(lambda filtered: @@ -151,7 +139,7 @@ class EncryptedFileReflectorClient(Protocol): def _save_descriptor_blob(sd_blob): self.stream_descriptor = sd_blob - d = self.factory.blob_manager.storage.get_sd_blob_hash_for_stream(self.factory.stream_hash) + d = self.factory.blob_manager.storage.get_sd_blob_hash_for_stream(self.stream_hash) d.addCallback(self.factory.blob_manager.get_blob) d.addCallback(_save_descriptor_blob) return d @@ -312,28 +300,14 @@ class EncryptedFileReflectorClient(Protocol): class EncryptedFileReflectorClientFactory(ClientFactory): protocol = EncryptedFileReflectorClient + protocol_version = REFLECTOR_V2 - def __init__(self, lbry_file): - self._lbry_file = lbry_file + def __init__(self, blob_manager, stream_hash): + self.blob_manager = blob_manager + self.stream_hash = stream_hash self.p = None self.finished_deferred = defer.Deferred() - @property - def blob_manager(self): - return self._lbry_file.blob_manager - - @property - def stream_hash(self): - return self._lbry_file.stream_hash - - @property - def file_name(self): - return self._lbry_file.file_name - - @property - def protocol_version(self): - return REFLECTOR_V2 - def buildProtocol(self, addr): p = self.protocol() p.factory = self diff --git a/lbrynet/reflector/reupload.py b/lbrynet/reflector/reupload.py index 39c6c1ba1..5f31b5c32 100644 --- a/lbrynet/reflector/reupload.py +++ b/lbrynet/reflector/reupload.py @@ -24,15 +24,19 @@ def resolve(host): @defer.inlineCallbacks -def _reflect_stream(lbry_file, reflector_server): +def _reflect_stream(blob_manager, stream_hash, reflector_server): reflector_address, reflector_port = reflector_server[0], reflector_server[1] - factory = ClientFactory(lbry_file) + factory = ClientFactory(blob_manager, stream_hash) ip = yield resolve(reflector_address) yield reactor.connectTCP(ip, reflector_port, factory) result = yield factory.finished_deferred defer.returnValue(result) +def _reflect_file(lbry_file, reflector_server): + return _reflect_stream(lbry_file.blob_manager, lbry_file.stream_hash, reflector_server) + + @defer.inlineCallbacks def _reflect_blobs(blob_manager, blob_hashes, reflector_server): reflector_address, reflector_port = reflector_server[0], reflector_server[1] @@ -43,7 +47,7 @@ def _reflect_blobs(blob_manager, blob_hashes, reflector_server): defer.returnValue(result) -def reflect_stream(lbry_file, reflector_server=None): +def reflect_file(lbry_file, reflector_server=None): if reflector_server: if len(reflector_server.split(":")) == 2: host, port = tuple(reflector_server.split(":")) @@ -52,7 +56,19 @@ def reflect_stream(lbry_file, reflector_server=None): reflector_server = reflector_server, 5566 else: reflector_server = random.choice(conf.settings['reflector_servers']) - return _reflect_stream(lbry_file, reflector_server) + return _reflect_file(lbry_file, reflector_server) + + +def reflect_stream(blob_manager, stream_hash, reflector_server=None): + if reflector_server: + if len(reflector_server.split(":")) == 2: + host, port = tuple(reflector_server.split(":")) + reflector_server = host, int(port) + else: + reflector_server = reflector_server, 5566 + else: + reflector_server = random.choice(conf.settings['reflector_servers']) + return _reflect_stream(blob_manager, stream_hash, reflector_server) def reflect_blob_hashes(blob_hashes, blob_manager, reflector_server=None): diff --git a/lbrynet/tests/functional/test_reflector.py b/lbrynet/tests/functional/test_reflector.py index a73dbee96..41d24902a 100644 --- a/lbrynet/tests/functional/test_reflector.py +++ b/lbrynet/tests/functional/test_reflector.py @@ -212,10 +212,7 @@ class TestReflector(unittest.TestCase): return d def send_to_server(): - fake_lbry_file = mocks.FakeLBRYFile(self.session.blob_manager, - self.server_session.storage, - self.stream_hash) - factory = reflector.ClientFactory(fake_lbry_file) + factory = reflector.ClientFactory(self.session.blob_manager, self.stream_hash) from twisted.internet import reactor reactor.connectTCP('localhost', self.port, factory) @@ -348,10 +345,7 @@ class TestReflector(unittest.TestCase): return factory.finished_deferred def send_to_server_as_stream(result): - fake_lbry_file = mocks.FakeLBRYFile(self.session.blob_manager, - self.server_session.storage, - self.stream_hash) - factory = reflector.ClientFactory(fake_lbry_file) + factory = reflector.ClientFactory(self.session.blob_manager, self.stream_hash) from twisted.internet import reactor reactor.connectTCP('localhost', self.port, factory) From 113cc8bb15e9546eafdd96dc824f5d9374ad5f3d Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 19 Mar 2018 14:31:17 -0400 Subject: [PATCH 04/15] Bump version 0.19.1rc6 --> 0.19.1rc7 Signed-off-by: Jack Robison --- lbrynet/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbrynet/__init__.py b/lbrynet/__init__.py index 228eace97..a435a2546 100644 --- a/lbrynet/__init__.py +++ b/lbrynet/__init__.py @@ -1,6 +1,6 @@ import logging -__version__ = "0.19.1rc6" +__version__ = "0.19.1rc7" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler()) From f283a2116e4a0c9147ea60245814c6805abec61b Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 20 Mar 2018 10:15:01 -0400 Subject: [PATCH 05/15] changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3528189..106ce6d52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,8 @@ at anytime. * fixed the inconsistencies in API and CLI docstrings * `blob_announce` error when announcing a single blob * `blob_list` error when looking up blobs by stream or sd hash - * issue#1107 whereing claiming a channel with the exact amount present in wallet would give out proper error - * Fix channel creation to use same bid logic as claim ([1148])(https://github.com/lbryio/lbry/pull/1148) + * issue#1107 where claiming a channel with the exact amount present in wallet would return a confusing error + * channel creation to use same bid logic as for claims ([1148])(https://github.com/lbryio/lbry/pull/1148) ### Deprecated * `report_bug` jsonrpc command @@ -28,9 +28,9 @@ at anytime. * reflector server to use `SQLiteStorage` to find needed blob hashes for a stream ### Added - * scripts to autogenerate documentation + * scripts to auto-generate documentation * now updating new channel also takes into consideration the original bid amount, so now channel could be updated for wallet balance + the original bid amount - * forward-compaitibility for upcoming DHT bencoding changes + * forward-compatibility for upcoming DHT bencoding changes ### Removed * short(single dashed) arguments for `lbrynet-cli` From de280b5ebf519e1344edd3146076d2ec93f4c2d3 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 20 Mar 2018 10:15:50 -0400 Subject: [PATCH 06/15] Bump version 0.19.1rc7 --> 0.19.1 Signed-off-by: Jack Robison --- CHANGELOG.md | 46 +++++++++++++++++++++++++++++++++------------ lbrynet/__init__.py | 2 +- requirements.txt | 4 ++-- setup.py | 4 ++-- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 106ce6d52..1327974f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,28 +13,50 @@ at anytime. * ### Fixed - * fixed the inconsistencies in API and CLI docstrings - * `blob_announce` error when announcing a single blob - * `blob_list` error when looking up blobs by stream or sd hash - * issue#1107 where claiming a channel with the exact amount present in wallet would return a confusing error - * channel creation to use same bid logic as for claims ([1148])(https://github.com/lbryio/lbry/pull/1148) + * + * ### Deprecated - * `report_bug` jsonrpc command + * * ### Changed - * reflector server to periodically check and set `should_announce` for sd and head blobs instead of during each request - * reflector server to use `SQLiteStorage` to find needed blob hashes for a stream + * + * ### Added - * scripts to auto-generate documentation - * now updating new channel also takes into consideration the original bid amount, so now channel could be updated for wallet balance + the original bid amount - * forward-compatibility for upcoming DHT bencoding changes + * + * ### Removed - * short(single dashed) arguments for `lbrynet-cli` * + * + + +## [0.19.1] - 2018-03-20 +### Fixed + * fixed the inconsistencies in API and CLI docstrings + * `blob_announce` error when announcing a single blob + * `blob_list` error when looking up blobs by stream or sd hash + * issue#1107 where claiming a channel with the exact amount present in wallet would return a confusing error + * channel creation to use same bid logic as for claims ([1148])(https://github.com/lbryio/lbry/pull/1148) + +### Deprecated + * `report_bug` jsonrpc command + +### Changed + * Bumped `lbryschema` requirement to 0.0.15 [see changelog](https://github.com/lbryio/lbryschema/blob/master/CHANGELOG.md#0015---2018-03-20) + * Bumped `lbryum` requirement to 3.2.0 [see changelog](https://github.com/lbryio/lbryum/blob/master/CHANGELOG.md#320---2018-03-20) + * reflector server to periodically check and set `should_announce` for sd and head blobs instead of during each request + * reflector server to use `SQLiteStorage` to find needed blob hashes for a stream + +### Added + * scripts to auto-generate documentation + * now updating new channel also takes into consideration the original bid amount, so now channel could be updated for wallet balance + the original bid amount + * forward-compatibility for upcoming DHT bencoding changes + +### Removed + * short(single dashed) arguments for `lbrynet-cli` ## [0.19.0] - 2018-03-02 diff --git a/lbrynet/__init__.py b/lbrynet/__init__.py index a435a2546..d82ed0829 100644 --- a/lbrynet/__init__.py +++ b/lbrynet/__init__.py @@ -1,6 +1,6 @@ import logging -__version__ = "0.19.1rc7" +__version__ = "0.19.1" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/requirements.txt b/requirements.txt index 4a0015bf8..cbca7a5c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,8 +12,8 @@ GitPython==2.1.3 jsonrpc==1.2 jsonrpclib==0.1.7 keyring==10.4.0 -git+https://github.com/lbryio/lbryschema.git@v0.0.15rc3#egg=lbryschema -git+https://github.com/lbryio/lbryum.git@v3.2.0rc20#egg=lbryum +git+https://github.com/lbryio/lbryschema.git@v0.0.15#egg=lbryschema +git+https://github.com/lbryio/lbryum.git@v3.2.0#egg=lbryum miniupnpc==1.9 pbkdf2==1.3 pycrypto==2.6.1 diff --git a/setup.py b/setup.py index 4c5074a11..d341584e5 100644 --- a/setup.py +++ b/setup.py @@ -20,8 +20,8 @@ requires = [ 'base58', 'envparse', 'jsonrpc', - 'lbryschema==0.0.15rc3', - 'lbryum==3.2.0rc20', + 'lbryschema==0.0.15', + 'lbryum==3.2.0', 'miniupnpc', 'pycrypto', 'pyyaml', From ef7a360ee6d43dc3b03d782c79ac3f666867f9a6 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 20 Mar 2018 10:44:17 -0400 Subject: [PATCH 07/15] docs --- docs/404.html | 4 +- docs/cli/index.html | 4 +- docs/index.html | 4 +- scripts/docs_build/cli.md | 1467 +++++++++++++++++++++++++++++++++++ scripts/docs_build/index.md | 1203 ++++++++++++++++++++++++++++ scripts/gen_docs.py | 2 +- 6 files changed, 2677 insertions(+), 7 deletions(-) create mode 100644 scripts/docs_build/cli.md create mode 100644 scripts/docs_build/index.md diff --git a/docs/404.html b/docs/404.html index 285a7053a..d7554115d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ - + @@ -295,7 +295,7 @@ - + diff --git a/docs/cli/index.html b/docs/cli/index.html index 880591af8..5c7dee6a9 100644 --- a/docs/cli/index.html +++ b/docs/cli/index.html @@ -32,7 +32,7 @@ - + @@ -2482,7 +2482,7 @@ Returns: - + diff --git a/docs/index.html b/docs/index.html index 3a27aad61..87e403ec6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,7 @@ - + @@ -2218,7 +2218,7 @@ Returns: - + diff --git a/scripts/docs_build/cli.md b/scripts/docs_build/cli.md new file mode 100644 index 000000000..b329f5617 --- /dev/null +++ b/scripts/docs_build/cli.md @@ -0,0 +1,1467 @@ +# LBRY JSON-RPC API Documentation + +## blob_announce + +```text +Announce blobs to the DHT + +Usage: + blob_announce [--announce_all] [ | --blob_hash=] + [ | --stream_hash=] + [ | --sd_hash=] + + +Options: + --announce_all= : (bool) announce all the blobs possessed by user + --blob_hash= : (str) announce a blob, specified by blob_hash + --stream_hash= : (str) announce all blobs associated with + stream_hash + --sd_hash= : (str) announce all blobs associated with + sd_hash and the sd_hash itself + +Returns: + (bool) true if successful +``` + +## blob_availability + +```text +Get blob availability + +Usage: + blob_availability () [ | --search_timeout=] + [ | --blob_timeout=] + + +Options: + --blob_hash= : (str) check availability for this blob hash + --search_timeout= : (int) how long to search for peers for the blob + in the dht + --blob_timeout= : (int) how long to try downloading from a peer + +Returns: + (dict) { + "is_available": + "reachable_peers": [":"], + "unreachable_peers": [":"] + } +``` + +## blob_delete + +```text +Delete a blob + +Usage: + blob_delete ( | --blob_hash= : (str) blob hash of the blob to delete + +Returns: + (str) Success/fail message +``` + +## blob_get + +```text +Download and return a blob + +Usage: + blob_get ( | --blob_hash=) [--timeout=] + [--encoding=] [--payment_rate_manager=] + + +Options: + --blob_hash= : (str) blob hash of the blob to get + --timeout= : (int) timeout in number of seconds + --encoding= : (str) by default no attempt at decoding + is made, can be set to one of the + following decoders: + 'json' + --payment_rate_manager= : (str) if not given the default payment rate + manager will be used. + supported alternative rate managers: + 'only-free' + +Returns: + (str) Success/Fail message or (dict) decoded data +``` + +## blob_list + +```text +Returns blob hashes. If not given filters, returns all blobs known by the blob manager + +Usage: + blob_list [--needed] [--finished] [ | --uri=] + [ | --stream_hash=] + [ | --sd_hash=] + [ | --page_size=] + [ | --page=] + + +Options: + --needed : (bool) only return needed blobs + --finished : (bool) only return finished blobs + --uri= : (str) filter blobs by stream in a uri + --stream_hash= : (str) filter blobs by stream hash + --sd_hash= : (str) filter blobs by sd hash + --page_size= : (int) results page size + --page= : (int) page of results to return + +Returns: + (list) List of blob hashes +``` + +## blob_reflect_all + +```text +Reflects all saved blobs + +Usage: + blob_reflect_all + + +Options: + None + +Returns: + (bool) true if successful +``` + +## block_show + +```text +Get contents of a block + +Usage: + block_show ( | --blockhash=) | ( | --height=) + + +Options: + --blockhash= : (str) hash of the block to look up + --height= : (int) height of the block to look up + +Returns: + (dict) Requested block +``` + +## channel_export + +```text +Export serialized channel signing information for a given certificate claim id + +Usage: + channel_export ( | --claim_id=) + + +Options: + --claim_id= : (str) Claim ID to export information about + +Returns: + (str) Serialized certificate information +``` + +## channel_import + +```text +Import serialized channel signing information (to allow signing new claims to the channel) + +Usage: + channel_import ( | + --serialized_certificate_info=) + + +Options: + --serialized_certificate_info= : (str) certificate info + +Returns: + (dict) Result dictionary +``` + +## channel_list + +```text +Get certificate claim infos for channels that can be published to + +Usage: + channel_list + + +Options: + None + +Returns: + (list) ClaimDict, includes 'is_mine' field to indicate if the certificate claim + is in the wallet. +``` + +## channel_new + +```text +Generate a publisher key and create a new '@' prefixed certificate claim + +Usage: + channel_new ( | --channel_name=) + ( | --amount=) + + +Options: + --channel_name= : (str) name of the channel prefixed with '@' + --amount= : (float) bid amount on the channel + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## claim_abandon + +```text +Abandon a name and reclaim credits from the claim + +Usage: + claim_abandon [ | --claim_id=] + [ | --txid=] [ | --nout=] + + +Options: + --claim_id= : (str) claim_id of the claim to abandon + --txid= : (str) txid of the claim to abandon + --nout= : (int) nout of the claim to abandon + +Returns: + (dict) Dictionary containing result of the claim + { + txid : (str) txid of resulting transaction + fee : (float) fee paid for the transaction + } +``` + +## claim_list + +```text +List current claims and information about them for a given name + +Usage: + claim_list ( | --name=) + + +Options: + --name= : (str) name of the claim to list info about + +Returns: + (dict) State of claims assigned for the name + { + 'claims': (list) list of claims for the name + [ + { + 'amount': (float) amount assigned to the claim + 'effective_amount': (float) total amount assigned to the claim, + including supports + 'claim_id': (str) claim ID of the claim + 'height': (int) height of block containing the claim + 'txid': (str) txid of the claim + 'nout': (int) nout of the claim + 'permanent_url': (str) permanent url of the claim, + 'supports': (list) a list of supports attached to the claim + 'value': (str) the value of the claim + }, + ] + 'supports_without_claims': (list) supports without any claims attached to them + 'last_takeover_height': (int) the height of last takeover for the name + } +``` + +## claim_list_by_channel + +```text +Get paginated claims in a channel specified by a channel uri + +Usage: + claim_list_by_channel ( | --uri=) [...] [--page=] + [--page_size=] + + +Options: + --uri= : (str) uri of the channel + --uris= : (list) uris of the channel + --page= : (int) which page of results to return where page 1 is the first + page, defaults to no pages + --page_size= : (int) number of results in a page, default of 10 + +Returns: + { + resolved channel uri: { + If there was an error: + 'error': (str) error message + + 'claims_in_channel': the total number of results for the channel, + + If a page of results was requested: + 'returned_page': page number returned, + 'claims_in_channel': [ + { + 'absolute_channel_position': (int) claim index number in sorted list of + claims which assert to be part of the + channel + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + ], + } + } +``` + +## claim_list_mine + +```text +List my name claims + +Usage: + claim_list_mine + + +Options: + None + +Returns: + (list) List of name claims owned by user + [ + { + 'address': (str) address that owns the claim + 'amount': (float) amount assigned to the claim + 'blocks_to_expiration': (int) number of blocks until it expires + 'category': (str) "claim", "update" , or "support" + 'claim_id': (str) claim ID of the claim + 'confirmations': (int) number of blocks of confirmations for the claim + 'expiration_height': (int) the block height which the claim will expire + 'expired': (bool) true if expired, false otherwise + 'height': (int) height of the block containing the claim + 'is_spent': (bool) true if claim is abandoned, false otherwise + 'name': (str) name of the claim + 'permanent_url': (str) permanent url of the claim, + 'txid': (str) txid of the cliam + 'nout': (int) nout of the claim + 'value': (str) value of the claim + }, + ] +``` + +## claim_new_support + +```text +Support a name claim + +Usage: + claim_new_support ( | --name=) ( | --claim_id=) + ( | --amount=) + + +Options: + --name= : (str) name of the claim to support + --claim_id= : (str) claim_id of the claim to support + --amount= : (float) amount of support + +Returns: + (dict) Dictionary containing result of the claim + { + txid : (str) txid of resulting support claim + nout : (int) nout of the resulting support claim + fee : (float) fee paid for the transaction + } +``` + +## claim_renew + +```text +Renew claim(s) or support(s) + +Usage: + claim_renew ( | --outpoint=) | ( | --height=) + + +Options: + --outpoint= : (str) outpoint of the claim to renew + --height= : (str) update claims expiring before or at this block height + +Returns: + (dict) Dictionary where key is the the original claim's outpoint and + value is the result of the renewal + { + outpoint:{ + + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + }, + } +``` + +## claim_send_to_address + +```text +Send a name claim to an address + +Usage: + claim_send_to_address ( | --claim_id=) + (
| --address=
) + [ | --amount=] + + +Options: + --claim_id= : (str) claim_id to send + --address=
: (str) address to send the claim to + --amount : (int) Amount of credits to claim name for, defaults to the current amount + on the claim + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## claim_show + +```text +Resolve claim info from txid/nout or with claim ID + +Usage: + claim_show [ | --txid=] [ | --nout=] + [ | --claim_id=] + + +Options: + --txid= : (str) look for claim with this txid, nout must + also be specified + --nout= : (int) look for claim with this nout, txid must + also be specified + --claim_id= : (str) look for claim with this claim id + +Returns: + (dict) Dictionary containing claim info as below, + + { + 'txid': (str) txid of claim + 'nout': (int) nout of claim + 'amount': (float) amount of claim + 'value': (str) value of claim + 'height' : (int) height of claim takeover + 'claim_id': (str) claim ID of claim + 'supports': (list) list of supports associated with claim + } + + if claim cannot be resolved, dictionary as below will be returned + + { + 'error': (str) reason for error + } +``` + +## cli_test_command + +```text +This command is only for testing the CLI argument parsing +Usage: + cli_test_command [--a_arg] [--b_arg] ( | --pos_arg=) + [...] [--pos_arg2=] + [--pos_arg3=] + + +Options: + --a_arg : a arg + --b_arg : b arg + --pos_arg= : pos arg + --pos_args= : pos args + --pos_arg2= : pos arg 2 + --pos_arg3= : pos arg 3 + +Returns: + pos args +``` + +## commands + +```text +Return a list of available commands + +Usage: + commands + + +Options: + None + +Returns: + (list) list of available commands +``` + +## daemon_stop + +```text +Stop lbrynet-daemon + +Usage: + daemon_stop + + +Options: + None + +Returns: + (string) Shutdown message +``` + +## file_delete + +```text +Delete a LBRY file + +Usage: + file_delete [--delete_from_download_dir] [--delete_all] [--sd_hash=] [--file_name=] + [--stream_hash=] [--rowid=] [--claim_id=] [--txid=] + [--nout=] [--claim_name=] [--channel_claim_id=] + [--channel_name=] + + +Options: + --delete_from_download_dir : (bool) delete file from download directory, + instead of just deleting blobs + --delete_all : (bool) if there are multiple matching files, + allow the deletion of multiple files. + Otherwise do not delete anything. + --sd_hash= : (str) delete by file sd hash + --file_name : (str) delete by file name in downloads folder + --stream_hash= : (str) delete by file stream hash + --rowid= : (int) delete by file row id + --claim_id= : (str) delete by file claim id + --txid= : (str) delete by file claim txid + --nout= : (int) delete by file claim nout + --claim_name= : (str) delete by file claim name + --channel_claim_id= : (str) delete by file channel claim id + --channel_name= : (str) delete by file channel claim name + +Returns: + (bool) true if deletion was successful +``` + +## file_list + +```text +List files limited by optional filters + +Usage: + file_list [--sd_hash=] [--file_name=] [--stream_hash=] + [--rowid=] [--claim_id=] [--outpoint=] [--txid=] [--nout=] + [--channel_claim_id=] [--channel_name=] + [--claim_name=] [--full_status] + + +Options: + --sd_hash= : (str) get file with matching sd hash + --file_name= : (str) get file with matching file name in the + downloads folder + --stream_hash= : (str) get file with matching stream hash + --rowid= : (int) get file with matching row id + --claim_id= : (str) get file with matching claim id + --outpoint= : (str) get file with matching claim outpoint + --txid= : (str) get file with matching claim txid + --nout= : (int) get file with matching claim nout + --channel_claim_id= : (str) get file with matching channel claim id + --channel_name= : (str) get file with matching channel name + --claim_name= : (str) get file with matching claim name + --full_status : (bool) full status, populate the + 'message' and 'size' fields + +Returns: + (list) List of files + + [ + { + 'completed': (bool) true if download is completed, + 'file_name': (str) name of file, + 'download_directory': (str) download directory, + 'points_paid': (float) credit paid to download file, + 'stopped': (bool) true if download is stopped, + 'stream_hash': (str) stream hash of file, + 'stream_name': (str) stream name , + 'suggested_file_name': (str) suggested file name, + 'sd_hash': (str) sd hash of file, + 'download_path': (str) download path of file, + 'mime_type': (str) mime type of file, + 'key': (str) key attached to file, + 'total_bytes': (int) file size in bytes, None if full_status is false, + 'written_bytes': (int) written size in bytes, + 'blobs_completed': (int) num_completed, None if full_status is false, + 'blobs_in_stream': (int) None if full_status is false, + 'status': (str) downloader status, None if full_status is false, + 'claim_id': (str) None if full_status is false or if claim is not found, + 'outpoint': (str) None if full_status is false or if claim is not found, + 'txid': (str) None if full_status is false or if claim is not found, + 'nout': (int) None if full_status is false or if claim is not found, + 'metadata': (dict) None if full_status is false or if claim is not found, + 'channel_claim_id': (str) None if full_status is false or if claim is not found or signed, + 'channel_name': (str) None if full_status is false or if claim is not found or signed, + 'claim_name': (str) None if full_status is false or if claim is not found + }, + ] +``` + +## file_reflect + +```text +Reflect all the blobs in a file matching the filter criteria + +Usage: + file_reflect [--sd_hash=] [--file_name=] + [--stream_hash=] [--rowid=] + [--reflector=] + + +Options: + --sd_hash= : (str) get file with matching sd hash + --file_name= : (str) get file with matching file name in the + downloads folder + --stream_hash= : (str) get file with matching stream hash + --rowid= : (int) get file with matching row id + --reflector= : (str) reflector server, ip address or url + by default choose a server from the config + +Returns: + (list) list of blobs reflected +``` + +## file_set_status + +```text +Start or stop downloading a file + +Usage: + file_set_status ( | --status=) [--sd_hash=] + [--file_name=] [--stream_hash=] [--rowid=] + + +Options: + --status= : (str) one of "start" or "stop" + --sd_hash= : (str) set status of file with matching sd hash + --file_name= : (str) set status of file with matching file name in the + downloads folder + --stream_hash= : (str) set status of file with matching stream hash + --rowid= : (int) set status of file with matching row id + +Returns: + (str) Confirmation message +``` + +## get + +```text +Download stream from a LBRY name. + +Usage: + get [ | --file_name=] [ | --timeout=] + + + +Options: + --uri= : (str) uri of the content to download + --file_name= : (str) specified name for the downloaded file + --timeout= : (int) download timeout in number of seconds + +Returns: + (dict) Dictionary containing information about the stream + { + 'completed': (bool) true if download is completed, + 'file_name': (str) name of file, + 'download_directory': (str) download directory, + 'points_paid': (float) credit paid to download file, + 'stopped': (bool) true if download is stopped, + 'stream_hash': (str) stream hash of file, + 'stream_name': (str) stream name , + 'suggested_file_name': (str) suggested file name, + 'sd_hash': (str) sd hash of file, + 'download_path': (str) download path of file, + 'mime_type': (str) mime type of file, + 'key': (str) key attached to file, + 'total_bytes': (int) file size in bytes, None if full_status is false, + 'written_bytes': (int) written size in bytes, + 'blobs_completed': (int) num_completed, None if full_status is false, + 'blobs_in_stream': (int) None if full_status is false, + 'status': (str) downloader status, None if full_status is false, + 'claim_id': (str) claim id, + 'outpoint': (str) claim outpoint string, + 'txid': (str) claim txid, + 'nout': (int) claim nout, + 'metadata': (dict) claim metadata, + 'channel_claim_id': (str) None if claim is not signed + 'channel_name': (str) None if claim is not signed + 'claim_name': (str) claim name + } +``` + +## help + +```text +Return a useful message for an API command + +Usage: + help [ | --command=] + + +Options: + --command= : (str) command to retrieve documentation for + +Returns: + (str) Help message +``` + +## peer_list + +```text +Get peers for blob hash + +Usage: + peer_list ( | --blob_hash=) [ | --timeout=] + + +Options: + --blob_hash= : (str) find available peers for this blob hash + --timeout= : (int) peer search timeout in seconds + +Returns: + (list) List of contacts +``` + +## publish + +```text +Make a new name claim and publish associated data to lbrynet, +update over existing claim if user already has a claim for name. + +Fields required in the final Metadata are: + 'title' + 'description' + 'author' + 'language' + 'license' + 'nsfw' + +Metadata can be set by either using the metadata argument or by setting individual arguments +fee, title, description, author, language, license, license_url, thumbnail, preview, nsfw, +or sources. Individual arguments will overwrite the fields specified in metadata argument. + +Usage: + publish ( | --name=) ( | --bid=) [--metadata=] + [--file_path=] [--fee=] [--title=] + [--description=<description>] [--author=<author>] [--language=<language>] + [--license=<license>] [--license_url=<license_url>] [--thumbnail=<thumbnail>] + [--preview=<preview>] [--nsfw=<nsfw>] [--sources=<sources>] + [--channel_name=<channel_name>] [--channel_id=<channel_id>] + [--claim_address=<claim_address>] [--change_address=<change_address>] + + +Options: + --name=<name> : (str) name of the content + --bid=<bid> : (float) amount to back the claim + --metadata=<metadata> : (dict) ClaimDict to associate with the claim. + --file_path=<file_path> : (str) path to file to be associated with name. If provided, + a lbry stream of this file will be used in 'sources'. + If no path is given but a sources dict is provided, + it will be used. If neither are provided, an + error is raised. + --fee=<fee> : (dict) Dictionary representing key fee to download content: + { + 'currency': currency_symbol, + 'amount': float, + 'address': str, optional + } + supported currencies: LBC, USD, BTC + If an address is not provided a new one will be + automatically generated. Default fee is zero. + --title=<title> : (str) title of the publication + --description=<description> : (str) description of the publication + --author=<author> : (str) author of the publication + --language=<language> : (str) language of the publication + --license=<license> : (str) publication license + --license_url=<license_url> : (str) publication license url + --thumbnail=<thumbnail> : (str) thumbnail url + --preview=<preview> : (str) preview url + --nsfw=<nsfw> : (bool) title of the publication + --sources=<sources> : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file + --channel_name=<channel_name> : (str) name of the publisher channel name in the wallet + --channel_id=<channel_id> : (str) claim id of the publisher channel, does not check + for channel claim being in the wallet. This allows + publishing to a channel where only the certificate + private key is in the wallet. + --claim_address=<claim_address> : (str) address where the claim is sent to, if not specified + new address wil automatically be created + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## resolve + +```text +Resolve given LBRY URIs + +Usage: + resolve [--force] (<uri> | --uri=<uri>) [<uris>...] + + +Options: + --force : (bool) force refresh and ignore cache + --uri=<uri> : (str) uri to resolve + --uris=<uris> : (list) uris to resolve + +Returns: + Dictionary of results, keyed by uri + '<uri>': { + If a resolution error occurs: + 'error': Error message + + If the uri resolves to a channel or a claim in a channel: + 'certificate': { + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'permanent_url': (str) permanent url of the certificate claim, + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + + If the uri resolves to a channel: + 'claims_in_channel': (int) number of claims in the channel, + + If the uri resolves to a claim: + 'claim': { + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'permanent_url': (str) permanent url of the claim, + 'channel_name': (str) channel name if claim is in a channel + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}] + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + } +``` + +## resolve_name + +```text +Resolve stream info from a LBRY name + +Usage: + resolve_name (<name> | --name=<name>) [--force] + + +Options: + --name=<name> : (str) the name to resolve + --force : (bool) force refresh and do not check cache + +Returns: + (dict) Metadata dictionary from name claim, None if the name is not + resolvable +``` + +## routing_table_get + +```text +Get DHT routing information + +Usage: + routing_table_get + + +Options: + None + +Returns: + (dict) dictionary containing routing and contact information + { + "buckets": { + <bucket index>: [ + { + "address": (str) peer address, + "node_id": (str) peer node id, + "blobs": (list) blob hashes announced by peer + } + ] + }, + "contacts": (list) contact node ids, + "blob_hashes": (list) all of the blob hashes stored by peers in the list of buckets, + "node_id": (str) the local dht node id + } +``` + +## settings_get + +```text +Get daemon settings + +Usage: + settings_get + + +Options: + None + +Returns: + (dict) Dictionary of daemon settings + See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings +``` + +## settings_set + +```text +Set daemon settings + +Usage: + settings_set [--download_directory=<download_directory>] + [--data_rate=<data_rate>] + [--download_timeout=<download_timeout>] + [--peer_port=<peer_port>] + [--max_key_fee=<max_key_fee>] + [--disable_max_key_fee=<disable_max_key_fee>] + [--use_upnp=<use_upnp>] + [--run_reflector_server=<run_reflector_server>] + [--cache_time=<cache_time>] + [--reflect_uploads=<reflect_uploads>] + [--share_usage_data=<share_usage_data>] + [--peer_search_timeout=<peer_search_timeout>] + [--sd_download_timeout=<sd_download_timeout>] + [--auto_renew_claim_height_delta=<auto_renew_claim_height_delta>] + + +Options: + --download_directory=<download_directory> : (str) path of download directory + --data_rate=<data_rate> : (float) 0.0001 + --download_timeout=<download_timeout> : (int) 180 + --peer_port=<peer_port> : (int) 3333 + --max_key_fee=<max_key_fee> : (dict) maximum key fee for downloads, + in the format: + { + 'currency': <currency_symbol>, + 'amount': <amount> + }. + In the CLI, it must be an escaped JSON string + Supported currency symbols: LBC, USD, BTC + --disable_max_key_fee=<disable_max_key_fee> : (bool) False + --use_upnp=<use_upnp> : (bool) True + --run_reflector_server=<run_reflector_server> : (bool) False + --cache_time=<cache_time> : (int) 150 + --reflect_uploads=<reflect_uploads> : (bool) True + --share_usage_data=<share_usage_data> : (bool) True + --peer_search_timeout=<peer_search_timeout> : (int) 3 + --sd_download_timeout=<sd_download_timeout> : (int) 3 + --auto_renew_claim_height_delta=<auto_renew_claim_height_delta> : (int) 0 + claims set to expire within this many blocks will be + automatically renewed after startup (if set to 0, renews + will not be made automatically) + +Returns: + (dict) Updated dictionary of daemon settings +``` + +## status + +```text +Get daemon status + +Usage: + status [--session_status] [--dht_status] + + +Options: + --session_status : (bool) include session status in results + --dht_status : (bool) include dht network and peer status + +Returns: + (dict) lbrynet-daemon status + { + 'lbry_id': lbry peer id, base58, + 'installation_id': installation id, base58, + 'is_running': bool, + 'is_first_run': bool, + 'startup_status': { + 'code': status code, + 'message': status message + }, + 'connection_status': { + 'code': connection status code, + 'message': connection status message + }, + 'blockchain_status': { + 'blocks': local blockchain height, + 'blocks_behind': remote_height - local_height, + 'best_blockhash': block hash of most recent block, + }, + 'wallet_is_encrypted': bool, + + If given the session status option: + 'session_status': { + 'managed_blobs': count of blobs in the blob manager, + 'managed_streams': count of streams in the file manager + 'announce_queue_size': number of blobs currently queued to be announced + 'should_announce_blobs': number of blobs that should be announced + } + + If given the dht status option: + 'dht_status': { + 'kbps_received': current kbps receiving, + 'kbps_sent': current kdps being sent, + 'total_bytes_sent': total bytes sent, + 'total_bytes_received': total bytes received, + 'queries_received': number of queries received per second, + 'queries_sent': number of queries sent per second, + 'recent_contacts': count of recently contacted peers, + 'unique_contacts': count of unique peers + }, + } +``` + +## stream_availability + +```text +Get stream availability for lbry uri + +Usage: + stream_availability (<uri> | --uri=<uri>) + [<search_timeout> | --search_timeout=<search_timeout>] + [<blob_timeout> | --blob_timeout=<blob_timeout>] + + +Options: + --uri=<uri> : (str) check availability for this uri + --search_timeout=<search_timeout> : (int) how long to search for peers for the blob + in the dht + --search_timeout=<blob_timeout> : (int) how long to try downloading from a peer + +Returns: + (dict) { + 'is_available': <bool>, + 'did_decode': <bool>, + 'did_resolve': <bool>, + 'is_stream': <bool>, + 'num_blobs_in_stream': <int>, + 'sd_hash': <str>, + 'sd_blob_availability': <dict> see `blob_availability`, + 'head_blob_hash': <str>, + 'head_blob_availability': <dict> see `blob_availability`, + 'use_upnp': <bool>, + 'upnp_redirect_is_set': <bool>, + 'error': <None> | <str> error message + } +``` + +## stream_cost_estimate + +```text +Get estimated cost for a lbry stream + +Usage: + stream_cost_estimate (<uri> | --uri=<uri>) [<size> | --size=<size>] + + +Options: + --uri=<uri> : (str) uri to use + --size=<size> : (float) stream size in bytes. if provided an sd blob won't be + downloaded. + +Returns: + (float) Estimated cost in lbry credits, returns None if uri is not + resolvable +``` + +## transaction_list + +```text +List transactions belonging to wallet + +Usage: + transaction_list + + +Options: + None + +Returns: + (list) List of transactions + + { + "claim_info": (list) claim info if in txn [{ + "address": (str) address of claim, + "balance_delta": (float) bid amount, + "amount": (float) claim amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "abandon_info": (list) abandon info if in txn [{ + "address": (str) address of abandoned claim, + "balance_delta": (float) returned amount, + "amount": (float) claim amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "confirmations": (int) number of confirmations for the txn, + "date": (str) date and time of txn, + "fee": (float) txn fee, + "support_info": (list) support info if in txn [{ + "address": (str) address of support, + "balance_delta": (float) support amount, + "amount": (float) support amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "is_tip": (bool), + "nout": (int) nout + }], + "timestamp": (int) timestamp, + "txid": (str) txn id, + "update_info": (list) update info if in txn [{ + "address": (str) address of claim, + "balance_delta": (float) credited/debited + "amount": (float) absolute amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "value": (float) value of txn + } +``` + +## transaction_show + +```text +Get a decoded transaction from a txid + +Usage: + transaction_show (<txid> | --txid=<txid>) + + +Options: + --txid=<txid> : (str) txid of the transaction + +Returns: + (dict) JSON formatted transaction +``` + +## utxo_list + +```text +List unspent transaction outputs + +Usage: + utxo_list + + +Options: + None + +Returns: + (list) List of unspent transaction outputs (UTXOs) + [ + { + "address": (str) the output address + "amount": (float) unspent amount + "height": (int) block height + "is_claim": (bool) is the tx a claim + "is_coinbase": (bool) is the tx a coinbase tx + "is_support": (bool) is the tx a support + "is_update": (bool) is the tx an update + "nout": (int) nout of the output + "txid": (str) txid of the output + }, + ... + ] +``` + +## version + +```text +Get lbry version information + +Usage: + version + + +Options: + None + +Returns: + (dict) Dictionary of lbry version information + { + 'build': (str) build type (e.g. "dev", "rc", "release"), + 'ip': (str) remote ip, if available, + 'lbrynet_version': (str) lbrynet_version, + 'lbryum_version': (str) lbryum_version, + 'lbryschema_version': (str) lbryschema_version, + 'os_release': (str) os release string + 'os_system': (str) os name + 'platform': (str) platform string + 'processor': (str) processor type, + 'python_version': (str) python version, + } +``` + +## wallet_balance + +```text +Return the balance of the wallet + +Usage: + wallet_balance [<address> | --address=<address>] [--include_unconfirmed] + + +Options: + --address=<address> : (str) If provided only the balance for this + address will be given + --include_unconfirmed : (bool) Include unconfirmed + +Returns: + (float) amount of lbry credits in wallet +``` + +## wallet_decrypt + +```text +Decrypt an encrypted wallet, this will remove the wallet password + +Usage: + wallet_decrypt + + +Options: + None + +Returns: + (bool) true if wallet is decrypted, otherwise false +``` + +## wallet_encrypt + +```text +Encrypt a wallet with a password, if the wallet is already encrypted this will update +the password + +Usage: + wallet_encrypt (<new_password> | --new_password=<new_password>) + + +Options: + --new_password=<new_password> : (str) password string to be used for encrypting wallet + +Returns: + (bool) true if wallet is decrypted, otherwise false +``` + +## wallet_is_address_mine + +```text +Checks if an address is associated with the current wallet. + +Usage: + wallet_is_address_mine (<address> | --address=<address>) + + +Options: + --address=<address> : (str) address to check + +Returns: + (bool) true, if address is associated with current wallet +``` + +## wallet_list + +```text +List wallet addresses + +Usage: + wallet_list + + +Options: + None + +Returns: + List of wallet addresses +``` + +## wallet_new_address + +```text +Generate a new wallet address + +Usage: + wallet_new_address + + +Options: + None + +Returns: + (str) New wallet address in base58 +``` + +## wallet_prefill_addresses + +```text +Create new addresses, each containing `amount` credits + +Usage: + wallet_prefill_addresses [--no_broadcast] + (<num_addresses> | --num_addresses=<num_addresses>) + (<amount> | --amount=<amount>) + + +Options: + --no_broadcast : (bool) whether to broadcast or not + --num_addresses=<num_addresses> : (int) num of addresses to create + --amount=<amount> : (float) initial amount in each address + +Returns: + (dict) the resulting transaction +``` + +## wallet_public_key + +```text +Get public key from wallet address + +Usage: + wallet_public_key (<address> | --address=<address>) + + +Options: + --address=<address> : (str) address for which to get the public key + +Returns: + (list) list of public keys associated with address. + Could contain more than one public key if multisig. +``` + +## wallet_send + +```text +Send credits. If given an address, send credits to it. If given a claim id, send a tip +to the owner of a claim specified by uri. A tip is a claim support where the recipient +of the support is the claim address for the claim being supported. + +Usage: + wallet_send (<amount> | --amount=<amount>) + ((<address> | --address=<address>) | (<claim_id> | --claim_id=<claim_id>)) + + +Options: + --amount=<amount> : (float) amount of credit to send + --address=<address> : (str) address to send credits to + --claim_id=<claim_id> : (float) claim_id of the claim to send to tip to + +Returns: + If sending to an address: + (bool) true if payment successfully scheduled + + If sending a claim tip: + (dict) Dictionary containing the result of the support + { + txid : (str) txid of resulting support claim + nout : (int) nout of the resulting support claim + fee : (float) fee paid for the transaction + } +``` + +## wallet_unlock + +```text +Unlock an encrypted wallet + +Usage: + wallet_unlock (<password> | --password=<password>) + + +Options: + --password=<password> : (str) password for unlocking wallet + +Returns: + (bool) true if wallet is unlocked, otherwise false +``` + +## wallet_unused_address + +```text +Return an address containing no balance, will create +a new address if there is none. + +Usage: + wallet_unused_address + + +Options: + None + +Returns: + (str) Unused wallet address in base58 +``` + diff --git a/scripts/docs_build/index.md b/scripts/docs_build/index.md new file mode 100644 index 000000000..ae513848c --- /dev/null +++ b/scripts/docs_build/index.md @@ -0,0 +1,1203 @@ +# LBRY JSON-RPC API Documentation + +## blob_announce + +```text +Announce blobs to the DHT + +Args: + 'announce_all' : (bool) announce all the blobs possessed by user + 'blob_hash' : (str) announce a blob, specified by blob_hash + 'stream_hash' : (str) announce all blobs associated with + stream_hash + 'sd_hash' : (str) announce all blobs associated with + sd_hash and the sd_hash itself + +Returns: + (bool) true if successful +``` + +## blob_availability + +```text +Get blob availability + +Args: + 'blob_hash' : (str) check availability for this blob hash + 'search_timeout' : (int) how long to search for peers for the blob + in the dht + 'blob_timeout' : (int) how long to try downloading from a peer + +Returns: + (dict) { + "is_available": <bool, true if blob is available from a peer from peer list> + "reachable_peers": ["<ip>:<port>"], + "unreachable_peers": ["<ip>:<port>"] + } +``` + +## blob_delete + +```text +Delete a blob + +Args: + 'blob_hash' : (str) blob hash of the blob to delete + +Returns: + (str) Success/fail message +``` + +## blob_get + +```text +Download and return a blob + +Args: + 'blob_hash' (required) : (str) blob hash of the blob to get + 'timeout' : (int) timeout in number of seconds + 'encoding' : (str) by default no attempt at decoding + is made, can be set to one of the + following decoders: + 'json' + 'payment_rate_manager' : (str) if not given the default payment rate + manager will be used. + supported alternative rate managers: + 'only-free' + +Returns: + (str) Success/Fail message or (dict) decoded data +``` + +## blob_list + +```text +Returns blob hashes. If not given filters, returns all blobs known by the blob manager + +Args: + 'needed' : (bool) only return needed blobs + 'finished' : (bool) only return finished blobs + 'uri' : (str) filter blobs by stream in a uri + 'stream_hash' : (str) filter blobs by stream hash + 'sd_hash' : (str) filter blobs by sd hash + 'page_size' : (int) results page size + 'page' : (int) page of results to return + +Returns: + (list) List of blob hashes +``` + +## blob_reflect_all + +```text +Reflects all saved blobs + +Args: + None + +Returns: + (bool) true if successful +``` + +## block_show + +```text +Get contents of a block + +Args: + 'blockhash' (required) : (str) hash of the block to look up + 'height' (required) : (int) height of the block to look up + +Returns: + (dict) Requested block +``` + +## channel_export + +```text +Export serialized channel signing information for a given certificate claim id + +Args: + 'claim_id' (required) : (str) Claim ID to export information about + +Returns: + (str) Serialized certificate information +``` + +## channel_import + +```text +Import serialized channel signing information (to allow signing new claims to the channel) + +Args: + 'serialized_certificate_info' : (str) certificate info + +Returns: + (dict) Result dictionary +``` + +## channel_list + +```text +Get certificate claim infos for channels that can be published to + +Args: + None + +Returns: + (list) ClaimDict, includes 'is_mine' field to indicate if the certificate claim + is in the wallet. +``` + +## channel_new + +```text +Generate a publisher key and create a new '@' prefixed certificate claim + +Args: + 'channel_name' (required) : (str) name of the channel prefixed with '@' + 'amount' (required) : (float) bid amount on the channel + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## claim_abandon + +```text +Abandon a name and reclaim credits from the claim + +Args: + 'claim_id' : (str) claim_id of the claim to abandon + 'txid' : (str) txid of the claim to abandon + 'nout' : (int) nout of the claim to abandon + +Returns: + (dict) Dictionary containing result of the claim + { + txid : (str) txid of resulting transaction + fee : (float) fee paid for the transaction + } +``` + +## claim_list + +```text +List current claims and information about them for a given name + +Args: + 'name' (required) : (str) name of the claim to list info about + +Returns: + (dict) State of claims assigned for the name + { + 'claims': (list) list of claims for the name + [ + { + 'amount': (float) amount assigned to the claim + 'effective_amount': (float) total amount assigned to the claim, + including supports + 'claim_id': (str) claim ID of the claim + 'height': (int) height of block containing the claim + 'txid': (str) txid of the claim + 'nout': (int) nout of the claim + 'permanent_url': (str) permanent url of the claim, + 'supports': (list) a list of supports attached to the claim + 'value': (str) the value of the claim + }, + ] + 'supports_without_claims': (list) supports without any claims attached to them + 'last_takeover_height': (int) the height of last takeover for the name + } +``` + +## claim_list_by_channel + +```text +Get paginated claims in a channel specified by a channel uri + +Args: + 'uri' (required) : (str) uri of the channel + 'uris' : (list) uris of the channel + 'page' : (int) which page of results to return where page 1 is the first + page, defaults to no pages + 'page_size' : (int) number of results in a page, default of 10 + +Returns: + { + resolved channel uri: { + If there was an error: + 'error': (str) error message + + 'claims_in_channel': the total number of results for the channel, + + If a page of results was requested: + 'returned_page': page number returned, + 'claims_in_channel': [ + { + 'absolute_channel_position': (int) claim index number in sorted list of + claims which assert to be part of the + channel + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + ], + } + } +``` + +## claim_list_mine + +```text +List my name claims + +Args: + None + +Returns: + (list) List of name claims owned by user + [ + { + 'address': (str) address that owns the claim + 'amount': (float) amount assigned to the claim + 'blocks_to_expiration': (int) number of blocks until it expires + 'category': (str) "claim", "update" , or "support" + 'claim_id': (str) claim ID of the claim + 'confirmations': (int) number of blocks of confirmations for the claim + 'expiration_height': (int) the block height which the claim will expire + 'expired': (bool) true if expired, false otherwise + 'height': (int) height of the block containing the claim + 'is_spent': (bool) true if claim is abandoned, false otherwise + 'name': (str) name of the claim + 'permanent_url': (str) permanent url of the claim, + 'txid': (str) txid of the cliam + 'nout': (int) nout of the claim + 'value': (str) value of the claim + }, + ] +``` + +## claim_new_support + +```text +Support a name claim + +Args: + 'name' (required) : (str) name of the claim to support + 'claim_id' (required) : (str) claim_id of the claim to support + 'amount' (required) : (float) amount of support + +Returns: + (dict) Dictionary containing result of the claim + { + txid : (str) txid of resulting support claim + nout : (int) nout of the resulting support claim + fee : (float) fee paid for the transaction + } +``` + +## claim_renew + +```text +Renew claim(s) or support(s) + +Args: + 'outpoint' (required) : (str) outpoint of the claim to renew + 'height' (required) : (str) update claims expiring before or at this block height + +Returns: + (dict) Dictionary where key is the the original claim's outpoint and + value is the result of the renewal + { + outpoint:{ + + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + }, + } +``` + +## claim_send_to_address + +```text +Send a name claim to an address + +Args: + 'claim_id' (required) : (str) claim_id to send + 'address' (required) : (str) address to send the claim to + 'amount' : (int) Amount of credits to claim name for, defaults to the current amount + on the claim + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## claim_show + +```text +Resolve claim info from txid/nout or with claim ID + +Args: + 'txid' : (str) look for claim with this txid, nout must + also be specified + 'nout' : (int) look for claim with this nout, txid must + also be specified + 'claim_id' : (str) look for claim with this claim id + +Returns: + (dict) Dictionary containing claim info as below, + + { + 'txid': (str) txid of claim + 'nout': (int) nout of claim + 'amount': (float) amount of claim + 'value': (str) value of claim + 'height' : (int) height of claim takeover + 'claim_id': (str) claim ID of claim + 'supports': (list) list of supports associated with claim + } + + if claim cannot be resolved, dictionary as below will be returned + + { + 'error': (str) reason for error + } +``` + +## cli_test_command + +```text +This command is only for testing the CLI argument parsing +Args: + 'a_arg' : a arg + 'b_arg' : b arg + 'pos_arg' (required) : pos arg + 'pos_args' : pos args + 'pos_arg2' : pos arg 2 + 'pos_arg3' : pos arg 3 + +Returns: + pos args +``` + +## commands + +```text +Return a list of available commands + +Args: + None + +Returns: + (list) list of available commands +``` + +## daemon_stop + +```text +Stop lbrynet-daemon + +Args: + None + +Returns: + (string) Shutdown message +``` + +## file_delete + +```text +Delete a LBRY file + +Args: + 'delete_from_download_dir' : (bool) delete file from download directory, + instead of just deleting blobs + 'delete_all' : (bool) if there are multiple matching files, + allow the deletion of multiple files. + Otherwise do not delete anything. + 'sd_hash' : (str) delete by file sd hash + 'file_name' : (str) delete by file name in downloads folder + 'stream_hash' : (str) delete by file stream hash + 'rowid' : (int) delete by file row id + 'claim_id' : (str) delete by file claim id + 'txid' : (str) delete by file claim txid + 'nout' : (int) delete by file claim nout + 'claim_name' : (str) delete by file claim name + 'channel_claim_id' : (str) delete by file channel claim id + 'channel_name' : (str) delete by file channel claim name + +Returns: + (bool) true if deletion was successful +``` + +## file_list + +```text +List files limited by optional filters + +Args: + 'sd_hash' : (str) get file with matching sd hash + 'file_name' : (str) get file with matching file name in the + downloads folder + 'stream_hash' : (str) get file with matching stream hash + 'rowid' : (int) get file with matching row id + 'claim_id' : (str) get file with matching claim id + 'outpoint' : (str) get file with matching claim outpoint + 'txid' : (str) get file with matching claim txid + 'nout' : (int) get file with matching claim nout + 'channel_claim_id' : (str) get file with matching channel claim id + 'channel_name' : (str) get file with matching channel name + 'claim_name' : (str) get file with matching claim name + 'full_status' : (bool) full status, populate the + 'message' and 'size' fields + +Returns: + (list) List of files + + [ + { + 'completed': (bool) true if download is completed, + 'file_name': (str) name of file, + 'download_directory': (str) download directory, + 'points_paid': (float) credit paid to download file, + 'stopped': (bool) true if download is stopped, + 'stream_hash': (str) stream hash of file, + 'stream_name': (str) stream name , + 'suggested_file_name': (str) suggested file name, + 'sd_hash': (str) sd hash of file, + 'download_path': (str) download path of file, + 'mime_type': (str) mime type of file, + 'key': (str) key attached to file, + 'total_bytes': (int) file size in bytes, None if full_status is false, + 'written_bytes': (int) written size in bytes, + 'blobs_completed': (int) num_completed, None if full_status is false, + 'blobs_in_stream': (int) None if full_status is false, + 'status': (str) downloader status, None if full_status is false, + 'claim_id': (str) None if full_status is false or if claim is not found, + 'outpoint': (str) None if full_status is false or if claim is not found, + 'txid': (str) None if full_status is false or if claim is not found, + 'nout': (int) None if full_status is false or if claim is not found, + 'metadata': (dict) None if full_status is false or if claim is not found, + 'channel_claim_id': (str) None if full_status is false or if claim is not found or signed, + 'channel_name': (str) None if full_status is false or if claim is not found or signed, + 'claim_name': (str) None if full_status is false or if claim is not found + }, + ] +``` + +## file_reflect + +```text +Reflect all the blobs in a file matching the filter criteria + +Args: + 'sd_hash' : (str) get file with matching sd hash + 'file_name' : (str) get file with matching file name in the + downloads folder + 'stream_hash' : (str) get file with matching stream hash + 'rowid' : (int) get file with matching row id + 'reflector' : (str) reflector server, ip address or url + by default choose a server from the config + +Returns: + (list) list of blobs reflected +``` + +## file_set_status + +```text +Start or stop downloading a file + +Args: + 'status' (required) : (str) one of "start" or "stop" + 'sd_hash' : (str) set status of file with matching sd hash + 'file_name' : (str) set status of file with matching file name in the + downloads folder + 'stream_hash' : (str) set status of file with matching stream hash + 'rowid' : (int) set status of file with matching row id + +Returns: + (str) Confirmation message +``` + +## get + +```text +Download stream from a LBRY name. + +Args: + 'uri' : (str) uri of the content to download + 'file_name' : (str) specified name for the downloaded file + 'timeout' : (int) download timeout in number of seconds + +Returns: + (dict) Dictionary containing information about the stream + { + 'completed': (bool) true if download is completed, + 'file_name': (str) name of file, + 'download_directory': (str) download directory, + 'points_paid': (float) credit paid to download file, + 'stopped': (bool) true if download is stopped, + 'stream_hash': (str) stream hash of file, + 'stream_name': (str) stream name , + 'suggested_file_name': (str) suggested file name, + 'sd_hash': (str) sd hash of file, + 'download_path': (str) download path of file, + 'mime_type': (str) mime type of file, + 'key': (str) key attached to file, + 'total_bytes': (int) file size in bytes, None if full_status is false, + 'written_bytes': (int) written size in bytes, + 'blobs_completed': (int) num_completed, None if full_status is false, + 'blobs_in_stream': (int) None if full_status is false, + 'status': (str) downloader status, None if full_status is false, + 'claim_id': (str) claim id, + 'outpoint': (str) claim outpoint string, + 'txid': (str) claim txid, + 'nout': (int) claim nout, + 'metadata': (dict) claim metadata, + 'channel_claim_id': (str) None if claim is not signed + 'channel_name': (str) None if claim is not signed + 'claim_name': (str) claim name + } +``` + +## help + +```text +Return a useful message for an API command + +Args: + 'command' : (str) command to retrieve documentation for + +Returns: + (str) Help message +``` + +## peer_list + +```text +Get peers for blob hash + +Args: + 'blob_hash' (required) : (str) find available peers for this blob hash + 'timeout' : (int) peer search timeout in seconds + +Returns: + (list) List of contacts +``` + +## publish + +```text +Make a new name claim and publish associated data to lbrynet, +update over existing claim if user already has a claim for name. + +Fields required in the final Metadata are: + 'title' + 'description' + 'author' + 'language' + 'license' + 'nsfw' + +Metadata can be set by either using the metadata argument or by setting individual arguments +fee, title, description, author, language, license, license_url, thumbnail, preview, nsfw, +or sources. Individual arguments will overwrite the fields specified in metadata argument. + +Args: + 'name' (required) : (str) name of the content + 'bid' (required) : (float) amount to back the claim + 'metadata' : (dict) ClaimDict to associate with the claim. + 'file_path' : (str) path to file to be associated with name. If provided, + a lbry stream of this file will be used in 'sources'. + If no path is given but a sources dict is provided, + it will be used. If neither are provided, an + error is raised. + 'fee' : (dict) Dictionary representing key fee to download content: + { + 'currency': currency_symbol, + 'amount': float, + 'address': str, optional + } + supported currencies: LBC, USD, BTC + If an address is not provided a new one will be + automatically generated. Default fee is zero. + 'title' : (str) title of the publication + 'description' : (str) description of the publication + 'author' : (str) author of the publication + 'language' : (str) language of the publication + 'license' : (str) publication license + 'license_url' : (str) publication license url + 'thumbnail' : (str) thumbnail url + 'preview' : (str) preview url + 'nsfw' : (bool) title of the publication + 'sources' : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file + 'channel_name' : (str) name of the publisher channel name in the wallet + 'channel_id' : (str) claim id of the publisher channel, does not check + for channel claim being in the wallet. This allows + publishing to a channel where only the certificate + private key is in the wallet. + 'claim_address' : (str) address where the claim is sent to, if not specified + new address wil automatically be created + +Returns: + (dict) Dictionary containing result of the claim + { + 'tx' : (str) hex encoded transaction + 'txid' : (str) txid of resulting claim + 'nout' : (int) nout of the resulting claim + 'fee' : (float) fee paid for the claim transaction + 'claim_id' : (str) claim ID of the resulting claim + } +``` + +## resolve + +```text +Resolve given LBRY URIs + +Args: + 'force' : (bool) force refresh and ignore cache + 'uri' (required) : (str) uri to resolve + 'uris' : (list) uris to resolve + +Returns: + Dictionary of results, keyed by uri + '<uri>': { + If a resolution error occurs: + 'error': Error message + + If the uri resolves to a channel or a claim in a channel: + 'certificate': { + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'permanent_url': (str) permanent url of the certificate claim, + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}], + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + + If the uri resolves to a channel: + 'claims_in_channel': (int) number of claims in the channel, + + If the uri resolves to a claim: + 'claim': { + 'address': (str) claim address, + 'amount': (float) claim amount, + 'effective_amount': (float) claim amount including supports, + 'claim_id': (str) claim id, + 'claim_sequence': (int) claim sequence number, + 'decoded_claim': (bool) whether or not the claim value was decoded, + 'height': (int) claim height, + 'depth': (int) claim depth, + 'has_signature': (bool) included if decoded_claim + 'name': (str) claim name, + 'permanent_url': (str) permanent url of the claim, + 'channel_name': (str) channel name if claim is in a channel + 'supports: (list) list of supports [{'txid': (str) txid, + 'nout': (int) nout, + 'amount': (float) amount}] + 'txid': (str) claim txid, + 'nout': (str) claim nout, + 'signature_is_valid': (bool), included if has_signature, + 'value': ClaimDict if decoded, otherwise hex string + } + } +``` + +## resolve_name + +```text +Resolve stream info from a LBRY name + +Args: + 'name' (required) : (str) the name to resolve + 'force' : (bool) force refresh and do not check cache + +Returns: + (dict) Metadata dictionary from name claim, None if the name is not + resolvable +``` + +## routing_table_get + +```text +Get DHT routing information + +Args: + None + +Returns: + (dict) dictionary containing routing and contact information + { + "buckets": { + <bucket index>: [ + { + "address": (str) peer address, + "node_id": (str) peer node id, + "blobs": (list) blob hashes announced by peer + } + ] + }, + "contacts": (list) contact node ids, + "blob_hashes": (list) all of the blob hashes stored by peers in the list of buckets, + "node_id": (str) the local dht node id + } +``` + +## settings_get + +```text +Get daemon settings + +Args: + None + +Returns: + (dict) Dictionary of daemon settings + See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings +``` + +## settings_set + +```text +Set daemon settings + +Args: + 'download_directory' : (str) path of download directory + 'data_rate' : (float) 0.0001 + 'download_timeout' : (int) 180 + 'peer_port' : (int) 3333 + 'max_key_fee' : (dict) maximum key fee for downloads, + in the format: + { + 'currency': <currency_symbol>, + 'amount': <amount> + }. + In the CLI, it must be an escaped JSON string + Supported currency symbols: LBC, USD, BTC + 'disable_max_key_fee' : (bool) False + 'use_upnp' : (bool) True + 'run_reflector_server' : (bool) False + 'cache_time' : (int) 150 + 'reflect_uploads' : (bool) True + 'share_usage_data' : (bool) True + 'peer_search_timeout' : (int) 3 + 'sd_download_timeout' : (int) 3 + 'auto_renew_claim_height_delta' : (int) 0 + claims set to expire within this many blocks will be + automatically renewed after startup (if set to 0, renews + will not be made automatically) + +Returns: + (dict) Updated dictionary of daemon settings +``` + +## status + +```text +Get daemon status + +Args: + 'session_status' : (bool) include session status in results + 'dht_status' : (bool) include dht network and peer status + +Returns: + (dict) lbrynet-daemon status + { + 'lbry_id': lbry peer id, base58, + 'installation_id': installation id, base58, + 'is_running': bool, + 'is_first_run': bool, + 'startup_status': { + 'code': status code, + 'message': status message + }, + 'connection_status': { + 'code': connection status code, + 'message': connection status message + }, + 'blockchain_status': { + 'blocks': local blockchain height, + 'blocks_behind': remote_height - local_height, + 'best_blockhash': block hash of most recent block, + }, + 'wallet_is_encrypted': bool, + + If given the session status option: + 'session_status': { + 'managed_blobs': count of blobs in the blob manager, + 'managed_streams': count of streams in the file manager + 'announce_queue_size': number of blobs currently queued to be announced + 'should_announce_blobs': number of blobs that should be announced + } + + If given the dht status option: + 'dht_status': { + 'kbps_received': current kbps receiving, + 'kbps_sent': current kdps being sent, + 'total_bytes_sent': total bytes sent, + 'total_bytes_received': total bytes received, + 'queries_received': number of queries received per second, + 'queries_sent': number of queries sent per second, + 'recent_contacts': count of recently contacted peers, + 'unique_contacts': count of unique peers + }, + } +``` + +## stream_availability + +```text +Get stream availability for lbry uri + +Args: + 'uri' (required) : (str) check availability for this uri + 'search_timeout' : (int) how long to search for peers for the blob + in the dht + 'search_timeout' : (int) how long to try downloading from a peer + +Returns: + (dict) { + 'is_available': <bool>, + 'did_decode': <bool>, + 'did_resolve': <bool>, + 'is_stream': <bool>, + 'num_blobs_in_stream': <int>, + 'sd_hash': <str>, + 'sd_blob_availability': <dict> see `blob_availability`, + 'head_blob_hash': <str>, + 'head_blob_availability': <dict> see `blob_availability`, + 'use_upnp': <bool>, + 'upnp_redirect_is_set': <bool>, + 'error': <None> | <str> error message + } +``` + +## stream_cost_estimate + +```text +Get estimated cost for a lbry stream + +Args: + 'uri' (required) : (str) uri to use + 'size' : (float) stream size in bytes. if provided an sd blob won't be + downloaded. + +Returns: + (float) Estimated cost in lbry credits, returns None if uri is not + resolvable +``` + +## transaction_list + +```text +List transactions belonging to wallet + +Args: + None + +Returns: + (list) List of transactions + + { + "claim_info": (list) claim info if in txn [{ + "address": (str) address of claim, + "balance_delta": (float) bid amount, + "amount": (float) claim amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "abandon_info": (list) abandon info if in txn [{ + "address": (str) address of abandoned claim, + "balance_delta": (float) returned amount, + "amount": (float) claim amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "confirmations": (int) number of confirmations for the txn, + "date": (str) date and time of txn, + "fee": (float) txn fee, + "support_info": (list) support info if in txn [{ + "address": (str) address of support, + "balance_delta": (float) support amount, + "amount": (float) support amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "is_tip": (bool), + "nout": (int) nout + }], + "timestamp": (int) timestamp, + "txid": (str) txn id, + "update_info": (list) update info if in txn [{ + "address": (str) address of claim, + "balance_delta": (float) credited/debited + "amount": (float) absolute amount, + "claim_id": (str) claim id, + "claim_name": (str) claim name, + "nout": (int) nout + }], + "value": (float) value of txn + } +``` + +## transaction_show + +```text +Get a decoded transaction from a txid + +Args: + 'txid' (required) : (str) txid of the transaction + +Returns: + (dict) JSON formatted transaction +``` + +## utxo_list + +```text +List unspent transaction outputs + +Args: + None + +Returns: + (list) List of unspent transaction outputs (UTXOs) + [ + { + "address": (str) the output address + "amount": (float) unspent amount + "height": (int) block height + "is_claim": (bool) is the tx a claim + "is_coinbase": (bool) is the tx a coinbase tx + "is_support": (bool) is the tx a support + "is_update": (bool) is the tx an update + "nout": (int) nout of the output + "txid": (str) txid of the output + }, + ... + ] +``` + +## version + +```text +Get lbry version information + +Args: + None + +Returns: + (dict) Dictionary of lbry version information + { + 'build': (str) build type (e.g. "dev", "rc", "release"), + 'ip': (str) remote ip, if available, + 'lbrynet_version': (str) lbrynet_version, + 'lbryum_version': (str) lbryum_version, + 'lbryschema_version': (str) lbryschema_version, + 'os_release': (str) os release string + 'os_system': (str) os name + 'platform': (str) platform string + 'processor': (str) processor type, + 'python_version': (str) python version, + } +``` + +## wallet_balance + +```text +Return the balance of the wallet + +Args: + 'address' : (str) If provided only the balance for this + address will be given + 'include_unconfirmed' : (bool) Include unconfirmed + +Returns: + (float) amount of lbry credits in wallet +``` + +## wallet_decrypt + +```text +Decrypt an encrypted wallet, this will remove the wallet password + +Args: + None + +Returns: + (bool) true if wallet is decrypted, otherwise false +``` + +## wallet_encrypt + +```text +Encrypt a wallet with a password, if the wallet is already encrypted this will update +the password + +Args: + 'new_password' (required) : (str) password string to be used for encrypting wallet + +Returns: + (bool) true if wallet is decrypted, otherwise false +``` + +## wallet_is_address_mine + +```text +Checks if an address is associated with the current wallet. + +Args: + 'address' (required) : (str) address to check + +Returns: + (bool) true, if address is associated with current wallet +``` + +## wallet_list + +```text +List wallet addresses + +Args: + None + +Returns: + List of wallet addresses +``` + +## wallet_new_address + +```text +Generate a new wallet address + +Args: + None + +Returns: + (str) New wallet address in base58 +``` + +## wallet_prefill_addresses + +```text +Create new addresses, each containing `amount` credits + +Args: + 'no_broadcast' : (bool) whether to broadcast or not + 'num_addresses' (required) : (int) num of addresses to create + 'amount' (required) : (float) initial amount in each address + +Returns: + (dict) the resulting transaction +``` + +## wallet_public_key + +```text +Get public key from wallet address + +Args: + 'address' (required) : (str) address for which to get the public key + +Returns: + (list) list of public keys associated with address. + Could contain more than one public key if multisig. +``` + +## wallet_send + +```text +Send credits. If given an address, send credits to it. If given a claim id, send a tip +to the owner of a claim specified by uri. A tip is a claim support where the recipient +of the support is the claim address for the claim being supported. + +Args: + 'amount' (required) : (float) amount of credit to send + 'address' (required) : (str) address to send credits to + 'claim_id' (required) : (float) claim_id of the claim to send to tip to + +Returns: + If sending to an address: + (bool) true if payment successfully scheduled + + If sending a claim tip: + (dict) Dictionary containing the result of the support + { + txid : (str) txid of resulting support claim + nout : (int) nout of the resulting support claim + fee : (float) fee paid for the transaction + } +``` + +## wallet_unlock + +```text +Unlock an encrypted wallet + +Args: + 'password' (required) : (str) password for unlocking wallet + +Returns: + (bool) true if wallet is unlocked, otherwise false +``` + +## wallet_unused_address + +```text +Return an address containing no balance, will create +a new address if there is none. + +Args: + None + +Returns: + (str) Unused wallet address in base58 +``` + diff --git a/scripts/gen_docs.py b/scripts/gen_docs.py index d1c0827f7..b4317269f 100755 --- a/scripts/gen_docs.py +++ b/scripts/gen_docs.py @@ -172,7 +172,7 @@ def _api_doc(obj): def main(): - root_dir = os.path.dirname(os.path.dirname(__file__)) + root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) build_dir = os.path.realpath(os.path.join(root_dir, DOCS_BUILD_DIR)) if not os.path.exists(build_dir): os.makedirs(build_dir) From ba8248887a6d28a2c17227dab66583a9a96c87dc Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan <tzarebczan@users.noreply.github.com> Date: Tue, 20 Mar 2018 11:29:30 -0400 Subject: [PATCH 08/15] cleanup changelog --- CHANGELOG.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1327974f0..4f6cedba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,11 +35,11 @@ at anytime. ## [0.19.1] - 2018-03-20 ### Fixed - * fixed the inconsistencies in API and CLI docstrings + * Fixed the inconsistencies in API and CLI docstrings * `blob_announce` error when announcing a single blob - * `blob_list` error when looking up blobs by stream or sd hash - * issue#1107 where claiming a channel with the exact amount present in wallet would return a confusing error - * channel creation to use same bid logic as for claims ([1148])(https://github.com/lbryio/lbry/pull/1148) + * `blob_list` error when looking up blobs by stream or sd hash ([1126](https://github.com/lbryio/lbry/pull/1126)) + * Claiming a channel with the exact amount present in wallet would return a confusing error ([1107](https://github.com/lbryio/lbry/issues/1107)) + * Channel creation to use same bid logic as for claims ([1148](https://github.com/lbryio/lbry/pull/1148)) ### Deprecated * `report_bug` jsonrpc command @@ -47,16 +47,16 @@ at anytime. ### Changed * Bumped `lbryschema` requirement to 0.0.15 [see changelog](https://github.com/lbryio/lbryschema/blob/master/CHANGELOG.md#0015---2018-03-20) * Bumped `lbryum` requirement to 3.2.0 [see changelog](https://github.com/lbryio/lbryum/blob/master/CHANGELOG.md#320---2018-03-20) - * reflector server to periodically check and set `should_announce` for sd and head blobs instead of during each request - * reflector server to use `SQLiteStorage` to find needed blob hashes for a stream + * Reflector server to periodically check and set `should_announce` for sd and head blobs instead of during each request + * Reflector server to use `SQLiteStorage` to find needed blob hashes for a stream ### Added - * scripts to auto-generate documentation - * now updating new channel also takes into consideration the original bid amount, so now channel could be updated for wallet balance + the original bid amount - * forward-compatibility for upcoming DHT bencoding changes + * Scripts to auto-generate documentation ([1128](https://github.com/lbryio/lbry/pull/1128)) + * Now updating new channel also takes into consideration the original bid amount, so now channel could be updated for wallet balance + the original bid amount ([1137](https://github.com/lbryio/lbry/pull/1137)) + * Forward-compatibility for upcoming DHT bencoding changes ### Removed - * short(single dashed) arguments for `lbrynet-cli` + * Short(single dashed) arguments for `lbrynet-cli` ## [0.19.0] - 2018-03-02 From 539881b5adbd4eb8bb85b11772b7fb4ce0b1767e Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg <grin@lbry.io> Date: Tue, 20 Mar 2018 11:38:02 -0400 Subject: [PATCH 09/15] oops --- scripts/docs_build/cli.md | 1467 ----------------------------------- scripts/docs_build/index.md | 1203 ---------------------------- 2 files changed, 2670 deletions(-) delete mode 100644 scripts/docs_build/cli.md delete mode 100644 scripts/docs_build/index.md diff --git a/scripts/docs_build/cli.md b/scripts/docs_build/cli.md deleted file mode 100644 index b329f5617..000000000 --- a/scripts/docs_build/cli.md +++ /dev/null @@ -1,1467 +0,0 @@ -# LBRY JSON-RPC API Documentation - -## blob_announce - -```text -Announce blobs to the DHT - -Usage: - blob_announce [--announce_all] [<blob_hash> | --blob_hash=<blob_hash>] - [<stream_hash> | --stream_hash=<stream_hash>] - [<sd_hash> | --sd_hash=<sd_hash>] - - -Options: - --announce_all=<announce_all> : (bool) announce all the blobs possessed by user - --blob_hash=<blob_hash> : (str) announce a blob, specified by blob_hash - --stream_hash=<stream_hash> : (str) announce all blobs associated with - stream_hash - --sd_hash=<sd_hash> : (str) announce all blobs associated with - sd_hash and the sd_hash itself - -Returns: - (bool) true if successful -``` - -## blob_availability - -```text -Get blob availability - -Usage: - blob_availability (<blob_hash>) [<search_timeout> | --search_timeout=<search_timeout>] - [<blob_timeout> | --blob_timeout=<blob_timeout>] - - -Options: - --blob_hash=<blob_hash> : (str) check availability for this blob hash - --search_timeout=<search_timeout> : (int) how long to search for peers for the blob - in the dht - --blob_timeout=<blob_timeout> : (int) how long to try downloading from a peer - -Returns: - (dict) { - "is_available": <bool, true if blob is available from a peer from peer list> - "reachable_peers": ["<ip>:<port>"], - "unreachable_peers": ["<ip>:<port>"] - } -``` - -## blob_delete - -```text -Delete a blob - -Usage: - blob_delete (<blob_hash> | --blob_hash=<blob_hash) - - -Options: - --blob_hash=<blob_hash> : (str) blob hash of the blob to delete - -Returns: - (str) Success/fail message -``` - -## blob_get - -```text -Download and return a blob - -Usage: - blob_get (<blob_hash> | --blob_hash=<blob_hash>) [--timeout=<timeout>] - [--encoding=<encoding>] [--payment_rate_manager=<payment_rate_manager>] - - -Options: - --blob_hash=<blob_hash> : (str) blob hash of the blob to get - --timeout=<timeout> : (int) timeout in number of seconds - --encoding=<encoding> : (str) by default no attempt at decoding - is made, can be set to one of the - following decoders: - 'json' - --payment_rate_manager=<payment_rate_manager> : (str) if not given the default payment rate - manager will be used. - supported alternative rate managers: - 'only-free' - -Returns: - (str) Success/Fail message or (dict) decoded data -``` - -## blob_list - -```text -Returns blob hashes. If not given filters, returns all blobs known by the blob manager - -Usage: - blob_list [--needed] [--finished] [<uri> | --uri=<uri>] - [<stream_hash> | --stream_hash=<stream_hash>] - [<sd_hash> | --sd_hash=<sd_hash>] - [<page_size> | --page_size=<page_size>] - [<page> | --page=<page>] - - -Options: - --needed : (bool) only return needed blobs - --finished : (bool) only return finished blobs - --uri=<uri> : (str) filter blobs by stream in a uri - --stream_hash=<stream_hash> : (str) filter blobs by stream hash - --sd_hash=<sd_hash> : (str) filter blobs by sd hash - --page_size=<page_size> : (int) results page size - --page=<page> : (int) page of results to return - -Returns: - (list) List of blob hashes -``` - -## blob_reflect_all - -```text -Reflects all saved blobs - -Usage: - blob_reflect_all - - -Options: - None - -Returns: - (bool) true if successful -``` - -## block_show - -```text -Get contents of a block - -Usage: - block_show (<blockhash> | --blockhash=<blockhash>) | (<height> | --height=<height>) - - -Options: - --blockhash=<blockhash> : (str) hash of the block to look up - --height=<height> : (int) height of the block to look up - -Returns: - (dict) Requested block -``` - -## channel_export - -```text -Export serialized channel signing information for a given certificate claim id - -Usage: - channel_export (<claim_id> | --claim_id=<claim_id>) - - -Options: - --claim_id=<claim_id> : (str) Claim ID to export information about - -Returns: - (str) Serialized certificate information -``` - -## channel_import - -```text -Import serialized channel signing information (to allow signing new claims to the channel) - -Usage: - channel_import (<serialized_certificate_info> | - --serialized_certificate_info=<serialized_certificate_info>) - - -Options: - --serialized_certificate_info=<serialized_certificate_info> : (str) certificate info - -Returns: - (dict) Result dictionary -``` - -## channel_list - -```text -Get certificate claim infos for channels that can be published to - -Usage: - channel_list - - -Options: - None - -Returns: - (list) ClaimDict, includes 'is_mine' field to indicate if the certificate claim - is in the wallet. -``` - -## channel_new - -```text -Generate a publisher key and create a new '@' prefixed certificate claim - -Usage: - channel_new (<channel_name> | --channel_name=<channel_name>) - (<amount> | --amount=<amount>) - - -Options: - --channel_name=<channel_name> : (str) name of the channel prefixed with '@' - --amount=<amount> : (float) bid amount on the channel - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## claim_abandon - -```text -Abandon a name and reclaim credits from the claim - -Usage: - claim_abandon [<claim_id> | --claim_id=<claim_id>] - [<txid> | --txid=<txid>] [<nout> | --nout=<nout>] - - -Options: - --claim_id=<claim_id> : (str) claim_id of the claim to abandon - --txid=<txid> : (str) txid of the claim to abandon - --nout=<nout> : (int) nout of the claim to abandon - -Returns: - (dict) Dictionary containing result of the claim - { - txid : (str) txid of resulting transaction - fee : (float) fee paid for the transaction - } -``` - -## claim_list - -```text -List current claims and information about them for a given name - -Usage: - claim_list (<name> | --name=<name>) - - -Options: - --name=<name> : (str) name of the claim to list info about - -Returns: - (dict) State of claims assigned for the name - { - 'claims': (list) list of claims for the name - [ - { - 'amount': (float) amount assigned to the claim - 'effective_amount': (float) total amount assigned to the claim, - including supports - 'claim_id': (str) claim ID of the claim - 'height': (int) height of block containing the claim - 'txid': (str) txid of the claim - 'nout': (int) nout of the claim - 'permanent_url': (str) permanent url of the claim, - 'supports': (list) a list of supports attached to the claim - 'value': (str) the value of the claim - }, - ] - 'supports_without_claims': (list) supports without any claims attached to them - 'last_takeover_height': (int) the height of last takeover for the name - } -``` - -## claim_list_by_channel - -```text -Get paginated claims in a channel specified by a channel uri - -Usage: - claim_list_by_channel (<uri> | --uri=<uri>) [<uris>...] [--page=<page>] - [--page_size=<page_size>] - - -Options: - --uri=<uri> : (str) uri of the channel - --uris=<uris> : (list) uris of the channel - --page=<page> : (int) which page of results to return where page 1 is the first - page, defaults to no pages - --page_size=<page_size> : (int) number of results in a page, default of 10 - -Returns: - { - resolved channel uri: { - If there was an error: - 'error': (str) error message - - 'claims_in_channel': the total number of results for the channel, - - If a page of results was requested: - 'returned_page': page number returned, - 'claims_in_channel': [ - { - 'absolute_channel_position': (int) claim index number in sorted list of - claims which assert to be part of the - channel - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}], - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - ], - } - } -``` - -## claim_list_mine - -```text -List my name claims - -Usage: - claim_list_mine - - -Options: - None - -Returns: - (list) List of name claims owned by user - [ - { - 'address': (str) address that owns the claim - 'amount': (float) amount assigned to the claim - 'blocks_to_expiration': (int) number of blocks until it expires - 'category': (str) "claim", "update" , or "support" - 'claim_id': (str) claim ID of the claim - 'confirmations': (int) number of blocks of confirmations for the claim - 'expiration_height': (int) the block height which the claim will expire - 'expired': (bool) true if expired, false otherwise - 'height': (int) height of the block containing the claim - 'is_spent': (bool) true if claim is abandoned, false otherwise - 'name': (str) name of the claim - 'permanent_url': (str) permanent url of the claim, - 'txid': (str) txid of the cliam - 'nout': (int) nout of the claim - 'value': (str) value of the claim - }, - ] -``` - -## claim_new_support - -```text -Support a name claim - -Usage: - claim_new_support (<name> | --name=<name>) (<claim_id> | --claim_id=<claim_id>) - (<amount> | --amount=<amount>) - - -Options: - --name=<name> : (str) name of the claim to support - --claim_id=<claim_id> : (str) claim_id of the claim to support - --amount=<amount> : (float) amount of support - -Returns: - (dict) Dictionary containing result of the claim - { - txid : (str) txid of resulting support claim - nout : (int) nout of the resulting support claim - fee : (float) fee paid for the transaction - } -``` - -## claim_renew - -```text -Renew claim(s) or support(s) - -Usage: - claim_renew (<outpoint> | --outpoint=<outpoint>) | (<height> | --height=<height>) - - -Options: - --outpoint=<outpoint> : (str) outpoint of the claim to renew - --height=<height> : (str) update claims expiring before or at this block height - -Returns: - (dict) Dictionary where key is the the original claim's outpoint and - value is the result of the renewal - { - outpoint:{ - - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - }, - } -``` - -## claim_send_to_address - -```text -Send a name claim to an address - -Usage: - claim_send_to_address (<claim_id> | --claim_id=<claim_id>) - (<address> | --address=<address>) - [<amount> | --amount=<amount>] - - -Options: - --claim_id=<claim_id> : (str) claim_id to send - --address=<address> : (str) address to send the claim to - --amount<amount> : (int) Amount of credits to claim name for, defaults to the current amount - on the claim - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## claim_show - -```text -Resolve claim info from txid/nout or with claim ID - -Usage: - claim_show [<txid> | --txid=<txid>] [<nout> | --nout=<nout>] - [<claim_id> | --claim_id=<claim_id>] - - -Options: - --txid=<txid> : (str) look for claim with this txid, nout must - also be specified - --nout=<nout> : (int) look for claim with this nout, txid must - also be specified - --claim_id=<claim_id> : (str) look for claim with this claim id - -Returns: - (dict) Dictionary containing claim info as below, - - { - 'txid': (str) txid of claim - 'nout': (int) nout of claim - 'amount': (float) amount of claim - 'value': (str) value of claim - 'height' : (int) height of claim takeover - 'claim_id': (str) claim ID of claim - 'supports': (list) list of supports associated with claim - } - - if claim cannot be resolved, dictionary as below will be returned - - { - 'error': (str) reason for error - } -``` - -## cli_test_command - -```text -This command is only for testing the CLI argument parsing -Usage: - cli_test_command [--a_arg] [--b_arg] (<pos_arg> | --pos_arg=<pos_arg>) - [<pos_args>...] [--pos_arg2=<pos_arg2>] - [--pos_arg3=<pos_arg3>] - - -Options: - --a_arg : a arg - --b_arg : b arg - --pos_arg=<pos_arg> : pos arg - --pos_args=<pos_args> : pos args - --pos_arg2=<pos_arg2> : pos arg 2 - --pos_arg3=<pos_arg3> : pos arg 3 - -Returns: - pos args -``` - -## commands - -```text -Return a list of available commands - -Usage: - commands - - -Options: - None - -Returns: - (list) list of available commands -``` - -## daemon_stop - -```text -Stop lbrynet-daemon - -Usage: - daemon_stop - - -Options: - None - -Returns: - (string) Shutdown message -``` - -## file_delete - -```text -Delete a LBRY file - -Usage: - file_delete [--delete_from_download_dir] [--delete_all] [--sd_hash=<sd_hash>] [--file_name=<file_name>] - [--stream_hash=<stream_hash>] [--rowid=<rowid>] [--claim_id=<claim_id>] [--txid=<txid>] - [--nout=<nout>] [--claim_name=<claim_name>] [--channel_claim_id=<channel_claim_id>] - [--channel_name=<channel_name>] - - -Options: - --delete_from_download_dir : (bool) delete file from download directory, - instead of just deleting blobs - --delete_all : (bool) if there are multiple matching files, - allow the deletion of multiple files. - Otherwise do not delete anything. - --sd_hash=<sd_hash> : (str) delete by file sd hash - --file_name<file_name> : (str) delete by file name in downloads folder - --stream_hash=<stream_hash> : (str) delete by file stream hash - --rowid=<rowid> : (int) delete by file row id - --claim_id=<claim_id> : (str) delete by file claim id - --txid=<txid> : (str) delete by file claim txid - --nout=<nout> : (int) delete by file claim nout - --claim_name=<claim_name> : (str) delete by file claim name - --channel_claim_id=<channel_claim_id> : (str) delete by file channel claim id - --channel_name=<channel_name> : (str) delete by file channel claim name - -Returns: - (bool) true if deletion was successful -``` - -## file_list - -```text -List files limited by optional filters - -Usage: - file_list [--sd_hash=<sd_hash>] [--file_name=<file_name>] [--stream_hash=<stream_hash>] - [--rowid=<rowid>] [--claim_id=<claim_id>] [--outpoint=<outpoint>] [--txid=<txid>] [--nout=<nout>] - [--channel_claim_id=<channel_claim_id>] [--channel_name=<channel_name>] - [--claim_name=<claim_name>] [--full_status] - - -Options: - --sd_hash=<sd_hash> : (str) get file with matching sd hash - --file_name=<file_name> : (str) get file with matching file name in the - downloads folder - --stream_hash=<stream_hash> : (str) get file with matching stream hash - --rowid=<rowid> : (int) get file with matching row id - --claim_id=<claim_id> : (str) get file with matching claim id - --outpoint=<outpoint> : (str) get file with matching claim outpoint - --txid=<txid> : (str) get file with matching claim txid - --nout=<nout> : (int) get file with matching claim nout - --channel_claim_id=<channel_claim_id> : (str) get file with matching channel claim id - --channel_name=<channel_name> : (str) get file with matching channel name - --claim_name=<claim_name> : (str) get file with matching claim name - --full_status : (bool) full status, populate the - 'message' and 'size' fields - -Returns: - (list) List of files - - [ - { - 'completed': (bool) true if download is completed, - 'file_name': (str) name of file, - 'download_directory': (str) download directory, - 'points_paid': (float) credit paid to download file, - 'stopped': (bool) true if download is stopped, - 'stream_hash': (str) stream hash of file, - 'stream_name': (str) stream name , - 'suggested_file_name': (str) suggested file name, - 'sd_hash': (str) sd hash of file, - 'download_path': (str) download path of file, - 'mime_type': (str) mime type of file, - 'key': (str) key attached to file, - 'total_bytes': (int) file size in bytes, None if full_status is false, - 'written_bytes': (int) written size in bytes, - 'blobs_completed': (int) num_completed, None if full_status is false, - 'blobs_in_stream': (int) None if full_status is false, - 'status': (str) downloader status, None if full_status is false, - 'claim_id': (str) None if full_status is false or if claim is not found, - 'outpoint': (str) None if full_status is false or if claim is not found, - 'txid': (str) None if full_status is false or if claim is not found, - 'nout': (int) None if full_status is false or if claim is not found, - 'metadata': (dict) None if full_status is false or if claim is not found, - 'channel_claim_id': (str) None if full_status is false or if claim is not found or signed, - 'channel_name': (str) None if full_status is false or if claim is not found or signed, - 'claim_name': (str) None if full_status is false or if claim is not found - }, - ] -``` - -## file_reflect - -```text -Reflect all the blobs in a file matching the filter criteria - -Usage: - file_reflect [--sd_hash=<sd_hash>] [--file_name=<file_name>] - [--stream_hash=<stream_hash>] [--rowid=<rowid>] - [--reflector=<reflector>] - - -Options: - --sd_hash=<sd_hash> : (str) get file with matching sd hash - --file_name=<file_name> : (str) get file with matching file name in the - downloads folder - --stream_hash=<stream_hash> : (str) get file with matching stream hash - --rowid=<rowid> : (int) get file with matching row id - --reflector=<reflector> : (str) reflector server, ip address or url - by default choose a server from the config - -Returns: - (list) list of blobs reflected -``` - -## file_set_status - -```text -Start or stop downloading a file - -Usage: - file_set_status (<status> | --status=<status>) [--sd_hash=<sd_hash>] - [--file_name=<file_name>] [--stream_hash=<stream_hash>] [--rowid=<rowid>] - - -Options: - --status=<status> : (str) one of "start" or "stop" - --sd_hash=<sd_hash> : (str) set status of file with matching sd hash - --file_name=<file_name> : (str) set status of file with matching file name in the - downloads folder - --stream_hash=<stream_hash> : (str) set status of file with matching stream hash - --rowid=<rowid> : (int) set status of file with matching row id - -Returns: - (str) Confirmation message -``` - -## get - -```text -Download stream from a LBRY name. - -Usage: - get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>] - - - -Options: - --uri=<uri> : (str) uri of the content to download - --file_name=<file_name> : (str) specified name for the downloaded file - --timeout=<timeout> : (int) download timeout in number of seconds - -Returns: - (dict) Dictionary containing information about the stream - { - 'completed': (bool) true if download is completed, - 'file_name': (str) name of file, - 'download_directory': (str) download directory, - 'points_paid': (float) credit paid to download file, - 'stopped': (bool) true if download is stopped, - 'stream_hash': (str) stream hash of file, - 'stream_name': (str) stream name , - 'suggested_file_name': (str) suggested file name, - 'sd_hash': (str) sd hash of file, - 'download_path': (str) download path of file, - 'mime_type': (str) mime type of file, - 'key': (str) key attached to file, - 'total_bytes': (int) file size in bytes, None if full_status is false, - 'written_bytes': (int) written size in bytes, - 'blobs_completed': (int) num_completed, None if full_status is false, - 'blobs_in_stream': (int) None if full_status is false, - 'status': (str) downloader status, None if full_status is false, - 'claim_id': (str) claim id, - 'outpoint': (str) claim outpoint string, - 'txid': (str) claim txid, - 'nout': (int) claim nout, - 'metadata': (dict) claim metadata, - 'channel_claim_id': (str) None if claim is not signed - 'channel_name': (str) None if claim is not signed - 'claim_name': (str) claim name - } -``` - -## help - -```text -Return a useful message for an API command - -Usage: - help [<command> | --command=<command>] - - -Options: - --command=<command> : (str) command to retrieve documentation for - -Returns: - (str) Help message -``` - -## peer_list - -```text -Get peers for blob hash - -Usage: - peer_list (<blob_hash> | --blob_hash=<blob_hash>) [<timeout> | --timeout=<timeout>] - - -Options: - --blob_hash=<blob_hash> : (str) find available peers for this blob hash - --timeout=<timeout> : (int) peer search timeout in seconds - -Returns: - (list) List of contacts -``` - -## publish - -```text -Make a new name claim and publish associated data to lbrynet, -update over existing claim if user already has a claim for name. - -Fields required in the final Metadata are: - 'title' - 'description' - 'author' - 'language' - 'license' - 'nsfw' - -Metadata can be set by either using the metadata argument or by setting individual arguments -fee, title, description, author, language, license, license_url, thumbnail, preview, nsfw, -or sources. Individual arguments will overwrite the fields specified in metadata argument. - -Usage: - publish (<name> | --name=<name>) (<bid> | --bid=<bid>) [--metadata=<metadata>] - [--file_path=<file_path>] [--fee=<fee>] [--title=<title>] - [--description=<description>] [--author=<author>] [--language=<language>] - [--license=<license>] [--license_url=<license_url>] [--thumbnail=<thumbnail>] - [--preview=<preview>] [--nsfw=<nsfw>] [--sources=<sources>] - [--channel_name=<channel_name>] [--channel_id=<channel_id>] - [--claim_address=<claim_address>] [--change_address=<change_address>] - - -Options: - --name=<name> : (str) name of the content - --bid=<bid> : (float) amount to back the claim - --metadata=<metadata> : (dict) ClaimDict to associate with the claim. - --file_path=<file_path> : (str) path to file to be associated with name. If provided, - a lbry stream of this file will be used in 'sources'. - If no path is given but a sources dict is provided, - it will be used. If neither are provided, an - error is raised. - --fee=<fee> : (dict) Dictionary representing key fee to download content: - { - 'currency': currency_symbol, - 'amount': float, - 'address': str, optional - } - supported currencies: LBC, USD, BTC - If an address is not provided a new one will be - automatically generated. Default fee is zero. - --title=<title> : (str) title of the publication - --description=<description> : (str) description of the publication - --author=<author> : (str) author of the publication - --language=<language> : (str) language of the publication - --license=<license> : (str) publication license - --license_url=<license_url> : (str) publication license url - --thumbnail=<thumbnail> : (str) thumbnail url - --preview=<preview> : (str) preview url - --nsfw=<nsfw> : (bool) title of the publication - --sources=<sources> : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file - --channel_name=<channel_name> : (str) name of the publisher channel name in the wallet - --channel_id=<channel_id> : (str) claim id of the publisher channel, does not check - for channel claim being in the wallet. This allows - publishing to a channel where only the certificate - private key is in the wallet. - --claim_address=<claim_address> : (str) address where the claim is sent to, if not specified - new address wil automatically be created - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## resolve - -```text -Resolve given LBRY URIs - -Usage: - resolve [--force] (<uri> | --uri=<uri>) [<uris>...] - - -Options: - --force : (bool) force refresh and ignore cache - --uri=<uri> : (str) uri to resolve - --uris=<uris> : (list) uris to resolve - -Returns: - Dictionary of results, keyed by uri - '<uri>': { - If a resolution error occurs: - 'error': Error message - - If the uri resolves to a channel or a claim in a channel: - 'certificate': { - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'permanent_url': (str) permanent url of the certificate claim, - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}], - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - - If the uri resolves to a channel: - 'claims_in_channel': (int) number of claims in the channel, - - If the uri resolves to a claim: - 'claim': { - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'permanent_url': (str) permanent url of the claim, - 'channel_name': (str) channel name if claim is in a channel - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}] - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - } -``` - -## resolve_name - -```text -Resolve stream info from a LBRY name - -Usage: - resolve_name (<name> | --name=<name>) [--force] - - -Options: - --name=<name> : (str) the name to resolve - --force : (bool) force refresh and do not check cache - -Returns: - (dict) Metadata dictionary from name claim, None if the name is not - resolvable -``` - -## routing_table_get - -```text -Get DHT routing information - -Usage: - routing_table_get - - -Options: - None - -Returns: - (dict) dictionary containing routing and contact information - { - "buckets": { - <bucket index>: [ - { - "address": (str) peer address, - "node_id": (str) peer node id, - "blobs": (list) blob hashes announced by peer - } - ] - }, - "contacts": (list) contact node ids, - "blob_hashes": (list) all of the blob hashes stored by peers in the list of buckets, - "node_id": (str) the local dht node id - } -``` - -## settings_get - -```text -Get daemon settings - -Usage: - settings_get - - -Options: - None - -Returns: - (dict) Dictionary of daemon settings - See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings -``` - -## settings_set - -```text -Set daemon settings - -Usage: - settings_set [--download_directory=<download_directory>] - [--data_rate=<data_rate>] - [--download_timeout=<download_timeout>] - [--peer_port=<peer_port>] - [--max_key_fee=<max_key_fee>] - [--disable_max_key_fee=<disable_max_key_fee>] - [--use_upnp=<use_upnp>] - [--run_reflector_server=<run_reflector_server>] - [--cache_time=<cache_time>] - [--reflect_uploads=<reflect_uploads>] - [--share_usage_data=<share_usage_data>] - [--peer_search_timeout=<peer_search_timeout>] - [--sd_download_timeout=<sd_download_timeout>] - [--auto_renew_claim_height_delta=<auto_renew_claim_height_delta>] - - -Options: - --download_directory=<download_directory> : (str) path of download directory - --data_rate=<data_rate> : (float) 0.0001 - --download_timeout=<download_timeout> : (int) 180 - --peer_port=<peer_port> : (int) 3333 - --max_key_fee=<max_key_fee> : (dict) maximum key fee for downloads, - in the format: - { - 'currency': <currency_symbol>, - 'amount': <amount> - }. - In the CLI, it must be an escaped JSON string - Supported currency symbols: LBC, USD, BTC - --disable_max_key_fee=<disable_max_key_fee> : (bool) False - --use_upnp=<use_upnp> : (bool) True - --run_reflector_server=<run_reflector_server> : (bool) False - --cache_time=<cache_time> : (int) 150 - --reflect_uploads=<reflect_uploads> : (bool) True - --share_usage_data=<share_usage_data> : (bool) True - --peer_search_timeout=<peer_search_timeout> : (int) 3 - --sd_download_timeout=<sd_download_timeout> : (int) 3 - --auto_renew_claim_height_delta=<auto_renew_claim_height_delta> : (int) 0 - claims set to expire within this many blocks will be - automatically renewed after startup (if set to 0, renews - will not be made automatically) - -Returns: - (dict) Updated dictionary of daemon settings -``` - -## status - -```text -Get daemon status - -Usage: - status [--session_status] [--dht_status] - - -Options: - --session_status : (bool) include session status in results - --dht_status : (bool) include dht network and peer status - -Returns: - (dict) lbrynet-daemon status - { - 'lbry_id': lbry peer id, base58, - 'installation_id': installation id, base58, - 'is_running': bool, - 'is_first_run': bool, - 'startup_status': { - 'code': status code, - 'message': status message - }, - 'connection_status': { - 'code': connection status code, - 'message': connection status message - }, - 'blockchain_status': { - 'blocks': local blockchain height, - 'blocks_behind': remote_height - local_height, - 'best_blockhash': block hash of most recent block, - }, - 'wallet_is_encrypted': bool, - - If given the session status option: - 'session_status': { - 'managed_blobs': count of blobs in the blob manager, - 'managed_streams': count of streams in the file manager - 'announce_queue_size': number of blobs currently queued to be announced - 'should_announce_blobs': number of blobs that should be announced - } - - If given the dht status option: - 'dht_status': { - 'kbps_received': current kbps receiving, - 'kbps_sent': current kdps being sent, - 'total_bytes_sent': total bytes sent, - 'total_bytes_received': total bytes received, - 'queries_received': number of queries received per second, - 'queries_sent': number of queries sent per second, - 'recent_contacts': count of recently contacted peers, - 'unique_contacts': count of unique peers - }, - } -``` - -## stream_availability - -```text -Get stream availability for lbry uri - -Usage: - stream_availability (<uri> | --uri=<uri>) - [<search_timeout> | --search_timeout=<search_timeout>] - [<blob_timeout> | --blob_timeout=<blob_timeout>] - - -Options: - --uri=<uri> : (str) check availability for this uri - --search_timeout=<search_timeout> : (int) how long to search for peers for the blob - in the dht - --search_timeout=<blob_timeout> : (int) how long to try downloading from a peer - -Returns: - (dict) { - 'is_available': <bool>, - 'did_decode': <bool>, - 'did_resolve': <bool>, - 'is_stream': <bool>, - 'num_blobs_in_stream': <int>, - 'sd_hash': <str>, - 'sd_blob_availability': <dict> see `blob_availability`, - 'head_blob_hash': <str>, - 'head_blob_availability': <dict> see `blob_availability`, - 'use_upnp': <bool>, - 'upnp_redirect_is_set': <bool>, - 'error': <None> | <str> error message - } -``` - -## stream_cost_estimate - -```text -Get estimated cost for a lbry stream - -Usage: - stream_cost_estimate (<uri> | --uri=<uri>) [<size> | --size=<size>] - - -Options: - --uri=<uri> : (str) uri to use - --size=<size> : (float) stream size in bytes. if provided an sd blob won't be - downloaded. - -Returns: - (float) Estimated cost in lbry credits, returns None if uri is not - resolvable -``` - -## transaction_list - -```text -List transactions belonging to wallet - -Usage: - transaction_list - - -Options: - None - -Returns: - (list) List of transactions - - { - "claim_info": (list) claim info if in txn [{ - "address": (str) address of claim, - "balance_delta": (float) bid amount, - "amount": (float) claim amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "abandon_info": (list) abandon info if in txn [{ - "address": (str) address of abandoned claim, - "balance_delta": (float) returned amount, - "amount": (float) claim amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "confirmations": (int) number of confirmations for the txn, - "date": (str) date and time of txn, - "fee": (float) txn fee, - "support_info": (list) support info if in txn [{ - "address": (str) address of support, - "balance_delta": (float) support amount, - "amount": (float) support amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "is_tip": (bool), - "nout": (int) nout - }], - "timestamp": (int) timestamp, - "txid": (str) txn id, - "update_info": (list) update info if in txn [{ - "address": (str) address of claim, - "balance_delta": (float) credited/debited - "amount": (float) absolute amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "value": (float) value of txn - } -``` - -## transaction_show - -```text -Get a decoded transaction from a txid - -Usage: - transaction_show (<txid> | --txid=<txid>) - - -Options: - --txid=<txid> : (str) txid of the transaction - -Returns: - (dict) JSON formatted transaction -``` - -## utxo_list - -```text -List unspent transaction outputs - -Usage: - utxo_list - - -Options: - None - -Returns: - (list) List of unspent transaction outputs (UTXOs) - [ - { - "address": (str) the output address - "amount": (float) unspent amount - "height": (int) block height - "is_claim": (bool) is the tx a claim - "is_coinbase": (bool) is the tx a coinbase tx - "is_support": (bool) is the tx a support - "is_update": (bool) is the tx an update - "nout": (int) nout of the output - "txid": (str) txid of the output - }, - ... - ] -``` - -## version - -```text -Get lbry version information - -Usage: - version - - -Options: - None - -Returns: - (dict) Dictionary of lbry version information - { - 'build': (str) build type (e.g. "dev", "rc", "release"), - 'ip': (str) remote ip, if available, - 'lbrynet_version': (str) lbrynet_version, - 'lbryum_version': (str) lbryum_version, - 'lbryschema_version': (str) lbryschema_version, - 'os_release': (str) os release string - 'os_system': (str) os name - 'platform': (str) platform string - 'processor': (str) processor type, - 'python_version': (str) python version, - } -``` - -## wallet_balance - -```text -Return the balance of the wallet - -Usage: - wallet_balance [<address> | --address=<address>] [--include_unconfirmed] - - -Options: - --address=<address> : (str) If provided only the balance for this - address will be given - --include_unconfirmed : (bool) Include unconfirmed - -Returns: - (float) amount of lbry credits in wallet -``` - -## wallet_decrypt - -```text -Decrypt an encrypted wallet, this will remove the wallet password - -Usage: - wallet_decrypt - - -Options: - None - -Returns: - (bool) true if wallet is decrypted, otherwise false -``` - -## wallet_encrypt - -```text -Encrypt a wallet with a password, if the wallet is already encrypted this will update -the password - -Usage: - wallet_encrypt (<new_password> | --new_password=<new_password>) - - -Options: - --new_password=<new_password> : (str) password string to be used for encrypting wallet - -Returns: - (bool) true if wallet is decrypted, otherwise false -``` - -## wallet_is_address_mine - -```text -Checks if an address is associated with the current wallet. - -Usage: - wallet_is_address_mine (<address> | --address=<address>) - - -Options: - --address=<address> : (str) address to check - -Returns: - (bool) true, if address is associated with current wallet -``` - -## wallet_list - -```text -List wallet addresses - -Usage: - wallet_list - - -Options: - None - -Returns: - List of wallet addresses -``` - -## wallet_new_address - -```text -Generate a new wallet address - -Usage: - wallet_new_address - - -Options: - None - -Returns: - (str) New wallet address in base58 -``` - -## wallet_prefill_addresses - -```text -Create new addresses, each containing `amount` credits - -Usage: - wallet_prefill_addresses [--no_broadcast] - (<num_addresses> | --num_addresses=<num_addresses>) - (<amount> | --amount=<amount>) - - -Options: - --no_broadcast : (bool) whether to broadcast or not - --num_addresses=<num_addresses> : (int) num of addresses to create - --amount=<amount> : (float) initial amount in each address - -Returns: - (dict) the resulting transaction -``` - -## wallet_public_key - -```text -Get public key from wallet address - -Usage: - wallet_public_key (<address> | --address=<address>) - - -Options: - --address=<address> : (str) address for which to get the public key - -Returns: - (list) list of public keys associated with address. - Could contain more than one public key if multisig. -``` - -## wallet_send - -```text -Send credits. If given an address, send credits to it. If given a claim id, send a tip -to the owner of a claim specified by uri. A tip is a claim support where the recipient -of the support is the claim address for the claim being supported. - -Usage: - wallet_send (<amount> | --amount=<amount>) - ((<address> | --address=<address>) | (<claim_id> | --claim_id=<claim_id>)) - - -Options: - --amount=<amount> : (float) amount of credit to send - --address=<address> : (str) address to send credits to - --claim_id=<claim_id> : (float) claim_id of the claim to send to tip to - -Returns: - If sending to an address: - (bool) true if payment successfully scheduled - - If sending a claim tip: - (dict) Dictionary containing the result of the support - { - txid : (str) txid of resulting support claim - nout : (int) nout of the resulting support claim - fee : (float) fee paid for the transaction - } -``` - -## wallet_unlock - -```text -Unlock an encrypted wallet - -Usage: - wallet_unlock (<password> | --password=<password>) - - -Options: - --password=<password> : (str) password for unlocking wallet - -Returns: - (bool) true if wallet is unlocked, otherwise false -``` - -## wallet_unused_address - -```text -Return an address containing no balance, will create -a new address if there is none. - -Usage: - wallet_unused_address - - -Options: - None - -Returns: - (str) Unused wallet address in base58 -``` - diff --git a/scripts/docs_build/index.md b/scripts/docs_build/index.md deleted file mode 100644 index ae513848c..000000000 --- a/scripts/docs_build/index.md +++ /dev/null @@ -1,1203 +0,0 @@ -# LBRY JSON-RPC API Documentation - -## blob_announce - -```text -Announce blobs to the DHT - -Args: - 'announce_all' : (bool) announce all the blobs possessed by user - 'blob_hash' : (str) announce a blob, specified by blob_hash - 'stream_hash' : (str) announce all blobs associated with - stream_hash - 'sd_hash' : (str) announce all blobs associated with - sd_hash and the sd_hash itself - -Returns: - (bool) true if successful -``` - -## blob_availability - -```text -Get blob availability - -Args: - 'blob_hash' : (str) check availability for this blob hash - 'search_timeout' : (int) how long to search for peers for the blob - in the dht - 'blob_timeout' : (int) how long to try downloading from a peer - -Returns: - (dict) { - "is_available": <bool, true if blob is available from a peer from peer list> - "reachable_peers": ["<ip>:<port>"], - "unreachable_peers": ["<ip>:<port>"] - } -``` - -## blob_delete - -```text -Delete a blob - -Args: - 'blob_hash' : (str) blob hash of the blob to delete - -Returns: - (str) Success/fail message -``` - -## blob_get - -```text -Download and return a blob - -Args: - 'blob_hash' (required) : (str) blob hash of the blob to get - 'timeout' : (int) timeout in number of seconds - 'encoding' : (str) by default no attempt at decoding - is made, can be set to one of the - following decoders: - 'json' - 'payment_rate_manager' : (str) if not given the default payment rate - manager will be used. - supported alternative rate managers: - 'only-free' - -Returns: - (str) Success/Fail message or (dict) decoded data -``` - -## blob_list - -```text -Returns blob hashes. If not given filters, returns all blobs known by the blob manager - -Args: - 'needed' : (bool) only return needed blobs - 'finished' : (bool) only return finished blobs - 'uri' : (str) filter blobs by stream in a uri - 'stream_hash' : (str) filter blobs by stream hash - 'sd_hash' : (str) filter blobs by sd hash - 'page_size' : (int) results page size - 'page' : (int) page of results to return - -Returns: - (list) List of blob hashes -``` - -## blob_reflect_all - -```text -Reflects all saved blobs - -Args: - None - -Returns: - (bool) true if successful -``` - -## block_show - -```text -Get contents of a block - -Args: - 'blockhash' (required) : (str) hash of the block to look up - 'height' (required) : (int) height of the block to look up - -Returns: - (dict) Requested block -``` - -## channel_export - -```text -Export serialized channel signing information for a given certificate claim id - -Args: - 'claim_id' (required) : (str) Claim ID to export information about - -Returns: - (str) Serialized certificate information -``` - -## channel_import - -```text -Import serialized channel signing information (to allow signing new claims to the channel) - -Args: - 'serialized_certificate_info' : (str) certificate info - -Returns: - (dict) Result dictionary -``` - -## channel_list - -```text -Get certificate claim infos for channels that can be published to - -Args: - None - -Returns: - (list) ClaimDict, includes 'is_mine' field to indicate if the certificate claim - is in the wallet. -``` - -## channel_new - -```text -Generate a publisher key and create a new '@' prefixed certificate claim - -Args: - 'channel_name' (required) : (str) name of the channel prefixed with '@' - 'amount' (required) : (float) bid amount on the channel - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## claim_abandon - -```text -Abandon a name and reclaim credits from the claim - -Args: - 'claim_id' : (str) claim_id of the claim to abandon - 'txid' : (str) txid of the claim to abandon - 'nout' : (int) nout of the claim to abandon - -Returns: - (dict) Dictionary containing result of the claim - { - txid : (str) txid of resulting transaction - fee : (float) fee paid for the transaction - } -``` - -## claim_list - -```text -List current claims and information about them for a given name - -Args: - 'name' (required) : (str) name of the claim to list info about - -Returns: - (dict) State of claims assigned for the name - { - 'claims': (list) list of claims for the name - [ - { - 'amount': (float) amount assigned to the claim - 'effective_amount': (float) total amount assigned to the claim, - including supports - 'claim_id': (str) claim ID of the claim - 'height': (int) height of block containing the claim - 'txid': (str) txid of the claim - 'nout': (int) nout of the claim - 'permanent_url': (str) permanent url of the claim, - 'supports': (list) a list of supports attached to the claim - 'value': (str) the value of the claim - }, - ] - 'supports_without_claims': (list) supports without any claims attached to them - 'last_takeover_height': (int) the height of last takeover for the name - } -``` - -## claim_list_by_channel - -```text -Get paginated claims in a channel specified by a channel uri - -Args: - 'uri' (required) : (str) uri of the channel - 'uris' : (list) uris of the channel - 'page' : (int) which page of results to return where page 1 is the first - page, defaults to no pages - 'page_size' : (int) number of results in a page, default of 10 - -Returns: - { - resolved channel uri: { - If there was an error: - 'error': (str) error message - - 'claims_in_channel': the total number of results for the channel, - - If a page of results was requested: - 'returned_page': page number returned, - 'claims_in_channel': [ - { - 'absolute_channel_position': (int) claim index number in sorted list of - claims which assert to be part of the - channel - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}], - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - ], - } - } -``` - -## claim_list_mine - -```text -List my name claims - -Args: - None - -Returns: - (list) List of name claims owned by user - [ - { - 'address': (str) address that owns the claim - 'amount': (float) amount assigned to the claim - 'blocks_to_expiration': (int) number of blocks until it expires - 'category': (str) "claim", "update" , or "support" - 'claim_id': (str) claim ID of the claim - 'confirmations': (int) number of blocks of confirmations for the claim - 'expiration_height': (int) the block height which the claim will expire - 'expired': (bool) true if expired, false otherwise - 'height': (int) height of the block containing the claim - 'is_spent': (bool) true if claim is abandoned, false otherwise - 'name': (str) name of the claim - 'permanent_url': (str) permanent url of the claim, - 'txid': (str) txid of the cliam - 'nout': (int) nout of the claim - 'value': (str) value of the claim - }, - ] -``` - -## claim_new_support - -```text -Support a name claim - -Args: - 'name' (required) : (str) name of the claim to support - 'claim_id' (required) : (str) claim_id of the claim to support - 'amount' (required) : (float) amount of support - -Returns: - (dict) Dictionary containing result of the claim - { - txid : (str) txid of resulting support claim - nout : (int) nout of the resulting support claim - fee : (float) fee paid for the transaction - } -``` - -## claim_renew - -```text -Renew claim(s) or support(s) - -Args: - 'outpoint' (required) : (str) outpoint of the claim to renew - 'height' (required) : (str) update claims expiring before or at this block height - -Returns: - (dict) Dictionary where key is the the original claim's outpoint and - value is the result of the renewal - { - outpoint:{ - - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - }, - } -``` - -## claim_send_to_address - -```text -Send a name claim to an address - -Args: - 'claim_id' (required) : (str) claim_id to send - 'address' (required) : (str) address to send the claim to - 'amount' : (int) Amount of credits to claim name for, defaults to the current amount - on the claim - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## claim_show - -```text -Resolve claim info from txid/nout or with claim ID - -Args: - 'txid' : (str) look for claim with this txid, nout must - also be specified - 'nout' : (int) look for claim with this nout, txid must - also be specified - 'claim_id' : (str) look for claim with this claim id - -Returns: - (dict) Dictionary containing claim info as below, - - { - 'txid': (str) txid of claim - 'nout': (int) nout of claim - 'amount': (float) amount of claim - 'value': (str) value of claim - 'height' : (int) height of claim takeover - 'claim_id': (str) claim ID of claim - 'supports': (list) list of supports associated with claim - } - - if claim cannot be resolved, dictionary as below will be returned - - { - 'error': (str) reason for error - } -``` - -## cli_test_command - -```text -This command is only for testing the CLI argument parsing -Args: - 'a_arg' : a arg - 'b_arg' : b arg - 'pos_arg' (required) : pos arg - 'pos_args' : pos args - 'pos_arg2' : pos arg 2 - 'pos_arg3' : pos arg 3 - -Returns: - pos args -``` - -## commands - -```text -Return a list of available commands - -Args: - None - -Returns: - (list) list of available commands -``` - -## daemon_stop - -```text -Stop lbrynet-daemon - -Args: - None - -Returns: - (string) Shutdown message -``` - -## file_delete - -```text -Delete a LBRY file - -Args: - 'delete_from_download_dir' : (bool) delete file from download directory, - instead of just deleting blobs - 'delete_all' : (bool) if there are multiple matching files, - allow the deletion of multiple files. - Otherwise do not delete anything. - 'sd_hash' : (str) delete by file sd hash - 'file_name' : (str) delete by file name in downloads folder - 'stream_hash' : (str) delete by file stream hash - 'rowid' : (int) delete by file row id - 'claim_id' : (str) delete by file claim id - 'txid' : (str) delete by file claim txid - 'nout' : (int) delete by file claim nout - 'claim_name' : (str) delete by file claim name - 'channel_claim_id' : (str) delete by file channel claim id - 'channel_name' : (str) delete by file channel claim name - -Returns: - (bool) true if deletion was successful -``` - -## file_list - -```text -List files limited by optional filters - -Args: - 'sd_hash' : (str) get file with matching sd hash - 'file_name' : (str) get file with matching file name in the - downloads folder - 'stream_hash' : (str) get file with matching stream hash - 'rowid' : (int) get file with matching row id - 'claim_id' : (str) get file with matching claim id - 'outpoint' : (str) get file with matching claim outpoint - 'txid' : (str) get file with matching claim txid - 'nout' : (int) get file with matching claim nout - 'channel_claim_id' : (str) get file with matching channel claim id - 'channel_name' : (str) get file with matching channel name - 'claim_name' : (str) get file with matching claim name - 'full_status' : (bool) full status, populate the - 'message' and 'size' fields - -Returns: - (list) List of files - - [ - { - 'completed': (bool) true if download is completed, - 'file_name': (str) name of file, - 'download_directory': (str) download directory, - 'points_paid': (float) credit paid to download file, - 'stopped': (bool) true if download is stopped, - 'stream_hash': (str) stream hash of file, - 'stream_name': (str) stream name , - 'suggested_file_name': (str) suggested file name, - 'sd_hash': (str) sd hash of file, - 'download_path': (str) download path of file, - 'mime_type': (str) mime type of file, - 'key': (str) key attached to file, - 'total_bytes': (int) file size in bytes, None if full_status is false, - 'written_bytes': (int) written size in bytes, - 'blobs_completed': (int) num_completed, None if full_status is false, - 'blobs_in_stream': (int) None if full_status is false, - 'status': (str) downloader status, None if full_status is false, - 'claim_id': (str) None if full_status is false or if claim is not found, - 'outpoint': (str) None if full_status is false or if claim is not found, - 'txid': (str) None if full_status is false or if claim is not found, - 'nout': (int) None if full_status is false or if claim is not found, - 'metadata': (dict) None if full_status is false or if claim is not found, - 'channel_claim_id': (str) None if full_status is false or if claim is not found or signed, - 'channel_name': (str) None if full_status is false or if claim is not found or signed, - 'claim_name': (str) None if full_status is false or if claim is not found - }, - ] -``` - -## file_reflect - -```text -Reflect all the blobs in a file matching the filter criteria - -Args: - 'sd_hash' : (str) get file with matching sd hash - 'file_name' : (str) get file with matching file name in the - downloads folder - 'stream_hash' : (str) get file with matching stream hash - 'rowid' : (int) get file with matching row id - 'reflector' : (str) reflector server, ip address or url - by default choose a server from the config - -Returns: - (list) list of blobs reflected -``` - -## file_set_status - -```text -Start or stop downloading a file - -Args: - 'status' (required) : (str) one of "start" or "stop" - 'sd_hash' : (str) set status of file with matching sd hash - 'file_name' : (str) set status of file with matching file name in the - downloads folder - 'stream_hash' : (str) set status of file with matching stream hash - 'rowid' : (int) set status of file with matching row id - -Returns: - (str) Confirmation message -``` - -## get - -```text -Download stream from a LBRY name. - -Args: - 'uri' : (str) uri of the content to download - 'file_name' : (str) specified name for the downloaded file - 'timeout' : (int) download timeout in number of seconds - -Returns: - (dict) Dictionary containing information about the stream - { - 'completed': (bool) true if download is completed, - 'file_name': (str) name of file, - 'download_directory': (str) download directory, - 'points_paid': (float) credit paid to download file, - 'stopped': (bool) true if download is stopped, - 'stream_hash': (str) stream hash of file, - 'stream_name': (str) stream name , - 'suggested_file_name': (str) suggested file name, - 'sd_hash': (str) sd hash of file, - 'download_path': (str) download path of file, - 'mime_type': (str) mime type of file, - 'key': (str) key attached to file, - 'total_bytes': (int) file size in bytes, None if full_status is false, - 'written_bytes': (int) written size in bytes, - 'blobs_completed': (int) num_completed, None if full_status is false, - 'blobs_in_stream': (int) None if full_status is false, - 'status': (str) downloader status, None if full_status is false, - 'claim_id': (str) claim id, - 'outpoint': (str) claim outpoint string, - 'txid': (str) claim txid, - 'nout': (int) claim nout, - 'metadata': (dict) claim metadata, - 'channel_claim_id': (str) None if claim is not signed - 'channel_name': (str) None if claim is not signed - 'claim_name': (str) claim name - } -``` - -## help - -```text -Return a useful message for an API command - -Args: - 'command' : (str) command to retrieve documentation for - -Returns: - (str) Help message -``` - -## peer_list - -```text -Get peers for blob hash - -Args: - 'blob_hash' (required) : (str) find available peers for this blob hash - 'timeout' : (int) peer search timeout in seconds - -Returns: - (list) List of contacts -``` - -## publish - -```text -Make a new name claim and publish associated data to lbrynet, -update over existing claim if user already has a claim for name. - -Fields required in the final Metadata are: - 'title' - 'description' - 'author' - 'language' - 'license' - 'nsfw' - -Metadata can be set by either using the metadata argument or by setting individual arguments -fee, title, description, author, language, license, license_url, thumbnail, preview, nsfw, -or sources. Individual arguments will overwrite the fields specified in metadata argument. - -Args: - 'name' (required) : (str) name of the content - 'bid' (required) : (float) amount to back the claim - 'metadata' : (dict) ClaimDict to associate with the claim. - 'file_path' : (str) path to file to be associated with name. If provided, - a lbry stream of this file will be used in 'sources'. - If no path is given but a sources dict is provided, - it will be used. If neither are provided, an - error is raised. - 'fee' : (dict) Dictionary representing key fee to download content: - { - 'currency': currency_symbol, - 'amount': float, - 'address': str, optional - } - supported currencies: LBC, USD, BTC - If an address is not provided a new one will be - automatically generated. Default fee is zero. - 'title' : (str) title of the publication - 'description' : (str) description of the publication - 'author' : (str) author of the publication - 'language' : (str) language of the publication - 'license' : (str) publication license - 'license_url' : (str) publication license url - 'thumbnail' : (str) thumbnail url - 'preview' : (str) preview url - 'nsfw' : (bool) title of the publication - 'sources' : (str) {'lbry_sd_hash': sd_hash} specifies sd hash of file - 'channel_name' : (str) name of the publisher channel name in the wallet - 'channel_id' : (str) claim id of the publisher channel, does not check - for channel claim being in the wallet. This allows - publishing to a channel where only the certificate - private key is in the wallet. - 'claim_address' : (str) address where the claim is sent to, if not specified - new address wil automatically be created - -Returns: - (dict) Dictionary containing result of the claim - { - 'tx' : (str) hex encoded transaction - 'txid' : (str) txid of resulting claim - 'nout' : (int) nout of the resulting claim - 'fee' : (float) fee paid for the claim transaction - 'claim_id' : (str) claim ID of the resulting claim - } -``` - -## resolve - -```text -Resolve given LBRY URIs - -Args: - 'force' : (bool) force refresh and ignore cache - 'uri' (required) : (str) uri to resolve - 'uris' : (list) uris to resolve - -Returns: - Dictionary of results, keyed by uri - '<uri>': { - If a resolution error occurs: - 'error': Error message - - If the uri resolves to a channel or a claim in a channel: - 'certificate': { - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'permanent_url': (str) permanent url of the certificate claim, - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}], - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - - If the uri resolves to a channel: - 'claims_in_channel': (int) number of claims in the channel, - - If the uri resolves to a claim: - 'claim': { - 'address': (str) claim address, - 'amount': (float) claim amount, - 'effective_amount': (float) claim amount including supports, - 'claim_id': (str) claim id, - 'claim_sequence': (int) claim sequence number, - 'decoded_claim': (bool) whether or not the claim value was decoded, - 'height': (int) claim height, - 'depth': (int) claim depth, - 'has_signature': (bool) included if decoded_claim - 'name': (str) claim name, - 'permanent_url': (str) permanent url of the claim, - 'channel_name': (str) channel name if claim is in a channel - 'supports: (list) list of supports [{'txid': (str) txid, - 'nout': (int) nout, - 'amount': (float) amount}] - 'txid': (str) claim txid, - 'nout': (str) claim nout, - 'signature_is_valid': (bool), included if has_signature, - 'value': ClaimDict if decoded, otherwise hex string - } - } -``` - -## resolve_name - -```text -Resolve stream info from a LBRY name - -Args: - 'name' (required) : (str) the name to resolve - 'force' : (bool) force refresh and do not check cache - -Returns: - (dict) Metadata dictionary from name claim, None if the name is not - resolvable -``` - -## routing_table_get - -```text -Get DHT routing information - -Args: - None - -Returns: - (dict) dictionary containing routing and contact information - { - "buckets": { - <bucket index>: [ - { - "address": (str) peer address, - "node_id": (str) peer node id, - "blobs": (list) blob hashes announced by peer - } - ] - }, - "contacts": (list) contact node ids, - "blob_hashes": (list) all of the blob hashes stored by peers in the list of buckets, - "node_id": (str) the local dht node id - } -``` - -## settings_get - -```text -Get daemon settings - -Args: - None - -Returns: - (dict) Dictionary of daemon settings - See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings -``` - -## settings_set - -```text -Set daemon settings - -Args: - 'download_directory' : (str) path of download directory - 'data_rate' : (float) 0.0001 - 'download_timeout' : (int) 180 - 'peer_port' : (int) 3333 - 'max_key_fee' : (dict) maximum key fee for downloads, - in the format: - { - 'currency': <currency_symbol>, - 'amount': <amount> - }. - In the CLI, it must be an escaped JSON string - Supported currency symbols: LBC, USD, BTC - 'disable_max_key_fee' : (bool) False - 'use_upnp' : (bool) True - 'run_reflector_server' : (bool) False - 'cache_time' : (int) 150 - 'reflect_uploads' : (bool) True - 'share_usage_data' : (bool) True - 'peer_search_timeout' : (int) 3 - 'sd_download_timeout' : (int) 3 - 'auto_renew_claim_height_delta' : (int) 0 - claims set to expire within this many blocks will be - automatically renewed after startup (if set to 0, renews - will not be made automatically) - -Returns: - (dict) Updated dictionary of daemon settings -``` - -## status - -```text -Get daemon status - -Args: - 'session_status' : (bool) include session status in results - 'dht_status' : (bool) include dht network and peer status - -Returns: - (dict) lbrynet-daemon status - { - 'lbry_id': lbry peer id, base58, - 'installation_id': installation id, base58, - 'is_running': bool, - 'is_first_run': bool, - 'startup_status': { - 'code': status code, - 'message': status message - }, - 'connection_status': { - 'code': connection status code, - 'message': connection status message - }, - 'blockchain_status': { - 'blocks': local blockchain height, - 'blocks_behind': remote_height - local_height, - 'best_blockhash': block hash of most recent block, - }, - 'wallet_is_encrypted': bool, - - If given the session status option: - 'session_status': { - 'managed_blobs': count of blobs in the blob manager, - 'managed_streams': count of streams in the file manager - 'announce_queue_size': number of blobs currently queued to be announced - 'should_announce_blobs': number of blobs that should be announced - } - - If given the dht status option: - 'dht_status': { - 'kbps_received': current kbps receiving, - 'kbps_sent': current kdps being sent, - 'total_bytes_sent': total bytes sent, - 'total_bytes_received': total bytes received, - 'queries_received': number of queries received per second, - 'queries_sent': number of queries sent per second, - 'recent_contacts': count of recently contacted peers, - 'unique_contacts': count of unique peers - }, - } -``` - -## stream_availability - -```text -Get stream availability for lbry uri - -Args: - 'uri' (required) : (str) check availability for this uri - 'search_timeout' : (int) how long to search for peers for the blob - in the dht - 'search_timeout' : (int) how long to try downloading from a peer - -Returns: - (dict) { - 'is_available': <bool>, - 'did_decode': <bool>, - 'did_resolve': <bool>, - 'is_stream': <bool>, - 'num_blobs_in_stream': <int>, - 'sd_hash': <str>, - 'sd_blob_availability': <dict> see `blob_availability`, - 'head_blob_hash': <str>, - 'head_blob_availability': <dict> see `blob_availability`, - 'use_upnp': <bool>, - 'upnp_redirect_is_set': <bool>, - 'error': <None> | <str> error message - } -``` - -## stream_cost_estimate - -```text -Get estimated cost for a lbry stream - -Args: - 'uri' (required) : (str) uri to use - 'size' : (float) stream size in bytes. if provided an sd blob won't be - downloaded. - -Returns: - (float) Estimated cost in lbry credits, returns None if uri is not - resolvable -``` - -## transaction_list - -```text -List transactions belonging to wallet - -Args: - None - -Returns: - (list) List of transactions - - { - "claim_info": (list) claim info if in txn [{ - "address": (str) address of claim, - "balance_delta": (float) bid amount, - "amount": (float) claim amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "abandon_info": (list) abandon info if in txn [{ - "address": (str) address of abandoned claim, - "balance_delta": (float) returned amount, - "amount": (float) claim amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "confirmations": (int) number of confirmations for the txn, - "date": (str) date and time of txn, - "fee": (float) txn fee, - "support_info": (list) support info if in txn [{ - "address": (str) address of support, - "balance_delta": (float) support amount, - "amount": (float) support amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "is_tip": (bool), - "nout": (int) nout - }], - "timestamp": (int) timestamp, - "txid": (str) txn id, - "update_info": (list) update info if in txn [{ - "address": (str) address of claim, - "balance_delta": (float) credited/debited - "amount": (float) absolute amount, - "claim_id": (str) claim id, - "claim_name": (str) claim name, - "nout": (int) nout - }], - "value": (float) value of txn - } -``` - -## transaction_show - -```text -Get a decoded transaction from a txid - -Args: - 'txid' (required) : (str) txid of the transaction - -Returns: - (dict) JSON formatted transaction -``` - -## utxo_list - -```text -List unspent transaction outputs - -Args: - None - -Returns: - (list) List of unspent transaction outputs (UTXOs) - [ - { - "address": (str) the output address - "amount": (float) unspent amount - "height": (int) block height - "is_claim": (bool) is the tx a claim - "is_coinbase": (bool) is the tx a coinbase tx - "is_support": (bool) is the tx a support - "is_update": (bool) is the tx an update - "nout": (int) nout of the output - "txid": (str) txid of the output - }, - ... - ] -``` - -## version - -```text -Get lbry version information - -Args: - None - -Returns: - (dict) Dictionary of lbry version information - { - 'build': (str) build type (e.g. "dev", "rc", "release"), - 'ip': (str) remote ip, if available, - 'lbrynet_version': (str) lbrynet_version, - 'lbryum_version': (str) lbryum_version, - 'lbryschema_version': (str) lbryschema_version, - 'os_release': (str) os release string - 'os_system': (str) os name - 'platform': (str) platform string - 'processor': (str) processor type, - 'python_version': (str) python version, - } -``` - -## wallet_balance - -```text -Return the balance of the wallet - -Args: - 'address' : (str) If provided only the balance for this - address will be given - 'include_unconfirmed' : (bool) Include unconfirmed - -Returns: - (float) amount of lbry credits in wallet -``` - -## wallet_decrypt - -```text -Decrypt an encrypted wallet, this will remove the wallet password - -Args: - None - -Returns: - (bool) true if wallet is decrypted, otherwise false -``` - -## wallet_encrypt - -```text -Encrypt a wallet with a password, if the wallet is already encrypted this will update -the password - -Args: - 'new_password' (required) : (str) password string to be used for encrypting wallet - -Returns: - (bool) true if wallet is decrypted, otherwise false -``` - -## wallet_is_address_mine - -```text -Checks if an address is associated with the current wallet. - -Args: - 'address' (required) : (str) address to check - -Returns: - (bool) true, if address is associated with current wallet -``` - -## wallet_list - -```text -List wallet addresses - -Args: - None - -Returns: - List of wallet addresses -``` - -## wallet_new_address - -```text -Generate a new wallet address - -Args: - None - -Returns: - (str) New wallet address in base58 -``` - -## wallet_prefill_addresses - -```text -Create new addresses, each containing `amount` credits - -Args: - 'no_broadcast' : (bool) whether to broadcast or not - 'num_addresses' (required) : (int) num of addresses to create - 'amount' (required) : (float) initial amount in each address - -Returns: - (dict) the resulting transaction -``` - -## wallet_public_key - -```text -Get public key from wallet address - -Args: - 'address' (required) : (str) address for which to get the public key - -Returns: - (list) list of public keys associated with address. - Could contain more than one public key if multisig. -``` - -## wallet_send - -```text -Send credits. If given an address, send credits to it. If given a claim id, send a tip -to the owner of a claim specified by uri. A tip is a claim support where the recipient -of the support is the claim address for the claim being supported. - -Args: - 'amount' (required) : (float) amount of credit to send - 'address' (required) : (str) address to send credits to - 'claim_id' (required) : (float) claim_id of the claim to send to tip to - -Returns: - If sending to an address: - (bool) true if payment successfully scheduled - - If sending a claim tip: - (dict) Dictionary containing the result of the support - { - txid : (str) txid of resulting support claim - nout : (int) nout of the resulting support claim - fee : (float) fee paid for the transaction - } -``` - -## wallet_unlock - -```text -Unlock an encrypted wallet - -Args: - 'password' (required) : (str) password for unlocking wallet - -Returns: - (bool) true if wallet is unlocked, otherwise false -``` - -## wallet_unused_address - -```text -Return an address containing no balance, will create -a new address if there is none. - -Args: - None - -Returns: - (str) Unused wallet address in base58 -``` - From 0cbe11b263444918371ba4466661da37cdb96196 Mon Sep 17 00:00:00 2001 From: Alex Grin <lyoshenka@users.noreply.github.com> Date: Wed, 21 Mar 2018 08:25:24 -0400 Subject: [PATCH 10/15] Update INSTALL.md --- INSTALL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index f06352b97..06a090dd1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -101,4 +101,6 @@ Then run: pip install --editable . ``` -This will update `lbrynet-daemon` and other executables. +This will install `lbrynet-daemon` in such a way that the changes you make to the code will be used as soon as you restart the daemon. + +Happy hacking! From 679c2f403f1707758bec615be80d82aad5a56dee Mon Sep 17 00:00:00 2001 From: Jack Robison <jackrobison@lbry.io> Date: Thu, 22 Mar 2018 13:23:12 -0400 Subject: [PATCH 11/15] fix incorrectly raised DownloadCanceledError for already verified blobs -make InvalidDataError message clearer -fix BlobReflectorClient result --- CHANGELOG.md | 2 +- lbrynet/blob/blob_file.py | 15 ++++++++------- lbrynet/reflector/client/blob.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6cedba1..e48e44f4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ at anytime. * ### Changed - * + * incorrectly raised download cancelled error for already verified blob files * ### Added diff --git a/lbrynet/blob/blob_file.py b/lbrynet/blob/blob_file.py index df17b25b5..709a33df0 100644 --- a/lbrynet/blob/blob_file.py +++ b/lbrynet/blob/blob_file.py @@ -176,17 +176,18 @@ class BlobFile(object): d.addCallbacks(lambda _: fire_finished_deferred(), errback_finished_deferred) d.addCallback(lambda _: cancel_other_downloads()) else: - errback_finished_deferred(Failure(DownloadCanceledError())) - d = defer.succeed(True) + d = defer.succeed(None) + fire_finished_deferred() else: - err_string = "length vs expected: {0}, {1}, hash vs expected: {2}, {3}" - err_string = err_string.format(self.length, writer.len_so_far, self.blob_hash, - writer.blob_hash) + if writer.len_so_far != self.length: + err_string = "blob length is %i vs expected %i" % (writer.len_so_far, self.length) + else: + err_string = "blob hash is %s vs expected %s" % (writer.blob_hash, self.blob_hash) errback_finished_deferred(Failure(InvalidDataError(err_string))) - d = defer.succeed(True) + d = defer.succeed(None) else: errback_finished_deferred(err) - d = defer.succeed(True) + d = defer.succeed(None) d.addBoth(lambda _: writer.close_handle()) return d diff --git a/lbrynet/reflector/client/blob.py b/lbrynet/reflector/client/blob.py index d2c41ce30..66406e2d0 100644 --- a/lbrynet/reflector/client/blob.py +++ b/lbrynet/reflector/client/blob.py @@ -49,7 +49,7 @@ class BlobReflectorClient(Protocol): self.factory.sent_blobs = self.sent_blobs if self.factory.sent_blobs: log.info('Finished sending data via reflector') - self.factory.finished_deferred.callback(True) + self.factory.finished_deferred.callback(self.factory.sent_blobs) else: log.info('Reflector finished: %s', reason) self.factory.finished_deferred.callback(reason) From 3085e284901d219d0ac9aed796b60e982d5b9a3c Mon Sep 17 00:00:00 2001 From: Jack Robison <jackrobison@lbry.io> Date: Thu, 22 Mar 2018 16:53:16 -0400 Subject: [PATCH 12/15] don't try to resend failed blobs to reflector -fixes infinite loop where client keeps trying to send failing blobs, which may be failing because they are invalid -return list of reflected blob hashes from BlobReflectorClient --- CHANGELOG.md | 6 +++--- lbrynet/reflector/client/blob.py | 11 +++++------ lbrynet/reflector/client/client.py | 9 ++++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e48e44f4c..72dd4428c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,15 +13,15 @@ at anytime. * ### Fixed - * - * + * incorrectly raised download cancelled error for already verified blob files + * infinite loop where reflector client keeps trying to send failing blobs, which may be failing because they are invalid and thus will never be successfully received ### Deprecated * * ### Changed - * incorrectly raised download cancelled error for already verified blob files + * * ### Added diff --git a/lbrynet/reflector/client/blob.py b/lbrynet/reflector/client/blob.py index 66406e2d0..d2533cb02 100644 --- a/lbrynet/reflector/client/blob.py +++ b/lbrynet/reflector/client/blob.py @@ -26,7 +26,7 @@ class BlobReflectorClient(Protocol): self.file_sender = None self.producer = None self.streaming = False - self.sent_blobs = False + self.reflected_blobs = [] d = self.send_handshake() d.addErrback( lambda err: log.warning("An error occurred immediately: %s", err.getTraceback())) @@ -46,10 +46,9 @@ class BlobReflectorClient(Protocol): def connectionLost(self, reason): if reason.check(error.ConnectionDone): - self.factory.sent_blobs = self.sent_blobs - if self.factory.sent_blobs: + if self.reflected_blobs: log.info('Finished sending data via reflector') - self.factory.finished_deferred.callback(self.factory.sent_blobs) + self.factory.finished_deferred.callback(self.reflected_blobs) else: log.info('Reflector finished: %s', reason) self.factory.finished_deferred.callback(reason) @@ -101,7 +100,6 @@ class BlobReflectorClient(Protocol): return defer.succeed(None) def start_transfer(self): - self.sent_blobs = True assert self.read_handle is not None, \ "self.read_handle was None when trying to start the transfer" d = self.file_sender.beginFileTransfer(self.read_handle, self) @@ -130,6 +128,8 @@ class BlobReflectorClient(Protocol): if 'received_blob' not in response_dict: raise ValueError("I don't know if the blob made it to the intended destination!") else: + if response_dict['received_blob']: + self.reflected_blobs.append(self.next_blob_to_send.blob_hash) return self.set_not_uploading() def open_blob_for_reading(self, blob): @@ -188,7 +188,6 @@ class BlobReflectorClientFactory(ClientFactory): self.blob_manager = blob_manager self.blobs = blobs self.p = None - self.sent_blobs = False self.finished_deferred = defer.Deferred() def buildProtocol(self, addr): diff --git a/lbrynet/reflector/client/client.py b/lbrynet/reflector/client/client.py index cd52adc14..7c5bc3e3e 100644 --- a/lbrynet/reflector/client/client.py +++ b/lbrynet/reflector/client/client.py @@ -204,14 +204,18 @@ class EncryptedFileReflectorClient(Protocol): raise ValueError("I don't know if the sd blob made it to the intended destination!") else: self.received_descriptor_response = True + disconnect = False if response_dict['received_sd_blob']: self.reflected_blobs.append(self.next_blob_to_send.blob_hash) log.info("Sent reflector descriptor %s", self.next_blob_to_send) else: log.warning("Reflector failed to receive descriptor %s", self.next_blob_to_send) - self.blob_hashes_to_send.append(self.next_blob_to_send.blob_hash) - return self.set_not_uploading() + disconnect = True + d = self.set_not_uploading() + if disconnect: + d.addCallback(lambda _: self.transport.loseConnection()) + return d def handle_normal_response(self, response_dict): if self.file_sender is None: # Expecting Server Info Response @@ -232,7 +236,6 @@ class EncryptedFileReflectorClient(Protocol): log.debug("Sent reflector blob %s", self.next_blob_to_send) else: log.warning("Reflector failed to receive blob %s", self.next_blob_to_send) - self.blob_hashes_to_send.append(self.next_blob_to_send.blob_hash) return self.set_not_uploading() def open_blob_for_reading(self, blob): From cb069ca002d0ac687aa3b9abdecb7400f77bb643 Mon Sep 17 00:00:00 2001 From: Jack Robison <jackrobison@lbry.io> Date: Thu, 22 Mar 2018 16:54:29 -0400 Subject: [PATCH 13/15] add blob_reflect --- CHANGELOG.md | 2 +- lbrynet/daemon/Daemon.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72dd4428c..80d5675dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ at anytime. * ### Added - * + * `blob_reflect` command to send specific blobs to a reflector server * ### Removed diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index c5e7d0e22..d83f0a118 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -3074,6 +3074,24 @@ class Daemon(AuthJSONRPCServer): response = yield self._render_response(blob_hashes_for_return) defer.returnValue(response) + def jsonrpc_blob_reflect(self, blob_hashes, reflector_server=None): + """ + Reflects specified blobs + + Usage: + blob_reflect (<blob_hashes>...) [--reflector_server=<reflector_server>] + + Options: + --reflector_server=<reflector_server> (str) : reflector address + + Returns: + (list) reflected blob hashes + """ + + d = reupload.reflect_blob_hashes(blob_hashes, self.session.blob_manager, reflector_server) + d.addCallback(lambda r: self._render_response(r)) + return d + def jsonrpc_blob_reflect_all(self): """ Reflects all saved blobs From 69657750b81379ade5d1aee8144a0ca5c1e9ec9f Mon Sep 17 00:00:00 2001 From: Jack Robison <jackrobison@lbry.io> Date: Thu, 22 Mar 2018 17:04:12 -0400 Subject: [PATCH 14/15] Bump version 0.19.1 --> 0.19.2rc1 Signed-off-by: Jack Robison <jackrobison@lbry.io> --- lbrynet/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbrynet/__init__.py b/lbrynet/__init__.py index d82ed0829..604a6d1c3 100644 --- a/lbrynet/__init__.py +++ b/lbrynet/__init__.py @@ -1,6 +1,6 @@ import logging -__version__ = "0.19.1" +__version__ = "0.19.2rc1" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler()) From 9ee5a3511d04874b890fb18c48d04d9073e912f3 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg <grin@lbry.io> Date: Fri, 23 Mar 2018 12:50:18 -0400 Subject: [PATCH 15/15] missed this in dht-compat merge --- lbrynet/dht/msgformat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbrynet/dht/msgformat.py b/lbrynet/dht/msgformat.py index 7a9dd5378..2cc79f29c 100644 --- a/lbrynet/dht/msgformat.py +++ b/lbrynet/dht/msgformat.py @@ -53,7 +53,7 @@ class DefaultFormat(MessageTranslator): return primitive[str(key)] # TODO: switch to int() def fromPrimitive(self, msgPrimitive): - msgType = msgPrimitive[self.headerType] + msgType = self.get(msgPrimitive, self.headerType) if msgType == self.typeRequest: msg = msgtypes.RequestMessage(self.get(msgPrimitive, self.headerNodeID), self.get(msgPrimitive, self.headerPayload),