Compare commits

..
Author SHA1 Message Date
Brendon J. Brewer 21f9711371 append 2020-02-05 14:07:41 +13:00
Brendon J. Brewer 46c2c539d9 lint 2020-02-05 09:19:09 +13:00
Brendon J. Brewer 9c407bb620 Where did that return go? 2020-02-05 09:05:58 +13:00
Brendon J. Brewer 1f15c6cb01 Use claim_hash not claim_id 2020-02-05 07:51:29 +13:00
Brendon J. Brewer b53c5ba2d8 Only create/rewrite file if logging is turned on 2020-02-05 07:49:26 +13:00
Brendon J. Brewer 9791bb800e Only create file during install 2020-02-05 07:47:38 +13:00
Jack Robison ef36e0311e Merge pull request #2764 from lbryio/version-analytics
Add version tracking to prometheus metrics
2020-02-04 12:44:30 -05:00
Jack Robison bf4cbe1204 add version to session count metric 2020-02-04 12:18:32 -05:00
Jack Robison 28eee4da25 add version metrics to prometheus 2020-02-04 10:52:08 -05:00
Jack Robison 933ccf6deb add block updates to prometheus 2020-02-04 10:26:22 -05:00
Jack Robison 9ac41322e5 add cpu count to prometheus 2020-02-04 10:25:40 -05:00
Jack Robison c3233e03ef Merge pull request #2762 from lbryio/fix-2368
cancel reflector uploads upon file delete
2020-02-03 23:51:12 -05:00
Jack Robison 111871bb28 update test 2020-02-03 23:00:45 -05:00
Jack Robison bf5b5f43e3 non blocking analytics 2020-02-03 23:00:45 -05:00
Jack Robison 2ed8ebff09 handle ConnectionError and ValueError in blob sendfile 2020-02-03 23:00:45 -05:00
Jack Robison 34eb856d09 cancel reflector uploads upon file delete
-remove unnecessary db call in stream_update
2020-02-03 23:00:45 -05:00
Lex Berezhny 2d644bdfb0 v0.58.0 2020-02-03 22:33:03 -05:00
Lex Berezhny 741e5cf103 regenerated api docs 2020-02-03 22:30:39 -05:00
Lex Berezhny d745c04fe6 Merge pull request #2726 from lbryio/add_video_transcoding
added video file validation and optimization when publishing streams (using `--validate_file` and `--optimize_file` arguments)
2020-02-03 22:29:15 -05:00
Lex Berezhny 3a3c63956a removed unnecessary try/finally 2020-02-03 22:06:15 -05:00
Lex Berezhny 153bdf576a removed wheel from setup.py 2020-02-03 22:05:47 -05:00
Lex Berezhny 6525ee6510 moved __init__ to top of class 2020-02-03 22:05:23 -05:00
Brannon King 1780ddd329 added ffmpeg status, addressed items from code review
linter
2020-02-03 21:53:42 -05:00
Brannon King 85ad972ca8 return string instead of path object for compatibility with hachoir 2020-02-03 21:53:42 -05:00
Brannon King a90b60799a Fixed check_video.py on Windows
using a cross-platform workaround


fixed proactor use in the SDK


fixed linter
2020-02-03 21:53:42 -05:00
Brannon King 47e8f74da9 changed to list append, relative claim test 2020-02-03 21:53:42 -05:00
Brannon King fac28072ab added unit tests, other minor fixes
added universe


try again


try 4
2020-02-03 21:53:42 -05:00
Brannon King ab77541f36 in progress on video transcoding
works


Fixing lint tests


remove eval
2020-02-03 21:53:42 -05:00
Lex Berezhny 9eb769f340 Merge pull request #2760 from lbryio/channel_hash_wallet_server_idx
added database index for several `channel_hash` based queries
2020-02-03 20:56:48 -05:00
Lex Berezhny 1e81d6f848 added database index for various channel_hash based queries 2020-02-03 20:28:39 -05:00
Jack Robison dc393f4b77 Merge pull request #2761 from lbryio/catch-notification-timeout
catch TimeoutError when attempting to send notifications
2020-02-03 19:03:07 -05:00
Jack Robison dd1de530c3 catch TimeoutError when attempting to send notifications 2020-02-03 18:46:17 -05:00
Lex Berezhny 74cd887249 v0.57.0 2020-02-03 13:41:33 -05:00
Lex Berezhny b40bb35652 change MINIMUM_REQUIRED on client for servers it connects to 2020-02-03 13:41:05 -05:00
Lex Berezhny dfe257af86 Revert "test to make sure next release tests pass"
This reverts commit ebb2a09107.
2020-02-03 13:39:36 -05:00
Lex Berezhny ebb2a09107 test to make sure next release tests pass 2020-02-03 13:22:33 -05:00
Lex Berezhny c157909b4e Merge pull request #2758 from ykris45/patch-6
update copyright year in license
2020-02-02 20:19:33 -05:00
YULIUS KURNIAWAN KRISTIANTO a744239b22 update year 2020-02-03 04:04:51 +07:00
Lex Berezhny 9b4417be87 Merge pull request #2757 from lbryio/resolve_for_local_list
added `--resolve` to local `claim_list`/`stream_list`/`channel_list` commands which returns more metadata for local claims
2020-02-01 18:15:35 -05:00
Lex Berezhny 84f807e278 regenerate docs 2020-02-01 17:59:57 -05:00
Lex Berezhny 448635a945 added --resolve to local *_list commands 2020-02-01 17:59:10 -05:00
Lex Berezhny 638e3e6b3d Merge pull request #2756 from lbryio/blocked_resolve
resolve errors make distinction between truely not found claims and claims which were censored by wallet server
2020-02-01 14:00:37 -05:00
Lex Berezhny bfe711bd42 fixing tests 2020-02-01 13:29:55 -05:00
Lex Berezhny d5eed91e7f fix sql unit tests 2020-02-01 13:03:39 -05:00
Lex Berezhny 15abf49211 censored resolve responses return appropriate error 2020-02-01 12:53:39 -05:00
Lex Berezhny b7eec0586c added ResolveCensoredError 2020-02-01 12:49:01 -05:00
Lex Berezhny e639124a69 Merge pull request #2755 from eggplantbren/master
fixed initialization problem with ar trending algorithm
2020-01-30 13:44:25 -05:00
Brendon J. Brewer 22bca7a16e Length zero could also just mean there aren't any claims 2020-01-31 07:34:43 +13:00
Lex Berezhny 6f66b354e5 Merge pull request #2754 from lbryio/feat-claim_search_duration
add duration to claim search params
2020-01-29 16:43:34 -05:00
jessop f98e3320ae make review changes 2020-01-29 16:25:04 -05:00
jessop 73c958222b add duration to claim search params 2020-01-29 15:46:47 -05:00
Lex Berezhny e43230e46a v0.56.0 2020-01-28 19:58:28 -05:00
Lex Berezhny dd07bc29eb Merge pull request #2747 from eggplantbren/master
new trending algorithm contributed by Brendon Brewer, to enable on wallet server set `TRENDING_ALGORITHMS` environment variable on wallet server to `ar`
2020-01-28 19:36:52 -05:00
Lex Berezhny 790bbfcc99 integrate ar trending algorithm into configurable trending system 2020-01-28 18:11:32 -05:00
Brendon J. Brewer 994e70d43a ar trending algorithm 2020-01-28 18:11:32 -05:00
Jack Robison 7d5e19716a Merge pull request #2749 from lbryio/prometheus-interrupts
add metrics to wallet server prometheus
2020-01-28 16:31:10 -05:00
Jack Robison 11530c675d initialize_request_handlers, remove local rpc handlers 2020-01-28 15:54:22 -05:00
Jack Robison 1c474352fe add wallet server prometheus metrics
-sessions gauge
-requests counter
-response times histogram
-notification counter
-request errors counter
-interrupt counter
-operational error counter
-internal error counter
-reader executor times histogram
-pending queries gauge
-lbrycrd request counter
-client versions counter
2020-01-28 15:54:22 -05:00
Jack Robison 3b2d635390 Revert "Revert "configurable trending algorithms""
This reverts commit 55e08f96a6.
2020-01-28 15:53:57 -05:00
Jack Robison 055c532d31 Merge pull request #2752 from lbryio/revert-2750-configurable_trending
Revert "configurable trending algorithms"
2020-01-28 15:04:29 -05:00
Jack Robison 55e08f96a6 Revert "configurable trending algorithms" 2020-01-28 15:03:09 -05:00
Lex Berezhny 3e0a9180bc Merge pull request #2750 from lbryio/configurable_trending
configurable trending algorithms
2020-01-28 12:30:26 -05:00
Lex Berezhny 01ed71b243 configurable trending 2020-01-28 11:58:27 -05:00
Lex Berezhny 595c058517 moved trending.py to trending/zscore.py 2020-01-28 11:58:27 -05:00
Alex Grintsvayg e04b0a6995 add docker tag to prometheus version info 2020-01-27 14:16:18 -05:00
Jack Robison 8961848ab1 Merge pull request #2748 from lbryio/cached-wallet-id
faster wallet.id attribute, improves speed of selecting wallets during api calls
2020-01-27 13:58:23 -05:00
Jack Robison 6fb1c72b7d cached wallet id 2020-01-27 13:57:21 -05:00
Alex Grintsvayg 400d79d6ab prom port off by default 2020-01-27 13:55:44 -05:00
Lex Berezhny ce6018f387 v0.55.0 2020-01-27 12:20:41 -05:00
Alex Grintsvayg 65d9dca917 Merge branch 'docker'
* docker:
  fix gitlab ci
  add min_version and method name to metrics
  include docker tag in build info
  build_type.py -> build_info.py
  add docker build info to wallet server image
2020-01-23 13:13:33 -05:00
Alex Grintsvayg 2232b08351 fix gitlab ci 2020-01-23 13:13:20 -05:00
Alex Grintsvayg 0732ab6ad5 add min_version and method name to metrics 2020-01-23 13:13:20 -05:00
Alex Grintsvayg fb568768c5 include docker tag in build info 2020-01-23 13:13:19 -05:00
Alex Grintsvayg 7fd56e0add build_type.py -> build_info.py 2020-01-23 13:13:19 -05:00
Alex Grintsvayg 38a3f8cf4c add docker build info to wallet server image 2020-01-23 13:13:19 -05:00
Lex Berezhny 8d8a5b36b6 Merge pull request #2737 from lbryio/fix_repost_resolve_bug
fix bug where repost claims were not being fully resolved
2020-01-22 23:32:55 -05:00
Lex Berezhny a70cc7beb1 fix bug where repost claims were not being fully resolved 2020-01-22 22:59:05 -05:00
Alex Grintsvayg c5421699b1 add prometheus port to docker-compose.yml 2020-01-22 20:08:29 -05:00
Alex Grintsvayg d9f809864f include version and build info in prometheus output 2020-01-22 19:13:58 -05:00
Lex Berezhny bb23f509d7 rename BLOCKING_CHANNELS_IDS/FILTERING_CHANNELS_IDS to remove double S 2020-01-22 11:02:01 -05:00
Alex Grin 254e184677 Merge pull request #2734 from lbryio/prom2
Add prometheus metrics collection to client and server (take two)
2020-01-22 10:28:54 -05:00
Alex Grintsvayg 6c07141abd Add prometheus metrics collection to client and server 2020-01-22 10:28:17 -05:00
Lex Berezhny 5822fc1d5b v0.54.1 2020-01-22 08:40:35 -05:00
Lex Berezhny 2cd7ea257c Added support to differentiate between filtering and blocking for content censoring 2020-01-22 08:39:14 -05:00
Alex Grin 0a21b72f9c v0.54.0 2020-01-21 16:17:12 -05:00
Alex Grintsvayg 80280f6f4a Revert "v0.54.0"
This reverts commit bd3b4906d1.
2020-01-21 15:34:35 -05:00
Alex Grintsvayg 810a8e76d1 Pin pip to 19.3.1 on Windows
pip 20 made the following change:

> Remove interpreter-specific major version tag e.g. cp3-none-any from consideration.
> https://github.com/pypa/pip/pull/7355

The coincurve pip package only has a major version tag for its windows
wheel. pip20 will not allow us to install that wheel, and compiling
coincurve from source causes errors. So we cannot use pip 20 or above
until coincurve fixes its compatibility tags, we can compile coincurve
from source, we stop using coincurve, or we figure out another way to
install it.

Note that on osx and linux, coincurve has the correct tags.
2020-01-21 15:24:29 -05:00
Lex Berezhny bd3b4906d1 v0.54.0 2020-01-21 11:30:14 -05:00
Lex Berezhny d9c740f014 update tests to use 0.54.0 minimum version 2020-01-21 11:28:56 -05:00
Alex Grintsvayg ec63a18960 Revert "v0.54.0"
This reverts commit fab0618b6b.
2020-01-21 11:23:51 -05:00
Alex Grin fab0618b6b v0.54.0 2020-01-21 11:00:38 -05:00
Alex Grintsvayg 13e57e7aa8 Revert "v0.54.0"
This reverts commit 836b66e110.
2020-01-21 10:43:21 -05:00
Alex Grintsvayg 1299c9162c Revert "Add prometheus metrics collection to client and server"
This reverts commit 59a5bacb2e.
2020-01-21 10:30:49 -05:00
Alex Grintsvayg a64f33dbcc ignore coverage files 2020-01-21 10:30:48 -05:00
Alex Grin 836b66e110 v0.54.0 2020-01-20 14:26:36 -05:00
Alex Grintsvayg 802119d789 Revert "v0.54.0"
This reverts commit aec4d1dc60.
2020-01-20 14:24:30 -05:00
Alex Grintsvayg f94135cadd make pycharm happy about long lines 2020-01-20 14:18:00 -05:00
Alex Grintsvayg 474c0f980e skip randomly-failing dht test 2020-01-20 14:16:52 -05:00
Alex Grintsvayg 2cf0f791f2 remove unused import 2020-01-20 13:44:49 -05:00
Alex Grin aec4d1dc60 v0.54.0 2020-01-20 13:13:30 -05:00
Alex Grintsvayg 8d28bb5a66 bump min protocol version 2020-01-20 12:53:10 -05:00
Alex Grintsvayg 1d5e553f9c Merge branch 'blocked_search_metadata'
* blocked_search_metadata:
  add index for claim_type and release_time
  fix test
  fix json api generator
  add pagination for claim_search
  regenerate protobufs
  using multiprocessing.Manager to keep blocked content synced between readers
2020-01-20 12:51:02 -05:00
Lex Berezhny 9d79c52d20 add index for claim_type and release_time 2020-01-20 12:50:20 -05:00
Lex Berezhny 1ac03e2f1d fix test 2020-01-20 12:50:16 -05:00
Lex Berezhny 801f05f45e fix json api generator 2020-01-20 12:50:16 -05:00
Lex Berezhny 345196aa3b add pagination for claim_search 2020-01-20 12:49:42 -05:00
Lex Berezhny a01b52421e regenerate protobufs 2020-01-20 12:49:41 -05:00
Lex Berezhny 86cedfe8b2 using multiprocessing.Manager to keep blocked content synced between readers 2020-01-20 12:49:41 -05:00
Alex Grintsvayg 709128225b Merge branch 'prometheus'
* prometheus:
  Add prometheus metrics collection to client and server
2020-01-20 12:45:11 -05:00
Alex Grintsvayg 59a5bacb2e Add prometheus metrics collection to client and server 2020-01-20 12:43:49 -05:00
Jack Robison 3a21df31ee v0.53.3 2020-01-16 16:43:26 -05:00
Jack Robison 0e3407ec2f Merge pull request #2730 from lbryio/bump-aioupnp2
update aioupnp requirement to 0.0.17
2020-01-16 16:00:42 -05:00
Jack Robison fd6609e961 bump aioupnp requirement to 0.0.17 2020-01-16 15:40:29 -05:00
Jack Robison b0b5e045ff non blocking aioupnp success analytics 2020-01-16 15:40:24 -05:00
Jack Robison f293d7cccc pin windows pyinstaller 2020-01-16 15:02:15 -05:00
Jack Robison 974ed29c36 Merge pull request #2729 from lbryio/fix-headers-subscription-to-old
disconnect from server that returns rpc error for server.version
2020-01-15 17:59:17 -05:00
Jack Robison 53eb033034 disconnect from server that returns rpc error for server.version
-the server returns this error if it thinks we are incompatible with it
2020-01-15 17:06:13 -05:00
Jack Robison f2545b98ab Merge pull request #2728 from lbryio/check-server-version-from-client
check minimum server version from wallet client
2020-01-15 16:53:10 -05:00
Jack Robison 1bf51e855d check minimum server version from wallet client 2020-01-15 15:55:39 -05:00
Jack Robison e4da2a695b v0.53.2 2020-01-14 16:47:56 -05:00
Lex Berezhny 1a905d9a42 make --start-tag work again in release/script.py 2020-01-13 21:40:07 -05:00
Victor Shyba 7d9d0c15d3 fix test_direct_sync flakiness 2020-01-13 21:17:10 -05:00
Victor Shyba d34f5c2712 fix None in history, check records after wait 2020-01-13 21:17:10 -05:00
Victor Shyba a56dd66c98 separate cases and make it deterministic 2020-01-13 21:17:10 -05:00
Victor Shyba 3946bc6662 fix and document new edge case on tests 2020-01-13 21:17:10 -05:00
Victor Shyba 6647dd8f08 fix decrypting invalid bytes with valid padding 2020-01-13 21:17:10 -05:00
Jack Robison 9371122bed Merge pull request #2725 from lbryio/stream-manager-startup
faster stream manager startup
2020-01-13 18:09:49 -05:00
Jack Robison 734cd8ee08 logging 2020-01-13 17:51:05 -05:00
Jack Robison d85d9d05bb fast get_all_lbry_files 2020-01-13 17:51:05 -05:00
Jack Robison 1d7b87b3a9 fix inefficient loop in update_manually_removed_files_since_last_run 2020-01-13 17:51:02 -05:00
Lex Berezhny f0cfde36f2 v0.53.1 2020-01-13 14:12:30 -05:00
Lex Berezhny 7e220d2741 downgrade setuptools 2020-01-13 14:03:45 -05:00
Lex Berezhny c4b1351a43 stop building on travis 2020-01-13 14:03:45 -05:00
Lex Berezhny 90d2597bc3 pin to pyinstaller==3.5 2020-01-13 14:03:45 -05:00
Lex Berezhny c1508c94c2 v0.53.0 2020-01-13 12:23:41 -05:00
65 changed files with 3476 additions and 1689 deletions

No files matched your search

+3 -2
View File
@@ -3,8 +3,9 @@
/build
/dist
/.tox
/.coverage
/.coverage*
/lbry-venv
/venv
lbry.egg-info
__pycache__
@@ -13,4 +14,4 @@ _trial_temp/
/tests/integration/blockchain/files
/tests/.coverage.*
/lbry/wallet/bin
/lbry/wallet/bin
+10 -5
View File
@@ -46,6 +46,8 @@ test:datanetwork-integration:
test:blockchain-integration:
stage: test
script:
- apt-get update
- apt-get install -y --no-install-recommends ffmpeg
- pip install tox-travis
- tox -e blockchain
@@ -70,9 +72,10 @@ test:json-api:
paths:
- lbrynet-${OS}.zip
script:
- pip install --upgrade 'setuptools<45.0.0'
- pip install pyinstaller
- python3.7 docker/set_build.py
- pip install -e .
- python3.7 docker/set_build.py # must come after lbry is installed because it imports lbry
- pyinstaller --onefile --name lbrynet lbry/extras/cli.py
- chmod +x dist/lbrynet
- zip --junk-paths ${CI_PROJECT_DIR}/lbrynet-${OS}.zip dist/lbrynet # gitlab expects artifacts to be in $CI_PROJECT_DIR
@@ -117,17 +120,19 @@ build:windows:
before_script:
- ./docker/install_choco.ps1
- choco install -y --x86 python3 7zip checksum
# - python --version | findstr /B "Python 3\.7\." # dont upgrade python on every run. just make sure we're on the right Python
# - pip --version | findstr /E '\(python 3\.7\)'
- python --version # | findstr /B "Python 3\.7\." # dont upgrade python on every run. just make sure we're on the right Python
- pip --version # | findstr /E '\(python 3\.7\)'
- pip install virtualenv pywin32
- virtualenv venv
- venv/Scripts/activate.ps1
- pip install pip==19.3.1; $true # $true ignores errors. need this to get the correct coincurve wheel. see commit notes for details.
after_script:
- rmdir -Recurse venv
script:
- pip install pyinstaller
- python docker/set_build.py
- pip install --upgrade 'setuptools<45.0.0'
- pip install pyinstaller==3.5
- pip install -e .
- python docker/set_build.py # must come after lbry is installed because it imports lbry
- pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico -F -n lbrynet lbry/extras/cli.py
- 7z a -tzip $env:CI_PROJECT_DIR/lbrynet-${OS}.zip ./dist/lbrynet.exe
- checksum --type=sha256 --file=$env:CI_PROJECT_DIR/lbrynet-${OS}.zip
-51
View File
@@ -1,51 +0,0 @@
dist: xenial
language: python
python: "3.7"
jobs:
include:
- stage: code quality
name: "pylint & mypy"
install:
- make install tools
script: make lint
- stage: test
name: "Unit Tests"
install:
- make install tools
script:
- HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit
- name: "Integration Tests - Data Network"
install:
- pip install tox-travis
- sudo mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp
script: tox -e datanetwork
- name: "Integration Tests - Blockchain"
install:
- pip install tox-travis
- sudo mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp
script: tox -e blockchain
- name: "Integration Tests - Other"
install:
- pip install tox-travis
- sudo mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp
script: tox -e other
- name: "Run Examples"
install:
- make install tools
script:
- HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
cache:
directories:
- $HOME/venv
- $HOME/.cache/pip
- $HOME/Library/Caches/pip
- $HOME/Library/Caches/Homebrew
- $TRAVIS_BUILD_DIR/.tox
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-2019 LBRY Inc
Copyright (c) 2015-2020 LBRY Inc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
+5
View File
@@ -4,6 +4,10 @@ ARG user=lbry
ARG db_dir=/database
ARG projects_dir=/home/$user
ARG DOCKER_TAG
ARG DOCKER_COMMIT=docker
ENV DOCKER_TAG=$DOCKER_TAG DOCKER_COMMIT=$DOCKER_COMMIT
RUN apt-get update && \
apt-get -y --no-install-recommends install \
wget \
@@ -29,6 +33,7 @@ WORKDIR $projects_dir
RUN pip install uvloop
RUN make install
RUN python3 docker/set_build.py
RUN rm ~/.cache -rf
# entry point
+1
View File
@@ -26,6 +26,7 @@ services:
ports:
- "50001:50001" # rpc port
- "50005:50005" # websocket port
#- "2112:2112" # uncomment to enable prometheus
volumes:
- "wallet_server:/database"
environment:
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/../.." ## make sure we're in the right place. Docker Hub screws this up sometimes
echo "docker build dir: $(pwd)"
docker build --build-arg DOCKER_TAG=$DOCKER_TAG --build-arg DOCKER_COMMIT=$SOURCE_COMMIT -f $DOCKERFILE_PATH -t $IMAGE_NAME .
+23 -20
View File
@@ -1,38 +1,41 @@
"""Set the build version to be 'qa', 'rc', 'release'"""
import sys
import os
import re
import logging
import lbry.build_info as build_info_mod
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(logging.DEBUG)
def get_build_type(ci_tag=None):
if not ci_tag:
return "qa"
log.debug("getting build type for tag: \"%s\"", ci_tag)
if re.match(r'v\d+\.\d+\.\d+rc\d+$', ci_tag):
return 'rc'
elif re.match(r'v\d+\.\d+\.\d+$', ci_tag):
return 'release'
return 'qa'
def _check_and_set(d: dict, key: str, value: str):
try:
d[key]
except KeyError:
raise Exception(f"{key} var does not exist in {build_info_mod.__file__}")
d[key] = value
def main():
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
build_type_path = os.path.join(root_dir, 'lbry', 'build_type.py')
log.debug("configuring build type file: %s", build_type_path)
commit_hash = os.getenv('CI_COMMIT_SHA', os.getenv('TRAVIS_COMMIT'))
build_info = {item: build_info_mod.__dict__[item] for item in dir(build_info_mod) if not item.startswith("__")}
commit_hash = os.getenv('DOCKER_COMMIT', os.getenv('CI_COMMIT_SHA', os.getenv('TRAVIS_COMMIT')))
if commit_hash is None:
raise ValueError("Commit hash not found in env vars")
commit_hash = commit_hash[:6]
build_type = get_build_type(os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG')))
log.debug("setting build type=%s, build commit=%s", build_type, commit_hash)
with open(build_type_path, 'w') as f:
f.write(f"BUILD = \"{build_type}\"\nBUILD_COMMIT = \"{commit_hash}\"\n")
_check_and_set(build_info, "COMMIT_HASH", commit_hash[:6])
docker_tag = os.getenv('DOCKER_TAG')
if docker_tag:
_check_and_set(build_info, "DOCKER_TAG", docker_tag)
_check_and_set(build_info, "BUILD", "docker")
else:
ci_tag = os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG'))
_check_and_set(build_info, "BUILD", "release" if re.match(r'v\d+\.\d+\.\d+$', str(ci_tag)) else "qa")
log.debug("build info: %s", ", ".join([f"{k}={v}" for k, v in build_info.items()]))
with open(build_info_mod.__file__, 'w') as f:
f.write("\n".join([f"{k} = \"{v}\"" for k, v in build_info.items()]) + "\n")
if __name__ == '__main__':
+226 -184
View File
@@ -47,10 +47,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#f95ede15cbeff2da7e4a481c538501c36343077c\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#f95ede15cbeff2da7e4a481c538501c36343077c",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#f95ede15cbeff2da7e4a481c538501c36343077c\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1578100350,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpykj53y2t\",\n \"download_path\": \"/tmp/tmpykj53y2t/tmpsg2mhmr_\",\n \"file_name\": \"tmpsg2mhmr_\",\n \"height\": 214,\n \"key\": \"518b647925f56fbbdadc5f15058b9196\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017897f4a57b411ebe066cbf2f54de8e16aeb9c834feb406b1b0991fcbfff25ad85805dbf02124246436d8012302edcdf004a4479aec646070e3c9909aa22f08a482d54f00cb245398f838f4c36941981d0698e2a20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"1b7b40081d9b1a8f60b7d5a2af031b1c04bd7edbd0675bfa1920f6351524501fa4edf6acb13db77a4ca1c9503fcaa33b\",\n \"stream_name\": \"tmpsg2mhmr_\",\n \"streaming_url\": \"http://localhost:5280/stream/d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"suggested_file_name\": \"tmpsg2mhmr_\",\n \"timestamp\": 1578100370,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#ca642adaf52552f0bfc746c2ebae77724d123aeb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1580787018,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpf0g7xmd6\",\n \"download_path\": \"/tmp/tmpf0g7xmd6/tmp2mvj0998\",\n \"file_name\": \"tmp2mvj0998\",\n \"height\": 214,\n \"key\": \"159a191d5364218290065f82af17512a\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01775c3833ba18f331d0371846632d74119176e078aeb47d02b808dcb36d6bbeba1438b303c03e746500d126fd08f92ec6a26509e6f218d2d600300debf6077650fe23f1a9c92afd1ed7c4abb81ac37a0ea6a4e0d20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"a44f91e5b3806ab20a7e0b3dbe5a431d0cbd6f7579b2ed5c7f9818fe5ecb34d8885d6bc461348de3a0cea293628721f1\",\n \"stream_name\": \"tmp2mvj0998\",\n \"streaming_url\": \"http://localhost:5280/stream/425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"suggested_file_name\": \"tmp2mvj0998\",\n \"timestamp\": 1580787039,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -76,6 +76,18 @@
"description": "path to file to be associated with name.",
"is_required": false
},
{
"name": "validate_file",
"type": "bool",
"description": "validate that the video container and encodings match common web browser support or that optimization succeeds if specified. FFmpeg is required",
"is_required": false
},
{
"name": "optimize_file",
"type": "bool",
"description": "transcode the video & audio if necessary to ensure common web browser support. FFmpeg is required",
"is_required": false
},
{
"name": "fee_currency",
"type": "string",
@@ -231,10 +243,10 @@
"examples": [
{
"title": "Publish a file",
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp89vmvfej\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmp89vmvfej",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp89vmvfej\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000019261fc655c21c891fdb228261e71b40731b7560485fde5ae2de4462f847987a8010000006a47304402203f618cdaac1482f66527524fc0d10a86a4b3d131a2851d5b727d4d168125d54d02207132914eebf13193ea9805f058705fb357a98a791dfa1bf869ee5fb95f0e1dbc0121026e6755b2a17c5d7a261164316cbb733320b8f15af4a9a6db073bc4795ad632e8ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703839766d7666656a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a6358fe4485d55476a753e02cd1ffbba8f2fedca0c1a64dc040a337e43e780c90fa55a4585b86884b4109b3abb696e5d6d7576a914ca546f7063fc143b3913f5c2925e8f62b540d01888ace0b46217000000001976a9145e5b817ed5c75ae107c70cca3a6b6d2fbf95034e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mt4ReBJRH3QXdfyxiKyCwuFAFDgPVUPiSK\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100370,\n \"txid\": \"a88779842f46e42daee5fd850456b73107b4711e2628b2fd91c8215c65fc6192\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"myxmwUKbt7Qg3yFL8Nuf6ewKy9t8Y5FPB6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"07956de3340a77144971b4464a121d2e5bd577fb\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"a-new-stream\",\n \"normalized_name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#07956de3340a77144971b4464a121d2e5bd577fb\",\n \"timestamp\": null,\n \"txid\": \"9dcb4a032983ce49038d4ff24fbec0ce82942780599c3d699c8d564c968cc0df\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp89vmvfej\",\n \"sd_hash\": \"a6358fe4485d55476a753e02cd1ffbba8f2fedca0c1a64dc040a337e43e780c90fa55a4585b86884b4109b3abb696e5d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mp7sS2K2b3EZgjoFeFqzGvFvS7tfJJ4Zyb\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"9dcb4a032983ce49038d4ff24fbec0ce82942780599c3d699c8d564c968cc0df\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"9dcb4a032983ce49038d4ff24fbec0ce82942780599c3d699c8d564c968cc0df\"\n }\n}"
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsknvxuc2\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpsknvxuc2",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsknvxuc2\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000015bc2b04ccba1d35b1c942beeac9e3bbb3113cd36eb9ac1d0a4f84c5a2d057fd2010000006b483045022100cbbfb6085367ee776c193804556a42c1840df308ff0a61281a7b3006a86d09ca022027ddfb85c92502cb6350fc8ee19b64864cd51b83470c4a792c072f712320733f012102be714be5898d0b931ea632d814be706430a0bc970e224d1827308b6cb33944cdffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70736b6e7678756332180b22186170706c69636174696f6e2f6f637465742d73747265616d323092b47fe68f0ef8f5f2f2f2e0621589810457e3ff1bc02fa4b48b7a8ac445b470ec5f8c686d9061f640266169fff8a64b6d7576a914c942e5805b2e2efcc4c48564b95ca922a9df998088ace0b46217000000001976a914fee1c3f1738006ada057ff984ac3fed9dfa34bf088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxUpKsZ6bvqqn3nhpDuC3hZBgjFXid8dc6\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787039,\n \"txid\": \"d27f052d5a4cf8a4d0c19aeb36cd1331bb3b9eacee2b941c5bd3a1cb4cb0c25b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mys8FfKeiRYbY7jDyZ7Ux3xdTAcGcqDoYu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"35946fe623d5aeb34b4399c999067cd20e045368\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"a-new-stream\",\n \"normalized_name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#35946fe623d5aeb34b4399c999067cd20e045368\",\n \"timestamp\": null,\n \"txid\": \"608443b3a86a9874a159c0cd31df0984ad958830f3524055e6714281f14225ae\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsknvxuc2\",\n \"sd_hash\": \"92b47fe68f0ef8f5f2f2f2e0621589810457e3ff1bc02fa4b48b7a8ac445b470ec5f8c686d9061f640266169fff8a64b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n4kePEXwBnUC4eiH65PmEPAJ2bKZw2UiVH\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"608443b3a86a9874a159c0cd31df0984ad958830f3524055e6714281f14225ae\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"608443b3a86a9874a159c0cd31df0984ad958830f3524055e6714281f14225ae\"\n }\n}"
}
]
},
@@ -259,10 +271,10 @@
"examples": [
{
"title": "Resolve a claim",
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#f95ede15cbeff2da7e4a481c538501c36343077c\"]}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#f95ede15cbeff2da7e4a481c538501c36343077c",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#f95ede15cbeff2da7e4a481c538501c36343077c\"]}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#f95ede15cbeff2da7e4a481c538501c36343077c\": {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#f\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1578100370,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1578100369,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\"]}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#ca642adaf52552f0bfc746c2ebae77724d123aeb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\"]}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\": {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#c\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1580787039,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1580787038,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
}
]
},
@@ -277,14 +289,14 @@
"name": "status",
"description": "Get daemon status",
"arguments": [],
"returns": "(dict) lbrynet-daemon status\n {\n 'installation_id': (str) installation id - base58,\n 'is_running': (bool),\n 'skipped_components': (list) [names of skipped components (str)],\n 'startup_status': { Does not include components which have been skipped\n 'blob_manager': (bool),\n 'blockchain_headers': (bool),\n 'database': (bool),\n 'dht': (bool),\n 'exchange_rate_manager': (bool),\n 'hash_announcer': (bool),\n 'peer_protocol_server': (bool),\n 'stream_manager': (bool),\n 'upnp': (bool),\n 'wallet': (bool),\n },\n 'connection_status': {\n 'code': (str) connection status code,\n 'message': (str) connection status message\n },\n 'blockchain_headers': {\n 'downloading_headers': (bool),\n 'download_progress': (float) 0-100.0\n },\n 'wallet': {\n 'blocks': (int) local blockchain height,\n 'blocks_behind': (int) remote_height - local_height,\n 'best_blockhash': (str) block hash of most recent block,\n 'is_encrypted': (bool),\n 'is_locked': (bool),\n 'connected_servers': (list) [\n {\n 'host': (str) server hostname,\n 'port': (int) server port,\n 'latency': (int) milliseconds\n }\n ],\n },\n 'dht': {\n 'node_id': (str) lbry dht node id - hex encoded,\n 'peers_in_routing_table': (int) the number of peers in the routing table,\n },\n 'blob_manager': {\n 'finished_blobs': (int) number of finished blobs in the blob manager,\n 'connections': {\n 'incoming_bps': {\n <source ip and tcp port>: (int) bytes per second received,\n },\n 'outgoing_bps': {\n <destination ip and tcp port>: (int) bytes per second sent,\n },\n 'total_outgoing_mps': (float) megabytes per second sent,\n 'total_incoming_mps': (float) megabytes per second received,\n 'time': (float) timestamp\n }\n },\n 'hash_announcer': {\n 'announce_queue_size': (int) number of blobs currently queued to be announced\n },\n 'stream_manager': {\n 'managed_files': (int) count of files in the stream manager,\n },\n 'upnp': {\n 'aioupnp_version': (str),\n 'redirects': {\n <TCP | UDP>: (int) external_port,\n },\n 'gateway': (str) manufacturer and model,\n 'dht_redirect_set': (bool),\n 'peer_redirect_set': (bool),\n 'external_ip': (str) external ip address,\n }\n }",
"returns": "(dict) lbrynet-daemon status\n {\n 'installation_id': (str) installation id - base58,\n 'is_running': (bool),\n 'skipped_components': (list) [names of skipped components (str)],\n 'startup_status': { Does not include components which have been skipped\n 'blob_manager': (bool),\n 'blockchain_headers': (bool),\n 'database': (bool),\n 'dht': (bool),\n 'exchange_rate_manager': (bool),\n 'hash_announcer': (bool),\n 'peer_protocol_server': (bool),\n 'stream_manager': (bool),\n 'upnp': (bool),\n 'wallet': (bool),\n },\n 'connection_status': {\n 'code': (str) connection status code,\n 'message': (str) connection status message\n },\n 'blockchain_headers': {\n 'downloading_headers': (bool),\n 'download_progress': (float) 0-100.0\n },\n 'wallet': {\n 'connected': (str) host and port of the connected spv server,\n 'blocks': (int) local blockchain height,\n 'blocks_behind': (int) remote_height - local_height,\n 'best_blockhash': (str) block hash of most recent block,\n 'is_encrypted': (bool),\n 'is_locked': (bool),\n 'connected_servers': (list) [\n {\n 'host': (str) server hostname,\n 'port': (int) server port,\n 'latency': (int) milliseconds\n }\n ],\n },\n 'dht': {\n 'node_id': (str) lbry dht node id - hex encoded,\n 'peers_in_routing_table': (int) the number of peers in the routing table,\n },\n 'blob_manager': {\n 'finished_blobs': (int) number of finished blobs in the blob manager,\n 'connections': {\n 'incoming_bps': {\n <source ip and tcp port>: (int) bytes per second received,\n },\n 'outgoing_bps': {\n <destination ip and tcp port>: (int) bytes per second sent,\n },\n 'total_outgoing_mps': (float) megabytes per second sent,\n 'total_incoming_mps': (float) megabytes per second received,\n 'time': (float) timestamp\n }\n },\n 'hash_announcer': {\n 'announce_queue_size': (int) number of blobs currently queued to be announced\n },\n 'stream_manager': {\n 'managed_files': (int) count of files in the stream manager,\n },\n 'upnp': {\n 'aioupnp_version': (str),\n 'redirects': {\n <TCP | UDP>: (int) external_port,\n },\n 'gateway': (str) manufacturer and model,\n 'dht_redirect_set': (bool),\n 'peer_redirect_set': (bool),\n 'external_ip': (str) external ip address,\n }\n }",
"examples": [
{
"title": "Get status",
"curl": "curl -d'{\"method\": \"status\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet status",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"status\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"max_incoming_mbs\": 0.0,\n \"max_outgoing_mbs\": 0.0,\n \"outgoing_bps\": {},\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"7L2Eqr9iYhoqYwYJFuXhjPRZUSehma22CM34RQcWzMA8Xp5iqopX6Su7n375uWN6TL\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"stream_manager\": true,\n \"wallet\": true\n },\n \"stream_manager\": {\n \"managed_files\": 0\n },\n \"wallet\": {\n \"available_servers\": 1,\n \"best_blockhash\": \"f25a215e89357dca5e22090632731ffe44977f01de951b25da4bf7f324a5d0dc\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.005787739999504993,\n \"port\": 50002\n }\n ]\n }\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"max_incoming_mbs\": 0.0,\n \"max_outgoing_mbs\": 0.0,\n \"outgoing_bps\": {},\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"ffmpeg_status\": {\n \"analyze_audio_volume\": true,\n \"available\": true,\n \"which\": \"/usr/bin/ffmpeg\"\n },\n \"installation_id\": \"2jezwuwxQ4YaPeK8NWsvHUG3cqafj355AKRN8FTu2it544VPXfKj3zyiy2Q9vDjTk3\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"stream_manager\": true,\n \"wallet\": true\n },\n \"stream_manager\": {\n \"managed_files\": 0\n },\n \"wallet\": {\n \"available_servers\": 1,\n \"best_blockhash\": \"53e5208f4f72ba63ec828e4f3cc51d51a1771862545ed88559ab2fdc9b3ad9dd\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected\": \"127.0.0.1:50002\",\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.010943017026875168,\n \"port\": 50002\n }\n ]\n }\n }\n}"
}
]
},
@@ -299,14 +311,14 @@
"name": "version",
"description": "Get lbrynet API server version information",
"arguments": [],
"returns": "(dict) Dictionary of lbry version information\n {\n 'processor': (str) processor type,\n 'python_version': (str) python version,\n 'platform': (str) platform string,\n 'os_release': (str) os release string,\n 'os_system': (str) os name,\n 'lbrynet_version': (str) lbrynet version,\n 'torba_version': (str) torba version,\n 'build': (str) \"dev\" | \"qa\" | \"rc\" | \"release\",\n }",
"returns": "(dict) Dictionary of lbry version information\n {\n 'processor': (str) processor type,\n 'python_version': (str) python version,\n 'platform': (str) platform string,\n 'os_release': (str) os release string,\n 'os_system': (str) os name,\n 'version': (str) lbrynet version,\n 'build': (str) \"dev\" | \"qa\" | \"rc\" | \"release\",\n }",
"examples": [
{
"title": "Get version",
"curl": "curl -d'{\"method\": \"version\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet version",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"version\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"ubuntu:GNOME\",\n \"distro\": {\n \"codename\": \"bionic\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"18.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"18\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.51.2\",\n \"os_release\": \"4.15.0-72-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.15.0-72-generic-x86_64-with-debian-buster-sid\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.3\",\n \"torba_version\": \"0.5.7\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"GNOME\",\n \"distro\": {\n \"codename\": \"xenial\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"16.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"16\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.57.0\",\n \"os_release\": \"4.4.0-116-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.5\",\n \"version\": \"0.57.0\"\n }\n}"
}
]
}
@@ -360,10 +372,10 @@
"examples": [
{
"title": "Add an account from seed",
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"crisp result shop endorse polar duck figure refuse forest cherry patient adult\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\", \"single_key\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1578100337.6263494,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnKS42LM2cpNdVGZzcBdnUDYgPE1FnJMQeYHfBeNem3Mvig22kHHcp7n4V6GLPu3NN2AB5B4jVW3so9pz8PVesPBhqGtyNW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFMDwfzwS2UVCWnW9wNYMmpKxuGJg46kF8o4HaTxqFfE6qjCCs9dqqVKwrGHFuRiZorsiJeL6diaQNGjVREQzwHDDmDRcHq\",\n \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"ten hope good unable volume uniform soda shell issue blame lemon mean\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\", \"single_key\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1580787005.8771687,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPent5uR3xLzqRGKn9H1XdTzLp5ybwM6qcA2DrngUrE2r6UDc14TLa4gJX7NtX6BquQ7KhedKSDuGkphGDnCHF5jYU9wKCV35\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YFuso4iYkQVXqMJ5SLiY3HwbNVeEmNdzzWUdR5JSQXTxeLtn3jRPmCsR4FYoYr66QGmQqBYsUvEvrGvBqbUgYYx1XNqDQ2H\",\n \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\"\n }\n}"
}
]
},
@@ -401,9 +413,9 @@
},
{
"title": "Get balance for specific account by id",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}).json()",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"available\": \"2.0\",\n \"reserved\": \"0.0\",\n \"reserved_subtotals\": {\n \"claims\": \"0.0\",\n \"supports\": \"0.0\",\n \"tips\": \"0.0\"\n },\n \"total\": \"2.0\"\n }\n}"
}
]
@@ -438,7 +450,7 @@
"curl": "curl -d'{\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account create \"generated account\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1578100337.3588758,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnKS42LM2cpNdVGZzcBdnUDYgPE1FnJMQeYHfBeNem3Mvig22kHHcp7n4V6GLPu3NN2AB5B4jVW3so9pz8PVesPBhqGtyNW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFMDwfzwS2UVCWnW9wNYMmpKxuGJg46kF8o4HaTxqFfE6qjCCs9dqqVKwrGHFuRiZorsiJeL6diaQNGjVREQzwHDDmDRcHq\",\n \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1580787005.6951761,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPent5uR3xLzqRGKn9H1XdTzLp5ybwM6qcA2DrngUrE2r6UDc14TLa4gJX7NtX6BquQ7KhedKSDuGkphGDnCHF5jYU9wKCV35\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YFuso4iYkQVXqMJ5SLiY3HwbNVeEmNdzzWUdR5JSQXTxeLtn3jRPmCsR4FYoYr66QGmQqBYsUvEvrGvBqbUgYYx1XNqDQ2H\",\n \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\"\n }\n}"
}
]
},
@@ -493,24 +505,24 @@
"examples": [
{
"title": "Transfer 2 LBC from default account to specific account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001fae81ffd71edd1fffa0ced713f6805cb3509a4fc3ab6dab9727e8bdc0a008b2c010000006b483045022100db45099bd6844ec2fbe177f52aae68691d62a2214594984434ceb709cffa8bd402201475e5b299669f675f66f9c74747ca89f69bf466a2bcb72ccb4e9e3a40ec269e012102e21b09fddf104abd95a09b5e2698bcb9b6f6309b8c6cbad7a03f492ef50501bcffffffff0200c2eb0b000000001976a914b083d5ba4e58ff5203a710510e14236f6cee550f88ac90d7ae2f000000001976a914699d461ab6d545bd8fa68aaad81987ced16f248488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgnRjwhDHYUFX1KYeDak6rsojzUBFQVCSb\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100368,\n \"txid\": \"2c8b000adc8b7e72b9dab63afca40935cb05683f71ed0cfaffd1ed71fd1fe8fa\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mwcH9s47UjtP7Nc1evDDS81XnKXB7vsiz8\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mq9PemsqE69wHyzyTKNB7SQeaFzyr4ASHb\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001f626854efbd538a7fc5170b5a945672d21c7c7424c9d157437e35c91fcb7d186010000006a47304402203cf140d1799dd7362424d9c5fde4d626fe53639cc7aba3923ba4b67c751abb14022025b372e48b89b34c6125b3ba3b6adc2c8b3d199c38f535f7d7774031ccb6eafd01210319fc05001cb1e655bde5f78cfbaf99afc6dde8c24ab72ec76a3b7117e3e52a68ffffffff0200c2eb0b000000001976a9140a823bfea253ec344d0d820e36a7c821b4b9a56488ac90d7ae2f000000001976a91406091021a2942d877e0cc114960e14d451f4094b88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2qHgdfzNg8NfkXzggryosZrdxcExzNwyF\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787037,\n \"txid\": \"86d1b7fc915ce33774159d4c42c7c7212d6745a9b57051fca738d5fb4e8526f6\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mgUX4pABAVjKEZAShzA5ArMvuFjpUB24LC\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mg4sCuydWT3EaoFuCadCSoVuxHqfCnvb4v\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\"\n }\n}"
},
{
"title": "Spread LBC between multiple addresses",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"from_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\" --from_account=\"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"from_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011a6fb5492c2038450eb0e116708eaf837789ef6a80eba9b91678429e391bb5fa000000006a473044022047a73955537de3e5f1c3db9a44d9736bac0b8cdadc17cf6f9c38834e85a8df30022071ab067746a267ab9e013ce3935af56437e91f45c3b0022cab0561c3238feecf01210340bcbba8e0a028d0e4cd0658b63cd00303ff71fec8ba8f8965fe3e7cfa495466ffffffff03c0687804000000001976a9142bace3499514b0539b48e093c565787eefb7264f88acc0687804000000001976a9142bace3499514b0539b48e093c565787eefb7264f88ac6cb9fa02000000001976a9142bace3499514b0539b48e093c565787eefb7264f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mwcH9s47UjtP7Nc1evDDS81XnKXB7vsiz8\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1578100369,\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"from_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\" --from_account=\"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"from_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001bf6d56758c48ec7adb2b8afd43913f4235cea885e1ff844ab58ec5fefa4af5a3000000006a4730440220099ead4341368eb214450dfc6da61605a0917b989625e470764951af9d035719022028a1aecd1117d9a6c5618ab9eb29d88d7cfb035becd79043aea4e47cfbf302be0121020477c5ab886701bae21cc2b1775af6f704dd4a5326686a18139b7bd1b956f38bffffffff03c0687804000000001976a914179c1a2afebd7b122e7a5be2f8daef0238231e6d88acc0687804000000001976a914179c1a2afebd7b122e7a5be2f8daef0238231e6d88ac6cb9fa02000000001976a914179c1a2afebd7b122e7a5be2f8daef0238231e6d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgUX4pABAVjKEZAShzA5ArMvuFjpUB24LC\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1580787038,\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\"\n }\n}"
},
{
"title": "Transfer all LBC to a specified account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003b50ac575d2d21dc85e8e93663320b594a0f05df65ea3b7ac750d8401d473e1f6000000006b483045022100d75863f53112e8019009a3170358ebcfae2f090ef66fde33603c34333052bd2b02204a2f2bae69756e00bd9d6b2162be63d634d27c90c5032e2f2c068569e6af1d7c012103db8496bdae55127421bd4c603a27a48f3e124634f0a78feba79e9713d8751d51ffffffffb50ac575d2d21dc85e8e93663320b594a0f05df65ea3b7ac750d8401d473e1f6010000006b483045022100e964a231ff8930c691e638188f31c861ea7e0c9de314e1178d745343141204b7022077aa8545ad0d6b078605bcc41b01377a39e6c32df40e27978ff9a3621e33b0da012103db8496bdae55127421bd4c603a27a48f3e124634f0a78feba79e9713d8751d51ffffffffb50ac575d2d21dc85e8e93663320b594a0f05df65ea3b7ac750d8401d473e1f6020000006b483045022100dbae65a07a75e0e71dd1a6ba11850dcd98eb868c603fba6861a573e2048a89a90220314e2bd84be73cd43797f55180b059511e5385d596b3b21faed2dd96878dfa3b012103db8496bdae55127421bd4c603a27a48f3e124634f0a78feba79e9713d8751d51ffffffff015027eb0b000000001976a9146e03ff57f1683632414efa4dc9f8618051d17b2988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1578100369,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100369,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1578100369,\n \"txid\": \"f6e173d401840d75acb7a35ef65df0a094b5203366938e5ec81dd2d275c50ab5\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqYfQuGoVMqbcsjHk1WpmewZ9xKqWjyQQE\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"5b1f6b704c3f42fef8b00ff1f18a74c04d321dd52430740df2cc46ca6756d329\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"5b1f6b704c3f42fef8b00ff1f18a74c04d321dd52430740df2cc46ca6756d329\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000035bd6006b2392e1d98e03b8b7e8802d7fff3d9d93f4121587a8f8f32f9715ada3000000006b483045022100ee58553826cedd5b9351ae6f0086d8bd708fb5fa433d5895dbc0f8805b43130702203368391620d0b8de296dff58f2bd803e1407cc77e21168035560866d7cb4f1970121027a4eb6ff21d85fea2f563d0533ab68abeb98995a4b205d50d33c4ccb2c50aee9ffffffff5bd6006b2392e1d98e03b8b7e8802d7fff3d9d93f4121587a8f8f32f9715ada3010000006a47304402200a811fc0e2756a3ffa190bc681b6db9d0a256b09caa8c884634979db33e775c202206f377b5ed0cfcbec292fdefcd195d4f6dc819cab494182f892fff1333b6aa3d90121027a4eb6ff21d85fea2f563d0533ab68abeb98995a4b205d50d33c4ccb2c50aee9ffffffff5bd6006b2392e1d98e03b8b7e8802d7fff3d9d93f4121587a8f8f32f9715ada3020000006b48304502210085a62bb096663852946d669bac6e1ddfb37cc6e53b5f5a86df3858110f33c11402207fc4485a1a69a2834d0e521ca4b879170c9d755fec917e3d88959ea7301e683c0121027a4eb6ff21d85fea2f563d0533ab68abeb98995a4b205d50d33c4ccb2c50aee9ffffffff015027eb0b000000001976a914f4f8881aa702cc7f114d4039d0e39188d368224188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1580787038,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787038,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1580787038,\n \"txid\": \"a3ad15972ff3f8a8871512f4939d3dff7f2d80e8b7b8038ed9e192236b00d65b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3rEu9EusAUzTr7gVuhYiWGFoM7Vs5SkAb\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"29f9d222c10ca66a9df55058e9cc4e5d5f9bc42918c3377a6b86bac06bc3106d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"29f9d222c10ca66a9df55058e9cc4e5d5f9bc42918c3377a6b86bac06bc3106d\"\n }\n}"
}
]
},
@@ -568,7 +580,7 @@
"curl": "curl -d'{\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"certificates\": 0,\n \"coins\": 10.0,\n \"encrypted\": false,\n \"id\": \"msR2Dh8sqsjhHbFRWydSVoKrZrUvF5V5ny\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #msR2Dh8sqsjhHbFRWydSVoKrZrUvF5V5ny\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YHvi5JKNRX6PikdKUPF4E3AUP2FRoR3NVPhZbEbYaa4RhvKYLotvyoGuBVwJq5faqL7n9rGxo2adKQscsfFDxX6N8LCA4Gi\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"certificates\": 0,\n \"coins\": 10.0,\n \"encrypted\": false,\n \"id\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WSAvo4W9rVBzqqFz2veB26nGaFyLh867KqXWPvQH3dxxJX6cWKQFShiTyqRaSRc3HR4eXmve3sAdXL91GfMvrYRFsqonnsa\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -613,10 +625,10 @@
"examples": [
{
"title": "Remove an account",
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1578100337.3588758,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnKS42LM2cpNdVGZzcBdnUDYgPE1FnJMQeYHfBeNem3Mvig22kHHcp7n4V6GLPu3NN2AB5B4jVW3so9pz8PVesPBhqGtyNW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFMDwfzwS2UVCWnW9wNYMmpKxuGJg46kF8o4HaTxqFfE6qjCCs9dqqVKwrGHFuRiZorsiJeL6diaQNGjVREQzwHDDmDRcHq\",\n \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1580787005.6951761,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPent5uR3xLzqRGKn9H1XdTzLp5ybwM6qcA2DrngUrE2r6UDc14TLa4gJX7NtX6BquQ7KhedKSDuGkphGDnCHF5jYU9wKCV35\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YFuso4iYkQVXqMJ5SLiY3HwbNVeEmNdzzWUdR5JSQXTxeLtn3jRPmCsR4FYoYr66QGmQqBYsUvEvrGvBqbUgYYx1XNqDQ2H\",\n \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\"\n }\n}"
}
]
},
@@ -703,10 +715,10 @@
"examples": [
{
"title": "Modify maximum number of times a change address can be reused",
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\", \"default\": false, \"change_max_uses\": 10}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 10\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1578100337.763172,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnKS42LM2cpNdVGZzcBdnUDYgPE1FnJMQeYHfBeNem3Mvig22kHHcp7n4V6GLPu3NN2AB5B4jVW3so9pz8PVesPBhqGtyNW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFMDwfzwS2UVCWnW9wNYMmpKxuGJg46kF8o4HaTxqFfE6qjCCs9dqqVKwrGHFuRiZorsiJeL6diaQNGjVREQzwHDDmDRcHq\",\n \"seed\": \"crisp result shop endorse polar duck figure refuse forest cherry patient adult\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\", \"default\": false, \"change_max_uses\": 10}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 10\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1580787005.9331355,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPent5uR3xLzqRGKn9H1XdTzLp5ybwM6qcA2DrngUrE2r6UDc14TLa4gJX7NtX6BquQ7KhedKSDuGkphGDnCHF5jYU9wKCV35\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YFuso4iYkQVXqMJ5SLiY3HwbNVeEmNdzzWUdR5JSQXTxeLtn3jRPmCsR4FYoYr66QGmQqBYsUvEvrGvBqbUgYYx1XNqDQ2H\",\n \"seed\": \"ten hope good unable volume uniform soda shell issue blame lemon mean\"\n }\n}"
}
]
}
@@ -742,9 +754,9 @@
"examples": [
{
"title": "Check if address is mine",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mqsQmxDUKHRr4CXwZ3s3GryGvNqKaikYap\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mqsQmxDUKHRr4CXwZ3s3GryGvNqKaikYap",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mqsQmxDUKHRr4CXwZ3s3GryGvNqKaikYap\"}}).json()",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -791,14 +803,14 @@
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet address list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mhRoAy2fFzHoYrDc7ECWfyPoQM87cjtmAC\",\n \"pubkey\": \"tpubDA9GDAntyJu4RSTwRGyaq6iWXT9v5KQeVqwi91LMqr2CgNsZY5KBQvfNUrJHceSzHsjAyezcDo35QnRghr8YJ7zTs4iTtYhrNxDaEkQxwnx\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mi36cwEEEMAmDj9DWJC9r8o38VtyaciSq9\",\n \"pubkey\": \"tpubDA9GDAntyJu51jEeFwEjqyFk1PYc8uAEBG2LWpwVdRhYM7J9WzRkwn93J6xL8qYr9kQmYPs6qyKavdbqD6NpagAeKM6WXJthpfwjwBbfg3h\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"miRscPmNBiyhHSJhZNzeGypv7Zt2cDKMgo\",\n \"pubkey\": \"tpubDA9GDAntyJu4PnisuVk9ZUSrWEGAYF3hVhtdZD9ZrwfAV4c8E2xWGQjb2am3JBaXVsDAFeXtzEu33bkcSbHB8sHvjuHLz2y3edwFgisyG7X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"midCaeVPj2m75g4RYmzjpH3cSotrCAEnDT\",\n \"pubkey\": \"tpubDA9GDAntyJu4LVt2DfgdFTREquiXLmnRnDJEWgLEcY5G3KSZA3Ntd48G2B8LaquNfsdAECZFn75V65dnhiDhUsuY5SVHMwgAnBU5pMC5oNh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"pubkey\": \"tpubDA9GDAntyJu4UpXp4njwPJnhkSd9NEXigbcTv6QWY5nEeACFxk5LuCDwVMxvxMBYvcscSqcpTriChL8JFu5HapMoBWUDbd33cs2or5eRcEt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mjbTR1JdEBHVuo2Au9pNkJQihEKTpGeae8\",\n \"pubkey\": \"tpubDA9GDAntyJu4JbSJCE9uwH7FaschXG9yxRAwRpZJig7txtfNPp44UBs1tfBKrRC4DG8VurobWAFNWcvsff6cKnkbJn6g35Gu553FewtUh5s\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkSKqHK2es9rVEtWWpdNDQrpGYMeNXcHRn\",\n \"pubkey\": \"tpubDA9GDAntyJu4K93MC1bJq1Fyq8u7fEMsWXGqWVFt78of92Yu98KaH6xHrZWjPYebA7Rw4GiJRQJuUsjR7yMHU6CsoR75Kpgx84CT5rAVBwh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkgrmBXBs3fvHiorrfq3RhJuEKfJdWo3Zo\",\n \"pubkey\": \"tpubDA9GDAntyJu4heotibNLewZPRaroUbgrU67TctTtHuguH51N4um2m9RxdgjKe12zW9zVCSuL24FNakgqk21YwkLsoc87jRHFr7zyRLct3A6\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkzZjeBq2DyBDGAU3WC4DtgHJ9cWt3R3am\",\n \"pubkey\": \"tpubDA9GDAntyJu4iNuKNPPjGrUuGtiDJiP2tfTUVpozKzU4nQXqPkdNSjV6LzetyGqQSeBiPRfziYj6NiYs4BTto6gtoJjRLmxpyHrc2vQ8MqE\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mm9wuEStZy1YncckjJ7ZR8XFrtjZ8xSuyv\",\n \"pubkey\": \"tpubDA9GDAntyJu4ExVTPY2WDrNE28ZtdUs2j6xbQGSyv9vay45ucvdU8Bd3R9RcGz6cagojV8e2GoaBtJNnX9xHLTZEGUnJ5iSv2knq3C5QFLR\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpFmiaUgLTV9wn2g5GCfw7mjHbMCrzRxWr\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLfrnYLLFenQNjpc7V49voZyZw3Yj8K5ccfHsvwAxs6RXxqM8ETHLcKiZaEa4W5p9ovZgwanx7EmpZSTu9ZgSsTdZZZ7g7Q\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpVpnkVofTBHjBPqd4rF3SJZB8ybipqx2m\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vkbkrsdd21MX4pwdkJhXirzy3QwaEi8BEBfmLdHsaimAKVDhdJbX2kFW2tyXBpJysuT58ZPQsfwb8jB4SHb2JNY9m5qCjxW\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpoqPCBm3NbKrzd7PSgfoBJ9bPES1spRUS\",\n \"pubkey\": \"tpubDA9GDAntyJu4Xuj1v5SSgUFtZmbugFmjwUqn784e77f5Y8XTgcKN3FzFXqwvUPGjFMf3nVm1GnWQKbXWotAWemNR5zmxq78DGuo5Qe2XFJ1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mqoi2fGDiramGu6AZCqdtGqwnUVn1cJAzT\",\n \"pubkey\": \"tpubDA9GDAntyJu4tJeJtyFz9JCcE4jjgfstYa4pTjryTrpVCmR9A1uEnDaBLudszsjQpmmWF5j7n8XAsLS5vF2AQZgtPgeutXVry1W6VvQwjWT\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mtsgHJjDhNxW4ndpwLFbDVrCPTRkPWZrUz\",\n \"pubkey\": \"tpubDA9GDAntyJu4No4Vi6syGUn1X1iMJg87HokQE4UnLMome3X9P8t6GqDWnFLv8TuuR8rFXE4wBJXoBVwPJQrY6nCT6BQwBhU95od6qaY2EVo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"muXjWrfZvZ2BFzH2Hr9bL3RjBXFPhw43yd\",\n \"pubkey\": \"tpubDA9GDAntyJu5555z1VeGnNsG15XCAFfau3Qf3gAzEB8nLtLY9iN2hh4F6h17tGucn9SmHSbkJiVzQWvJZ5cZdkFUvTndk7yzfjvuzaT5Hoo\",\n \"Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mg4sCuydWT3EaoFuCadCSoVuxHqfCnvb4v\",\n \"pubkey\": \"tpubDA9GDAntyJu4TrJhMhaeoxsf3KznrGecoJfwGzrNxMxokxM12paw697yxXMkJdcdCfoTW9Zmi6EMKug2DLsDpCcgCzYqaHbGbKNjbkjS3qk\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mgXfHPzpiAJuPDeBXhDVQmwpQsRwrQ3msZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4vvvuf3ZfJzi1HBXTdrcrpNCZqWrwAmfa7e6Jc6AMb9TRmLvUaSjXrHg1GpqRqwTXkU7KeAsYNoXCr3iuPSoVZKSbcvN5oMM\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mjbLw6bmUb6DwU1UJyvMnzWkVEaAefzByj\",\n \"pubkey\": \"tpubDA9GDAntyJu4NNvtdYwfqaFhTwjXhymLnRTvLCLuNEbkKpEdChkQyHhkJMzrqMxLYunNimWfatywjrcZogcqCo6CtpPRZfxvsmmTTSisVnG\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mjoRtVG4ghTdsRuuDorE7RKXwKYDP5jzRV\",\n \"pubkey\": \"tpubDA9GDAntyJu4WHgaUn84C3vaEw2FbBB5tbhNQfsVSmBp1oAinGKakGgLwvDUWjhJnnVGwcBiyNU4xYYmzXEDr3Yy5QHq2HRcR2tKDg91Ryj\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mjtFmUSHfvKQ1YJMD7QZKaZoRTV3Et567P\",\n \"pubkey\": \"tpubDA9GDAntyJu4n5NEU7oHd1rj9wiUTMB4TD2im5y4LjxXUKFAAKdhj2qiJLDSjkmMQgxRf9MQwmKWwxDbEeeym48o28FwtG6TNYRRvTtJtu9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mkJZLpiG2hujADdJsYUS8JYydVn8kobGu2\",\n \"pubkey\": \"tpubDA9GDAntyJu4QyP6CWsuhNf24A3kpr6hdHur3V8z237Kgg45P5BPXZYJJKd8UVFyroZ3uYSmtDJwhAuzg27ovsTNt9Q98UMx1xUFTYYXM69\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mkJx7UPdnqoFcaYB6jZkWUGY3Ji4z7NtJ1\",\n \"pubkey\": \"tpubDA9GDAntyJu52dx53ttzWLsT1mExLJ3MyRYsrVd6cgXB8KHUx6vfqxYc2gVAXEmRp9w1FxukgSV4fMFebVF3oH9d8WcagQg6xeFMoMRrkwJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mkcoQLhx9Cvvx45fNjXmQaarDZCS12gEo5\",\n \"pubkey\": \"tpubDA9GDAntyJu4os9QDdEYzjAdMoNYneChu1mTgpd7y5rtJXULZ1yG2gWhaptyLzZnkPBLEcbu9fno6rpjw1fPXURt1dfc4Cj2ysfTZwwDJvg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mkzzf2aKuyvRjV2uXfBwWTJWaxVeSoeSHh\",\n \"pubkey\": \"tpubDA9GDAntyJu4sg1iqSdVMx5ZDu8PpEs73MGNHngUzhbDN5qbnMdiVbKgtCeV8g45fdaSZmWDEqt5oQQkE3PQd2AEVySthGzJkfDGVk4aAax\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mmwn9tCu54gvAaVXwP5gLUeSpHtyCt3mQr\",\n \"pubkey\": \"tpubDA9GDAntyJu561eFZrne4Uhryk7ya2jRdPVRZuAxMixhefoN4Qu1a1G6PDtNtTXNHy1yW1nmZxHW2GJKiicMSsoSJDRHW6tSkgmYvaL4y2E\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"pubkey\": \"tpubDA9GDAntyJu4h9BTNXfq1EubM3P92YcHsppTtAgKwLt7F6fUb77bQbQzaRCmnsVrAco8QXN4yBS17xWthKmvNYdqzvuLrny7xAYLvedN42k\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP\",\n \"pubkey\": \"tpubDA9GDAntyJu4XuRPXtLyopDiZFA4JEK7u7SjGLVNqHvnDsJHKsnhwAm3ghkWMbcDbpA6UA84T6LeTv8H8uHWLSZ1uYx3nUv57jCMo9h7Q1p\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mpaFPKG87uCvLBfx3scBqEt2gQmxDHvLEo\",\n \"pubkey\": \"tpubDA9GDAntyJu4iD68JkxhyEVVuMGA9YrZG9sz3FbGPbNeHKoQJvQ27ocYEBNeMsgfWb7FdrbGXVhftFiyRaF3vrLShB5LMA44RREGHePWhpw\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mpfngLET5nhTZzvWRD71poTMg3y288NbM1\",\n \"pubkey\": \"tpubDA9GDAntyJu4bKkMM54YZkXFmmw4Rb6RnjazGb4mrkFYDKwRhMTpoRVF8LB8FtPuE1k9bhXXheg9MMQFucyDYyDMnCKzbmxgoaJ5CC8av2F\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"msrzeC3SYYH5DxhMt91jSkUcqguyKKPSJD\",\n \"pubkey\": \"tpubDA9GDAntyJu4z217gK7uH5RVaaFTTifA25guGnMMMt7EQBJDjzvG8NZiRBRfhqc5yoMo7UD9f5bakz9U7sLpBrwdS5NbDdrKxjjHhsudqZD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mp29NVVYf3k331DGBfC3cv874z5KdyDU5V\",\n \"address\": \"mvS5DbYDZnnCA79uE4d49Vg5bxSXyLqScx\",\n \"pubkey\": \"tpubDA9GDAntyJu4JprXk2XBTLWfUw76U3y5pCSRcHdevM8gxhZD5xLZ9XXV3tAfTgxj77RkRiKKhq3KfMuBTaT79P6nwoMjk8XyT2QSWuEWdFM\",\n \"Line truncated
},
{
"title": "List addresses in specified account",
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mhRoAy2fFzHoYrDc7ECWfyPoQM87cjtmAC\",\n \"pubkey\": \"tpubDA9GDAntyJu4RSTwRGyaq6iWXT9v5KQeVqwi91LMqr2CgNsZY5KBQvfNUrJHceSzHsjAyezcDo35QnRghr8YJ7zTs4iTtYhrNxDaEkQxwnx\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mi36cwEEEMAmDj9DWJC9r8o38VtyaciSq9\",\n \"pubkey\": \"tpubDA9GDAntyJu51jEeFwEjqyFk1PYc8uAEBG2LWpwVdRhYM7J9WzRkwn93J6xL8qYr9kQmYPs6qyKavdbqD6NpagAeKM6WXJthpfwjwBbfg3h\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"miRscPmNBiyhHSJhZNzeGypv7Zt2cDKMgo\",\n \"pubkey\": \"tpubDA9GDAntyJu4PnisuVk9ZUSrWEGAYF3hVhtdZD9ZrwfAV4c8E2xWGQjb2am3JBaXVsDAFeXtzEu33bkcSbHB8sHvjuHLz2y3edwFgisyG7X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"midCaeVPj2m75g4RYmzjpH3cSotrCAEnDT\",\n \"pubkey\": \"tpubDA9GDAntyJu4LVt2DfgdFTREquiXLmnRnDJEWgLEcY5G3KSZA3Ntd48G2B8LaquNfsdAECZFn75V65dnhiDhUsuY5SVHMwgAnBU5pMC5oNh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mjVtTm4kGu9fYZBRRtSfL9busdQKo6Ho6j\",\n \"pubkey\": \"tpubDA9GDAntyJu4UpXp4njwPJnhkSd9NEXigbcTv6QWY5nEeACFxk5LuCDwVMxvxMBYvcscSqcpTriChL8JFu5HapMoBWUDbd33cs2or5eRcEt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mjbTR1JdEBHVuo2Au9pNkJQihEKTpGeae8\",\n \"pubkey\": \"tpubDA9GDAntyJu4JbSJCE9uwH7FaschXG9yxRAwRpZJig7txtfNPp44UBs1tfBKrRC4DG8VurobWAFNWcvsff6cKnkbJn6g35Gu553FewtUh5s\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkSKqHK2es9rVEtWWpdNDQrpGYMeNXcHRn\",\n \"pubkey\": \"tpubDA9GDAntyJu4K93MC1bJq1Fyq8u7fEMsWXGqWVFt78of92Yu98KaH6xHrZWjPYebA7Rw4GiJRQJuUsjR7yMHU6CsoR75Kpgx84CT5rAVBwh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkgrmBXBs3fvHiorrfq3RhJuEKfJdWo3Zo\",\n \"pubkey\": \"tpubDA9GDAntyJu4heotibNLewZPRaroUbgrU67TctTtHuguH51N4um2m9RxdgjKe12zW9zVCSuL24FNakgqk21YwkLsoc87jRHFr7zyRLct3A6\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mkzZjeBq2DyBDGAU3WC4DtgHJ9cWt3R3am\",\n \"pubkey\": \"tpubDA9GDAntyJu4iNuKNPPjGrUuGtiDJiP2tfTUVpozKzU4nQXqPkdNSjV6LzetyGqQSeBiPRfziYj6NiYs4BTto6gtoJjRLmxpyHrc2vQ8MqE\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mm9wuEStZy1YncckjJ7ZR8XFrtjZ8xSuyv\",\n \"pubkey\": \"tpubDA9GDAntyJu4ExVTPY2WDrNE28ZtdUs2j6xbQGSyv9vay45ucvdU8Bd3R9RcGz6cagojV8e2GoaBtJNnX9xHLTZEGUnJ5iSv2knq3C5QFLR\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpFmiaUgLTV9wn2g5GCfw7mjHbMCrzRxWr\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLfrnYLLFenQNjpc7V49voZyZw3Yj8K5ccfHsvwAxs6RXxqM8ETHLcKiZaEa4W5p9ovZgwanx7EmpZSTu9ZgSsTdZZZ7g7Q\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpVpnkVofTBHjBPqd4rF3SJZB8ybipqx2m\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vkbkrsdd21MX4pwdkJhXirzy3QwaEi8BEBfmLdHsaimAKVDhdJbX2kFW2tyXBpJysuT58ZPQsfwb8jB4SHb2JNY9m5qCjxW\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mpoqPCBm3NbKrzd7PSgfoBJ9bPES1spRUS\",\n \"pubkey\": \"tpubDA9GDAntyJu4Xuj1v5SSgUFtZmbugFmjwUqn784e77f5Y8XTgcKN3FzFXqwvUPGjFMf3nVm1GnWQKbXWotAWemNR5zmxq78DGuo5Qe2XFJ1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mqoi2fGDiramGu6AZCqdtGqwnUVn1cJAzT\",\n \"pubkey\": \"tpubDA9GDAntyJu4tJeJtyFz9JCcE4jjgfstYa4pTjryTrpVCmR9A1uEnDaBLudszsjQpmmWF5j7n8XAsLS5vF2AQZgtPgeutXVry1W6VvQwjWT\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"mtsgHJjDhNxW4ndpwLFbDVrCPTRkPWZrUz\",\n \"pubkey\": \"tpubDA9GDAntyJu4No4Vi6syGUn1X1iMJg87HokQE4UnLMome3X9P8t6GqDWnFLv8TuuR8rFXE4wBJXoBVwPJQrY6nCT6BQwBhU95od6qaY2EVo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mnVHmjfWZm6m13QiZTVRtpyo8NSM5vdaSE\",\n \"address\": \"muXjWrfZvZ2BFzH2Hr9bL3RjBXFPhw43yd\",\n \"pubkey\": \"tpubDA9GDAntyJu5555z1VeGnNsG15XCAFfau3Qf3gAzEB8nLtLY9iN2hh4F6h17tGucn9SmHSbkJiVzQWvJZ5cZdkFUvTndk7yzfjvuzaT5Hoo\",\n \"Line truncated
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mfat1w5NsfN7tQqYeGYtK65Zm2ey39DGUC\",\n \"pubkey\": \"tpubDA9GDAntyJu55myzAeyCFYX3RbLMYRp1fKJvKKViW1W4tyeG9ACeBZsKZmrAxep6tHEHL8sXojD7d3yauJJh3aXDEeSKztCXRUFifSYx4Fg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mfxZThzQEkE5eKzF4B1cS5MLaB87RLAZbi\",\n \"pubkey\": \"tpubDA9GDAntyJu4rwh3fvSRr1EVsRFSvGXXF5GHNzkpoH49s2W5vzcfn533313cyrdMDstefavVQwxEd3jaE9x3d7CZSsGbwJvHiXMTfy2pkLQ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mgUX4pABAVjKEZAShzA5ArMvuFjpUB24LC\",\n \"pubkey\": \"tpubDA9GDAntyJu4GonvTxsUMQQNFdwnSwqubdkk3bh7SeBxfBAZ3Wddj7firFd711BXCkDsqC36jBSEYi1SDER3F7Z8vYsYFsUHoRtBHCFtnvK\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mhfnqdysV2yQPxtGvFegYLsTGVyHMRvp38\",\n \"pubkey\": \"tpubDA9GDAntyJu4SA3YfjCsVDofEka7XFaTF1cMfPn3ZmKs9xdZMU6vSdLGb71a8DvcpDWEP6UaDews2Y6AKtm8HHduDv8hmnRW4EC9w1G3ELf\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mjRGG3iw1x2EM2mTPW7YRQxjNoYYLQ5fnp\",\n \"pubkey\": \"tpubDA9GDAntyJu4eEFTtCkDYMLLa7ppmgdTgLmUSQSUabXoXasNXthh7vZKzTuh1HgVSnGyyxE37ncqaR2QDG5GvB7kSKv3kLdrpyeU61Q7DZ7\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mk4CenuF879p2u96oqJLzBTeiMW8LCMYbb\",\n \"pubkey\": \"tpubDA9GDAntyJu4ZGGwV5JjN8CRQxdh2nr5afiBiE23zR6SHE118eguHX4iQkzhzZx1L1SrqePkKL1Hc6Ut7vGJ8VnQsH4qvAQSqnqpPYfikUX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mk4VyfUwWurYozf94ZGNTHtWtreNC6fUbU\",\n \"pubkey\": \"tpubDA9GDAntyJu4vPcGm18dbULrbAKAvv5wQ6xKuxN3MpvaxqcEh6X59fHWmDRk19xn7iH4Pxrqtc1aVoqEha2gtoXELLzQ4yjPFhy6xght4UC\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mkLQGh5bwpQ7YGQvPn3QxhndHWsM67ohoT\",\n \"pubkey\": \"tpubDA9GDAntyJu4DzSi6gLMPrLeSJBFhEMbXPJF9tYi5S3uCNUbpFtfUZG3Zpj7hRTLRUeznSzH5jozXXuq72bQ43X32ShSzawhC3ZdxZWekiM\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mmt58zLT21KRiCwESwajXAbJh8kwCzo2o3\",\n \"pubkey\": \"tpubDA9GDAntyJu4Tp2hABXqkwJxHFeChbqJ1CfbsaCNqxyFAGQbEGGza9UmBKSbZCxMQizwJiyjNtjsfmSB54odAtwLkuceLitsPYwrvzLmmj8\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mnBSAY9BnmoLPzzXm2Xoc15oGXvDMcnTcS\",\n \"pubkey\": \"tpubDA9GDAntyJu4MHsHpZk2XBCrF5MnTt1rxrtoZTGyXwUUDz3ZLzJipGc8iYthCFGKnTwEGoQrtCR8gwhsMewJAf9T4jWmvvo8nD6CKdB8oZx\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mrKcp7mf3d1byeZmDfqJ8BdRXDCmCi39V1\",\n \"pubkey\": \"tpubDA9GDAntyJu4EnPW1VYseMJ5rsm8UeyrDyK3t5SohYoTKFkHseexhhMi4C2opLjn6BivojfDhiFe61R1Rhqpz6DWjkiqpB1SJkFPaevdJv9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mrQZgHT4iNRBTKAhuwq7GChomJnaB7bFmp\",\n \"pubkey\": \"tpubDA9GDAntyJu4k3siG2Vpg4FVePFqgc8eFjCtC2FZszwpuqrXzfPiA1X9n9yXeekwkQiXS93j5cUdz1Ai4ACcYhHFUpnw2N7pMiuFpW4BS4K\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mrhvBJT8niVCGT4bmZ7ngGDDNm197cNA8p\",\n \"pubkey\": \"tpubDA9GDAntyJu4yJ7wHRBDCnyby95izJiopfRpgKP233hkSmo5w8gshmdg8YZXLXo8wprsM7YEREE47AQ7pyFYFHSWdYW4RHtNkcf3uiq8LH4\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mrxxeBwGQYwLm5oJRw7tNYBU8b82FNm6Vb\",\n \"pubkey\": \"tpubDA9GDAntyJu4LeunT5yfFALZJu21VTqaidFLnPHPkZeswvJHNLCeheGakQidVFfW3mNws61eeWUULE4GtEJRSQFQ44au9ZEwVLcTB7epYvs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"mtk5c8YcgDtkF1YhzWwMNztMnJu71G79mP\",\n \"pubkey\": \"tpubDA9GDAntyJu4vgagzy68rLgER3fSxQ9pb2XrQBdYwVx8bcAf97TF55dhB5UM2qFnWkCqvNHCwB9kE2uNwhBMXC7haMWT5cn2H3Lc4ibvrma\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrnadPzdQ5B3NqQeA5pN2UZUeKnzNmjLxT\",\n \"address\": \"muuy1gdKpeFDhprf6j2DBZh9zAyMh7PXPB\",\n \"pubkey\": \"tpubDA9GDAntyJu4JxKBQd6Ddrrs8q5zntWfiBzGwiTxCcxMPa6nKcoSicNN4HjJYb3jaCeC6WDq4nz4EHePce6KsVQ7mRjqBKY3wxG5RFrxVV9\",\n \"Line truncated
}
]
},
@@ -826,7 +838,7 @@
"curl": "curl -d'{\"method\": \"address_unused\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet address unused",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_unused\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mqsQmxDUKHRr4CXwZ3s3GryGvNqKaikYap\"\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP\"\n}"
}
]
}
@@ -876,10 +888,10 @@
"examples": [
{
"title": "Delete a blob",
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"\n}"
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"756ffee0f7af3b702889cf33f4bd09405295c05dc4fef1f2f597e1d52fdd4727f6fe85ce5754036a9d2357ba6c53fb4a\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete 756ffee0f7af3b702889cf33f4bd09405295c05dc4fef1f2f597e1d52fdd4727f6fe85ce5754036a9d2357ba6c53fb4a",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"756ffee0f7af3b702889cf33f4bd09405295c05dc4fef1f2f597e1d52fdd4727f6fe85ce5754036a9d2357ba6c53fb4a\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 756ffee0f7af3b702889cf33f4bd09405295c05dc4fef1f2f597e1d52fdd4727f6fe85ce5754036a9d2357ba6c53fb4a\"\n}"
}
]
},
@@ -957,7 +969,7 @@
"curl": "curl -d'{\"method\": \"blob_list\", \"params\": {\"needed\": false, \"finished\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet blob list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_list\", \"params\": {\"needed\": false, \"finished\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"e43e126a8ab9d7c2fba7fa619adf4a06e8ba559c3ae9d5c8a1cf6ab6f23f9202a06f0ee14ce48f73351c44cc81f6fafd\",\n \"60f3a294f3e56f7acc5383cc68261e819456624fef11de8a34647088412564882bf683dcc6521cfcdd06dfc252e89450\",\n \"b610beb101c564ba97da7da38a8fc2dad6e5c9f05534740f9bdfff11a5d59a5e5b081d052e5930ac7d7a78c9ec64fc2b\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n \"756ffee0f7af3b702889cf33f4bd09405295c05dc4fef1f2f597e1d52fdd4727f6fe85ce5754036a9d2357ba6c53fb4a\",\n \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"2284855cae256da0a8adf8f8fbfc794cb7ec25c89ddbbe908755d762bc59d997e368356e226b02d0f0984f87ab9016cc\",\n \"9872b781dffda958c58a2cd59bf744a01bab989e6a451f31b979e2f5eee87ec27e739e409da4f0760d5fc3e4c15df7e6\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1038,10 +1050,10 @@
"examples": [
{
"title": "Abandon a channel claim",
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 34c8b9ae168ede542fbf6c06be1e417ba5f49778",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000160dd075274b262d0fc240b977c22cc43722fef8915e8b45f3a7706a54110ec2d000000006b483045022100b0017ad6c4f8b64b8b388a0f98381cba7d6a0ba927dc93782b3e445b409e4299022029235923fb13553d4e75432c8318252a4796a9fc5e6e884349e5b02164830bee01210283a3599bf2285ec1c5cab20e7deb848c0859879817febbc19741f6d24c4d585cffffffff0134b7f505000000001976a914834bda886513b18154ddc81942a882bbd23050fc88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msVBgb2ADQVvspzSbHbHxaZf5GkJsK3WUj\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"22c2f90777594c01cf2317f8bf391065f094ab7be15b06c53ac7194508581d11\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"22c2f90777594c01cf2317f8bf391065f094ab7be15b06c53ac7194508581d11\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 78e0769111742d63461837d031f318ba33385c77",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012352ea95064b18dbc55a0fef31fec33d26a27f27b5d38ee923372db353d0c22c000000006b483045022100ab6ae56030c41e53f218a52911f250e1d45a1aa508ad757119f8364f8c8f532702206e55772f83786e7574e83b69c434aa4e890068ca9fca5a1377b73628dbfa0466012102525cc908004ae60af279c13dcd258cd78c21008d49cba99f6897e755fbcd8973ffffffff0134b7f505000000001976a91416ea93f6448bc517de5b07dede7816f828ec9a8688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhc8B39XVpZP9KEwQDHjb1B9PmiF91usho\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"9eeb64a183fe004303dc37081669a439c8d8960c49192fe8e0b1828a70c0c1eb\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"9eeb64a183fe004303dc37081669a439c8d8960c49192fe8e0b1828a70c0c1eb\"\n }\n}"
}
]
},
@@ -1171,14 +1183,14 @@
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel create @channel 1.0",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011a6fb5492c2038450eb0e116708eaf837789ef6a80eba9b91678429e391bb5fa010000006b483045022100ca9a2dbda7fb4c8e664f937a5505418665d06c955ef17049d6428e3264921ba502203c2c4e8b59dc15688103401bb676bd92f0781c51fade04c8c21590b8100cd6ac012103d3e551a3f99f1285c13cfa6acb2b4cdc46dbd54c535ff4aeebc606b605de6cbdffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b6d7576a9140c6e94d265bed4f6905211e5cce559f0eb24fa6788acc462a029000000001976a914054cfc428d109bbbf8bd05064b93285ee0e24b2488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mq9PemsqE69wHyzyTKNB7SQeaFzyr4ASHb\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100369,\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": null,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mfzyu3xmuyEGe5JrdzJDzA2WTbmzKX4NhH\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001bf6d56758c48ec7adb2b8afd43913f4235cea885e1ff844ab58ec5fefa4af5a3010000006b483045022100d7aeb8e2d3532a5b1dc234ebc1825ddfe969186fb91a7cea8efb18afd41b53300220046a29c67406ff3a94cf38e3bc2330fe01c5aa827f528cad7c8b213d19c318930121029c1a1db6dcdd769b9b0f6386840215fcb12b76768f1dccde101f5b6fca8130d7ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e176d7576a9144f1fcb21dab8b64bb790d10d206273a6c62e2d2488acc462a029000000001976a91434807a5145d4898b3ef0d69b2c83ba658aac505a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mg4sCuydWT3EaoFuCadCSoVuxHqfCnvb4v\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787038,\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": null,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mkJZLpiG2hujADdJsYUS8JYydVn8kobGu2\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\"\n }\n}"
},
{
"title": "Create a channel claim with all metadata",
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel create @bigchannel 1.0 --title=\"Big Channel\" --description=\"A channel with lots of videos.\" --email=\"creator@smallmedia.com\" --tags=music --tags=art --languages=pt-BR --languages=uk --locations=BR --locations=UA::Kiyv --website_url=\"http://smallmedia.com\" --thumbnail_url=\"http://smallmedia.com/logo.jpg\" --cover_url=\"http://smallmedia.com/logo.jpg\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000160dd075274b262d0fc240b977c22cc43722fef8915e8b45f3a7706a54110ec2d010000006b483045022100b85b3132cd6f4af5b206a67a77c936c2728dc65853963a8a8deb48295a74181902206c9da830d016f90c4eeb1ccd1f3a86913ea375f1439b131d4f9e5bcd17d55941012102bd88c34ec29ef877731b6df4b33639f100286ad1773e95bbd370386f047467a7ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a0342000473f9be55e6c57d3148aac400a8bbf972ab129bb7f7f4c4072b73af700124046cde1f4969b2a5c9bd74f7f790b77ce451e1e05b66b7be5e43de87111b287f535d121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914cd0441f0594022f35e49794ce757b71e0ea7ad9488ace221d305000000001976a914babf2b1708de18de4706473d4fac84d63573f82488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1ko3V5QiUem8yDuBjLXbXfxNYkNHqxa5b\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzCyvCbHJFr6qxjTL6fR6MuhYa47zXLCWk\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2392a555c9d6e76a533bcdfdbe994304dca0380f\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@bigchannel\",\n \"normalized_name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#2392a555c9d6e76a533bcdfdbe994304dca0380f\",\n \"timestamp\": null,\n \"txid\": \"1cdd8976085097fabe7110cd87e3daea2c44cf41ec961fe4b10cee36b0e274bd\",\n \"type\": \"claim\",\n \"value\": {\n \"cover\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"description\": \"A channel with lots of videos.\",\n \"email\": \"creator@smallmedia.com\",\n \"languages\": [\n \"pt-BR\",\n \"uk\"\n ],\n \"locations\": [\n {\n \"country\": \"BR\"\n },\n {\n \"city\": \"Kiyv\",\n \"country\": \"UA\"\n }\n ],\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000473f9be55e6c57d3148aac400a8bbf972ab129bb7f7f4c4072b73af700124046cde1f4969b2a5c9bd74f7f790b77ce451e1e05b66b7be5e43de87111b287f535d\",\n \"public_key_id\": \"mwASebZ7GpVKHwNZnJPCxD6hghQtPNfURw\",\n \"tags\": [\n \"music\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"title\": \"Big Channel\",\n \"website_url\": \"http://smallmedia.com\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mxYNzLoWYLHRSTNpaM1JKoGgAvr3X96aMf\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1cdd8976085097fabe7110cd87e3daea2c44cf41ec961fe4b10cee36b0e274bd\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"1cdd8976085097fabe7110cd87e3daea2c44cf41ec961fe4b10cee36b0e274bd\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012352ea95064b18dbc55a0fef31fec33d26a27f27b5d38ee923372db353d0c22c010000006a47304402200d248bab954394c408ac383c04b56e42a33f4a165a54a567b36e499c9d5cbe6a02207e9e01f0c75eb2736b53ab1b9d7c2301f4a8e6e7ace8e0192bc23d0f8c54704b01210377c7f0303e107007fc882517927bf0ba6eaa8220d9cb5d8856fc7badba38c78bffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004bccd90ca1f59750072516c9784f2b7dff52b24c8a6bf7151efe5a632834c3d0f7428e08ed28f4d28e3e1f9a2faaa4540b1ba943cc0e2e8104251f4c76e7e2ce4121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914609fc28b7c0a1f66195d5c51cf140d210f7df2fc88ace221d305000000001976a91428ffdcf0a939d86244b11d5be68013689809080588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msVHKAhna4JmZbwHNA8zm85yJhnATsrGiw\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpKrYnV7Fp7pWNH73UbkLdaqdU7LhZkAkP\",\n \"amount\": \"1.0\",\n \"claim_id\": \"6ee246f886ba0081b1d0e84dab086ca1b036e234\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@bigchannel\",\n \"normalized_name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#6ee246f886ba0081b1d0e84dab086ca1b036e234\",\n \"timestamp\": null,\n \"txid\": \"4d13de7350b3c65c5a17b8738c0006a710af8435902cc2ae48ef4e3a14f39fe8\",\n \"type\": \"claim\",\n \"value\": {\n \"cover\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"description\": \"A channel with lots of videos.\",\n \"email\": \"creator@smallmedia.com\",\n \"languages\": [\n \"pt-BR\",\n \"uk\"\n ],\n \"locations\": [\n {\n \"country\": \"BR\"\n },\n {\n \"city\": \"Kiyv\",\n \"country\": \"UA\"\n }\n ],\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bccd90ca1f59750072516c9784f2b7dff52b24c8a6bf7151efe5a632834c3d0f7428e08ed28f4d28e3e1f9a2faaa4540b1ba943cc0e2e8104251f4c76e7e2ce4\",\n \"public_key_id\": \"mzgLp9FA3JfjL2DaTg4aJvY5oNvTcZi1zL\",\n \"tags\": [\n \"music\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"title\": \"Big Channel\",\n \"website_url\": \"http://smallmedia.com\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mjFjqQMMroPbKTLQ2KzTY9UFHsyZLXJnYa\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4d13de7350b3c65c5a17b8738c0006a710af8435902cc2ae48ef4e3a14f39fe8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"4d13de7350b3c65c5a17b8738c0006a710af8435902cc2ae48ef4e3a14f39fe8\"\n }\n}"
}
]
},
@@ -1261,23 +1273,29 @@
"type": "int",
"description": "number of items on page during pagination",
"is_required": false
},
{
"name": "resolve",
"type": "bool",
"description": "resolves each channel to provide additional metadata",
"is_required": false
}
],
"returns": " {\n \"page\": \"Page number of the current items.\",\n \"page_size\": \"Number of items to show on a page.\",\n \"total_pages\": \"Total number of pages.\",\n \"total_items\": \"Total number of items.\",\n \"items\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'purchase'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim', 'support' or 'purchase', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"claim\": \"for purchase outputs only, metadata of purchased claim\",\n \"reposted_claim\": \"for repost claims only, metadata of claim being reposted\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\",\n \"purchase_receipt\": \"metadata for the purchase transaction associated with this claim\"\n }\n ]\n }",
"examples": [
{
"title": "List your channel claims",
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {\"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
},
{
"title": "Paginate your channel claims",
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1434,10 +1452,10 @@
"examples": [
{
"title": "Update a channel claim",
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel update 34c8b9ae168ede542fbf6c06be1e417ba5f49778 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002e1c3a10f44df49aede90a021d0c9ec6d495bcb1cd35fc3d4d383a4790539c727000000006b4830450221008260f89ca26a469272c0ad7967e0977d9203ccc5dc94076c0f24510a2d17f83702201e23673ca769fd279db7d847b826897cf38fcfccd8692d018e3f75a583e5c27401210283a3599bf2285ec1c5cab20e7deb848c0859879817febbc19741f6d24c4d585cffffffff29d35667ca46ccf20d743024d51d324dc0748af1f10fb0f8fe423f4c706b1f5b000000006a47304402200f5cf42111a0cf601f18af3786e7b0a3aac1e0bb328ffe86483337a49d1738e5022021a170843213297d4f7fd83a8b798d71c4887c096e31a708ad1e8239498c38b10121036498bf6b798a60e5ad0715c0f285d8a4232e36dfa3ed52de50d45f228dcc0181ffffffff0200e1f50500000000a6b708406368616e6e656c147897f4a57b411ebe066cbf2f54de8e16aeb9c8344c6a00125a0a583056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b420b4e6577204368616e6e656c6d6d76a9140c6e94d265bed4f6905211e5cce559f0eb24fa6788ac6ebeea0b000000001976a914de009ddbc11e758e57dc6fa3cedb505e046e4af188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mqYfQuGoVMqbcsjHk1WpmewZ9xKqWjyQQE\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1578100369,\n \"txid\": \"5b1f6b704c3f42fef8b00ff1f18a74c04d321dd52430740df2cc46ca6756d329\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": null,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n1ko3V5QiUem8yDuBjLXbXfxNYkNHqxa5b\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel update 78e0769111742d63461837d031f318ba33385c77 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000020e0a7f2b61a7a06502fe601413fe7e3c6698ce3bec4eed290d27d08a2a61b699000000006b48304502210092930b1f59557b7f5da4a5d8448de598d65dd3174e69d8aa8fb7011174262e79022023ab1dba1209c3b035c54fcc498e929296110f312a85de2c86e9da4622b3be95012102525cc908004ae60af279c13dcd258cd78c21008d49cba99f6897e755fbcd8973ffffffff6d10c36bc0ba866b7a37c31829c49b5f5d4ecce95850f59d6aa60cc122d2f929000000006a473044022007ae12a8b5fc737d8f20151b3a488dc299b7362b0f44c8a40a3731dbf7cc1aaa022030d0f0580c954b07d07f4fbfd124f1c16cb4c90afe9da30807df97707eac87f3012102aa0c29c64c81687eb888e766b20650fb8847cf07f624d2cea8c910f7a0c0e1b4ffffffff0200e1f50500000000a6b708406368616e6e656c14775c3833ba18f331d0371846632d74119176e0784c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17420b4e6577204368616e6e656c6d6d76a9144f1fcb21dab8b64bb790d10d206273a6c62e2d2488ac6ebeea0b000000001976a91483508dcd88f7825b64342cb079447438b1d237dd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n3rEu9EusAUzTr7gVuhYiWGFoM7Vs5SkAb\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1580787038,\n \"txid\": \"29f9d222c10ca66a9df55058e9cc4e5d5f9bc42918c3377a6b86bac06bc3106d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": null,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"msVHKAhna4JmZbwHNA8zm85yJhnATsrGiw\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\"\n }\n}"
}
]
}
@@ -1479,23 +1497,29 @@
"type": "int",
"description": "number of items on page during pagination",
"is_required": false
},
{
"name": "resolve",
"type": "bool",
"description": "resolves each claim to provide additional metadata",
"is_required": false
}
],
"returns": " {\n \"page\": \"Page number of the current items.\",\n \"page_size\": \"Number of items to show on a page.\",\n \"total_pages\": \"Total number of pages.\",\n \"total_items\": \"Total number of items.\",\n \"items\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'purchase'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim', 'support' or 'purchase', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"claim\": \"for purchase outputs only, metadata of purchased claim\",\n \"reposted_claim\": \"for repost claims only, metadata of claim being reposted\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\",\n \"purchase_receipt\": \"metadata for the purchase transaction associated with this claim\"\n }\n ]\n }",
"examples": [
{
"title": "List all your claims",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
},
{
"title": "Paginate your claims",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1557,12 +1581,6 @@
"description": "exclude claims signed by any of these channels (arguments must be claim ids of the channels)",
"is_required": false
},
{
"name": "blocklist_channel_ids",
"type": "list",
"description": "channel_ids of channels containing reposts of claims you want to be blocked from search results",
"is_required": false
},
{
"name": "has_channel_signature",
"type": "bool",
@@ -1719,6 +1737,12 @@
"description": "content download fee (supports equality constraints)",
"is_required": false
},
{
"name": "duration",
"type": "int",
"description": "duration of video or audio in seconds (supports equality constraints)",
"is_required": false
},
{
"name": "any_tags",
"type": "list",
@@ -1808,17 +1832,17 @@
"examples": [
{
"title": "Search for all claims in channel",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"blocklist_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --channel=@channel",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"blocklist_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#f\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1578100370,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1578100369,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": {},\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#c\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1580787039,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1580787038,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
},
{
"title": "Search for claims matching a name",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"blocklist_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --name=\"astream\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"blocklist_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#f\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1578100370,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1578100369,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": {},\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#c\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1580787039,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1580787038,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
}
@@ -2229,10 +2253,10 @@
"examples": [
{
"title": "Abandon a comment",
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"error\": {\n \"IndexError\": \"list index out of range\",\n \"code\": -32603,\n \"message\": \"Internal Server Error. Please notify a LBRY Administrator.\"\n },\n \"id\": null,\n \"jsonrpc\": \"2.0\"\n }\n}"
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"abandoned\": false\n }\n}"
}
]
},
@@ -2273,7 +2297,7 @@
{
"name": "channel_account_id",
"type": "str",
"description": "one or more account ids for accounts to look in for channel certificates, defaults to all accounts.",
"description": "one or more account ids for accounts to look in for channel certificates, defaults to all accounts",
"is_required": false
},
{
@@ -2287,51 +2311,17 @@
"examples": [
{
"title": "Posting a comment as your channel",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=f95ede15cbeff2da7e4a481c538501c36343077c",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"cea3d588e438a9c725db76c4f9f071a80438c7d586d56563685f0357c2ed5069d6eba598ca58887c029ddeaea6feeb13c63a13f85768390608601cc391412179\",\n \"signing_ts\": \"1578100348\",\n \"timestamp\": 1578100348\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=ca642adaf52552f0bfc746c2ebae77724d123aeb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"bad21d0ea39ad40531c98c5a713302c2d37552a75863cc2d2938e49e19acf897398cc387492ffd9e72cc9ed9c0c34b7e0b5862f2260a4c1aadea31f1eef5b701\",\n \"signing_ts\": \"1580787015\",\n \"timestamp\": 1580787015\n }\n}"
},
{
"title": "You can r",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"I have photographic evidence confirming Sasquatch exists\" --channel_name=@channel --claim_id=f95ede15cbeff2da7e4a481c538501c36343077c --parent_id=0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"50931c4dea5fa80a84e4b42c091b26197cc5e3b33bde978ec18e0c95bf01ee4b\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\",\n \"signature\": \"b3ffcf62cc5aedfef3cc200b597955404752487244a816744387ebfbc2e6ed3ce1eaf0656a581d8eaec6bc6e228effbb7cf0d9a74a861cfdc41ffa519bb2eba0\",\n \"signing_ts\": \"1578100348\",\n \"timestamp\": 1578100348\n }\n}"
}
]
},
{
"name": "comment_update",
"description": "Update a comment published as one of your channels.",
"arguments": [
{
"name": "comment",
"type": "str",
"description": "New comment replacing the old one",
"is_required": true
},
{
"name": "comment_id",
"type": "str",
"description": "Hash identifying the comment to edit",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(dict) Comment object if edit was successful, (None) otherwise\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"signing_ts\": (str) Timestamp used to sign the most recent signature,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n }",
"examples": [
{
"title": "Edit the contents of a comment",
"curl": "curl -d'{\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment \"update Where there was once sasquatch, there is not\" --comment_id=0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"error\": {\n \"code\": -32601,\n \"message\": \"The method does not exist / is not available.\"\n },\n \"id\": null,\n \"jsonrpc\": \"2.0\"\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"I have photographic evidence confirming Sasquatch exists\" --channel_name=@channel --parent_id=b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"d618940bf1b976f5fca41771f1ba2b6cbc8aa5bc7899232c37252498eb2c66ed\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\",\n \"signature\": \"a57c7562d39fcaecb94bed0de0c71c826c3550fe29425b21c9bc3a878c31614082f1125b43d88b34011b6ac59f5bbbbd622c216be28a731966b5daf6268969ea\",\n \"signing_ts\": \"1580787015\",\n \"timestamp\": 1580787015\n }\n}"
}
]
},
@@ -2412,17 +2402,51 @@
"examples": [
{
"title": "List all comments on a claim",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"include_replies\": true, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list f95ede15cbeff2da7e4a481c538501c36343077c --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"include_replies\": true, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"cea3d588e438a9c725db76c4f9f071a80438c7d586d56563685f0357c2ed5069d6eba598ca58887c029ddeaea6feeb13c63a13f85768390608601cc391412179\",\n \"signing_ts\": \"1578100348\",\n \"timestamp\": 1578100348\n },\n {\n \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"50931c4dea5fa80a84e4b42c091b26197cc5e3b33bde978ec18e0c95bf01ee4b\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\",\n \"signature\": \"b3ffcf62cc5aedfef3cc200b597955404752487244a816744387ebfbc2e6ed3ce1eaf0656a581d8eaec6bc6e228effbb7cf0d9a74a861cfdc41ffa519bb2eba0\",\n \"signing_ts\": \"1578100348\",\n \"timestamp\": 1578100348\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"include_replies\": true, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list ca642adaf52552f0bfc746c2ebae77724d123aeb --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"include_replies\": true, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"bad21d0ea39ad40531c98c5a713302c2d37552a75863cc2d2938e49e19acf897398cc387492ffd9e72cc9ed9c0c34b7e0b5862f2260a4c1aadea31f1eef5b701\",\n \"signing_ts\": \"1580787015\",\n \"timestamp\": 1580787015\n },\n {\n \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"d618940bf1b976f5fca41771f1ba2b6cbc8aa5bc7899232c37252498eb2c66ed\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\",\n \"signature\": \"a57c7562d39fcaecb94bed0de0c71c826c3550fe29425b21c9bc3a878c31614082f1125b43d88b34011b6ac59f5bbbbd622c216be28a731966b5daf6268969ea\",\n \"signing_ts\": \"1580787015\",\n \"timestamp\": 1580787015\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
},
{
"title": "List a comment thread replying to a top level comment",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\", \"include_replies\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list f95ede15cbeff2da7e4a481c538501c36343077c --parent_id=0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"parent_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\", \"include_replies\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"0dec63ef27fd7d8c76237811b00db797479061caba39ac0f4f3b094aae59a5cb\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"cea3d588e438a9c725db76c4f9f071a80438c7d586d56563685f0357c2ed5069d6eba598ca58887c029ddeaea6feeb13c63a13f85768390608601cc391412179\",\n \"signing_ts\": \"1578100348\",\n \"timestamp\": 1578100348\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\", \"include_replies\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list ca642adaf52552f0bfc746c2ebae77724d123aeb --parent_id=b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"parent_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\", \"include_replies\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"bad21d0ea39ad40531c98c5a713302c2d37552a75863cc2d2938e49e19acf897398cc387492ffd9e72cc9ed9c0c34b7e0b5862f2260a4c1aadea31f1eef5b701\",\n \"signing_ts\": \"1580787015\",\n \"timestamp\": 1580787015\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
{
"name": "comment_update",
"description": "Edit a comment published as one of your channels.",
"arguments": [
{
"name": "comment",
"type": "str",
"description": "New comment replacing the old one",
"is_required": true
},
{
"name": "comment_id",
"type": "str",
"description": "Hash identifying the comment to edit",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(dict) Comment object if edit was successful, (None) otherwise\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"signing_ts\": (str) Timestamp used to sign the most recent signature,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n }",
"examples": [
{
"title": "Edit the contents of a comment",
"curl": "curl -d'{\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"b4fe9a306a7c40e2baffd33f4dba495b53fc4c6f5fdc62ac4f81e76b77c53036\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": null\n}"
}
]
}
@@ -2512,9 +2536,9 @@
"examples": [
{
"title": "Delete a file",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"f95ede15cbeff2da7e4a481c538501c36343077c\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\"}}).json()",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"ca642adaf52552f0bfc746c2ebae77724d123aeb\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -2645,14 +2669,14 @@
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"518b647925f56fbbdadc5f15058b9196\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017897f4a57b411ebe066cbf2f54de8e16aeb9c834feb406b1b0991fcbfff25ad85805dbf02124246436d8012302edcdf004a4479aec646070e3c9909aa22f08a482d54f00cb245398f838f4c36941981d0698e2a20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"1b7b40081d9b1a8f60b7d5a2af031b1c04bd7edbd0675bfa1920f6351524501fa4edf6acb13db77a4ca1c9503fcaa33b\",\n \"stream_name\": \"tmpsg2mhmr_\",\n \"streaming_url\": \"http://localhost:5280/stream/d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"suggested_file_name\": \"tmpsg2mhmr_\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"written_bytes\": 0\n },\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"2dfb4a9dc1557c5cc89d3447904cc3b493be911e\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"6773acf1a6d9101f7dcd69fcc43a9a2d\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvkLPgxEeqM1iP5o69JVj4Tm6NpdYjhCZE\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1578100345\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpouzs2ayp.png\",\n \"sd_hash\": \"b610beb101c564ba97da7da38a8fc2dad6e5c9f05534740f9bdfff11a5d59a5e5b081d052e5930ac7d7a78c9ec64fc2b\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/thumbnail.jpg\"\n },\n \"title\": \"Blank Image\"\n },\n \"mime_type\": \"image/png\",\n \"nout\": 0,\n \"outpoint\": \"a88779842f46e42daee5fd850456b73107b4711e2628b2fdLine truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"159a191d5364218290065f82af17512a\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01775c3833ba18f331d0371846632d74119176e078aeb47d02b808dcb36d6bbeba1438b303c03e746500d126fd08f92ec6a26509e6f218d2d600300debf6077650fe23f1a9c92afd1ed7c4abb81ac37a0ea6a4e0d20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"a44f91e5b3806ab20a7e0b3dbe5a431d0cbd6f7579b2ed5c7f9818fe5ecb34d8885d6bc461348de3a0cea293628721f1\",\n \"stream_name\": \"tmp2mvj0998\",\n \"streaming_url\": \"http://localhost:5280/stream/425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"suggested_file_name\": \"tmp2mvj0998\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"written_bytes\": 0\n },\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"3afacf53358a8234b23ff60e51231b3a62b28165\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"7580ab9a0a85562a6f6c13bd59e84d0f\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mjbLw6bmUb6DwU1UJyvMnzWkVEaAefzByj\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1580787013\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpw_1zp_we.png\",\n \"sd_hash\": \"9872b781dffda958c58a2cd59bf744a01bab989e6a451f31b979e2f5eee87ec27e739e409da4f0760d5fc3e4c15df7e6\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/thumbnail.jpg\"\n },\n \"title\": \"Blank Image\"\n },\n \"mime_type\": \"image/png\",\n \"nout\": 0,\n \"outpoint\": \"d27f052d5a4cf8a4d0c19aeb36cd1331bb3b9eacee2b941cLine truncated
},
{
"title": "List files matching a parameter",
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"f95ede15cbeff2da7e4a481c538501c36343077c\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"518b647925f56fbbdadc5f15058b9196\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017897f4a57b411ebe066cbf2f54de8e16aeb9c834feb406b1b0991fcbfff25ad85805dbf02124246436d8012302edcdf004a4479aec646070e3c9909aa22f08a482d54f00cb245398f838f4c36941981d0698e2a20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"1b7b40081d9b1a8f60b7d5a2af031b1c04bd7edbd0675bfa1920f6351524501fa4edf6acb13db77a4ca1c9503fcaa33b\",\n \"stream_name\": \"tmpsg2mhmr_\",\n \"streaming_url\": \"http://localhost:5280/stream/d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"suggested_file_name\": \"tmpsg2mhmr_\",\n \"timestamp\": 1578100370,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"written_bytes\": 0\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"ca642adaf52552f0bfc746c2ebae77724d123aeb\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"159a191d5364218290065f82af17512a\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01775c3833ba18f331d0371846632d74119176e078aeb47d02b808dcb36d6bbeba1438b303c03e746500d126fd08f92ec6a26509e6f218d2d600300debf6077650fe23f1a9c92afd1ed7c4abb81ac37a0ea6a4e0d20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"a44f91e5b3806ab20a7e0b3dbe5a431d0cbd6f7579b2ed5c7f9818fe5ecb34d8885d6bc461348de3a0cea293628721f1\",\n \"stream_name\": \"tmp2mvj0998\",\n \"streaming_url\": \"http://localhost:5280/stream/425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"suggested_file_name\": \"tmp2mvj0998\",\n \"timestamp\": 1580787039,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"written_bytes\": 0\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -2769,10 +2793,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1578100350,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpykj53y2t\",\n \"download_path\": \"/tmp/tmpykj53y2t/tmpsg2mhmr__1\",\n \"file_name\": \"tmpsg2mhmr__1\",\n \"height\": 214,\n \"key\": \"518b647925f56fbbdadc5f15058b9196\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017897f4a57b411ebe066cbf2f54de8e16aeb9c834feb406b1b0991fcbfff25ad85805dbf02124246436d8012302edcdf004a4479aec646070e3c9909aa22f08a482d54f00cb245398f838f4c36941981d0698e2a20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"1b7b40081d9b1a8f60b7d5a2af031b1c04bd7edbd0675bfa1920f6351524501fa4edf6acb13db77a4ca1c9503fcaa33b\",\n \"stream_name\": \"tmpsg2mhmr_\",\n \"streaming_url\": \"http://localhost:5280/stream/d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"suggested_file_name\": \"tmpsg2mhmr_\",\n \"timestamp\": 1578100370,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1580787018,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpf0g7xmd6\",\n \"download_path\": \"/tmp/tmpf0g7xmd6/tmp2mvj0998_1\",\n \"file_name\": \"tmp2mvj0998_1\",\n \"height\": 214,\n \"key\": \"159a191d5364218290065f82af17512a\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01775c3833ba18f331d0371846632d74119176e078aeb47d02b808dcb36d6bbeba1438b303c03e746500d126fd08f92ec6a26509e6f218d2d600300debf6077650fe23f1a9c92afd1ed7c4abb81ac37a0ea6a4e0d20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"a44f91e5b3806ab20a7e0b3dbe5a431d0cbd6f7579b2ed5c7f9818fe5ecb34d8885d6bc461348de3a0cea293628721f1\",\n \"stream_name\": \"tmp2mvj0998\",\n \"streaming_url\": \"http://localhost:5280/stream/425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"suggested_file_name\": \"tmp2mvj0998\",\n \"timestamp\": 1580787039,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -3053,7 +3077,7 @@
"curl": "curl -d'{\"method\": \"settings_get\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet settings get",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"settings_get\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/oleg/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpykj53y2t\",\n \"download_dir\": \"/tmp/tmpykj53y2t\",\n \"download_timeout\": 30.0,\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmpykj53y2t\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"audio_encoder\": \"aac -b:a 192k\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpf0g7xmd6\",\n \"download_dir\": \"/tmp/tmpf0g7xmd6\",\n \"download_timeout\": 30.0,\n \"ffmpeg_folder\": \"\",\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"prometheus_port\": 0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"video_encoder\": \"libx264 -crf 18 -vf \\\"format=yuv420p\\\"\",\n \"volume_analysis_time\": \"240\",\n \"volume_filter\": \"-af loudnorm\",\n \"wallet_dir\": \"/tmp/tmpf0g7xmd6\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
}
]
},
@@ -3128,10 +3152,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon f95ede15cbeff2da7e4a481c538501c36343077c",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010fe58e3e251177a38c4fd8348d4124a515a013f76cbce0c229e35a1132350ba5000000006a47304402203074166d29b98dc529c8a1d1508e75016c50ba20d5025cc88fa3623ca7c021ab02207780bf6259b3a0cd849d9c0b81e2ccd33ff71a95c4039c26a3287fc4f9cce81c012103f2e2ccaf961844ec796b540daf5d42cff1d04a97d4056fa93dcc26c97ec7c2c0ffffffff0134b7f505000000001976a914c8ea871b5657f6189cb8749701cb9b36f8c03e4288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"myqJPhEuj6btmLkrdqezi23koaE1s9hsjE\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"4eae8324fa33aac4d8737a08848db7cf00412ef74a8c9e72a455402c6fc8b513\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"4eae8324fa33aac4d8737a08848db7cf00412ef74a8c9e72a455402c6fc8b513\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon ca642adaf52552f0bfc746c2ebae77724d123aeb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000124fbe60deb75dc0bb3612fa870e07330706a03e8ef89144f6b183cf2de303a34000000006a47304402204a2c679e653b096f5a8387251f751b74228bae7a70849c6be09fb5b5dc67af5c02205ca7604ebf3dbafae917015eb1e437810a76b36f930e71370b15596e56aeea60012102663f1832b7906bdce2af55d6950114be6d7e4bc3fae658caa6b5f7b8dbbdf47bffffffff0134b7f505000000001976a914991d30b9508a7cd112148485c7e06f11f76ed32288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"muUYeaoUkFAazwbpkdnE3ng5QgVTgnBQdt\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f96b71572ed7a8fdcfa80aba4ef639cb0b31082ad89ac041edf1e0831334e1eb\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"f96b71572ed7a8fdcfa80aba4ef639cb0b31082ad89ac041edf1e0831334e1eb\"\n }\n}"
}
]
},
@@ -3171,6 +3195,18 @@
"description": "path to file to be associated with name.",
"is_required": true
},
{
"name": "validate_file",
"type": "bool",
"description": "validate that the video container and encodings match common web browser support or that optimization succeeds if specified. FFmpeg is required",
"is_required": false
},
{
"name": "optimize_file",
"type": "bool",
"description": "transcode the video & audio if necessary to ensure common web browser support. FFmpeg is required",
"is_required": false
},
{
"name": "allow_duplicate_name",
"type": "bool",
@@ -3332,17 +3368,17 @@
"examples": [
{
"title": "Create a stream claim without metadata",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsg2mhmr_\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpsg2mhmr_",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsg2mhmr_\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e1c3a10f44df49aede90a021d0c9ec6d495bcb1cd35fc3d4d383a4790539c727010000006a4730440220524487b323b690518e0486ddc3ab3c410f36923f6685765976faedeb52cb9f5702204ff3d6bd490007c890497e9ce8cd470ca273914b3095fc1f97e671f0d92bd66201210395301134db56244412f5d36c0d5277eaa3f7db80b5a2460f999de187f9e46f45ffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea51856d7576a914ba69e8b2c9aa40bdff8fc5890344f4fff6c7028588ac38fb9423000000001976a914ee3ed40a870a4cfcab28e9b0d3a2a42b135b3d5a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mfzyu3xmuyEGe5JrdzJDzA2WTbmzKX4NhH\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100369,\n \"txid\": \"27c7390579a483d3d4c35fd31ccb5b496decc9d021a090deae49df440fa1c3e1\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"timestamp\": null,\n \"txid\": \"e17fdc5ca2418fced58b9d34c8688c99dcc3e1dd33412a84268889b884f5d523\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3EgP6VSRrfksucGhy8DES7q9nzVNqt3zu\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"e17fdc5ca2418fced58b9d34c8688c99dcc3e1dd33412a84268889b884f5d523\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"e17fdc5ca2418fced58b9d34c8688c99dcc3e1dd33412a84268889b884f5d523\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp2mvj0998\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmp2mvj0998",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp2mvj0998\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010e0a7f2b61a7a06502fe601413fe7e3c6698ce3bec4eed290d27d08a2a61b699010000006b483045022100bca41fd4c2fbe78a471862a0cbcada72dec85928c003096b89711262a6afa904022046091f619cbc19cb466d217f9664fb2fea6894a84791bc816e0cdae14390395b01210302992bba48b71d309cebbfa183094de20158f078d0d32b4fd794ec2a00cade1effffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f6d7576a914cfd4d42838e26f3ecaea287f6361f360dcb4288788ac38fb9423000000001976a914ddf9fe5f71d19f344f2d0c54a0f5d85206fd9ad888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkJZLpiG2hujADdJsYUS8JYydVn8kobGu2\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787038,\n \"txid\": \"99b6612a8ad0270d29ed4eec3bce98663c7efe131460fe0265a0a7612b7f0a0e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"timestamp\": null,\n \"txid\": \"95d266ac57b044eeb974d4a395395fd988e76d6a4237acb3e0f64c9fee306775\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1kf7K1vAFwRL8xfCUgJFoyc68jrX5Mq4a\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"95d266ac57b044eeb974d4a395395fd988e76d6a4237acb3e0f64c9fee306775\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"95d266ac57b044eeb974d4a395395fd988e76d6a4237acb3e0f64c9fee306775\"\n }\n}"
},
{
"title": "Create an image stream claim with all metadata and fee",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpouzs2ayp.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1578100345, \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpouzs2ayp.png --tags=blank --tags=art --languages=en --locations=US:NH:Manchester --fee_currency=LBC --fee_amount=0.3 --title=\"Blank Image\" --description=\"A blank PNG that is 5x7.\" --author=Picaso --license=\"Public Domain\" --license_url=http://public-domain.org --thumbnail_url=\"http://smallmedia.com/thumbnail.jpg\" --release_time=1578100345 --channel_id=\"34c8b9ae168ede542fbf6c06be1e417ba5f49778\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpouzs2ayp.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1578100345, \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000123d5f584b8898826842a4133dde1c3dc998c68c8349d8bd5ce8f41a25cdc7fe1010000006a473044022012dafd1dec1614e6952f9c76856dada3b0e6297f9f685e6e553f000bc76d6ce902202694ac7ad4aefb336e977beda4fceba693834b687c90d5bc7fb3c9002b2482d3012102480ca93f8eedad5b32e533220b047828b8bacbf22698e783a4f9869817b5a1b3ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101017897f4a57b411ebe066cbf2f54de8e16aeb9c834ab253012b48d909ffedaaedc15bd1803adaaa38595d1a0b6146f1be6c03cd1775befdc00cdfe79240a54441bf0c25be69276062d2996ca0467d8ddf0720c04d20ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d706f757a73326179702e706e6718632209696d6167652f706e673230b610beb101c564ba97da7da38a8fc2dad6e5c9f05534740f9bdfff11a5d59a5e5b081d052e5930ac7d7a78c9ec64fc2b120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728f9ccbff0053222080112196fa711bd739a0b2d2706f69cf3fcaed58867580adea7190699188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914a711bd739a0b2d2706f69cf3fcaed58867580ade88acac5e7d1d000000001976a91489953b798ec28c4334b1d8dc2132762ec19afbfa88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3EgP6VSRrfksucGhy8DES7q9nzVNqt3zu\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100370,\n \"txid\": \"e17fdc5ca2418fced58b9d34c8688c99dcc3e1dd33412a84268889b884f5d523\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvkLPgxEeqM1iP5o69JVj4Tm6NpdYjhCZE\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2dfb4a9dc1557c5cc89d3447904cc3b493be911e\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"blank-image\",\n \"normalized_name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#2dfb4a9dc1557c5cc89d3447904cc3b493be911e\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"a88779842f46e42daee5fd850456b73107b4711e2628b2fd91c8215c65fc6192\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvkLPgxEeqM1iP5o69JVj4Tm6NpdYjhCZE\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1578100345\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpouzs2ayp.png\",\n \"sd_hash\": \"b610beb101c564ba97da7da38a8fc2dad6e5c9f05534740f9bdfff11a5d59a5e5b081d052e5930ac7d7a78c9ec64fc2b\",\n \"size\": \"99\"\n },\n \"streaLine truncated
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpw_1zp_we.png\", \"validate_file\": false, \"optimize_file\": false, \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1580787013, \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpw_1zp_we.png --tags=blank --tags=art --languages=en --locations=US:NH:Manchester --fee_currency=LBC --fee_amount=0.3 --title=\"Blank Image\" --description=\"A blank PNG that is 5x7.\" --author=Picaso --license=\"Public Domain\" --license_url=http://public-domain.org --thumbnail_url=\"http://smallmedia.com/thumbnail.jpg\" --release_time=1580787013 --channel_id=\"78e0769111742d63461837d031f318ba33385c77\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpw_1zp_we.png\", \"validate_file\": false, \"optimize_file\": false, \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1580787013, \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001756730ee9f4cf6e0b3ac37426a6de788d95f3995a3d474b9ee44b057ac66d295010000006b483045022100cf9ef3f2bdbdc84282ad8655c45bd744c56e235cbce75bb391c999f1e8c942d1022073b534e9e0f98a315d3b2b56c5f3c588427dd46cbea769e47a1ca074a60f1b09012102bce50c23209e12358222c1e0b2a4f0ebb1a52958ffa6bc8f1efcba6cd73c10abffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101775c3833ba18f331d0371846632d74119176e0788971c8a96b0c86b464771c4d2cfdbe1041beaec22d10e1caf5caffe66cdb1ec0d9b244a0ba024bd9318a4f4dac3d95ee4cd5eaaa9ade4d3ed43adda5525bad060ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d70775f317a705f77652e706e6718632209696d6167652f706e6732309872b781dffda958c58a2cd59bf744a01bab989e6a451f31b979e2f5eee87ec27e739e409da4f0760d5fc3e4c15df7e6120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728c5cae3f1053222080112196f2cb51096ada6af68d92aa5e9256f76a95cd0f761d22acf6a188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a9142cb51096ada6af68d92aa5e9256f76a95cd0f76188acac5e7d1d000000001976a914ba12a78dd8482240f8a74dc3d3d9b0cec11cc50d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1kf7K1vAFwRL8xfCUgJFoyc68jrX5Mq4a\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787039,\n \"txid\": \"95d266ac57b044eeb974d4a395395fd988e76d6a4237acb3e0f64c9fee306775\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjbLw6bmUb6DwU1UJyvMnzWkVEaAefzByj\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3afacf53358a8234b23ff60e51231b3a62b28165\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"blank-image\",\n \"normalized_name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#3afacf53358a8234b23ff60e51231b3a62b28165\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"d27f052d5a4cf8a4d0c19aeb36cd1331bb3b9eacee2b941c5bd3a1cb4cb0c25b\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mjbLw6bmUb6DwU1UJyvMnzWkVEaAefzByj\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1580787013\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpw_1zp_we.png\",\n \"sd_hash\": \"9872b781dffda958c58a2cd59bf744a01bab989e6a451f31b979e2f5eee87ec27e739e409da4f0760d5fc3e4c15df7e6\",\n \"size\": \"99\"\n },\n \"strLine truncated
}
]
},
@@ -3373,23 +3409,29 @@
"type": "int",
"description": "number of items on page during pagination",
"is_required": false
},
{
"name": "resolve",
"type": "bool",
"description": "resolves each stream to provide additional metadata",
"is_required": false
}
],
"returns": " {\n \"page\": \"Page number of the current items.\",\n \"page_size\": \"Number of items to show on a page.\",\n \"total_pages\": \"Total number of pages.\",\n \"total_items\": \"Total number of items.\",\n \"items\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'purchase'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim', 'support' or 'purchase', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"claim\": \"for purchase outputs only, metadata of purchased claim\",\n \"reposted_claim\": \"for repost claims only, metadata of claim being reposted\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\",\n \"purchase_receipt\": \"metadata for the purchase transaction associated with this claim\"\n }\n ]\n }",
"examples": [
{
"title": "List all your stream claims",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
},
{
"title": "Paginate your stream claims",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1578100370,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20, \"resolve\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1580787039,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -3710,10 +3752,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update f95ede15cbeff2da7e4a481c538501c36343077c --channel_id=\"34c8b9ae168ede542fbf6c06be1e417ba5f49778\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000223d5f584b8898826842a4133dde1c3dc998c68c8349d8bd5ce8f41a25cdc7fe1000000006a47304402206c2a1d14de758134ec21c1ebac7f09c6f550732195d64aa933ebef69aa8a154002207e2a7a16397cd775dec508dfee1c96fe168d4369ce19cc56631807bb4659bb30012103f2e2ccaf961844ec796b540daf5d42cff1d04a97d4056fa93dcc26c97ec7c2c0ffffffffbd74e2b036ee0cb1e41f96ec41cf442ceadae387cd1071befa9750087689dd1c010000006b483045022100f198c09c8fa0302328bfbb8a4eb9fa8e82471d5808c843ea3af46e2e157463a502207b9ff778f705aa250d79a95320ca6c9d8dc71af3c293abf7d6004a8ecc38994101210227da4d9f87093bc831863496f30e690544e3ecf51b174783d6a623bdf6906e04ffffffff0200e1f50500000000fd2301b7076173747265616d147c074363c30185531c484a7edaf2efcb15de5ef94ce8017897f4a57b411ebe066cbf2f54de8e16aeb9c834feb406b1b0991fcbfff25ad85805dbf02124246436d8012302edcdf004a4479aec646070e3c9909aa22f08a482d54f00cb245398f838f4c36941981d0698e2a20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707367326d686d725f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea51856d6d76a914ba69e8b2c9aa40bdff8fc5890344f4fff6c7028588ac32a0d205000000001976a914f22c67628f4fbf6b6f137e60e7ff41de630e422c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"timestamp\": 1578100370,\n \"txid\": \"e17fdc5ca2418fced58b9d34c8688c99dcc3e1dd33412a84268889b884f5d523\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpsg2mhmr_\",\n \"sd_hash\": \"d5d9055437076e3fc8b5f3a2aa724ec45e1c70fdd4f169839e0d44b8345e6968b8dda9ac4740fc6a0ea01c6cc5ea5185\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mxYNzLoWYLHRSTNpaM1JKoGgAvr3X96aMf\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1578100369,\n \"txid\": \"1cdd8976085097fabe7110cd87e3daea2c44cf41ec961fe4b10cee36b0e274bd\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxWcrRGimXXR7VmSAhgzGkWfENPu5PE4Sv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#f95ede15cbeff2da7e4a481c538501c36343077c\",\n \"signing_channel\": {\n \"address\": \"mgegsgW4K5Za5hALM3us2wcKtPiSvZuNoW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#34c8b9ae168ede542fbf6c06be1e417ba5f49778\",\n \"timestamp\": 1578100369,\n \"txid\": \"2dec1041a506773a5fb4e81589ef2f7243cc227c970b24fcd062b2745207dd60\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200042a0e709a4a4becca5e9d95972e931d5046eea76fec6db02616521b4ac48626b14ed5cd2175fcb8a428553ccb4e31c320539c02499f25c465bcf4af324bfbdb4b\",\n \"public_key_id\": \"mhW32CGgi122kZTBp4XnkTFZSTYwFP4bva\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"a50b3532115ae329c2e0bc6cf713a015a524418d34d84f8ca37711253e8ee50f\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n Line truncated
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update ca642adaf52552f0bfc746c2ebae77724d123aeb --channel_id=\"78e0769111742d63461837d031f318ba33385c77\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"78e0769111742d63461837d031f318ba33385c77\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002756730ee9f4cf6e0b3ac37426a6de788d95f3995a3d474b9ee44b057ac66d295000000006a473044022017c35e499a06449082d37319300a3ab123d65dfe443ea88471de8b55b899a0ca02204f105a09bee5afd441f7428dc8ec698962ff29d6adc3787e0bb675b23e0e78d4012102663f1832b7906bdce2af55d6950114be6d7e4bc3fae658caa6b5f7b8dbbdf47bffffffffe89ff3143a4eef48aec22c903584af10a706008c73b8175a5cc6b35073de134d010000006b483045022100d84db641a86c6e3d6da6c3a0120a805cdb6e8b6648f6b81fa88aa0fcc48e1d7e0220533ab4b67510263f6732d2be5791fb5fa2747c6d1c08ac4707aefc732b698b7301210265859227aa59bab66198913f4f8486cd39381ca8809f03591e6bd711367c67b7ffffffff0200e1f50500000000fd2301b7076173747265616d14eb3a124d7277aeebc246c7bff05225f5da2a64ca4ce801775c3833ba18f331d0371846632d74119176e078aeb47d02b808dcb36d6bbeba1438b303c03e746500d126fd08f92ec6a26509e6f218d2d600300debf6077650fe23f1a9c92afd1ed7c4abb81ac37a0ea6a4e0d20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70326d766a30393938180b22186170706c69636174696f6e2f6f637465742d73747265616d3230425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f6d6d76a914cfd4d42838e26f3ecaea287f6361f360dcb4288788ac32a0d205000000001976a914df1c174e484b9f4470019bf89261d761d4bd83fd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"timestamp\": 1580787039,\n \"txid\": \"95d266ac57b044eeb974d4a395395fd988e76d6a4237acb3e0f64c9fee306775\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp2mvj0998\",\n \"sd_hash\": \"425d8f86f518cb36d0eb8532779ebb3dc23cce40f5f32ca4d961f1a861169ffae5b3b21a4b023dc38359321c74e5952f\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mjFjqQMMroPbKTLQ2KzTY9UFHsyZLXJnYa\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1580787038,\n \"txid\": \"4d13de7350b3c65c5a17b8738c0006a710af8435902cc2ae48ef4e3a14f39fe8\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzTs8N19cDptAh1AbEW3wuKEXJBcJugRAd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ca642adaf52552f0bfc746c2ebae77724d123aeb\",\n \"signing_channel\": {\n \"address\": \"mnjKmFxZTu7DBwXpLQvyVQwUCXnofLDesW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"78e0769111742d63461837d031f318ba33385c77\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#78e0769111742d63461837d031f318ba33385c77\",\n \"timestamp\": 1580787038,\n \"txid\": \"2cc2d053b32d3723e98ed3b5277fa2263dc3fe31ef0f5ac5db184b0695ea5223\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c081899169bff6634f20e59e90318a963bb6760e9cc21ed980ac41593e277b54d04386c2720acef997a431e5c0fc3551d40f36e79f29a2109a23a50f432e0e17\",\n \"public_key_id\": \"mrMajaekWv14aDoSWK2Jg7euMjYey5peju\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"343a30def23c186b4f1489efe8036a703073e070a82f61b30bdc75eb0de6fb24\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n Line truncated
}
]
}
@@ -3958,7 +4000,7 @@
"curl": "curl -d'{\"method\": \"transaction_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet transaction list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"transaction_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2020-01-03 20:12\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1578100369,\n \"txid\": \"fab51b399e427816b9a9eb806aef897783af8e7016e1b00e4538202c49b56f1a\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2020-01-03 20:12\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1578100368,\n \"txid\": \"2c8b000adc8b7e72b9dab63afca40935cb05683f71ed0cfaffd1ed71fd1fe8fa\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2020-02-03 22:30\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1580787038,\n \"txid\": \"a3f54afafec58eb54a84ffe185a8ce35423f9143fd8a2bdb7aec488c75566dbf\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2020-02-03 22:30\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1580787037,\n \"txid\": \"86d1b7fc915ce33774159d4c42c7c7212d6745a9b57051fca738d5fb4e8526f6\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = "0.52.0"
__version__ = "0.58.0"
version = tuple(map(int, __version__.split('.'))) # pylint: disable=invalid-name
+1 -1
View File
@@ -167,7 +167,7 @@ class AbstractBlob:
with self.reader_context() as handle:
try:
return await self.loop.sendfile(writer.transport, handle, count=self.get_length())
except (ConnectionResetError, BrokenPipeError, RuntimeError, OSError, AttributeError):
except (ConnectionError, BrokenPipeError, RuntimeError, OSError, AttributeError):
return -1
def decrypt(self, key: bytes, iv: bytes) -> bytes:
+5 -2
View File
@@ -105,18 +105,21 @@ class BlobServerProtocol(asyncio.Protocol):
self.blob_manager.connection_manager.sent_data(self.peer_address_and_port, sent)
log.info("sent %s (%i bytes) to %s:%i", blob_hash, sent, peer_address, peer_port)
else:
self.close()
log.debug("stopped sending %s to %s:%i", blob_hash, peer_address, peer_port)
except (OSError, asyncio.TimeoutError) as err:
return
except (OSError, ValueError, asyncio.TimeoutError) as err:
if isinstance(err, asyncio.TimeoutError):
log.debug("timed out sending blob %s to %s", blob_hash, peer_address)
else:
log.warning("could not read blob %s to send %s:%i", blob_hash, peer_address, peer_port)
self.close()
return
finally:
self.transfer_finished.set()
else:
log.info("don't have %s to send %s:%i", blob.blob_hash[:8], peer_address, peer_port)
if responses:
if responses and not self.transport.is_closing():
self.send_response(responses)
def data_received(self, data):
+2 -1
View File
@@ -1,3 +1,4 @@
# don't touch this. CI server changes this during build/deployment
BUILD = "dev"
BUILD_COMMIT = "source installation"
COMMIT_HASH = "none"
DOCKER_TAG = "none"
+15 -1
View File
@@ -462,7 +462,20 @@ class BaseConfig:
self.persisted.save()
class CLIConfig(BaseConfig):
class TranscodeConfig(BaseConfig):
ffmpeg_folder = String('The path to ffmpeg and ffprobe', '')
video_encoder = String('FFmpeg codec and parameters for the video encoding. '
'Example: libaom-av1 -crf 25 -b:v 0 -strict experimental',
'libx264 -crf 18 -vf "format=yuv420p"')
audio_encoder = String('FFmpeg codec and parameters for the audio encoding. '
'Example: libopus -b:a 128k',
'aac -b:a 192k')
volume_filter = String('FFmpeg filter for audio normalization.', '-af loudnorm')
volume_analysis_time = Integer('Maximum seconds into the file that we examine audio volume (0 to disable).', '240')
class CLIConfig(TranscodeConfig):
api = String('Host name and port for lbrynet daemon API.', 'localhost:5279', metavar='HOST:PORT')
@@ -502,6 +515,7 @@ class Config(CLIConfig):
)
udp_port = Integer("UDP port for communicating on the LBRY DHT", 4444, previous_names=['dht_node_port'])
tcp_port = Integer("TCP port to listen for incoming blob requests", 3333, previous_names=['peer_port'])
prometheus_port = Integer("Port to expose prometheus metrics (off by default)", 0)
network_interface = String("Interface to use for the DHT and blob exchange", '0.0.0.0')
# routing table
+2
View File
@@ -33,6 +33,8 @@ def aes_decrypt(secret: str, value: str) -> typing.Tuple[str, bytes]:
unpadder = PKCS7(AES.block_size).unpadder()
result = unpadder.update(decryptor.update(data)) + unpadder.finalize()
return result.decode(), init_vector
except UnicodeDecodeError:
raise InvalidPasswordError()
except ValueError as e:
if e.args[0] == 'Invalid padding bytes.':
raise InvalidPasswordError()
+6 -4
View File
@@ -51,10 +51,12 @@ Code | Name | Message
405 | ChannelKeyNotFound | Channel signing key not found.
406 | ChannelKeyInvalid | Channel signing key is out of date. -- For example, channel was updated but you don't have the updated key.
407 | DataDownload | Failed to download blob. *generic*
408 | Resolve | Failed to resolve '{url}'.
409 | ResolveTimeout | Failed to resolve '{url}' within the timeout.
410 | KeyFeeAboveMaxAllowed | {message}
411 | InvalidPassword | Password is invalid.
410 | Resolve | Failed to resolve '{url}'.
411 | ResolveTimeout | Failed to resolve '{url}' within the timeout.
411 | ResolveCensored | Resolve of '{url}' was censored by channel with claim id '{censor_id}'.
420 | KeyFeeAboveMaxAllowed | {message}
421 | InvalidPassword | Password is invalid.
422 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
**5xx** | Blob | **Blobs**
500 | BlobNotFound | Blob not found.
501 | BlobPermissionDenied | Permission denied to read blob.
+12
View File
@@ -197,6 +197,12 @@ class ResolveTimeoutError(WalletError):
super().__init__(f"Failed to resolve '{url}' within the timeout.")
class ResolveCensoredError(WalletError):
def __init__(self, url, censor_id):
super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{censor_id}'.")
class KeyFeeAboveMaxAllowedError(WalletError):
def __init__(self, message):
@@ -209,6 +215,12 @@ class InvalidPasswordError(WalletError):
super().__init__("Password is invalid.")
class IncompatibleWalletServerError(WalletError):
def __init__(self, server, port):
super().__init__(f"'{server}:{port}' has an incompatibly old version.")
class BlobError(BaseError):
"""
**Blobs**
+1 -1
View File
@@ -50,7 +50,7 @@ class ErrorClass:
def get_arguments(self):
args = ['self']
for arg in re.findall('{([a-z0-1]+)}', self.message):
for arg in re.findall('{([a-z0-1_]+)}', self.message):
args.append(arg)
return args
+4
View File
@@ -3,6 +3,7 @@ import sys
import shutil
import signal
import pathlib
import platform
import json
import asyncio
import argparse
@@ -262,6 +263,9 @@ def setup_logging(logger: logging.Logger, args: argparse.Namespace, conf: Config
def run_daemon(args: argparse.Namespace, conf: Config):
if sys.version_info < (3, 8) and platform.system() == "Windows":
# TODO: remove after we move to requiring Python 3.8
asyncio.set_event_loop(asyncio.ProactorEventLoop())
loop = asyncio.get_event_loop()
if args.verbose is not None:
loop.set_debug(True)
+4 -2
View File
@@ -475,8 +475,10 @@ class UPnPComponent(Component):
if self.external_ip:
log.info("detected external ip using lbry.com fallback")
if self.component_manager.analytics_manager:
await self.component_manager.analytics_manager.send_upnp_setup_success_fail(
success, await self.get_status()
self.component_manager.loop.create_task(
self.component_manager.analytics_manager.send_upnp_setup_success_fail(
success, await self.get_status()
)
)
self._maintain_redirects_task = self.component_manager.loop.create_task(
self._repeatedly_maintain_redirects(now=False)
+89 -36
View File
@@ -17,6 +17,7 @@ from functools import wraps, partial
import ecdsa
import base58
from aiohttp import web
from prometheus_client import generate_latest as prom_generate_latest
from google.protobuf.message import DecodeError
from lbry.wallet import (
Wallet, ENCRYPT_ON_DISK, SingleKey, HierarchicalDeterministic,
@@ -43,6 +44,7 @@ from lbry.extras.daemon.componentmanager import ComponentManager
from lbry.extras.daemon.json_response_encoder import JSONResponseEncoder
from lbry.extras.daemon import comment_client
from lbry.extras.daemon.undecorated import undecorated
from lbry.file_analysis import VideoFileAnalyzer
from lbry.schema.claim import Claim
from lbry.schema.url import URL
@@ -295,6 +297,7 @@ class Daemon(metaclass=JSONRPCServerType):
def __init__(self, conf: Config, component_manager: typing.Optional[ComponentManager] = None):
self.conf = conf
self._video_file_analyzer = VideoFileAnalyzer(conf)
self._node_id = None
self._installation_id = None
self.session_id = base58.b58encode(utils.generate_id()).decode()
@@ -319,6 +322,10 @@ class Daemon(metaclass=JSONRPCServerType):
streaming_app.router.add_get('/stream/{sd_hash}', self.handle_stream_range_request)
self.streaming_runner = web.AppRunner(streaming_app)
prom_app = web.Application()
prom_app.router.add_get('/metrics', self.handle_metrics_get_request)
self.metrics_runner = web.AppRunner(prom_app)
@property
def dht_node(self) -> typing.Optional['Node']:
return self.component_manager.get_component(DHT_COMPONENT)
@@ -446,6 +453,7 @@ class Daemon(metaclass=JSONRPCServerType):
await self.analytics_manager.send_server_startup()
await self.rpc_runner.setup()
await self.streaming_runner.setup()
await self.metrics_runner.setup()
try:
rpc_site = web.TCPSite(self.rpc_runner, self.conf.api_host, self.conf.api_port, shutdown_timeout=.5)
@@ -467,6 +475,16 @@ class Daemon(metaclass=JSONRPCServerType):
await self.analytics_manager.send_server_startup_error(str(e))
raise SystemExit()
if self.conf.prometheus_port:
try:
prom_site = web.TCPSite(self.metrics_runner, "0.0.0.0", self.conf.prometheus_port, shutdown_timeout=.5)
await prom_site.start()
log.info('metrics server listening on TCP %s:%i', *prom_site._server.sockets[0].getsockname()[:2])
except OSError as e:
log.error('metrics server failed to bind TCP :%i', self.conf.prometheus_port)
await self.analytics_manager.send_server_startup_error(str(e))
raise SystemExit()
try:
await self.initialize()
except asyncio.CancelledError:
@@ -498,6 +516,7 @@ class Daemon(metaclass=JSONRPCServerType):
log.info("stopped api components")
await self.rpc_runner.cleanup()
await self.streaming_runner.cleanup()
await self.metrics_runner.cleanup()
log.info("stopped api server")
if self.analytics_manager.is_started:
self.analytics_manager.stop()
@@ -527,6 +546,16 @@ class Daemon(metaclass=JSONRPCServerType):
content_type='application/json'
)
async def handle_metrics_get_request(self, request: web.Request):
try:
return web.Response(
text=prom_generate_latest().decode(),
content_type='text/plain; version=0.0.4'
)
except Exception:
log.exception('could not generate prometheus data')
raise
async def handle_stream_get_request(self, request: web.Request):
if not self.conf.streaming_get:
log.warning("streaming_get is disabled, rejecting request")
@@ -595,7 +624,7 @@ class Daemon(metaclass=JSONRPCServerType):
# TODO: this is for backwards compatibility. Remove this once API and UI are updated
# TODO: also delete EMPTY_PARAMS then
_args, _kwargs = (), args[0]
elif isinstance(args, list) and len(args) == 2 and\
elif isinstance(args, list) and len(args) == 2 and \
isinstance(args[0], list) and isinstance(args[1], dict):
_args, _kwargs = args
else:
@@ -824,6 +853,7 @@ class Daemon(metaclass=JSONRPCServerType):
"""
connection_code = await self.get_connection_status()
ffmpeg_status = await self._video_file_analyzer.status()
response = {
'installation_id': self.installation_id,
@@ -834,6 +864,7 @@ class Daemon(metaclass=JSONRPCServerType):
'code': connection_code,
'message': CONNECTION_MESSAGES[connection_code],
},
'ffmpeg_status': ffmpeg_status
}
for component in self.component_manager.components:
status = await component.get_status()
@@ -1371,7 +1402,7 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.ledger.broadcast(tx)
await self.analytics_manager.send_credits_sent()
self.component_manager.loop.create_task(self.analytics_manager.send_credits_sent())
else:
await self.ledger.release_tx(tx)
@@ -2117,7 +2148,8 @@ class Daemon(metaclass=JSONRPCServerType):
"""
@requires(WALLET_COMPONENT)
def jsonrpc_claim_list(self, claim_type=None, account_id=None, wallet_id=None, page=None, page_size=None):
def jsonrpc_claim_list(
self, claim_type=None, account_id=None, wallet_id=None, page=None, page_size=None, resolve=False):
"""
List my stream and channel claims.
@@ -2125,6 +2157,7 @@ class Daemon(metaclass=JSONRPCServerType):
claim_list [--claim_type=<claim_type>]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--page=<page>] [--page_size=<page_size>]
[--resolve]
Options:
--claim_type=<claim_type> : (str) claim type: channel, stream, repost, collection
@@ -2132,6 +2165,7 @@ class Daemon(metaclass=JSONRPCServerType):
--wallet_id=<wallet_id> : (str) restrict results to specific wallet
--page=<page> : (int) page to return during paginating
--page_size=<page_size> : (int) number of items on page during pagination
--resolve : (bool) resolves each claim to provide additional metadata
Returns: {Paginated[Output]}
"""
@@ -2143,7 +2177,7 @@ class Daemon(metaclass=JSONRPCServerType):
else:
claims = partial(self.ledger.get_claims, wallet=wallet, accounts=wallet.accounts)
claim_count = partial(self.ledger.get_claim_count, wallet=wallet, accounts=wallet.accounts)
return paginate_rows(claims, claim_count, page, page_size, claim_type=claim_type)
return paginate_rows(claims, claim_count, page, page_size, claim_type=claim_type, resolve=resolve)
@requires(WALLET_COMPONENT)
async def jsonrpc_claim_search(self, **kwargs):
@@ -2159,7 +2193,6 @@ class Daemon(metaclass=JSONRPCServerType):
[--claim_id=<claim_id> | --claim_ids=<claim_ids>...]
[--channel=<channel> |
[[--channel_ids=<channel_ids>...] [--not_channel_ids=<not_channel_ids>...]]]
[--blocklist_channel_ids=<blocklist_channel_ids>...]
[--has_channel_signature] [--valid_channel_signature | --invalid_channel_signature]
[--is_controlling] [--release_time=<release_time>] [--public_key_id=<public_key_id>]
[--timestamp=<timestamp>] [--creation_timestamp=<creation_timestamp>]
@@ -2172,6 +2205,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--reposted_claim_id=<reposted_claim_id>] [--reposted=<reposted>]
[--claim_type=<claim_type>] [--stream_types=<stream_types>...] [--media_types=<media_types>...]
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>]
[--duration=<duration>]
[--any_tags=<any_tags>...] [--all_tags=<all_tags>...] [--not_tags=<not_tags>...]
[--any_languages=<any_languages>...] [--all_languages=<all_languages>...]
[--not_languages=<not_languages>...]
@@ -2200,9 +2234,6 @@ class Daemon(metaclass=JSONRPCServerType):
use in conjunction with --valid_channel_signature
--not_channel_ids=<not_channel_ids>: (list) exclude claims signed by any of these channels
(arguments must be claim ids of the channels)
--blocklist_channel_ids=<blocklist_channel_ids>: (list) channel_ids of channels containing
reposts of claims you want to be blocked from
search results
--has_channel_signature : (bool) claims with a channel signature (valid or invalid)
--valid_channel_signature : (bool) claims with a valid channel signature or no signature,
use in conjunction with --has_channel_signature to
@@ -2261,6 +2292,8 @@ class Daemon(metaclass=JSONRPCServerType):
--media_types=<media_types> : (list) filter by 'video/mp4', 'image/png', etc
--fee_currency=<fee_currency> : (string) specify fee currency: LBC, BTC, USD
--fee_amount=<fee_amount> : (decimal) content download fee (supports equality constraints)
--duration=<duration> : (int) duration of video or audio in seconds
(supports equality constraints)
--any_tags=<any_tags> : (list) find claims containing any of the tags
--all_tags=<all_tags> : (list) find claims containing every tag
--not_tags=<not_tags> : (list) find claims not containing any of these tags
@@ -2293,8 +2326,13 @@ class Daemon(metaclass=JSONRPCServerType):
kwargs['signature_valid'] = 0
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50)
kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size})
txos, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs)
result = {"items": txos, "page": page_num, "page_size": page_size}
txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs)
result = {
"items": txos,
"blocked": blocked,
"page": page_num,
"page_size": page_size
}
if not kwargs.pop('no_totals', False):
result['total_pages'] = int((total + (page_size - 1)) / page_size)
result['total_items'] = total
@@ -2420,7 +2458,7 @@ class Daemon(metaclass=JSONRPCServerType):
await self.storage.save_claims([self._old_get_temp_claim_info(
tx, txo, claim_address, claim, name, dewies_to_lbc(amount)
)])
await self.analytics_manager.send_new_channel()
self.component_manager.loop.create_task(self.analytics_manager.send_new_channel())
else:
await account.ledger.release_tx(tx)
@@ -2576,7 +2614,7 @@ class Daemon(metaclass=JSONRPCServerType):
await self.storage.save_claims([self._old_get_temp_claim_info(
tx, new_txo, claim_address, new_txo.claim, new_txo.claim_name, dewies_to_lbc(amount)
)])
await self.analytics_manager.send_new_channel()
self.component_manager.loop.create_task(self.analytics_manager.send_new_channel())
else:
await account.ledger.release_tx(tx)
@@ -2635,26 +2673,27 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('abandon')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('abandon'))
else:
await account.ledger.release_tx(tx)
return tx
@requires(WALLET_COMPONENT)
def jsonrpc_channel_list(self, account_id=None, wallet_id=None, page=None, page_size=None):
def jsonrpc_channel_list(self, account_id=None, wallet_id=None, page=None, page_size=None, resolve=False):
"""
List my channel claims.
Usage:
channel_list [<account_id> | --account_id=<account_id>] [--wallet_id=<wallet_id>]
[--page=<page>] [--page_size=<page_size>]
[--page=<page>] [--page_size=<page_size>] [--resolve]
Options:
--account_id=<account_id> : (str) id of the account to use
--wallet_id=<wallet_id> : (str) restrict results to specific wallet
--page=<page> : (int) page to return during paginating
--page_size=<page_size> : (int) number of items on page during pagination
--resolve : (bool) resolves each channel to provide additional metadata
Returns: {Paginated[Output]}
"""
@@ -2666,7 +2705,7 @@ class Daemon(metaclass=JSONRPCServerType):
else:
channels = partial(self.ledger.get_channels, wallet=wallet, accounts=wallet.accounts)
channel_count = partial(self.ledger.get_channel_count, wallet=wallet, accounts=wallet.accounts)
return paginate_rows(channels, channel_count, page, page_size)
return paginate_rows(channels, channel_count, page, page_size, resolve=resolve)
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_export(self, channel_id=None, channel_name=None, account_id=None, wallet_id=None):
@@ -2729,7 +2768,7 @@ class Daemon(metaclass=JSONRPCServerType):
# check that the holding_address hasn't changed since the export was made
holding_address = data['holding_address']
channels, _, _ = await self.ledger.claim_search(
channels, _, _, _ = await self.ledger.claim_search(
wallet.accounts, public_key_id=self.ledger.public_key_to_address(public_key_der)
)
if channels and channels[0].get_address(self.ledger) != holding_address:
@@ -2773,6 +2812,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
publish (<name> | --name=<name>) [--bid=<bid>] [--file_path=<file_path>]
[--validate_file] [--optimize_file]
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
[--title=<title>] [--description=<description>] [--author=<author>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
@@ -2788,6 +2828,11 @@ class Daemon(metaclass=JSONRPCServerType):
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
--bid=<bid> : (decimal) amount to back the claim
--file_path=<file_path> : (str) path to file to be associated with name.
--validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified.
FFmpeg is required
--optimize_file : (bool) transcode the video & audio if necessary to ensure
common web browser support. FFmpeg is required
--fee_currency=<fee_currency> : (string) specify fee currency
--fee_amount=<fee_amount> : (decimal) content download fee
--fee_address=<fee_address> : (str) address where to send fee payments, will use
@@ -2948,7 +2993,7 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('publish')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
else:
await account.ledger.release_tx(tx)
@@ -2959,12 +3004,13 @@ class Daemon(metaclass=JSONRPCServerType):
self, name, bid, file_path, allow_duplicate_name=False,
channel_id=None, channel_name=None, channel_account_id=None,
account_id=None, wallet_id=None, claim_address=None, funding_account_ids=None,
preview=False, blocking=False, **kwargs):
preview=False, blocking=False, validate_file=False, optimize_file=False, **kwargs):
"""
Make a new stream claim and announce the associated file to lbrynet.
Usage:
stream_create (<name> | --name=<name>) (<bid> | --bid=<bid>) (<file_path> | --file_path=<file_path>)
[--validate_file] [--optimize_file]
[--allow_duplicate_name=<allow_duplicate_name>]
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
[--title=<title>] [--description=<description>] [--author=<author>]
@@ -2981,6 +3027,11 @@ class Daemon(metaclass=JSONRPCServerType):
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
--bid=<bid> : (decimal) amount to back the claim
--file_path=<file_path> : (str) path to file to be associated with name.
--validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified.
FFmpeg is required
--optimize_file : (bool) transcode the video & audio if necessary to ensure
common web browser support. FFmpeg is required
--allow_duplicate_name=<allow_duplicate_name> : (bool) create new claim even if one already exists with
given name. default: false.
--fee_currency=<fee_currency> : (string) specify fee currency
@@ -3072,6 +3123,8 @@ class Daemon(metaclass=JSONRPCServerType):
f"Use --allow-duplicate-name flag to override."
)
file_path = await self._video_file_analyzer.verify_or_repair(validate_file, optimize_file, file_path)
claim = Claim()
claim.stream.update(file_path=file_path, sd_hash='0' * 96, **kwargs)
tx = await Transaction.claim_create(
@@ -3095,7 +3148,7 @@ class Daemon(metaclass=JSONRPCServerType):
tx, new_txo, claim_address, claim, name, dewies_to_lbc(amount)
)])
await self.storage.save_content_claim(file_stream.stream_hash, new_txo.id)
await self.analytics_manager.send_claim_action('publish')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
else:
await account.ledger.release_tx(tx)
@@ -3280,17 +3333,16 @@ class Daemon(metaclass=JSONRPCServerType):
stream_hash = None
if not preview:
old_stream_hash = await self.storage.get_stream_hash_for_sd_hash(old_txo.claim.stream.source.sd_hash)
old_stream = self.stream_manager.streams.get(old_txo.claim.stream.source.sd_hash, None)
if file_path is not None:
if old_stream_hash:
stream_to_delete = self.stream_manager.get_stream_by_stream_hash(old_stream_hash)
await self.stream_manager.delete_stream(stream_to_delete, delete_file=False)
if old_stream:
await self.stream_manager.delete_stream(old_stream, delete_file=False)
file_stream = await self.stream_manager.create_stream(file_path)
new_txo.claim.stream.source.sd_hash = file_stream.sd_hash
new_txo.script.generate()
stream_hash = file_stream.stream_hash
else:
stream_hash = old_stream_hash
elif old_stream:
stream_hash = old_stream.stream_hash
if channel:
new_txo.sign(channel)
@@ -3303,7 +3355,7 @@ class Daemon(metaclass=JSONRPCServerType):
)])
if stream_hash:
await self.storage.save_content_claim(stream_hash, new_txo.id)
await self.analytics_manager.send_claim_action('publish')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
else:
await account.ledger.release_tx(tx)
@@ -3362,26 +3414,27 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('abandon')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('abandon'))
else:
await self.ledger.release_tx(tx)
return tx
@requires(WALLET_COMPONENT)
def jsonrpc_stream_list(self, account_id=None, wallet_id=None, page=None, page_size=None):
def jsonrpc_stream_list(self, account_id=None, wallet_id=None, page=None, page_size=None, resolve=False):
"""
List my stream claims.
Usage:
stream_list [<account_id> | --account_id=<account_id>] [--wallet_id=<wallet_id>]
[--page=<page>] [--page_size=<page_size>]
[--page=<page>] [--page_size=<page_size>] [--resolve]
Options:
--account_id=<account_id> : (str) id of the account to query
--wallet_id=<wallet_id> : (str) restrict results to specific wallet
--page=<page> : (int) page to return during paginating
--page_size=<page_size> : (int) number of items on page during pagination
--resolve : (bool) resolves each stream to provide additional metadata
Returns: {Paginated[Output]}
"""
@@ -3393,7 +3446,7 @@ class Daemon(metaclass=JSONRPCServerType):
else:
streams = partial(self.ledger.get_streams, wallet=wallet, accounts=wallet.accounts)
stream_count = partial(self.ledger.get_stream_count, wallet=wallet, accounts=wallet.accounts)
return paginate_rows(streams, stream_count, page, page_size)
return paginate_rows(streams, stream_count, page, page_size, resolve=resolve)
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT,
DHT_COMPONENT, DATABASE_COMPONENT)
@@ -3526,7 +3579,7 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('publish')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
else:
await account.ledger.release_tx(tx)
@@ -3680,7 +3733,7 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('publish')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
else:
await account.ledger.release_tx(tx)
@@ -3832,7 +3885,7 @@ class Daemon(metaclass=JSONRPCServerType):
'claim_id': claim_id,
'amount': dewies_to_lbc(amount)
}]})
await self.analytics_manager.send_claim_action('new_support')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('new_support'))
else:
await self.ledger.release_tx(tx)
@@ -3932,7 +3985,7 @@ class Daemon(metaclass=JSONRPCServerType):
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('abandon')
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('abandon'))
else:
await self.ledger.release_tx(tx)
@@ -4336,7 +4389,7 @@ class Daemon(metaclass=JSONRPCServerType):
else:
server, port = random.choice(self.conf.reflector_servers)
reflected = await asyncio.gather(*[
stream.upload_to_reflector(server, port)
self.stream_manager.reflect_stream(stream, server, port)
for stream in self.stream_manager.get_filtered_streams(**kwargs)
])
total = []
+26 -23
View File
@@ -136,18 +136,13 @@ def _get_lbry_file_stream_dict(rowid, added_on, stream_hash, file_name, download
def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Dict]:
files = []
signed_claims = {}
stream_hashes_and_bt_infohashes = transaction.execute("select stream_hash, bt_infohash from file").fetchall()
stream_hashes = tuple(
stream_hash for stream_hash, _ in stream_hashes_and_bt_infohashes if stream_hash is not None
)
for (rowid, stream_hash, _, file_name, download_dir, data_rate, status, saved_file, raw_content_fee,
added_on, _, sd_hash, stream_key, stream_name, suggested_file_name, *claim_args) in _batched_select(
transaction, "select file.rowid, file.*, stream.*, c.* "
added_on, _, sd_hash, stream_key, stream_name, suggested_file_name, *claim_args) in transaction.execute(
"select file.rowid, file.*, stream.*, c.* "
"from file inner join stream on file.stream_hash=stream.stream_hash "
"inner join content_claim cc on file.stream_hash=cc.stream_hash "
"inner join claim c on cc.claim_outpoint=c.claim_outpoint "
"where file.stream_hash in {} "
"order by c.rowid desc", stream_hashes):
"order by c.rowid desc").fetchall():
claim = StoredContentClaim(*claim_args)
if claim.channel_claim_id:
if claim.channel_claim_id not in signed_claims:
@@ -539,22 +534,30 @@ class SQLiteStorage(SQLiteMixin):
Update files that have been removed from the downloads directory since the last run
"""
def update_manually_removed_files(transaction: sqlite3.Connection):
removed = []
for (stream_hash, download_directory, file_name) in transaction.execute(
"select stream_hash, download_directory, file_name from file where saved_file=1 "
files = {}
query = "select stream_hash, download_directory, file_name from file where saved_file=1 " \
"and stream_hash is not null"
).fetchall():
if download_directory and file_name and os.path.isfile(
os.path.join(binascii.unhexlify(download_directory).decode(),
binascii.unhexlify(file_name).decode())):
continue
removed.append((stream_hash,))
if removed:
transaction.executemany(
"update file set file_name=null, download_directory=null, saved_file=0 where stream_hash=?",
removed
).fetchall()
return await self.db.run(update_manually_removed_files)
for (stream_hash, download_directory, file_name) in transaction.execute(query).fetchall():
if download_directory and file_name:
files[stream_hash] = download_directory, file_name
return files
def detect_removed(files):
return [
stream_hash for stream_hash, (download_directory, file_name) in files.items()
if not os.path.isfile(os.path.join(binascii.unhexlify(download_directory).decode(),
binascii.unhexlify(file_name).decode()))
]
def update_db_removed(transaction: sqlite3.Connection, removed):
query = "update file set file_name=null, download_directory=null, saved_file=0 where stream_hash in {}"
for cur in _batched_select(transaction, query, removed):
cur.fetchall()
stream_and_file = await self.db.run(update_manually_removed_files)
removed = await self.loop.run_in_executor(None, detect_removed, stream_and_file)
if removed:
await self.db.run(update_db_removed, removed)
def get_all_lbry_files(self) -> typing.Awaitable[typing.List[typing.Dict]]:
return self.db.run(get_all_lbry_files)
+2 -2
View File
@@ -2,7 +2,7 @@ import platform
import os
import logging.handlers
from lbry import build_type, __version__ as lbrynet_version
from lbry import build_info, __version__ as lbrynet_version
log = logging.getLogger(__name__)
@@ -19,7 +19,7 @@ def get_platform() -> dict:
"os_system": os_system,
"lbrynet_version": lbrynet_version,
"version": lbrynet_version,
"build": build_type.BUILD, # CI server sets this during build step
"build": build_info.BUILD, # CI server sets this during build step
}
if d["os_system"] == "Linux":
import distro # pylint: disable=import-outside-toplevel
+355
View File
@@ -0,0 +1,355 @@
import asyncio
import json
import logging
import os
import pathlib
import re
import shlex
import shutil
from lbry.conf import TranscodeConfig
log = logging.getLogger(__name__)
class VideoFileAnalyzer:
def __init__(self, conf: TranscodeConfig):
self._conf = conf
self._available_encoders = ""
self._ffmpeg_installed = False
self._which = None
async def _execute(self, command, arguments):
args = shlex.split(arguments)
process = await asyncio.create_subprocess_exec(self._conf.ffmpeg_folder + command, *args,
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
stdout, stderr = await process.communicate() # returns when the streams are closed
return stdout.decode() + stderr.decode(), process.returncode
async def _verify_executable(self, name):
try:
version, code = await self._execute(name, "-version")
except Exception as e:
log.warning("Unable to run %s, but it was requested. Message: %s", name, str(e))
code = -1
version = ""
if code != 0 or not version.startswith(name):
raise FileNotFoundError(f"Unable to locate or run {name}. Please install FFmpeg "
f"and ensure that it is callable via PATH or conf.ffmpeg_folder")
return version
async def _verify_ffmpeg_installed(self):
if self._ffmpeg_installed:
return
await self._verify_executable("ffprobe")
version = await self._verify_executable("ffmpeg")
self._which = shutil.which(f"{self._conf.ffmpeg_folder}ffmpeg")
self._ffmpeg_installed = True
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which)
async def status(self, reset=False):
if reset:
self._available_encoders = ""
self._ffmpeg_installed = False
self._which = None
installed = True
try:
await self._verify_ffmpeg_installed()
except FileNotFoundError:
installed = False
return {
"available": installed,
"which": self._which,
"analyze_audio_volume": int(self._conf.volume_analysis_time) > 0
}
@staticmethod
def _verify_container(scan_data: json):
container = scan_data["format"]["format_name"]
log.debug(" Detected container is %s", container)
if not {"webm", "mp4", "3gp", "ogg"}.intersection(container.split(",")):
return "Container format is not in the approved list of WebM, MP4. " \
f"Actual: {container} [{scan_data['format']['format_long_name']}]"
return ""
@staticmethod
def _verify_video_encoding(scan_data: json):
for stream in scan_data["streams"]:
if stream["codec_type"] != "video":
continue
codec = stream["codec_name"]
log.debug(" Detected video codec is %s, format is %s", codec, stream["pix_fmt"])
if not {"h264", "vp8", "vp9", "av1", "theora"}.intersection(codec.split(",")):
return "Video codec is not in the approved list of H264, VP8, VP9, AV1, Theora. " \
f"Actual: {codec} [{stream['codec_long_name']}]"
if "h264" in codec.split(",") and stream["pix_fmt"] != "yuv420p":
return "Video codec is H264, but its pixel format does not match the approved yuv420p. " \
f"Actual: {stream['pix_fmt']}"
return ""
@staticmethod
def _verify_bitrate(scan_data: json):
if "bit_rate" not in scan_data["format"]:
return ""
bit_rate = float(scan_data["format"]["bit_rate"])
log.debug(" Detected bitrate is %s Mbps", str(bit_rate / 1000000.0))
pixels = -1.0
for stream in scan_data["streams"]:
if stream["codec_type"] == "video":
pieces = stream["r_frame_rate"].split('/', 1)
frame_rate = float(pieces[0]) if len(pieces) == 1 \
else float(pieces[0]) / float(pieces[1])
pixels = max(pixels, float(stream["height"]) * float(stream["width"]) * frame_rate)
if pixels > 0.0 and pixels / bit_rate < 3.0:
return "Bits per second is excessive for this data; this may impact web streaming performance. " \
f"Actual: {str(bit_rate / 1000000.0)} Mbps"
return ""
async def _verify_fast_start(self, scan_data: json, video_file):
container = scan_data["format"]["format_name"]
if {"webm", "ogg"}.intersection(container.split(",")):
return ""
result, _ = await self._execute("ffprobe", f'-v debug "{video_file}"')
iterator = re.finditer(r"\s+seeks:(\d+)\s+", result)
for match in iterator:
if int(match.group(1)) != 0:
return "Video stream descriptors are not at the start of the file (the faststart flag was not used)."
return ""
@staticmethod
def _verify_audio_encoding(scan_data: json):
for stream in scan_data["streams"]:
if stream["codec_type"] != "audio":
continue
codec = stream["codec_name"]
log.debug(" Detected audio codec is %s", codec)
if not {"aac", "mp3", "flac", "vorbis", "opus"}.intersection(codec.split(",")):
return "Audio codec is not in the approved list of AAC, FLAC, MP3, Vorbis, and Opus. " \
f"Actual: {codec} [{stream['codec_long_name']}]"
return ""
async def _verify_audio_volume(self, seconds, video_file):
try:
validate_volume = int(seconds) > 0
except ValueError:
validate_volume = False
if not validate_volume:
return ""
result, _ = await self._execute("ffmpeg", f'-i "{video_file}" -t {seconds} '
f'-af volumedetect -vn -sn -dn -f null "{os.devnull}"')
try:
mean_volume = float(re.search(r"mean_volume:\s+([-+]?\d*\.\d+|\d+)", result).group(1))
max_volume = float(re.search(r"max_volume:\s+([-+]?\d*\.\d+|\d+)", result).group(1))
except Exception as e:
log.debug(" Failure in volume analysis. Message: %s", str(e))
return ""
if max_volume < -5.0 and mean_volume < -22.0:
return "Audio is at least five dB lower than prime. " \
f"Actual max: {max_volume}, mean: {mean_volume}"
log.debug(" Detected audio volume has mean, max of %f, %f dB", mean_volume, max_volume)
return ""
@staticmethod
def _compute_crf(scan_data):
height = 240.0
for stream in scan_data["streams"]:
if stream["codec_type"] == "video":
height = max(height, float(stream["height"]))
# https://developers.google.com/media/vp9/settings/vod/
return int(-0.011 * height + 40)
async def _get_video_encoder(self, scan_data):
# use what the user said if it's there:
# if it's not there, use h264 if we can because it's way faster than the others
# if we don't have h264 use vp9; it's fairly compatible even though it's slow
if not self._available_encoders:
self._available_encoders, _ = await self._execute("ffmpeg", "-encoders -v quiet")
encoder = self._conf.video_encoder.split(" ", 1)[0]
if re.search(fr"^\s*V..... {encoder} ", self._available_encoders, re.MULTILINE):
return self._conf.video_encoder
if re.search(r"^\s*V..... libx264 ", self._available_encoders, re.MULTILINE):
if encoder:
log.warning(" Using libx264 since the requested encoder was unavailable. Requested: %s", encoder)
return 'libx264 -crf 19 -vf "format=yuv420p"'
if not encoder:
encoder = "libx264"
if re.search(r"^\s*V..... libvpx-vp9 ", self._available_encoders, re.MULTILINE):
log.warning(" Using libvpx-vp9 since the requested encoder was unavailable. Requested: %s", encoder)
crf = self._compute_crf(scan_data)
return f"libvpx-vp9 -crf {crf} -b:v 0"
if re.search(r"^\s*V..... libtheora", self._available_encoders, re.MULTILINE):
log.warning(" Using libtheora since the requested encoder was unavailable. Requested: %s", encoder)
return "libtheora -q:v 7"
raise Exception(f"The video encoder is not available. Requested: {encoder}")
async def _get_audio_encoder(self, extension):
# if the video encoding is theora or av1/vp8/vp9 use opus (or fallback to vorbis)
# or we don't have a video encoding but we have an ogg or webm container use opus
# if we need to use opus/vorbis see if the conf file has it else use our own params
# else use the user-set value if it exists
# else use aac
wants_opus = extension != "mp4"
if not self._available_encoders:
self._available_encoders, _ = await self._execute("ffmpeg", "-encoders -v quiet")
encoder = self._conf.audio_encoder.split(" ", 1)[0]
if wants_opus and 'opus' in encoder:
return self._conf.audio_encoder
if wants_opus and re.search(r"^\s*A..... libopus ", self._available_encoders, re.MULTILINE):
return "libopus -b:a 160k"
if wants_opus and 'vorbis' in encoder:
return self._conf.audio_encoder
if wants_opus and re.search(r"^\s*A..... libvorbis ", self._available_encoders, re.MULTILINE):
return "libvorbis -q:a 6"
if re.search(fr"^\s*A..... {encoder} ", self._available_encoders, re.MULTILINE):
return self._conf.audio_encoder
if re.search(r"^\s*A..... aac ", self._available_encoders, re.MULTILINE):
return "aac -b:a 192k"
raise Exception(f"The audio encoder is not available. Requested: {encoder or 'aac'}")
async def _get_volume_filter(self):
return self._conf.volume_filter if self._conf.volume_filter else "-af loudnorm"
@staticmethod
def _get_best_container_extension(scan_data, video_encoder):
# the container is chosen by the video format
# if we are theora-encoded, we want ogg
# if we are vp8/vp9/av1 we want webm
# use mp4 for anything else
if not video_encoder: # not re-encoding video
for stream in scan_data["streams"]:
if stream["codec_type"] != "video":
continue
codec = stream["codec_name"].split(",")
if "theora" in codec:
return "ogg"
if {"vp8", "vp9", "av1"}.intersection(codec):
return "webm"
if "theora" in video_encoder:
return "ogg"
elif re.search(r"vp[89x]|av1", video_encoder.split(" ", 1)[0]):
return "webm"
return "mp4"
async def _get_scan_data(self, validate, file_path):
result, _ = await self._execute("ffprobe",
f'-v quiet -print_format json -show_format -show_streams "{file_path}"')
try:
scan_data = json.loads(result)
except Exception as e:
log.debug("Failure in JSON parsing ffprobe results. Message: %s", str(e))
if validate:
raise Exception(f'Invalid video file: {file_path}')
log.info("Unable to optimize %s . FFmpeg output was unreadable.", file_path)
return
if "format" not in scan_data:
if validate:
raise FileNotFoundError(f'Unexpected or absent video file contents at: {file_path}')
log.info("Unable to optimize %s . FFmpeg output is missing the format section.", file_path)
return
return scan_data
async def verify_or_repair(self, validate, repair, file_path):
if not validate and not repair:
return file_path
await self._verify_ffmpeg_installed()
scan_data = await self._get_scan_data(validate, file_path)
fast_start_msg = await self._verify_fast_start(scan_data, file_path)
log.debug("Analyzing %s:", file_path)
log.debug(" Detected faststart is %s", "false" if fast_start_msg else "true")
container_msg = self._verify_container(scan_data)
bitrate_msg = self._verify_bitrate(scan_data)
video_msg = self._verify_video_encoding(scan_data)
audio_msg = self._verify_audio_encoding(scan_data)
volume_msg = await self._verify_audio_volume(self._conf.volume_analysis_time, file_path)
messages = [container_msg, bitrate_msg, fast_start_msg, video_msg, audio_msg, volume_msg]
if not any(messages):
return file_path
if not repair:
errors = ["Streamability verification failed:"]
errors.extend(filter(None, messages))
raise Exception("\n ".join(errors))
# the plan for transcoding:
# we have to re-encode the video if it is in a nonstandard format
# we also re-encode if we are h264 but not yuv420p (both errors caught in video_msg)
# we also re-encode if our bitrate is too high
try:
transcode_command = [f'-i "{file_path}" -y -c:s copy -c:d copy -c:v']
video_encoder = ""
if video_msg or bitrate_msg:
video_encoder = await self._get_video_encoder(scan_data)
transcode_command.append(video_encoder)
else:
transcode_command.append("copy")
transcode_command.append("-movflags +faststart -c:a")
path = pathlib.Path(file_path)
extension = self._get_best_container_extension(scan_data, video_encoder)
if audio_msg or volume_msg:
audio_encoder = await self._get_audio_encoder(extension)
transcode_command.append(audio_encoder)
if volume_msg:
volume_filter = await self._get_volume_filter()
transcode_command.append(volume_filter)
else:
transcode_command.append("copy")
# TODO: put it in a temp folder and delete it after we upload?
output = path.parent / f"{path.stem}_fixed.{extension}"
transcode_command.append(f'"{output}"')
ffmpeg_command = " ".join(transcode_command)
log.info("Proceeding on transcode via: ffmpeg %s", ffmpeg_command)
result, code = await self._execute("ffmpeg", ffmpeg_command)
if code != 0:
raise Exception(f"Failure to complete the transcode command. Output: {result}")
except Exception as e:
if validate:
raise
log.info("Unable to transcode %s . Message: %s", file_path, str(e))
# TODO: delete partial output file here if it exists?
return file_path
return str(output)
+1 -1
View File
@@ -1,5 +1,5 @@
build:
rm types/v2/* -rf
touch types/v2/__init__.py
cd types/v2/ && protoc --python_out=. -I ../../../../../../types/v2/proto/ ../../../../../../types/v2/proto/*.proto
cd types/v2/ && protoc --python_out=. -I ../../../../../types/v2/proto/ ../../../../../types/v2/proto/*.proto
sed -e 's/^import\ \(.*\)_pb2\ /from . import\ \1_pb2\ /g' -i types/v2/*.py
+81 -11
View File
@@ -1,32 +1,90 @@
import base64
import struct
from typing import List, Optional, Tuple
from typing import List
from binascii import hexlify
from itertools import chain
from lbry.error import ResolveCensoredError
from lbry.schema.types.v2.result_pb2 import Outputs as OutputsMessage
from lbry.schema.types.v2.result_pb2 import Error as ErrorMessage
INVALID = ErrorMessage.Code.Name(ErrorMessage.INVALID)
NOT_FOUND = ErrorMessage.Code.Name(ErrorMessage.NOT_FOUND)
BLOCKED = ErrorMessage.Code.Name(ErrorMessage.BLOCKED)
class Censor:
__slots__ = 'streams', 'channels', 'censored', 'total'
def __init__(self, streams: dict = None, channels: dict = None):
self.streams = streams or {}
self.channels = channels or {}
self.censored = {}
self.total = 0
def censor(self, row) -> bool:
was_censored = False
for claim_hash, lookup in (
(row['claim_hash'], self.streams),
(row['claim_hash'], self.channels),
(row['channel_hash'], self.channels)):
censoring_channel_hash = lookup.get(claim_hash)
if censoring_channel_hash:
was_censored = True
self.censored.setdefault(censoring_channel_hash, 0)
self.censored[censoring_channel_hash] += 1
break
if was_censored:
self.total += 1
return was_censored
def to_message(self, outputs: OutputsMessage):
outputs.blocked_total = self.total
for censoring_channel_hash, count in self.censored.items():
block = outputs.blocked.add()
block.count = count
block.channel_hash = censoring_channel_hash
class Outputs:
__slots__ = 'txos', 'extra_txos', 'txs', 'offset', 'total'
__slots__ = 'txos', 'extra_txos', 'txs', 'offset', 'total', 'blocked', 'blocked_total'
def __init__(self, txos: List, extra_txos: List, txs: set, offset: int, total: int):
def __init__(self, txos: List, extra_txos: List, txs: set,
offset: int, total: int, blocked: List, blocked_total: int):
self.txos = txos
self.txs = txs
self.extra_txos = extra_txos
self.offset = offset
self.total = total
self.blocked = blocked
self.blocked_total = blocked_total
def inflate(self, txs):
tx_map = {tx.hash: tx for tx in txs}
for txo_message in self.extra_txos:
self.message_to_txo(txo_message, tx_map)
return [self.message_to_txo(txo_message, tx_map) for txo_message in self.txos]
txos = [self.message_to_txo(txo_message, tx_map) for txo_message in self.txos]
return txos, self.inflate_blocked()
def inflate_blocked(self):
return {
"total": self.blocked_total,
"channels": {
hexlify(message.channel_hash[::-1]).decode(): message.count
for message in self.blocked
}
}
def message_to_txo(self, txo_message, tx_map):
if txo_message.WhichOneof('meta') == 'error':
return None
return {
'error': {
'name': txo_message.error.Code.Name(txo_message.error.code).lower(),
'text': txo_message.error.text,
}
}
txo = tx_map[txo_message.tx_hash].outputs[txo_message.nout]
if txo_message.WhichOneof('meta') == 'claim':
claim = txo_message.claim
@@ -70,18 +128,24 @@ class Outputs:
if txo_message.WhichOneof('meta') == 'error':
continue
txs.add((hexlify(txo_message.tx_hash[::-1]).decode(), txo_message.height))
return cls(outputs.txos, outputs.extra_txos, txs, outputs.offset, outputs.total)
return cls(
outputs.txos, outputs.extra_txos, txs,
outputs.offset, outputs.total,
outputs.blocked, outputs.blocked_total
)
@classmethod
def to_base64(cls, txo_rows, extra_txo_rows, offset=0, total=None) -> str:
return base64.b64encode(cls.to_bytes(txo_rows, extra_txo_rows, offset, total)).decode()
def to_base64(cls, txo_rows, extra_txo_rows, offset=0, total=None, blocked=None) -> str:
return base64.b64encode(cls.to_bytes(txo_rows, extra_txo_rows, offset, total, blocked)).decode()
@classmethod
def to_bytes(cls, txo_rows, extra_txo_rows, offset=0, total=None) -> bytes:
def to_bytes(cls, txo_rows, extra_txo_rows, offset=0, total=None, blocked: Censor = None) -> bytes:
page = OutputsMessage()
page.offset = offset
if total is not None:
page.total = total
if blocked is not None:
blocked.to_message(page)
for row in txo_rows:
cls.row_to_message(row, page.txos.add(), extra_txo_rows)
for row in extra_txo_rows:
@@ -93,9 +157,11 @@ class Outputs:
if isinstance(txo, Exception):
txo_message.error.text = txo.args[0]
if isinstance(txo, ValueError):
txo_message.error.code = txo_message.error.INVALID
txo_message.error.code = ErrorMessage.INVALID
elif isinstance(txo, LookupError):
txo_message.error.code = txo_message.error.NOT_FOUND
txo_message.error.code = ErrorMessage.NOT_FOUND
elif isinstance(txo, ResolveCensoredError):
txo_message.error.code = ErrorMessage.BLOCKED
return
txo_message.tx_hash = txo['txo_hash'][:32]
txo_message.nout, = struct.unpack('<I', txo['txo_hash'][32:])
@@ -121,6 +187,10 @@ class Outputs:
cls.set_reference(txo_message, 'channel', txo['channel_hash'], extra_txo_rows)
cls.set_reference(txo_message, 'repost', txo['reposted_claim_hash'], extra_txo_rows)
@staticmethod
def set_blocked(message, blocked):
message.blocked_total = blocked.total
@staticmethod
def set_reference(message, attr, claim_hash, rows):
if claim_hash:
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -7,6 +7,7 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -18,9 +19,9 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='purchase.proto',
package='pb',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n\x0epurchase.proto\x12\x02pb\"\x1e\n\x08Purchase\x12\x12\n\nclaim_hash\x18\x01 \x01(\x0c\x62\x06proto3')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@@ -38,14 +39,14 @@ _PURCHASE = _descriptor.Descriptor(
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
@@ -56,7 +57,6 @@ _PURCHASE = _descriptor.Descriptor(
)
DESCRIPTOR.message_types_by_name['Purchase'] = _PURCHASE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Purchase = _reflection.GeneratedProtocolMessageType('Purchase', (_message.Message,), dict(
DESCRIPTOR = _PURCHASE,
+122 -49
View File
@@ -7,6 +7,7 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -18,9 +19,9 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='result.proto',
package='pb',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n\x0cresult.proto\x12\x02pb\"b\n\x07Outputs\x12\x18\n\x04txos\x18\x01 \x03(\x0b\x32\n.pb.Output\x12\x1e\n\nextra_txos\x18\x02 \x03(\x0b\x32\n.pb.Output\x12\r\n\x05total\x18\x03 \x01(\r\x12\x0e\n\x06offset\x18\x04 \x01(\r\"{\n\x06Output\x12\x0f\n\x07tx_hash\x18\x01 \x01(\x0c\x12\x0c\n\x04nout\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x1e\n\x05\x63laim\x18\x07 \x01(\x0b\x32\r.pb.ClaimMetaH\x00\x12\x1a\n\x05\x65rror\x18\x0f \x01(\x0b\x32\t.pb.ErrorH\x00\x42\x06\n\x04meta\"\xaf\x03\n\tClaimMeta\x12\x1b\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\n.pb.Output\x12\x1a\n\x06repost\x18\x02 \x01(\x0b\x32\n.pb.Output\x12\x11\n\tshort_url\x18\x03 \x01(\t\x12\x15\n\rcanonical_url\x18\x04 \x01(\t\x12\x16\n\x0eis_controlling\x18\x05 \x01(\x08\x12\x18\n\x10take_over_height\x18\x06 \x01(\r\x12\x17\n\x0f\x63reation_height\x18\x07 \x01(\r\x12\x19\n\x11\x61\x63tivation_height\x18\x08 \x01(\r\x12\x19\n\x11\x65xpiration_height\x18\t \x01(\r\x12\x19\n\x11\x63laims_in_channel\x18\n \x01(\r\x12\x10\n\x08reposted\x18\x0b \x01(\r\x12\x18\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x14 \x01(\x04\x12\x16\n\x0esupport_amount\x18\x15 \x01(\x04\x12\x16\n\x0etrending_group\x18\x16 \x01(\r\x12\x16\n\x0etrending_mixed\x18\x17 \x01(\x02\x12\x16\n\x0etrending_local\x18\x18 \x01(\x02\x12\x17\n\x0ftrending_global\x18\x19 \x01(\x02\"i\n\x05\x45rror\x12\x1c\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0e.pb.Error.Code\x12\x0c\n\x04text\x18\x02 \x01(\t\"4\n\x04\x43ode\x12\x10\n\x0cUNKNOWN_CODE\x10\x00\x12\r\n\tNOT_FOUND\x10\x01\x12\x0b\n\x07INVALID\x10\x02\x62\x06proto3')
serialized_pb=_b('\n\x0cresult.proto\x12\x02pb\"\x97\x01\n\x07Outputs\x12\x18\n\x04txos\x18\x01 \x03(\x0b\x32\n.pb.Output\x12\x1e\n\nextra_txos\x18\x02 \x03(\x0b\x32\n.pb.Output\x12\r\n\x05total\x18\x03 \x01(\r\x12\x0e\n\x06offset\x18\x04 \x01(\r\x12\x1c\n\x07\x62locked\x18\x05 \x03(\x0b\x32\x0b.pb.Blocked\x12\x15\n\rblocked_total\x18\x06 \x01(\r\"{\n\x06Output\x12\x0f\n\x07tx_hash\x18\x01 \x01(\x0c\x12\x0c\n\x04nout\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x1e\n\x05\x63laim\x18\x07 \x01(\x0b\x32\r.pb.ClaimMetaH\x00\x12\x1a\n\x05\x65rror\x18\x0f \x01(\x0b\x32\t.pb.ErrorH\x00\x42\x06\n\x04meta\"\xaf\x03\n\tClaimMeta\x12\x1b\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\n.pb.Output\x12\x1a\n\x06repost\x18\x02 \x01(\x0b\x32\n.pb.Output\x12\x11\n\tshort_url\x18\x03 \x01(\t\x12\x15\n\rcanonical_url\x18\x04 \x01(\t\x12\x16\n\x0eis_controlling\x18\x05 \x01(\x08\x12\x18\n\x10take_over_height\x18\x06 \x01(\r\x12\x17\n\x0f\x63reation_height\x18\x07 \x01(\r\x12\x19\n\x11\x61\x63tivation_height\x18\x08 \x01(\r\x12\x19\n\x11\x65xpiration_height\x18\t \x01(\r\x12\x19\n\x11\x63laims_in_channel\x18\n \x01(\r\x12\x10\n\x08reposted\x18\x0b \x01(\r\x12\x18\n\x10\x65\x66\x66\x65\x63tive_amount\x18\x14 \x01(\x04\x12\x16\n\x0esupport_amount\x18\x15 \x01(\x04\x12\x16\n\x0etrending_group\x18\x16 \x01(\r\x12\x16\n\x0etrending_mixed\x18\x17 \x01(\x02\x12\x16\n\x0etrending_local\x18\x18 \x01(\x02\x12\x17\n\x0ftrending_global\x18\x19 \x01(\x02\"\x94\x01\n\x05\x45rror\x12\x1c\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0e.pb.Error.Code\x12\x0c\n\x04text\x18\x02 \x01(\t\x12\x1c\n\x07\x62locked\x18\x03 \x01(\x0b\x32\x0b.pb.Blocked\"A\n\x04\x43ode\x12\x10\n\x0cUNKNOWN_CODE\x10\x00\x12\r\n\tNOT_FOUND\x10\x01\x12\x0b\n\x07INVALID\x10\x02\x12\x0b\n\x07\x42LOCKED\x10\x03\".\n\x07\x42locked\x12\r\n\x05\x63ount\x18\x01 \x01(\r\x12\x14\n\x0c\x63hannel_hash\x18\x02 \x01(\x0c\x62\x06proto3')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@@ -32,21 +33,25 @@ _ERROR_CODE = _descriptor.EnumDescriptor(
values=[
_descriptor.EnumValueDescriptor(
name='UNKNOWN_CODE', index=0, number=0,
serialized_options=None,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NOT_FOUND', index=1, number=1,
serialized_options=None,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INVALID', index=2, number=2,
serialized_options=None,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLOCKED', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=732,
serialized_end=784,
options=None,
serialized_start=817,
serialized_end=882,
)
_sym_db.RegisterEnumDescriptor(_ERROR_CODE)
@@ -64,42 +69,56 @@ _OUTPUTS = _descriptor.Descriptor(
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='extra_txos', full_name='pb.Outputs.extra_txos', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='total', full_name='pb.Outputs.total', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='offset', full_name='pb.Outputs.offset', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='blocked', full_name='pb.Outputs.blocked', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='blocked_total', full_name='pb.Outputs.blocked_total', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=20,
serialized_end=118,
serialized_start=21,
serialized_end=172,
)
@@ -116,42 +135,42 @@ _OUTPUT = _descriptor.Descriptor(
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='nout', full_name='pb.Output.nout', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='height', full_name='pb.Output.height', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='claim', full_name='pb.Output.claim', index=3,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='error', full_name='pb.Output.error', index=4,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
@@ -160,8 +179,8 @@ _OUTPUT = _descriptor.Descriptor(
name='meta', full_name='pb.Output.meta',
index=0, containing_type=None, fields=[]),
],
serialized_start=120,
serialized_end=243,
serialized_start=174,
serialized_end=297,
)
@@ -178,133 +197,133 @@ _CLAIMMETA = _descriptor.Descriptor(
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='repost', full_name='pb.ClaimMeta.repost', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='short_url', full_name='pb.ClaimMeta.short_url', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='canonical_url', full_name='pb.ClaimMeta.canonical_url', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='is_controlling', full_name='pb.ClaimMeta.is_controlling', index=4,
number=5, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='take_over_height', full_name='pb.ClaimMeta.take_over_height', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='creation_height', full_name='pb.ClaimMeta.creation_height', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='activation_height', full_name='pb.ClaimMeta.activation_height', index=7,
number=8, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='expiration_height', full_name='pb.ClaimMeta.expiration_height', index=8,
number=9, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='claims_in_channel', full_name='pb.ClaimMeta.claims_in_channel', index=9,
number=10, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='reposted', full_name='pb.ClaimMeta.reposted', index=10,
number=11, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='effective_amount', full_name='pb.ClaimMeta.effective_amount', index=11,
number=20, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='support_amount', full_name='pb.ClaimMeta.support_amount', index=12,
number=21, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='trending_group', full_name='pb.ClaimMeta.trending_group', index=13,
number=22, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='trending_mixed', full_name='pb.ClaimMeta.trending_mixed', index=14,
number=23, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='trending_local', full_name='pb.ClaimMeta.trending_local', index=15,
number=24, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='trending_global', full_name='pb.ClaimMeta.trending_global', index=16,
number=25, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=246,
serialized_end=677,
serialized_start=300,
serialized_end=731,
)
@@ -321,14 +340,21 @@ _ERROR = _descriptor.Descriptor(
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='text', full_name='pb.Error.text', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
options=None),
_descriptor.FieldDescriptor(
name='blocked', full_name='pb.Error.blocked', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
@@ -336,18 +362,57 @@ _ERROR = _descriptor.Descriptor(
enum_types=[
_ERROR_CODE,
],
serialized_options=None,
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=679,
serialized_end=784,
serialized_start=734,
serialized_end=882,
)
_BLOCKED = _descriptor.Descriptor(
name='Blocked',
full_name='pb.Blocked',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='count', full_name='pb.Blocked.count', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='channel_hash', full_name='pb.Blocked.channel_hash', index=1,
number=2, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=884,
serialized_end=930,
)
_OUTPUTS.fields_by_name['txos'].message_type = _OUTPUT
_OUTPUTS.fields_by_name['extra_txos'].message_type = _OUTPUT
_OUTPUTS.fields_by_name['blocked'].message_type = _BLOCKED
_OUTPUT.fields_by_name['claim'].message_type = _CLAIMMETA
_OUTPUT.fields_by_name['error'].message_type = _ERROR
_OUTPUT.oneofs_by_name['meta'].fields.append(
@@ -359,12 +424,13 @@ _OUTPUT.fields_by_name['error'].containing_oneof = _OUTPUT.oneofs_by_name['meta'
_CLAIMMETA.fields_by_name['channel'].message_type = _OUTPUT
_CLAIMMETA.fields_by_name['repost'].message_type = _OUTPUT
_ERROR.fields_by_name['code'].enum_type = _ERROR_CODE
_ERROR.fields_by_name['blocked'].message_type = _BLOCKED
_ERROR_CODE.containing_type = _ERROR
DESCRIPTOR.message_types_by_name['Outputs'] = _OUTPUTS
DESCRIPTOR.message_types_by_name['Output'] = _OUTPUT
DESCRIPTOR.message_types_by_name['ClaimMeta'] = _CLAIMMETA
DESCRIPTOR.message_types_by_name['Error'] = _ERROR
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
DESCRIPTOR.message_types_by_name['Blocked'] = _BLOCKED
Outputs = _reflection.GeneratedProtocolMessageType('Outputs', (_message.Message,), dict(
DESCRIPTOR = _OUTPUTS,
@@ -394,5 +460,12 @@ Error = _reflection.GeneratedProtocolMessageType('Error', (_message.Message,), d
))
_sym_db.RegisterMessage(Error)
Blocked = _reflection.GeneratedProtocolMessageType('Blocked', (_message.Message,), dict(
DESCRIPTOR = _BLOCKED,
__module__ = 'result_pb2'
# @@protoc_insertion_point(class_scope:pb.Blocked)
))
_sym_db.RegisterMessage(Blocked)
# @@protoc_insertion_point(module_scope)
+25 -13
View File
@@ -77,7 +77,7 @@ class StreamManager:
self.resume_saving_task: Optional[asyncio.Task] = None
self.re_reflect_task: Optional[asyncio.Task] = None
self.update_stream_finished_futs: typing.List[asyncio.Future] = []
self.running_reflector_uploads: typing.List[asyncio.Task] = []
self.running_reflector_uploads: typing.Dict[str, asyncio.Task] = {}
self.started = asyncio.Event(loop=self.loop)
async def _update_content_claim(self, stream: ManagedStream):
@@ -144,6 +144,7 @@ class StreamManager:
to_recover.append(file_info)
to_start.append(file_info)
if to_recover:
log.info("Recover %i files", len(to_recover))
await self.recover_streams(to_recover)
log.info("Initializing %i files", len(to_start))
@@ -184,10 +185,10 @@ class StreamManager:
batch = []
while sd_hashes:
stream = self.streams[sd_hashes.pop()]
if self.blob_manager.is_blob_verified(stream.sd_hash) and stream.blobs_completed:
if not stream.fully_reflected.is_set():
host, port = random.choice(self.config.reflector_servers)
batch.append(stream.upload_to_reflector(host, port))
if self.blob_manager.is_blob_verified(stream.sd_hash) and stream.blobs_completed and \
stream.sd_hash not in self.running_reflector_uploads and not \
stream.fully_reflected.is_set():
batch.append(self.reflect_stream(stream))
if len(batch) >= self.config.concurrent_reflector_uploads:
await asyncio.gather(*batch, loop=self.loop)
batch = []
@@ -211,26 +212,37 @@ class StreamManager:
while self.update_stream_finished_futs:
self.update_stream_finished_futs.pop().cancel()
while self.running_reflector_uploads:
self.running_reflector_uploads.pop().cancel()
_, t = self.running_reflector_uploads.popitem()
t.cancel()
self.started.clear()
log.info("finished stopping the stream manager")
def reflect_stream(self, stream: ManagedStream, server: Optional[str] = None,
port: Optional[int] = None) -> asyncio.Task:
if not server or not port:
server, port = random.choice(self.config.reflector_servers)
if stream.sd_hash in self.running_reflector_uploads:
return self.running_reflector_uploads[stream.sd_hash]
task = self.loop.create_task(stream.upload_to_reflector(server, port))
self.running_reflector_uploads[stream.sd_hash] = task
task.add_done_callback(
lambda _: None if stream.sd_hash not in self.running_reflector_uploads else
self.running_reflector_uploads.pop(stream.sd_hash)
)
return task
async def create_stream(self, file_path: str, key: Optional[bytes] = None,
iv_generator: Optional[typing.Generator[bytes, None, None]] = None) -> ManagedStream:
stream = await ManagedStream.create(self.loop, self.config, self.blob_manager, file_path, key, iv_generator)
self.streams[stream.sd_hash] = stream
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
if self.config.reflect_streams and self.config.reflector_servers:
host, port = random.choice(self.config.reflector_servers)
task = self.loop.create_task(stream.upload_to_reflector(host, port))
self.running_reflector_uploads.append(task)
task.add_done_callback(
lambda _: None
if task not in self.running_reflector_uploads else self.running_reflector_uploads.remove(task)
)
self.reflect_stream(stream)
return stream
async def delete_stream(self, stream: ManagedStream, delete_file: Optional[bool] = False):
if stream.sd_hash in self.running_reflector_uploads:
self.running_reflector_uploads[stream.sd_hash].cancel()
stream.stop_tasks()
if stream.sd_hash in self.streams:
del self.streams[stream.sd_hash]
+6
View File
@@ -555,6 +555,12 @@ class CommandTestCase(IntegrationTestCase):
async def claim_list(self, *args, **kwargs):
return (await self.out(self.daemon.jsonrpc_claim_list(*args, **kwargs)))['items']
async def stream_list(self, *args, **kwargs):
return (await self.out(self.daemon.jsonrpc_stream_list(*args, **kwargs)))['items']
async def channel_list(self, *args, **kwargs):
return (await self.out(self.daemon.jsonrpc_channel_list(*args, **kwargs)))['items']
@staticmethod
def get_claim_id(tx):
return tx['outputs'][0]['claim_id']
+1
View File
@@ -631,6 +631,7 @@ class Database(SQLiteMixin):
return txos
async def get_txo_count(self, **constraints):
constraints.pop('resolve', None)
constraints.pop('wallet', None)
constraints.pop('offset', None)
constraints.pop('limit', None)
+45 -19
View File
@@ -12,7 +12,7 @@ from binascii import hexlify, unhexlify
from typing import Dict, Tuple, Type, Iterable, List, Optional, DefaultDict
import pylru
from lbry.schema.result import Outputs
from lbry.schema.result import Outputs, INVALID, NOT_FOUND
from lbry.schema.url import URL
from lbry.crypto.hash import hash160, double_sha256, sha256
from lbry.crypto.base58 import Base58
@@ -271,7 +271,7 @@ class Ledger(metaclass=LedgerRegistry):
async def get_local_status_and_history(self, address, history=None):
if not history:
address_details = await self.db.get_address(address=address)
history = address_details['history'] or ''
history = (address_details['history'] if address_details else '') or ''
parts = history.split(':')[:-1]
return (
hexlify(sha256(history.encode())).decode() if history else None,
@@ -616,9 +616,12 @@ class Ledger(metaclass=LedgerRegistry):
)) for address_record in records
], timeout=timeout)
if pending:
records = await self.db.get_addresses(address__in=addresses)
for record in records:
found = False
_, local_history = await self.get_local_status_and_history(None, history=record['history'])
local_history = (await self.get_local_status_and_history(
record['address'], history=record['history']
))[1] if record['history'] else []
for txid, local_height in local_history:
if txid == tx.id and local_height >= height:
found = True
@@ -626,7 +629,7 @@ class Ledger(metaclass=LedgerRegistry):
print(record['history'], addresses, tx.id)
raise asyncio.TimeoutError('Timed out waiting for transaction.')
async def _inflate_outputs(self, query, accounts):
async def _inflate_outputs(self, query, accounts) -> Tuple[List[Output], dict, int, int]:
outputs = Outputs.from_base64(await query)
txs = []
if len(outputs.txs) > 0:
@@ -649,7 +652,8 @@ class Ledger(metaclass=LedgerRegistry):
}
for txo in priced_claims:
txo.purchase_receipt = receipts.get(txo.claim_id)
return outputs.inflate(txs), outputs.offset, outputs.total
txos, blocked = outputs.inflate(txs)
return txos, blocked, outputs.offset, outputs.total
async def resolve(self, accounts, urls):
resolve = partial(self.network.retriable_call, self.network.resolve)
@@ -657,16 +661,16 @@ class Ledger(metaclass=LedgerRegistry):
assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received."
result = {}
for url, txo in zip(urls, txos):
if txo and URL.parse(url).has_stream_in_channel:
if not txo.channel or not txo.is_signed_by(txo.channel, self):
txo = None
if txo:
result[url] = txo
if isinstance(txo, Output) and URL.parse(url).has_stream_in_channel:
if not txo.channel or not txo.is_signed_by(txo.channel, self):
txo = {'error': {'name': INVALID, 'text': f'{url} has invalid channel signature'}}
else:
result[url] = {'error': f'{url} did not resolve to a claim'}
txo = {'error': {'name': NOT_FOUND, 'text': f'{url} did not resolve to a claim'}}
result[url] = txo
return result
async def claim_search(self, accounts, **kwargs) -> Tuple[List[Output], int, int]:
async def claim_search(self, accounts, **kwargs) -> Tuple[List[Output], dict, int, int]:
return await self._inflate_outputs(self.network.claim_search(**kwargs), accounts)
async def get_claim_by_claim_id(self, accounts, claim_id) -> Output:
@@ -714,7 +718,7 @@ class Ledger(metaclass=LedgerRegistry):
if resolve:
claim_ids = [p.purchased_claim_id for p in purchases]
try:
resolved, _, _ = await self.claim_search([], claim_ids=claim_ids)
resolved, _, _, _ = await self.claim_search([], claim_ids=claim_ids)
except Exception as err:
if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8
raise
@@ -728,20 +732,42 @@ class Ledger(metaclass=LedgerRegistry):
def get_purchase_count(self, resolve=False, **constraints):
return self.db.get_purchase_count(**constraints)
def get_claims(self, **constraints):
return self.db.get_claims(**constraints)
async def _resolve_for_local_results(self, accounts, txos):
results = []
response = await self.resolve(accounts, [txo.permanent_url for txo in txos])
for txo in txos:
resolved = response[txo.permanent_url]
if isinstance(resolved, Output):
results.append(resolved)
else:
if isinstance(resolved, dict) and 'error' in resolved:
txo.meta['error'] = resolved['error']
results.append(txo)
return results
async def get_claims(self, resolve=False, **constraints):
claims = await self.db.get_claims(**constraints)
if resolve:
return await self._resolve_for_local_results(constraints.get('accounts', []), claims)
return claims
def get_claim_count(self, **constraints):
return self.db.get_claim_count(**constraints)
def get_streams(self, **constraints):
return self.db.get_streams(**constraints)
async def get_streams(self, resolve=False, **constraints):
streams = await self.db.get_streams(**constraints)
if resolve:
return await self._resolve_for_local_results(constraints.get('accounts', []), streams)
return streams
def get_stream_count(self, **constraints):
return self.db.get_stream_count(**constraints)
def get_channels(self, **constraints):
return self.db.get_channels(**constraints)
async def get_channels(self, resolve=False, **constraints):
channels = await self.db.get_channels(**constraints)
if resolve:
return await self._resolve_for_local_results(constraints.get('accounts', []), channels)
return channels
def get_channel_count(self, **constraints):
return self.db.get_channel_count(**constraints)
@@ -749,7 +775,7 @@ class Ledger(metaclass=LedgerRegistry):
async def resolve_collection(self, collection, offset=0, page_size=1):
claim_ids = collection.claim.collection.claims.ids[offset:page_size+offset]
try:
resolve_results, _, _ = await self.claim_search([], claim_ids=claim_ids)
resolve_results, _, _, _ = await self.claim_search([], claim_ids=claim_ids)
except Exception as err:
if isinstance(err, asyncio.CancelledError): # TODO: remove when updated to 3.8
raise
+17 -13
View File
@@ -5,6 +5,7 @@ from operator import itemgetter
from typing import Dict, Optional, Tuple
from lbry import __version__
from lbry.error import IncompatibleWalletServerError
from lbry.wallet.rpc import RPCSession as BaseClientSession, Connector, RPCError, ProtocolError
from lbry.wallet.stream import StreamController
@@ -77,7 +78,7 @@ class ClientSession(BaseClientSession):
self.synchronous_close()
raise
except asyncio.CancelledError:
log.warning("cancelled sending %s to %s:%i", method, *self.server)
log.info("cancelled sending %s to %s:%i", method, *self.server)
self.synchronous_close()
raise
finally:
@@ -90,7 +91,6 @@ class ClientSession(BaseClientSession):
while True:
try:
if self.is_closing():
log.warning("is closing, reconnect")
await self.create_connection(self.timeout)
await self.ensure_server_version()
self._on_connect_cb()
@@ -98,16 +98,17 @@ class ClientSession(BaseClientSession):
await self.ensure_server_version()
retry_delay = default_delay
except RPCError as e:
log.warning("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message)
await self.close()
log.debug("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message)
retry_delay = 60 * 60
except asyncio.TimeoutError:
log.error("closing due to timeout")
except IncompatibleWalletServerError:
await self.close()
retry_delay = 60 * 60
log.debug("Wallet server has an incompatible version, retrying in 1h: %s:%d", *self.server)
except (asyncio.TimeoutError, OSError):
await self.close()
retry_delay = min(60, retry_delay * 2)
log.warning("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
except Exception:
log.exception("unexpected error")
raise
log.debug("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
try:
await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay)
except asyncio.TimeoutError:
@@ -117,9 +118,12 @@ class ClientSession(BaseClientSession):
async def ensure_server_version(self, required=None, timeout=3):
required = required or self.network.PROTOCOL_VERSION
return await asyncio.wait_for(
response = await asyncio.wait_for(
self.send_request('server.version', [__version__, required]), timeout=timeout
)
if tuple(int(piece) for piece in response[0].split(".")) < self.network.MINIMUM_REQUIRED:
raise IncompatibleWalletServerError(*self.server)
return response
async def create_connection(self, timeout=6):
connector = Connector(lambda: self, *self.server)
@@ -132,7 +136,7 @@ class ClientSession(BaseClientSession):
controller.add(request.args)
def connection_lost(self, exc):
log.warning("Connection lost: %s:%d", *self.server)
log.debug("Connection lost: %s:%d", *self.server)
super().connection_lost(exc)
self.response_time = None
self.connection_latency = None
@@ -144,6 +148,7 @@ class ClientSession(BaseClientSession):
class Network:
PROTOCOL_VERSION = __version__
MINIMUM_REQUIRED = (0, 57, 0)
def __init__(self, ledger):
self.ledger = ledger
@@ -228,8 +233,7 @@ class Network:
except asyncio.TimeoutError:
log.warning("Wallet server call timed out, retrying.")
except ConnectionError:
log.warning("Ignoring connection error")
log.warning("Raising cancelled error")
pass
raise asyncio.CancelledError() # if we got here, we are shutting down
def _update_remote_height(self, header_args):
+13 -7
View File
@@ -40,6 +40,7 @@ from .jsonrpc import Request, JSONRPCConnection, JSONRPCv2, JSONRPC, Batch, Noti
from .jsonrpc import RPCError, ProtocolError
from .framing import BadMagicError, BadChecksumError, OversizedPayloadError, BitcoinFramer, NewlineFramer
from .util import Concurrency
from lbry.wallet.server.prometheus import NOTIFICATION_COUNT, RESPONSE_TIMES, REQUEST_ERRORS_COUNT
class Connector:
@@ -115,7 +116,6 @@ class SessionBase(asyncio.Protocol):
try:
await asyncio.wait_for(self._can_send.wait(), secs)
except asyncio.TimeoutError:
self.logger.warning("abort connection after limited wait (%s)", secs)
self.abort()
raise asyncio.TimeoutError(f'task timed out after {secs}s')
@@ -132,7 +132,6 @@ class SessionBase(asyncio.Protocol):
self.transport.write(framed_message)
def _bump_errors(self):
self.logger.warning("bump errors %i", self.errors)
self.errors += 1
if self.errors >= self.max_errors:
# Don't await self.close() because that is self-cancelling
@@ -183,7 +182,6 @@ class SessionBase(asyncio.Protocol):
"""Called by asyncio when the connection closes.
Tear down things done in connection_made."""
self.logger.error("connection lost to %s - %s", self.peer_address_str(), exc)
self._address = None
self.transport = None
self._task_group.cancel()
@@ -223,14 +221,12 @@ class SessionBase(asyncio.Protocol):
def abort(self):
"""Forcefully close the connection."""
self.logger.warning("abort connection")
if self.transport:
self.transport.abort()
# TODO: replace with synchronous_close
async def close(self, *, force_after=30):
"""Close the connection and return when closed."""
self.logger.warning("close connection")
self._close()
if self._pm_task:
with suppress(CancelledError):
@@ -239,7 +235,6 @@ class SessionBase(asyncio.Protocol):
await self._pm_task
def synchronous_close(self):
self.logger.warning("synchronous close")
self._close()
if self._pm_task and not self._pm_task.done():
self._pm_task.cancel()
@@ -385,6 +380,7 @@ class RPCSession(SessionBase):
def __init__(self, *, framer=None, loop=None, connection=None):
super().__init__(framer=framer, loop=loop)
self.connection = connection or self.default_connection()
self.client_version = 'unknown'
async def _receive_messages(self):
while not self.is_closing():
@@ -400,7 +396,7 @@ class RPCSession(SessionBase):
try:
requests = self.connection.receive_message(message)
except ProtocolError as e:
self.logger.warning(f'protocol error {e}')
self.logger.debug(f'{e}')
if e.error_message:
await self._send_message(e.error_message)
if e.code == JSONRPC.PARSE_ERROR:
@@ -411,6 +407,7 @@ class RPCSession(SessionBase):
await self._task_group.add(self._handle_request(request))
async def _handle_request(self, request):
start = time.perf_counter()
try:
result = await self.handle_request(request)
except (ProtocolError, RPCError) as e:
@@ -423,10 +420,18 @@ class RPCSession(SessionBase):
'internal server error')
if isinstance(request, Request):
message = request.send_result(result)
RESPONSE_TIMES.labels(
method=request.method,
version=self.client_version
).observe(time.perf_counter() - start)
if message:
await self._send_message(message)
if isinstance(result, Exception):
self._bump_errors()
REQUEST_ERRORS_COUNT.labels(
method=request.method,
version=self.client_version
).inc()
def connection_lost(self, exc):
# Cancel pending requests and message processing
@@ -460,6 +465,7 @@ class RPCSession(SessionBase):
async def send_notification(self, method, args=()):
"""Send an RPC notification over the network."""
message = self.connection.send_notification(Notification(method, args))
NOTIFICATION_COUNT.labels(method=method, version=self.client_version).inc()
await self._send_message(message)
def send_batch(self, raise_errors=False):
+7 -5
View File
@@ -9,6 +9,7 @@ from lbry.wallet.server.daemon import DaemonError
from lbry.wallet.server.hash import hash_to_hex_str, HASHX_LEN
from lbry.wallet.server.util import chunks, class_logger
from lbry.wallet.server.leveldb import FlushData
from lbry.wallet.server.prometheus import BLOCK_COUNT, BLOCK_UPDATE_TIMES
class Prefetcher:
@@ -188,14 +189,15 @@ class BlockProcessor:
chain = [self.tip] + [self.coin.header_hash(h) for h in headers[:-1]]
if hprevs == chain:
start = time.time()
start = time.perf_counter()
await self.run_in_thread_with_lock(self.advance_blocks, blocks)
await self._maybe_flush()
processed_time = time.perf_counter() - start
BLOCK_COUNT.set(self.height)
BLOCK_UPDATE_TIMES.observe(processed_time)
if not self.db.first_sync:
s = '' if len(blocks) == 1 else 's'
self.logger.info('processed {:,d} block{} in {:.1f}s'
.format(len(blocks), s,
time.time() - start))
self.logger.info('processed {:,d} block{} in {:.1f}s'.format(len(blocks), s, processed_time))
if self._caught_up_event.is_set():
await self.notifications.on_block(self.touched, self.height)
self.touched = set()
@@ -749,7 +751,7 @@ class LBRYBlockProcessor(BlockProcessor):
timer = self.timer.sub_timers['advance_blocks']
undo = timer.run(super().advance_txs, height, txs, header, timer_name='super().advance_txs')
timer.run(self.sql.advance_txs, height, txs, header, self.daemon.cached_height(), forward_timer=True)
if (height % 10000 == 0 or not self.db.first_sync) and self.logger.isEnabledFor(20):
if (height % 10000 == 0 or not self.db.first_sync) and self.logger.isEnabledFor(10):
self.timer.show(height=height)
return undo
+4 -4
View File
@@ -12,9 +12,9 @@ from lbry.wallet.server.util import cachedproperty, subclasses
from lbry.wallet.server.hash import Base58, hash160, double_sha256, hash_to_hex_str, HASHX_LEN
from lbry.wallet.server.daemon import Daemon, LBCDaemon
from lbry.wallet.server.script import ScriptPubKey, OpCodes
from lbry.wallet.server.leveldb import DB
from lbry.wallet.server.leveldb import LevelDB
from lbry.wallet.server.session import LBRYElectrumX, LBRYSessionManager
from lbry.wallet.server.db.writer import LBRYDB
from lbry.wallet.server.db.writer import LBRYLevelDB
from lbry.wallet.server.block_processor import LBRYBlockProcessor
@@ -41,7 +41,7 @@ class Coin:
DAEMON = Daemon
BLOCK_PROCESSOR = LBRYBlockProcessor
SESSION_MANAGER = LBRYSessionManager
DB = DB
DB = LevelDB
HEADER_VALUES = [
'version', 'prev_block_hash', 'merkle_root', 'timestamp', 'bits', 'nonce'
]
@@ -240,7 +240,7 @@ class LBC(Coin):
BLOCK_PROCESSOR = LBRYBlockProcessor
SESSION_MANAGER = LBRYSessionManager
DESERIALIZER = DeserializerSegWit
DB = LBRYDB
DB = LBRYLevelDB
NAME = "LBRY"
SHORTNAME = "LBC"
NET = "mainnet"
+23 -5
View File
@@ -9,7 +9,7 @@ import aiohttp
from lbry.wallet.rpc.jsonrpc import RPCError
from lbry.wallet.server.util import hex_to_bytes, class_logger
from lbry.wallet.rpc import JSONRPC
from lbry.wallet.server.prometheus import LBRYCRD_REQUEST_TIMES, LBRYCRD_PENDING_COUNT
class DaemonError(Exception):
"""Raised when the daemon returns an error in its results."""
@@ -106,6 +106,7 @@ class Daemon:
Handles temporary connection issues. Daemon response errors
are raise through DaemonError.
"""
def log_error(error):
nonlocal last_error_log, retry
now = time.time()
@@ -119,8 +120,13 @@ class Daemon:
last_error_log = 0
data = json.dumps(payload)
retry = self.init_retry
methods = tuple(
[payload['method']] if isinstance(payload, dict) else [request['method'] for request in payload]
)
while True:
try:
for method in methods:
LBRYCRD_PENDING_COUNT.labels(method=method).inc()
result = await self._send_data(data)
result = processor(result)
if on_good_message:
@@ -143,12 +149,17 @@ class Daemon:
except WorkQueueFullError:
log_error('work queue full.')
on_good_message = 'running normally'
finally:
for method in methods:
LBRYCRD_PENDING_COUNT.labels(method=method).dec()
await asyncio.sleep(retry)
retry = max(min(self.max_retry, retry * 2), self.init_retry)
async def _send_single(self, method, params=None):
"""Send a single request to the daemon."""
start = time.perf_counter()
def processor(result):
err = result['error']
if not err:
@@ -160,7 +171,9 @@ class Daemon:
payload = {'method': method, 'id': next(self.id_counter)}
if params:
payload['params'] = params
return await self._send(payload, processor)
result = await self._send(payload, processor)
LBRYCRD_REQUEST_TIMES.labels(method=method).observe(time.perf_counter() - start)
return result
async def _send_vector(self, method, params_iterable, replace_errs=False):
"""Send several requests of the same method.
@@ -168,6 +181,9 @@ class Daemon:
The result will be an array of the same length as params_iterable.
If replace_errs is true, any item with an error is returned as None,
otherwise an exception is raised."""
start = time.perf_counter()
def processor(result):
errs = [item['error'] for item in result if item['error']]
if any(err.get('code') == self.WARMING_UP for err in errs):
@@ -178,9 +194,11 @@ class Daemon:
payload = [{'method': method, 'params': p, 'id': next(self.id_counter)}
for p in params_iterable]
result = []
if payload:
return await self._send(payload, processor)
return []
result = await self._send(payload, processor)
LBRYCRD_REQUEST_TIMES.labels(method=method).observe(time.perf_counter()-start)
return result
async def _is_rpc_available(self, method):
"""Return whether given RPC method is available in the daemon.
+85 -48
View File
@@ -4,17 +4,17 @@ import apsw
import logging
from operator import itemgetter
from typing import Tuple, List, Dict, Union, Type, Optional
from binascii import unhexlify
from binascii import unhexlify, hexlify
from decimal import Decimal
from contextvars import ContextVar
from functools import wraps
from dataclasses import dataclass
from lbry.wallet.database import query, interpolate
from lbry.error import ResolveCensoredError
from lbry.schema.url import URL, normalize_name
from lbry.schema.tags import clean_tags
from lbry.schema.result import Outputs
from lbry.schema.result import Outputs, Censor
from lbry.wallet import Ledger, RegTestLedger
from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS
@@ -37,7 +37,7 @@ ATTRIBUTE_ARRAY_MAX_LENGTH = 100
INTEGER_PARAMS = {
'height', 'creation_height', 'activation_height', 'expiration_height',
'timestamp', 'creation_timestamp', 'release_time', 'fee_amount',
'timestamp', 'creation_timestamp', 'duration', 'release_time', 'fee_amount',
'tx_position', 'channel_join', 'reposted',
'amount', 'effective_amount', 'support_amount',
'trending_group', 'trending_mixed',
@@ -47,7 +47,7 @@ INTEGER_PARAMS = {
SEARCH_PARAMS = {
'name', 'text', 'claim_id', 'claim_ids', 'txid', 'nout', 'channel', 'channel_ids', 'not_channel_ids',
'public_key_id', 'claim_type', 'stream_types', 'media_types', 'fee_currency',
'has_channel_signature', 'signature_valid', 'blocklist_channel_ids',
'has_channel_signature', 'signature_valid',
'any_tags', 'all_tags', 'not_tags', 'reposted_claim_id',
'any_locations', 'all_locations', 'not_locations',
'any_languages', 'all_languages', 'not_languages',
@@ -70,6 +70,10 @@ class ReaderState:
ledger: Type[Ledger]
query_timeout: float
log: logging.Logger
blocked_streams: Dict
blocked_channels: Dict
filtered_streams: Dict
filtered_channels: Dict
def close(self):
self.db.close()
@@ -88,20 +92,37 @@ class ReaderState:
self.db.setprogresshandler(interruptor, 100)
def get_resolve_censor(self) -> Censor:
return Censor(self.blocked_streams, self.blocked_channels)
def get_search_censor(self) -> Censor:
return Censor(self.filtered_streams, self.filtered_channels)
ctx: ContextVar[Optional[ReaderState]] = ContextVar('ctx')
def initializer(log, _path, _ledger_name, query_timeout, _measure=False):
def row_factory(cursor, row):
return {
k[0]: (set(row[i].split(',')) if k[0] == 'tags' else row[i])
for i, k in enumerate(cursor.getdescription())
}
def initializer(log, _path, _ledger_name, query_timeout, _measure=False, block_and_filter=None):
db = apsw.Connection(_path, flags=apsw.SQLITE_OPEN_READONLY | apsw.SQLITE_OPEN_URI)
def row_factory(cursor, row):
return {k[0]: row[i] for i, k in enumerate(cursor.getdescription())}
db.setrowtrace(row_factory)
if block_and_filter:
blocked_streams, blocked_channels, filtered_streams, filtered_channels = block_and_filter
else:
blocked_streams = blocked_channels = filtered_streams = filtered_channels = {}
ctx.set(
ReaderState(
db=db, stack=[], metrics={}, is_tracking_metrics=_measure,
ledger=Ledger if _ledger_name == 'mainnet' else RegTestLedger,
query_timeout=query_timeout, log=log
query_timeout=query_timeout, log=log,
blocked_streams=blocked_streams, blocked_channels=blocked_channels,
filtered_streams=filtered_streams, filtered_channels=filtered_channels,
)
)
@@ -159,11 +180,28 @@ def encode_result(result):
@measure
def execute_query(sql, values) -> List:
def execute_query(sql, values, row_offset: int, row_limit: int, censor: Censor) -> List:
context = ctx.get()
context.set_query_timeout()
try:
return context.db.cursor().execute(sql, values).fetchall()
c = context.db.cursor()
def row_filter(cursor, row):
nonlocal row_offset
row = row_factory(cursor, row)
if len(row) > 1 and censor.censor(row):
return
if row_offset:
row_offset -= 1
return
return row
c.setrowtrace(row_filter)
i, rows = 0, []
for row in c.execute(sql, values):
i += 1
rows.append(row)
if i >= row_limit:
break
return rows
except apsw.Error as err:
plain_sql = interpolate(sql, values)
if context.is_tracking_metrics:
@@ -175,10 +213,13 @@ def execute_query(sql, values) -> List:
raise SQLiteOperationalError(context.metrics)
def _get_claims(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
if 'order_by' in constraints:
order_by_parts = constraints['order_by']
if isinstance(order_by_parts, str):
order_by_parts = [order_by_parts]
sql_order_by = []
for order_by in constraints['order_by']:
for order_by in order_by_parts:
is_asc = order_by.startswith('^')
column = order_by[1:] if is_asc else order_by
if column not in ORDER_FIELDS:
@@ -256,21 +297,6 @@ def _get_claims(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
'claim.signature_valid__is_null': True,
'claim.channel_hash__not_in': not_channel_ids_binary
}
if 'blocklist_channel_ids' in constraints:
blocklist_ids = constraints.pop('blocklist_channel_ids')
if blocklist_ids:
blocking_channels = [
unhexlify(channel_id)[::-1] for channel_id in blocklist_ids
]
constraints.update({
f'$blocking_channel{i}': a for i, a in enumerate(blocking_channels)
})
blocklist = ', '.join([
f':$blocking_channel{i}' for i in range(len(blocking_channels))
])
constraints['claim.claim_hash__not_in#blocklist_channel_ids'] = f"""
SELECT reposted_claim_hash FROM claim WHERE channel_hash IN ({blocklist})
"""
if 'signature_valid' in constraints:
has_channel_signature = constraints.pop('has_channel_signature', False)
if has_channel_signature:
@@ -319,7 +345,7 @@ def _get_claims(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
return query(select, **constraints)
def get_claims(cols, for_count=False, **constraints) -> List:
def select_claims(censor: Censor, cols: str, for_count=False, **constraints) -> List:
if 'channel' in constraints:
channel_url = constraints.pop('channel')
match = resolve_url(channel_url)
@@ -327,21 +353,24 @@ def get_claims(cols, for_count=False, **constraints) -> List:
constraints['channel_hash'] = match['claim_hash']
else:
return [{'row_count': 0}] if cols == 'count(*) as row_count' else []
sql, values = _get_claims(cols, for_count, **constraints)
return execute_query(sql, values)
row_offset = constraints.pop('offset', 0)
row_limit = constraints.pop('limit', 20)
sql, values = claims_query(cols, for_count, **constraints)
return execute_query(sql, values, row_offset, row_limit, censor)
@measure
def get_claims_count(**constraints) -> int:
def count_claims(**constraints) -> int:
constraints.pop('offset', None)
constraints.pop('limit', None)
constraints.pop('order_by', None)
count = get_claims('count(*) as row_count', for_count=True, **constraints)
count = select_claims(Censor(), 'count(*) as row_count', for_count=True, **constraints)
return count[0]['row_count']
def _search(**constraints):
return get_claims(
def search_claims(censor: Censor, **constraints) -> List:
return select_claims(
censor,
"""
claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
@@ -359,48 +388,52 @@ def _search(**constraints):
)
def _get_referenced_rows(txo_rows: List[dict]):
def _get_referenced_rows(censor: Censor, txo_rows: List[dict]):
repost_hashes = set(filter(None, map(itemgetter('reposted_claim_hash'), txo_rows)))
channel_hashes = set(filter(None, map(itemgetter('channel_hash'), txo_rows)))
reposted_txos = []
if repost_hashes:
reposted_txos = _search(**{'claim.claim_hash__in': repost_hashes})
reposted_txos = search_claims(censor, **{'claim.claim_hash__in': repost_hashes})
channel_hashes |= set(filter(None, map(itemgetter('channel_hash'), reposted_txos)))
channel_txos = []
if channel_hashes:
channel_txos = _search(**{'claim.claim_hash__in': channel_hashes})
channel_txos = search_claims(censor, **{'claim.claim_hash__in': channel_hashes})
# channels must come first for client side inflation to work properly
return channel_txos + reposted_txos
@measure
def search(constraints) -> Tuple[List, List, int, int]:
def search(constraints) -> Tuple[List, List, int, int, Censor]:
assert set(constraints).issubset(SEARCH_PARAMS), \
f"Search query contains invalid arguments: {set(constraints).difference(SEARCH_PARAMS)}"
total = None
if not constraints.pop('no_totals', False):
total = get_claims_count(**constraints)
total = count_claims(**constraints)
constraints['offset'] = abs(constraints.get('offset', 0))
constraints['limit'] = min(abs(constraints.get('limit', 10)), 50)
if 'order_by' not in constraints:
constraints['order_by'] = ["claim_hash"]
txo_rows = _search(**constraints)
extra_txo_rows = _get_referenced_rows(txo_rows)
return txo_rows, extra_txo_rows, constraints['offset'], total
context = ctx.get()
search_censor = context.get_search_censor()
txo_rows = search_claims(search_censor, **constraints)
extra_txo_rows = _get_referenced_rows(context.get_resolve_censor(), txo_rows)
return txo_rows, extra_txo_rows, constraints['offset'], total, search_censor
@measure
def resolve(urls) -> Tuple[List, List]:
txo_rows = [resolve_url(raw_url) for raw_url in urls]
extra_txo_rows = _get_referenced_rows([r for r in txo_rows if isinstance(r, dict)])
extra_txo_rows = _get_referenced_rows(
ctx.get().get_resolve_censor(), [r for r in txo_rows if isinstance(r, dict)]
)
return txo_rows, extra_txo_rows
@measure
def resolve_url(raw_url):
censor = ctx.get().get_resolve_censor()
try:
url = URL.parse(raw_url)
@@ -415,9 +448,11 @@ def resolve_url(raw_url):
query['is_controlling'] = True
else:
query['order_by'] = ['^creation_height']
matches = _search(**query, limit=1)
matches = search_claims(censor, **query, limit=1)
if matches:
channel = matches[0]
elif censor.censored:
return ResolveCensoredError(raw_url, hexlify(next(iter(censor.censored))[::-1]).decode())
else:
return LookupError(f'Could not find channel in "{raw_url}".')
@@ -433,11 +468,13 @@ def resolve_url(raw_url):
query['signature_valid'] = 1
elif set(query) == {'name'}:
query['is_controlling'] = 1
matches = _search(**query, limit=1)
matches = search_claims(censor, **query, limit=1)
if matches:
return matches[0]
elif censor.censored:
return ResolveCensoredError(raw_url, hexlify(next(iter(censor.censored))[::-1]).decode())
else:
return LookupError(f'Could not find stream in "{raw_url}".')
return LookupError(f'Could not find claim at "{raw_url}".')
return channel
@@ -0,0 +1,8 @@
from . import zscore
from . import ar
TRENDING_ALGORITHMS = {
'zscore': zscore,
'ar': ar
}
+265
View File
@@ -0,0 +1,265 @@
import copy
import math
import time
# Half life in blocks
HALF_LIFE = 134
# Decay coefficient per block
DECAY = 0.5**(1.0/HALF_LIFE)
# How frequently to write trending values to the db
SAVE_INTERVAL = 10
# Renormalisation interval
RENORM_INTERVAL = 1000
# Assertion
assert RENORM_INTERVAL % SAVE_INTERVAL == 0
# Decay coefficient per renormalisation interval
DECAY_PER_RENORM = DECAY**(RENORM_INTERVAL)
# Log trending calculations?
TRENDING_LOG = True
def install(connection):
"""
Install the AR trending algorithm.
"""
check_trending_values(connection)
if TRENDING_LOG:
f = open("trending_ar.log", "a")
f.close()
# Stub
CREATE_TREND_TABLE = ""
def check_trending_values(connection):
"""
If the trending values appear to be based on the zscore algorithm,
reset them. This will allow resyncing from a standard snapshot.
"""
c = connection.cursor()
needs_reset = False
for row in c.execute("SELECT COUNT(*) num FROM claim WHERE trending_global <> 0;"):
if row[0] != 0:
needs_reset = True
break
if needs_reset:
print("Resetting some columns. This might take a while...", flush=True, end="")
c.execute(""" BEGIN;
UPDATE claim SET trending_group = 0;
UPDATE claim SET trending_mixed = 0;
UPDATE claim SET trending_global = 0;
UPDATE claim SET trending_local = 0;
COMMIT;""")
print("done.")
def spike_height(trending_score, x, x_old, time_boost=1.0):
"""
Compute the size of a trending spike.
"""
# Change in softened amount
change_in_softened_amount = x**0.25 - x_old**0.25
# Softened change in amount
delta = x - x_old
softened_change_in_amount = abs(delta)**0.25
# Softened change in amount counts more for minnows
if delta > 0.0:
multiplier = 1.0/math.sqrt(x + 1.0)
softened_change_in_amount *= multiplier
else:
softened_change_in_amount *= -1.0
return time_boost*(softened_change_in_amount + change_in_softened_amount)
def get_time_boost(height):
"""
Return the time boost at a given height.
"""
return 1.0/DECAY**(height % RENORM_INTERVAL)
def trending_log(s):
"""
Log a string.
"""
if TRENDING_LOG:
fout = open("trending_ar.log", "a")
fout.write(s)
fout.flush()
fout.close()
class TrendingData:
"""
An object of this class holds trending data
"""
def __init__(self):
self.claims = {}
# Have all claims been read from db yet?
self.initialised = False
def insert_claim_from_load(self, claim_hash, trending_score, total_amount):
assert not self.initialised
self.claims[claim_hash] = {"trending_score": trending_score,
"total_amount": total_amount,
"changed": False}
def update_claim(self, claim_hash, total_amount, time_boost=1.0):
"""
Update trending data for a claim, given its new total amount.
"""
assert self.initialised
# Extract existing total amount and trending score
# or use starting values if the claim is new
if claim_hash in self.claims:
old_state = copy.deepcopy(self.claims[claim_hash])
else:
old_state = {"trending_score": 0.0,
"total_amount": 0.0,
"changed": False}
# Calculate LBC change
change = total_amount - old_state["total_amount"]
# Modify data if there was an LBC change
if change != 0.0:
spike = spike_height(old_state["trending_score"],
total_amount,
old_state["total_amount"],
time_boost)
trending_score = old_state["trending_score"] + spike
self.claims[claim_hash] = {"total_amount": total_amount,
"trending_score": trending_score,
"changed": True}
def test_trending():
"""
Quick trending test for something receiving 10 LBC per block
"""
data = TrendingData()
data.insert_claim_from_load("abc", 10.0, 1.0)
data.initialised = True
for height in range(1, 5000):
if height % RENORM_INTERVAL == 0:
data.claims["abc"]["trending_score"] *= DECAY_PER_RENORM
time_boost = get_time_boost(height)
data.update_claim("abc", data.claims["abc"]["total_amount"] + 10.0,
time_boost=time_boost)
print(str(height) + " " + str(time_boost) + " " \
+ str(data.claims["abc"]["trending_score"]))
# One global instance
# pylint: disable=C0103
trending_data = TrendingData()
def run(db, height, final_height, recalculate_claim_hashes):
if height < final_height - 5*HALF_LIFE:
trending_log("Skipping AR trending at block {h}.\n".format(h=height))
return
start = time.time()
trending_log("Calculating AR trending at block {h}.\n".format(h=height))
trending_log(" Length of trending data = {l}.\n"\
.format(l=len(trending_data.claims)))
# Renormalise trending scores and mark all as having changed
if height % RENORM_INTERVAL == 0:
trending_log(" Renormalising trending scores...")
keys = trending_data.claims.keys()
for key in keys:
if trending_data.claims[key]["trending_score"] != 0.0:
trending_data.claims[key]["trending_score"] *= DECAY_PER_RENORM
trending_data.claims[key]["changed"] = True
# Tiny becomes zero
if abs(trending_data.claims[key]["trending_score"]) < 1E-9:
trending_data.claims[key]["trending_score"] = 0.0
trending_log("done.\n")
# Regular message.
trending_log(" Reading total_amounts from db and updating"\
+ " trending scores in RAM...")
# Get the value of the time boost
time_boost = get_time_boost(height)
# Update claims from db
if not trending_data.initialised:
# On fresh launch
for row in db.execute("""
SELECT claim_hash, trending_mixed,
(amount + support_amount)
AS total_amount
FROM claim;
"""):
trending_data.insert_claim_from_load(row[0], row[1], 1E-8*row[2])
trending_data.initialised = True
else:
for row in db.execute(f"""
SELECT claim_hash,
(amount + support_amount)
AS total_amount
FROM claim
WHERE claim_hash IN
({','.join('?' for _ in recalculate_claim_hashes)});
""", recalculate_claim_hashes):
trending_data.update_claim(row[0], 1E-8*row[1], time_boost)
trending_log("done.\n")
# Write trending scores to DB
if height % SAVE_INTERVAL == 0:
trending_log(" Writing trending scores to db...")
the_list = []
keys = trending_data.claims.keys()
for key in keys:
if trending_data.claims[key]["changed"]:
the_list.append((trending_data.claims[key]["trending_score"],
key))
trending_data.claims[key]["changed"] = False
trending_log("{n} scores to write...".format(n=len(the_list)))
db.executemany("UPDATE claim SET trending_mixed=? WHERE claim_hash=?;",
the_list)
trending_log("done.\n")
trending_log("Trending operations took {time} seconds.\n\n"\
.format(time=time.time() - start))
if __name__ == "__main__":
test_trending()
@@ -52,11 +52,12 @@ class ZScore:
return cls(), cls.step, cls.finalize
def register_trending_functions(connection):
def install(connection):
connection.createaggregatefunction("zscore", ZScore.factory, 1)
connection.cursor().execute(CREATE_TREND_TABLE)
def calculate_trending(db, height, final_height):
def run(db, height, final_height, affected_claims):
# don't start tracking until we're at the end of initial sync
if height < (final_height - (TRENDING_WINDOW * TRENDING_DATA_POINTS)):
return
+96 -14
View File
@@ -4,8 +4,10 @@ from typing import Union, Tuple, Set, List
from itertools import chain
from decimal import Decimal
from collections import namedtuple
from multiprocessing import Manager
from binascii import unhexlify
from lbry.wallet.server.leveldb import DB
from lbry.wallet.server.leveldb import LevelDB
from lbry.wallet.server.util import class_logger
from lbry.wallet.database import query, constraints_to_sql
@@ -15,9 +17,7 @@ from lbry.wallet import Ledger, RegTestLedger
from lbry.wallet.transaction import Transaction, Output
from lbry.wallet.server.db.canonical import register_canonical_functions
from lbry.wallet.server.db.full_text_search import update_full_text_search, CREATE_FULL_TEXT_SEARCH, first_sync_finished
from lbry.wallet.server.db.trending import (
CREATE_TREND_TABLE, calculate_trending, register_trending_functions
)
from lbry.wallet.server.db.trending import TRENDING_ALGORITHMS
from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS
@@ -63,6 +63,7 @@ class SQLDB:
media_type text,
fee_amount integer default 0,
fee_currency text,
duration integer,
-- reposts
reposted_claim_hash bytes,
@@ -136,6 +137,14 @@ class SQLDB:
create unique index if not exists filter_fee_amount_order_release_time_idx on claim (fee_amount, release_time, claim_hash);
create unique index if not exists claim_type_trending_idx on claim (claim_type, trending_global, trending_mixed, claim_hash);
create unique index if not exists claim_type_release_idx on claim (claim_type, release_time, claim_hash);
create unique index if not exists claim_type_effective_amount_idx on claim (claim_type, effective_amount, claim_hash);
create unique index if not exists channel_hash_release_time_idx on claim (channel_hash, release_time, claim_hash);
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, trending_global, trending_mixed, claim_hash);
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, effective_amount, claim_hash);
create unique index if not exists filter_stream_duration_idx on claim (duration, trending_global, trending_mixed, claim_hash);
-- TODO: verify that all indexes below are used
create index if not exists claim_height_normalized_idx on claim (height, normalized asc);
@@ -159,20 +168,32 @@ class SQLDB:
CREATE_TABLES_QUERY = (
CREATE_CLAIM_TABLE +
CREATE_TREND_TABLE +
CREATE_FULL_TEXT_SEARCH +
CREATE_SUPPORT_TABLE +
CREATE_CLAIMTRIE_TABLE +
CREATE_TAG_TABLE
)
def __init__(self, main, path):
def __init__(
self, main, path: str, blocking_channels: list, filtering_channels: list, trending: list):
self.main = main
self._db_path = path
self.db = None
self.logger = class_logger(__name__, self.__class__.__name__)
self.ledger = Ledger if self.main.coin.NET == 'mainnet' else RegTestLedger
self.ledger = Ledger if main.coin.NET == 'mainnet' else RegTestLedger
self._fts_synced = False
self.state_manager = None
self.blocked_streams = None
self.blocked_channels = None
self.blocking_channel_hashes = {
unhexlify(channel_id)[::-1] for channel_id in blocking_channels if channel_id
}
self.filtered_streams = None
self.filtered_channels = None
self.filtering_channel_hashes = {
unhexlify(channel_id)[::-1] for channel_id in filtering_channels if channel_id
}
self.trending = trending
def open(self):
self.db = apsw.Connection(
@@ -191,11 +212,50 @@ class SQLDB:
self.execute(self.PRAGMAS)
self.execute(self.CREATE_TABLES_QUERY)
register_canonical_functions(self.db)
register_trending_functions(self.db)
self.state_manager = Manager()
self.blocked_streams = self.state_manager.dict()
self.blocked_channels = self.state_manager.dict()
self.filtered_streams = self.state_manager.dict()
self.filtered_channels = self.state_manager.dict()
self.update_blocked_and_filtered_claims()
for algorithm in self.trending:
algorithm.install(self.db)
def close(self):
if self.db is not None:
self.db.close()
if self.state_manager is not None:
self.state_manager.shutdown()
def update_blocked_and_filtered_claims(self):
self.update_claims_from_channel_hashes(
self.blocked_streams, self.blocked_channels, self.blocking_channel_hashes
)
self.update_claims_from_channel_hashes(
self.filtered_streams, self.filtered_channels, self.filtering_channel_hashes
)
self.filtered_streams.update(self.blocked_streams)
self.filtered_channels.update(self.blocked_channels)
def update_claims_from_channel_hashes(self, shared_streams, shared_channels, channel_hashes):
streams, channels = {}, {}
if channel_hashes:
sql = query(
"SELECT claim.channel_hash, claim.reposted_claim_hash, reposted.claim_type "
"FROM claim JOIN claim AS reposted ON (reposted.claim_hash=claim.reposted_claim_hash)", **{
'claim.reposted_claim_hash__is_not_null': 1,
'claim.channel_hash__in': channel_hashes
}
)
for blocked_claim in self.execute(*sql):
if blocked_claim.claim_type == CLAIM_TYPES['stream']:
streams[blocked_claim.reposted_claim_hash] = blocked_claim.channel_hash
elif blocked_claim.claim_type == CLAIM_TYPES['channel']:
channels[blocked_claim.reposted_claim_hash] = blocked_claim.channel_hash
shared_streams.clear()
shared_streams.update(streams)
shared_channels.clear()
shared_channels.update(channels)
@staticmethod
def _insert_sql(table: str, data: dict) -> Tuple[str, list]:
@@ -263,6 +323,7 @@ class SQLDB:
'title': None,
'description': None,
'author': None,
'duration': None,
'claim_type': None,
'stream_type': None,
'media_type': None,
@@ -286,6 +347,10 @@ class SQLDB:
claim_record['title'] = claim.stream.title
claim_record['description'] = claim.stream.description
claim_record['author'] = claim.stream.author
if claim.stream.video and claim.stream.video.duration:
claim_record['duration'] = claim.stream.video.duration
if claim.stream.audio and claim.stream.audio.duration:
claim_record['duration'] = claim.stream.audio.duration
if claim.stream.release_time:
claim_record['release_time'] = claim.stream.release_time
if claim.stream.has_fee:
@@ -319,12 +384,12 @@ class SQLDB:
INSERT OR IGNORE INTO claim (
claim_hash, claim_id, claim_name, normalized, txo_hash, tx_position, amount,
claim_type, media_type, stream_type, timestamp, creation_timestamp,
fee_currency, fee_amount, title, description, author, height, reposted_claim_hash,
fee_currency, fee_amount, title, description, author, duration, height, reposted_claim_hash,
creation_height, release_time, activation_height, expiration_height, short_url)
VALUES (
:claim_hash, :claim_id, :claim_name, :normalized, :txo_hash, :tx_position, :amount,
:claim_type, :media_type, :stream_type, :timestamp, :timestamp,
:fee_currency, :fee_amount, :title, :description, :author, :height, :reposted_claim_hash, :height,
:fee_currency, :fee_amount, :title, :description, :author, :duration, :height, :reposted_claim_hash, :height,
CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE :timestamp END,
CASE WHEN :normalized NOT IN (SELECT normalized FROM claimtrie) THEN :height END,
CASE WHEN :height >= 137181 THEN :height+2102400 ELSE :height+262974 END,
@@ -342,7 +407,7 @@ class SQLDB:
txo_hash=:txo_hash, tx_position=:tx_position, amount=:amount, height=:height,
claim_type=:claim_type, media_type=:media_type, stream_type=:stream_type,
timestamp=:timestamp, fee_amount=:fee_amount, fee_currency=:fee_currency,
title=:title, description=:description, author=:author, reposted_claim_hash=:reposted_claim_hash,
title=:title, duration=:duration, description=:description, author=:author, reposted_claim_hash=:reposted_claim_hash,
release_time=CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE release_time END
WHERE claim_hash=:claim_hash;
""", claims)
@@ -585,6 +650,13 @@ class SQLDB:
""", [(channel_hash,) for channel_hash in all_channel_keys.keys()])
sub_timer.stop()
sub_timer = timer.add_timer('update blocked claims list')
sub_timer.start()
if (self.blocking_channel_hashes.intersection(all_channel_keys) or
self.filtering_channel_hashes.intersection(all_channel_keys)):
self.update_blocked_and_filtered_claims()
sub_timer.stop()
def _update_support_amount(self, claim_hashes):
if claim_hashes:
self.execute(f"""
@@ -772,18 +844,28 @@ class SQLDB:
update_claims, delete_claim_hashes, affected_channels, forward_timer=True)
r(self.insert_supports, insert_supports)
r(self.update_claimtrie, height, recalculate_claim_hashes, deleted_claim_names, forward_timer=True)
r(calculate_trending, self.db.cursor(), height, daemon_height)
for algorithm in self.trending:
r(algorithm.run, self.db.cursor(), height, daemon_height, recalculate_claim_hashes)
if not self._fts_synced and self.main.first_sync and height == daemon_height:
r(first_sync_finished, self.db.cursor())
self._fts_synced = True
class LBRYDB(DB):
class LBRYLevelDB(LevelDB):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
path = os.path.join(self.env.db_dir, 'claims.db')
self.sql = SQLDB(self, path)
trending = []
for algorithm_name in set(self.env.default('TRENDING_ALGORITHMS', 'zscore').split(' ')):
if algorithm_name in TRENDING_ALGORITHMS:
trending.append(TRENDING_ALGORITHMS[algorithm_name])
self.sql = SQLDB(
self, path,
self.env.default('BLOCKING_CHANNEL_IDS', '').split(' '),
self.env.default('FILTERING_CHANNEL_IDS', '').split(' '),
trending
)
def close(self):
super().close()
+1
View File
@@ -59,6 +59,7 @@ class Env:
self.ssl_certfile = self.required('SSL_CERTFILE')
self.ssl_keyfile = self.required('SSL_KEYFILE')
self.rpc_port = self.integer('RPC_PORT', 8000)
self.prometheus_port = self.integer('PROMETHEUS_PORT', 0)
self.max_subscriptions = self.integer('MAX_SUBSCRIPTIONS', 10000)
self.banner_file = self.default('BANNER_FILE', None)
self.tor_banner_file = self.default('TOR_BANNER_FILE', self.banner_file)
+1 -1
View File
@@ -47,7 +47,7 @@ class FlushData:
tip = attr.ib()
class DB:
class LevelDB:
"""Simple wrapper of the backend database for querying.
Performs no DB update, though the DB will be cleaned on opening if
+82
View File
@@ -0,0 +1,82 @@
import os
from aiohttp import web
from prometheus_client import Counter, Info, generate_latest as prom_generate_latest, Histogram, Gauge
from lbry import __version__ as version
from lbry.build_info import BUILD, COMMIT_HASH, DOCKER_TAG
from lbry.wallet.server import util
import lbry.wallet.server.version as wallet_server_version
NAMESPACE = "wallet_server"
CPU_COUNT = f"{os.cpu_count()}"
VERSION_INFO = Info('build', 'Wallet server build info (e.g. version, commit hash)', namespace=NAMESPACE)
VERSION_INFO.info({
'build': BUILD,
"commit": COMMIT_HASH,
"docker_tag": DOCKER_TAG,
'version': version,
"min_version": util.version_string(wallet_server_version.PROTOCOL_MIN),
"cpu_count": CPU_COUNT
})
SESSIONS_COUNT = Gauge("session_count", "Number of connected client sessions", namespace=NAMESPACE,
labelnames=("version", ))
REQUESTS_COUNT = Counter("requests_count", "Number of requests received", namespace=NAMESPACE,
labelnames=("method", "version"))
RESPONSE_TIMES = Histogram("response_time", "Response times", namespace=NAMESPACE, labelnames=("method", "version"))
NOTIFICATION_COUNT = Counter("notification", "Number of notifications sent (for subscriptions)",
namespace=NAMESPACE, labelnames=("method", "version"))
REQUEST_ERRORS_COUNT = Counter("request_error", "Number of requests that returned errors", namespace=NAMESPACE,
labelnames=("method", "version"))
SQLITE_INTERRUPT_COUNT = Counter("interrupt", "Number of interrupted queries", namespace=NAMESPACE)
SQLITE_OPERATIONAL_ERROR_COUNT = Counter(
"operational_error", "Number of queries that raised operational errors", namespace=NAMESPACE
)
SQLITE_INTERNAL_ERROR_COUNT = Counter(
"internal_error", "Number of queries raising unexpected errors", namespace=NAMESPACE
)
SQLITE_EXECUTOR_TIMES = Histogram("executor_time", "SQLite executor times", namespace=NAMESPACE)
SQLITE_PENDING_COUNT = Gauge(
"pending_queries_count", "Number of pending and running sqlite queries", namespace=NAMESPACE
)
LBRYCRD_REQUEST_TIMES = Histogram(
"lbrycrd_request", "lbrycrd requests count", namespace=NAMESPACE, labelnames=("method",)
)
LBRYCRD_PENDING_COUNT = Gauge(
"lbrycrd_pending_count", "Number of lbrycrd rpcs that are in flight", namespace=NAMESPACE, labelnames=("method",)
)
CLIENT_VERSIONS = Counter(
"clients", "Number of connections received per client version",
namespace=NAMESPACE, labelnames=("version",)
)
BLOCK_COUNT = Gauge(
"block_count", "Number of processed blocks", namespace=NAMESPACE
)
BLOCK_UPDATE_TIMES = Histogram("block_time", "Block update times", namespace=NAMESPACE)
class PrometheusServer:
def __init__(self):
self.logger = util.class_logger(__name__, self.__class__.__name__)
self.runner = None
async def start(self, port: int):
prom_app = web.Application()
prom_app.router.add_get('/metrics', self.handle_metrics_get_request)
self.runner = web.AppRunner(prom_app)
await self.runner.setup()
metrics_site = web.TCPSite(self.runner, "0.0.0.0", port, shutdown_timeout=.5)
await metrics_site.start()
self.logger.info('metrics server listening on %s:%i', *metrics_site._server.sockets[0].getsockname()[:2])
async def handle_metrics_get_request(self, request: web.Request):
try:
return web.Response(
text=prom_generate_latest().decode(),
content_type='text/plain; version=0.0.4'
)
except Exception:
self.logger.exception('could not generate prometheus data')
raise
async def stop(self):
await self.runner.cleanup()
+12
View File
@@ -2,9 +2,11 @@ import signal
import logging
import asyncio
from concurrent.futures.thread import ThreadPoolExecutor
import typing
import lbry
from lbry.wallet.server.mempool import MemPool, MemPoolAPI
from lbry.wallet.server.prometheus import PrometheusServer
class Notifications:
@@ -74,6 +76,7 @@ class Server:
self.daemon = daemon = env.coin.DAEMON(env.coin, env.daemon_url)
self.db = db = env.coin.DB(env)
self.bp = bp = env.coin.BLOCK_PROCESSOR(env, db, daemon, notifications)
self.prometheus_server: typing.Optional[PrometheusServer] = None
# Set notifications up to implement the MemPoolAPI
notifications.height = daemon.height
@@ -107,11 +110,15 @@ class Server:
await self.db.populate_header_merkle_cache()
await _start_cancellable(self.mempool.keep_synchronized)
await _start_cancellable(self.session_mgr.serve, self.notifications)
await self.start_prometheus()
async def stop(self):
for task in reversed(self.cancellable_tasks):
task.cancel()
await asyncio.wait(self.cancellable_tasks)
if self.prometheus_server:
await self.prometheus_server.stop()
self.prometheus_server = None
self.shutdown_event.set()
await self.daemon.close()
@@ -132,3 +139,8 @@ class Server:
finally:
loop.run_until_complete(self.stop())
executor.shutdown(True)
async def start_prometheus(self):
if not self.prometheus_server and self.env.prometheus_port:
self.prometheus_server = PrometheusServer()
await self.prometheus_server.start(self.env.prometheus_port)
+101 -76
View File
@@ -23,10 +23,14 @@ from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import lbry
from lbry.wallet.server.block_processor import LBRYBlockProcessor
from lbry.wallet.server.db.writer import LBRYDB
from lbry.wallet.server.db.writer import LBRYLevelDB
from lbry.wallet.server.db import reader
from lbry.wallet.server.websocket import AdminWebSocket
from lbry.wallet.server.metrics import ServerLoadData, APICallMetrics
from lbry.wallet.server.prometheus import REQUESTS_COUNT, SQLITE_INTERRUPT_COUNT, SQLITE_INTERNAL_ERROR_COUNT
from lbry.wallet.server.prometheus import SQLITE_OPERATIONAL_ERROR_COUNT, SQLITE_EXECUTOR_TIMES, SESSIONS_COUNT
from lbry.wallet.server.prometheus import SQLITE_PENDING_COUNT, CLIENT_VERSIONS
import lbry.wallet.server.version as VERSION
from lbry.wallet.rpc import (
RPCSession, JSONRPCAutoDetect, JSONRPCConnection,
@@ -39,8 +43,6 @@ from lbry.wallet.server.daemon import DaemonError
from lbry.wallet.server.peers import PeerManager
if typing.TYPE_CHECKING:
from lbry.wallet.server.env import Env
from lbry.wallet.server.leveldb import DB
from lbry.wallet.server.block_processor import BlockProcessor
from lbry.wallet.server.mempool import MemPool
from lbry.wallet.server.daemon import Daemon
@@ -119,7 +121,7 @@ class SessionGroup:
class SessionManager:
"""Holds global state about all sessions."""
def __init__(self, env: 'Env', db: 'DB', bp: 'BlockProcessor', daemon: 'Daemon', mempool: 'MemPool',
def __init__(self, env: 'Env', db: LBRYLevelDB, bp: LBRYBlockProcessor, daemon: 'Daemon', mempool: 'MemPool',
shutdown_event: asyncio.Event):
env.max_send = max(350000, env.max_send)
self.env = env
@@ -142,13 +144,6 @@ class SessionManager:
self.session_event = Event()
# Set up the RPC request handlers
cmds = ('add_peer daemon_url disconnect getinfo groups log peers '
'query reorg sessions stop'.split())
LocalRPC.request_handlers.update(
{cmd: getattr(self, 'rpc_' + cmd) for cmd in cmds}
)
async def _start_server(self, kind, *args, **kw_args):
loop = asyncio.get_event_loop()
if kind == 'RPC':
@@ -331,7 +326,7 @@ class SessionManager:
return [(session.session_id,
session.flags(),
session.peer_address_str(for_log=for_log),
session.client,
session.client_version,
session.protocol_version_string(),
session.count_pending_items(),
session.txs_sent,
@@ -635,7 +630,6 @@ class SessionBase(RPCSession):
self.kind = kind # 'RPC', 'TCP' etc.
self.env = session_mgr.env
self.coin = self.env.coin
self.client = 'unknown'
self.anon_logs = self.env.anon_logs
self.txs_sent = 0
self.log_me = False
@@ -679,13 +673,16 @@ class SessionBase(RPCSession):
context = {'conn_id': f'{self.session_id}'}
self.logger = util.ConnectionLogger(self.logger, context)
self.group = self.session_mgr.add_session(self)
self.logger.info(f'{self.kind} {self.peer_address_str()}, '
SESSIONS_COUNT.labels(version=self.client_version).inc()
peer_addr_str = self.peer_address_str()
self.logger.info(f'{self.kind} {peer_addr_str}, '
f'{self.session_mgr.session_count():,d} total')
def connection_lost(self, exc):
"""Handle client disconnection."""
super().connection_lost(exc)
self.session_mgr.remove_session(self)
SESSIONS_COUNT.labels(version=self.client_version).dec()
msg = ''
if not self._can_send.is_set():
msg += ' whilst paused'
@@ -709,8 +706,10 @@ class SessionBase(RPCSession):
"""Handle an incoming request. ElectrumX doesn't receive
notifications from client sessions.
"""
REQUESTS_COUNT.labels(method=request.method, version=self.client_version).inc()
if isinstance(request, Request):
handler = self.request_handlers.get(request.method)
handler = partial(handler, self)
else:
handler = None
coro = handler_invocation(handler, request)()
@@ -747,8 +746,13 @@ class LBRYSessionManager(SessionManager):
path = os.path.join(self.env.db_dir, 'claims.db')
args = dict(
initializer=reader.initializer,
initargs=(self.logger, path, self.env.coin.NET, self.env.database_query_timeout,
self.env.track_metrics)
initargs=(
self.logger, path, self.env.coin.NET, self.env.database_query_timeout,
self.env.track_metrics, (
self.db.sql.blocked_streams, self.db.sql.blocked_channels,
self.db.sql.filtered_streams, self.db.sql.filtered_channels
)
)
)
if self.env.max_query_workers is not None and self.env.max_query_workers == 0:
self.query_executor = ThreadPoolExecutor(max_workers=1, **args)
@@ -773,28 +777,65 @@ class LBRYSessionManager(SessionManager):
class LBRYElectrumX(SessionBase):
"""A TCP server that handles incoming Electrum connections."""
PROTOCOL_MIN = (0, 52, 0)
PROTOCOL_MAX = (0, 99, 0)
PROTOCOL_MIN = VERSION.PROTOCOL_MIN
PROTOCOL_MAX = VERSION.PROTOCOL_MAX
max_errors = math.inf # don't disconnect people for errors! let them happen...
session_mgr: LBRYSessionManager
version = lbry.__version__
@classmethod
def initialize_request_handlers(cls):
cls.request_handlers.update({
'blockchain.block.get_chunk': cls.block_get_chunk,
'blockchain.block.get_header': cls.block_get_header,
'blockchain.estimatefee': cls.estimatefee,
'blockchain.relayfee': cls.relayfee,
'blockchain.scripthash.get_balance': cls.scripthash_get_balance,
'blockchain.scripthash.get_history': cls.scripthash_get_history,
'blockchain.scripthash.get_mempool': cls.scripthash_get_mempool,
'blockchain.scripthash.listunspent': cls.scripthash_listunspent,
'blockchain.scripthash.subscribe': cls.scripthash_subscribe,
'blockchain.transaction.broadcast': cls.transaction_broadcast,
'blockchain.transaction.get': cls.transaction_get,
'blockchain.transaction.get_merkle': cls.transaction_merkle,
'server.add_peer': cls.add_peer,
'server.banner': cls.banner,
'server.donation_address': cls.donation_address,
'server.features': cls.server_features_async,
'server.peers.subscribe': cls.peers_subscribe,
'server.version': cls.server_version,
'blockchain.transaction.get_height': cls.transaction_get_height,
'blockchain.claimtrie.search': cls.claimtrie_search,
'blockchain.claimtrie.resolve': cls.claimtrie_resolve,
'blockchain.claimtrie.getclaimsbyids': cls.claimtrie_getclaimsbyids,
'blockchain.block.get_server_height': cls.get_server_height,
'mempool.get_fee_histogram': cls.mempool_compact_histogram,
'blockchain.block.headers': cls.block_headers,
'server.ping': cls.ping,
'blockchain.headers.subscribe': cls.headers_subscribe_False,
'blockchain.address.get_balance': cls.address_get_balance,
'blockchain.address.get_history': cls.address_get_history,
'blockchain.address.get_mempool': cls.address_get_mempool,
'blockchain.address.listunspent': cls.address_listunspent,
'blockchain.address.subscribe': cls.address_subscribe,
'blockchain.address.unsubscribe': cls.address_unsubscribe,
})
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not LBRYElectrumX.request_handlers:
LBRYElectrumX.initialize_request_handlers()
self.subscribe_headers = False
self.subscribe_headers_raw = False
self.connection.max_response_size = self.env.max_send
self.hashX_subs = {}
self.sv_seen = False
self.mempool_statuses = {}
self.set_request_handlers(self.PROTOCOL_MIN)
# fixme: this is a rebase hack, we need to go through ChainState instead later
self.protocol_tuple = self.PROTOCOL_MIN
self.daemon = self.session_mgr.daemon
self.bp: LBRYBlockProcessor = self.session_mgr.bp
self.db: LBRYDB = self.bp.db
# space separated list of channel URIs used for filtering bad content
filtering_channels = self.env.default('FILTERING_CHANNELS_IDS', '')
self.filtering_channels_ids = list(filter(None, filtering_channels.split(' ')))
self.db: LBRYLevelDB = self.bp.db
@classmethod
def protocol_min_max_strings(cls):
@@ -838,7 +879,12 @@ class LBRYElectrumX(SessionBase):
"""
if height_changed and self.subscribe_headers:
args = (await self.subscribe_headers_result(), )
await self.send_notification('blockchain.headers.subscribe', args)
try:
await self.send_notification('blockchain.headers.subscribe', args)
except asyncio.TimeoutError:
self.logger.info("timeout sending headers notification to %s", self.peer_address_str(for_log=True))
self.abort()
return
touched = touched.intersection(self.hashX_subs)
if touched or (height_changed and self.mempool_statuses):
@@ -866,7 +912,13 @@ class LBRYElectrumX(SessionBase):
method = 'blockchain.scripthash.subscribe'
else:
method = 'blockchain.address.subscribe'
await self.send_notification(method, (alias, status))
try:
await self.send_notification(method, (alias, status))
except asyncio.TimeoutError:
self.logger.info("timeout sending address notification to %s", self.peer_address_str(for_log=True))
self.abort()
return
if changed:
es = '' if len(changed) == 1 else 'es'
@@ -885,6 +937,7 @@ class LBRYElectrumX(SessionBase):
async def run_in_executor(self, query_name, func, kwargs):
start = time.perf_counter()
try:
SQLITE_PENDING_COUNT.inc()
result = await asyncio.get_running_loop().run_in_executor(
self.session_mgr.query_executor, func, kwargs
)
@@ -893,23 +946,28 @@ class LBRYElectrumX(SessionBase):
except reader.SQLiteInterruptedError as error:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_interrupt(start, error.metrics)
SQLITE_INTERRUPT_COUNT.inc()
raise RPCError(JSONRPC.QUERY_TIMEOUT, 'sqlite query timed out')
except reader.SQLiteOperationalError as error:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_error(start, error.metrics)
SQLITE_OPERATIONAL_ERROR_COUNT.inc()
raise RPCError(JSONRPC.INTERNAL_ERROR, 'query failed to execute')
except Exception:
log.exception("dear devs, please handle this exception better")
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_error(start, {})
SQLITE_INTERNAL_ERROR_COUNT.inc()
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')
if self.env.track_metrics:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
(result, metrics_data) = result
metrics.query_response(start, metrics_data)
return base64.b64encode(result).decode()
else:
if self.env.track_metrics:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
(result, metrics_data) = result
metrics.query_response(start, metrics_data)
return base64.b64encode(result).decode()
finally:
SQLITE_PENDING_COUNT.dec()
SQLITE_EXECUTOR_TIMES.observe(time.perf_counter() - start)
async def run_and_cache_query(self, query_name, function, kwargs):
metrics = self.get_metrics_or_placeholder_for_api(query_name)
@@ -932,9 +990,11 @@ class LBRYElectrumX(SessionBase):
metrics.cache_response()
return cache_item.result
async def mempool_compact_histogram(self):
return self.mempool.compact_fee_histogram()
async def claimtrie_search(self, **kwargs):
if kwargs:
kwargs.setdefault('blocklist_channel_ids', []).extend(self.filtering_channels_ids)
return await self.run_and_cache_query('search', reader.search_to_bytes, kwargs)
async def claimtrie_resolve(self, *urls):
@@ -1356,6 +1416,7 @@ class LBRYElectrumX(SessionBase):
client_name: a string identifying the client
protocol_version: the protocol version spoken by the client
"""
if self.sv_seen and self.protocol_tuple >= (1, 4):
raise RPCError(BAD_REQUEST, f'server.version already sent')
self.sv_seen = True
@@ -1367,7 +1428,11 @@ class LBRYElectrumX(SessionBase):
self.close_after_send = True
raise RPCError(BAD_REQUEST,
f'unsupported client: {client_name}')
self.client = client_name[:17]
if self.client_version != client_name[:17]:
SESSIONS_COUNT.labels(version=self.client_version).dec()
self.client_version = client_name[:17]
SESSIONS_COUNT.labels(version=self.client_version).inc()
CLIENT_VERSIONS.labels(version=self.client_version).inc()
# Find the highest common protocol version. Disconnect if
# that protocol version in unsupported.
@@ -1382,8 +1447,7 @@ class LBRYElectrumX(SessionBase):
self.close_after_send = True
raise RPCError(BAD_REQUEST,
f'unsupported protocol version: {protocol_version}')
self.set_request_handlers(ptuple)
self.protocol_tuple = ptuple
return self.version, self.protocol_version_string()
async def transaction_broadcast(self, raw_tx):
@@ -1477,45 +1541,6 @@ class LBRYElectrumX(SessionBase):
else:
return tx_hash
def set_request_handlers(self, ptuple):
self.protocol_tuple = ptuple
handlers = {
'blockchain.block.get_chunk': self.block_get_chunk,
'blockchain.block.get_header': self.block_get_header,
'blockchain.estimatefee': self.estimatefee,
'blockchain.relayfee': self.relayfee,
'blockchain.scripthash.get_balance': self.scripthash_get_balance,
'blockchain.scripthash.get_history': self.scripthash_get_history,
'blockchain.scripthash.get_mempool': self.scripthash_get_mempool,
'blockchain.scripthash.listunspent': self.scripthash_listunspent,
'blockchain.scripthash.subscribe': self.scripthash_subscribe,
'blockchain.transaction.broadcast': self.transaction_broadcast,
'blockchain.transaction.get': self.transaction_get,
'blockchain.transaction.get_merkle': self.transaction_merkle,
'server.add_peer': self.add_peer,
'server.banner': self.banner,
'server.donation_address': self.donation_address,
'server.features': self.server_features_async,
'server.peers.subscribe': self.peers_subscribe,
'server.version': self.server_version,
'blockchain.transaction.get_height': self.transaction_get_height,
'blockchain.claimtrie.search': self.claimtrie_search,
'blockchain.claimtrie.resolve': self.claimtrie_resolve,
'blockchain.claimtrie.getclaimsbyids': self.claimtrie_getclaimsbyids,
'blockchain.block.get_server_height': self.get_server_height,
'mempool.get_fee_histogram': self.mempool.compact_fee_histogram,
'blockchain.block.headers': self.block_headers,
'server.ping': self.ping,
'blockchain.headers.subscribe': self.headers_subscribe_False,
'blockchain.address.get_balance': self.address_get_balance,
'blockchain.address.get_history': self.address_get_history,
'blockchain.address.get_mempool': self.address_get_mempool,
'blockchain.address.listunspent': self.address_listunspent,
'blockchain.address.subscribe': self.address_subscribe,
'blockchain.address.unsubscribe': self.address_unsubscribe,
}
self.request_handlers = handlers
class LocalRPC(SessionBase):
"""A local TCP RPC server session."""
+3
View File
@@ -0,0 +1,3 @@
# need this to avoid circular import
PROTOCOL_MIN = (0, 54, 0)
PROTOCOL_MAX = (0, 99, 0)
+3 -5
View File
@@ -74,12 +74,10 @@ class Wallet:
self.storage = storage or WalletStorage()
self.preferences = TimestampedPreferences(preferences or {})
self.encryption_password = None
self.id = self.get_id()
@property
def id(self):
if self.storage.path:
return os.path.basename(self.storage.path)
return self.name
def get_id(self):
return os.path.basename(self.storage.path) if self.storage.path else self.name
def add_account(self, account: 'Account'):
self.accounts.append(account)
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env python3
import asyncio
import logging
import platform
import sys
# noinspection PyUnresolvedReferences
import lbry.wallet # needed to make the following line work (it's a bug):
from lbry.conf import TranscodeConfig
from lbry.file_analysis import VideoFileAnalyzer
def enable_logging():
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s') # %(asctime)s - %(levelname)s -
handler.setFormatter(formatter)
root.addHandler(handler)
async def process_video(analyzer, video_file):
try:
await analyzer.verify_or_repair(True, False, video_file)
print("No concerns. Ship it!")
except FileNotFoundError as e:
print(str(e))
except Exception as e:
print(str(e))
transcode = input("Would you like to make a repaired clone now? [y/N] ")
if transcode == "y":
try:
new_video_file = await analyzer.verify_or_repair(True, True, video_file)
print("Successfully created ", new_video_file)
except Exception as e:
print("Unable to complete the transcode. Message: ", str(e))
def main():
if len(sys.argv) < 2:
print("Usage: check_video.py <path to video file>", file=sys.stderr)
sys.exit(1)
enable_logging()
video_file = sys.argv[1]
conf = TranscodeConfig()
analyzer = VideoFileAnalyzer(conf)
if sys.version_info < (3, 8) and platform.system() == "Windows":
# TODO: remove after we move to requiring Python 3.8
asyncio.set_event_loop(asyncio.ProactorEventLoop())
try:
asyncio.run(process_video(analyzer, video_file))
except KeyboardInterrupt:
pass
if __name__ == '__main__':
main()
+1 -1
View File
@@ -127,7 +127,7 @@ def release(args):
new_version = current_version.increment(args.action)
print(f' New Version: {new_version}')
previous_release = repo.release_from_tag(current_version.tag)
previous_release = repo.release_from_tag(args.start_tag or current_version.tag)
print(f' Changelog From: {previous_release.tag_name} ({previous_release.created_at})')
print()
+2 -1
View File
@@ -34,7 +34,7 @@ setup(
},
install_requires=[
'aiohttp==3.5.4',
'aioupnp==0.0.16',
'aioupnp==0.0.17',
'appdirs==1.4.3',
'certifi>=2018.11.29',
'colorama==0.3.7',
@@ -44,6 +44,7 @@ setup(
'cryptography==2.5',
'protobuf==3.6.1',
'msgpack==0.6.1',
'prometheus_client==0.7.1',
'ecdsa==0.13.3',
'pyyaml==4.2b1',
'docopt==0.6.2',
@@ -328,6 +328,13 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([image], media_types=['image/png'])
await self.assertFindsClaims([image, video], media_types=['video/mp4', 'image/png'])
# duration
await self.assertFindsClaim(video, duration='>14')
await self.assertFindsClaim(video, duration='<16')
await self.assertFindsClaim(video, duration=15)
await self.assertFindsClaims([], duration='>100')
await self.assertFindsClaims([], duration='<14')
async def test_search_by_text(self):
chan1_id = self.get_claim_id(await self.channel_create('@SatoshiNakamoto'))
chan2_id = self.get_claim_id(await self.channel_create('@Bitcoin'))
@@ -375,6 +382,78 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([], text='cloud')
class ClaimCommands(ClaimTestCase):
async def test_claim_stream_channel_list_with_resolve(self):
await self.channel_create()
await self.stream_create()
r = await self.claim_list()
self.assertNotIn('short_url', r[0])
self.assertNotIn('short_url', r[1])
self.assertNotIn('short_url', (await self.stream_list())[0])
self.assertNotIn('short_url', (await self.channel_list())[0])
r = await self.claim_list(resolve=True)
self.assertIn('short_url', r[0])
self.assertIn('short_url', r[1])
self.assertIn('short_url', (await self.stream_list(resolve=True))[0])
self.assertIn('short_url', (await self.channel_list(resolve=True))[0])
# unconfirmed channel won't resolve
channel_tx = await self.daemon.jsonrpc_channel_create('@foo', '1.0')
await self.ledger.wait(channel_tx)
r = await self.claim_list(resolve=True)
self.assertEqual('not_found', r[0]['meta']['error']['name'])
self.assertTrue(r[1]['meta']['is_controlling'])
r = await self.channel_list(resolve=True)
self.assertEqual('not_found', r[0]['meta']['error']['name'])
self.assertTrue(r[1]['meta']['is_controlling'])
# confirm it
await self.generate(1)
await self.ledger.wait(channel_tx, self.blockchain.block_expected)
# all channel claims resolve
r = await self.claim_list(resolve=True)
self.assertTrue(r[0]['meta']['is_controlling'])
self.assertTrue(r[1]['meta']['is_controlling'])
r = await self.channel_list(resolve=True)
self.assertTrue(r[0]['meta']['is_controlling'])
self.assertTrue(r[1]['meta']['is_controlling'])
# unconfirmed stream won't resolve
stream_tx = await self.daemon.jsonrpc_stream_create(
'foo', '1.0', file_path=self.create_upload_file(data=b'hi')
)
await self.ledger.wait(stream_tx)
r = await self.claim_list(resolve=True)
self.assertEqual('not_found', r[0]['meta']['error']['name'])
self.assertTrue(r[1]['meta']['is_controlling'])
r = await self.stream_list(resolve=True)
self.assertEqual('not_found', r[0]['meta']['error']['name'])
self.assertTrue(r[1]['meta']['is_controlling'])
# confirm it
await self.generate(1)
await self.ledger.wait(stream_tx, self.blockchain.block_expected)
# all claims resolve
r = await self.claim_list(resolve=True)
self.assertTrue(r[0]['meta']['is_controlling'])
self.assertTrue(r[1]['meta']['is_controlling'])
self.assertTrue(r[2]['meta']['is_controlling'])
self.assertTrue(r[3]['meta']['is_controlling'])
r = await self.stream_list(resolve=True)
self.assertTrue(r[0]['meta']['is_controlling'])
self.assertTrue(r[1]['meta']['is_controlling'])
r = await self.channel_list(resolve=True)
self.assertTrue(r[0]['meta']['is_controlling'])
self.assertTrue(r[1]['meta']['is_controlling'])
class ChannelCommands(CommandTestCase):
async def test_create_channel_names(self):
@@ -751,27 +830,52 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(resolved['newstuff-again']['reposted_claim']['name'], 'newstuff')
async def test_filtering_channels_for_removing_content(self):
await self.channel_create('@badstuff', '1.0')
await self.stream_create('not_bad', '1.1', channel_name='@badstuff')
tx = await self.stream_create('too_bad', '1.1', channel_name='@badstuff')
claim_id = self.get_claim_id(tx)
await self.channel_create('@reposts', '1.0')
await self.stream_repost(claim_id, 'normal_repost', '1.2', channel_name='@reposts')
filtering1 = await self.channel_create('@filtering1', '1.0')
filtering1 = self.get_claim_id(filtering1)
await self.stream_repost(claim_id, 'filter1', '1.1', channel_name='@filtering1')
await self.conductor.spv_node.stop()
await self.conductor.spv_node.start(
self.conductor.blockchain_node, extraconf={'FILTERING_CHANNELS_IDS': filtering1}
await self.channel_create('@some_channel', '1.0')
await self.stream_create('good_content', '1.1', channel_name='@some_channel', tags=['good'])
bad_content_id = self.get_claim_id(
await self.stream_create('bad_content', '1.1', channel_name='@some_channel', tags=['bad'])
)
await self.ledger.stop()
await self.ledger.start()
filtered_claim_search = await self.claim_search(name='too_bad')
self.assertEqual(filtered_claim_search, [])
filtered_claim_search = await self.claim_search(name='not_bad')
self.assertEqual(len(filtered_claim_search), 1)
filtered_claim_search = await self.claim_search(name='normal_repost')
self.assertEqual(len(filtered_claim_search), 1)
filtering_channel_id = self.get_claim_id(
await self.channel_create('@filtering', '1.0')
)
self.conductor.spv_node.server.db.sql.filtering_channel_hashes.add(
unhexlify(filtering_channel_id)[::-1]
)
await self.stream_repost(bad_content_id, 'filter1', '1.1', channel_name='@filtering')
# search for blocked content directly
result = await self.out(self.daemon.jsonrpc_claim_search(name='bad_content'))
self.assertEqual([], result['items'])
self.assertEqual({"channels": {filtering_channel_id: 1}, "total": 1}, result['blocked'])
# search channel containing blocked content
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel'))
self.assertEqual(1, len(result['items']))
self.assertEqual({"channels": {filtering_channel_id: 1}, "total": 1}, result['blocked'])
# content was filtered by not_tag before censoring
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel', not_tags=["good", "bad"]))
self.assertEqual(0, len(result['items']))
self.assertEqual({"channels": {}, "total": 0}, result['blocked'])
blocking_channel_id = self.get_claim_id(
await self.channel_create('@blocking', '1.0')
)
self.conductor.spv_node.server.db.sql.blocking_channel_hashes.add(
unhexlify(blocking_channel_id)[::-1]
)
# filtered content can still be resolved
result = await self.out(self.daemon.jsonrpc_resolve('lbry://@some_channel/bad_content'))
self.assertEqual(bad_content_id, result['lbry://@some_channel/bad_content']['claim_id'])
await self.stream_repost(bad_content_id, 'block1', '1.1', channel_name='@blocking')
# blocked content is not resolveable
result = await self.out(self.daemon.jsonrpc_resolve('lbry://@some_channel/bad_content'))
error = result['lbry://@some_channel/bad_content']['error']
self.assertTrue(error['name'], 'blocked')
self.assertTrue(error['text'].startswith("Resolve of 'lbry://@some_channel/bad_content' was censored"))
async def test_publish_updates_file_list(self):
tx = await self.stream_create(title='created')
@@ -72,6 +72,7 @@ class BasicTransactionTest(IntegrationTestCase):
self.assertIn('error', response['lbry://@bar/foo'])
# checks for expected format in inexistent URIs
response = await self.ledger.resolve([], ['lbry://404', 'lbry://@404'])
self.assertEqual('lbry://404 did not resolve to a claim', response['lbry://404']['error'])
self.assertEqual('lbry://@404 did not resolve to a claim', response['lbry://@404']['error'])
response = await self.ledger.resolve([], ['lbry://404', 'lbry://@404', 'lbry://@404/404'])
self.assertEqual('Could not find claim at "lbry://404".', response['lbry://404']['error']['text'])
self.assertEqual('Could not find channel in "lbry://@404".', response['lbry://@404']['error']['text'])
self.assertEqual('Could not find channel in "lbry://@404/404".', response['lbry://@404/404']['error']['text'])
+6 -6
View File
@@ -25,7 +25,7 @@ class NetworkTests(IntegrationTestCase):
'hash_function': 'sha256',
'hosts': {},
'protocol_max': '0.99.0',
'protocol_min': '0.52.0',
'protocol_min': '0.54.0',
'pruning': None,
'description': '',
'payment_address': '',
@@ -44,7 +44,7 @@ class NetworkTests(IntegrationTestCase):
'hash_function': 'sha256',
'hosts': {},
'protocol_max': '0.99.0',
'protocol_min': '0.52.0',
'protocol_min': '0.54.0',
'pruning': None,
'description': 'Fastest server in the west.',
'payment_address': address,
@@ -54,8 +54,6 @@ class NetworkTests(IntegrationTestCase):
class ReconnectTests(IntegrationTestCase):
VERBOSITY = logging.WARN
async def test_multiple_servers(self):
# we have a secondary node that connects later, so
node2 = SPVNode(self.conductor.spv_module, node_number=2)
@@ -80,7 +78,7 @@ class ReconnectTests(IntegrationTestCase):
await self.ledger.stop()
initial_height = self.ledger.local_height_including_downloaded_height
await self.blockchain.generate(100)
while self.conductor.spv_node.server.bp.height < initial_height + 99: # off by 1
while self.conductor.spv_node.server.session_mgr.notified_height < initial_height + 99: # off by 1
await asyncio.sleep(0.1)
self.assertEqual(initial_height, self.ledger.local_height_including_downloaded_height)
# locks header processing so we make sure we are the only ones modifying it
@@ -147,7 +145,9 @@ class ServerPickingTestCase(AsyncioTestCase):
class FakeSession(RPCSession):
async def handle_request(self, request):
await asyncio.sleep(latency)
return {"height": 1}
if request.method == 'server.version':
return tuple(request.args)
return {'height': 1}
server = await self.loop.create_server(lambda: FakeSession(), host='127.0.0.1', port=port)
self.addCleanup(server.close)
return '127.0.0.1', port
@@ -15,6 +15,7 @@ class BaseResolveTestCase(CommandTestCase):
other = (await self.resolve(name))[name]
if claim_id is None:
self.assertIn('error', other)
self.assertEqual(other['error']['name'], 'not_found')
else:
self.assertEqual(claim_id, other['claim_id'])
@@ -183,7 +184,12 @@ class ResolveCommand(BaseResolveTestCase):
# only possible outside a channel
response = await self.resolve('lbry://@abc/on-channel-claim')
self.assertEqual(response, {
'lbry://@abc/on-channel-claim': {'error': 'lbry://@abc/on-channel-claim did not resolve to a claim'}
'lbry://@abc/on-channel-claim': {
'error': {
'name': 'not_found',
'text': 'Could not find claim at "lbry://@abc/on-channel-claim".',
}
}
})
response = (await self.resolve('lbry://on-channel-claim'))['lbry://on-channel-claim']
self.assertFalse(response['is_channel_signature_valid'])
@@ -257,7 +263,12 @@ class ResolveCommand(BaseResolveTestCase):
self.assertFalse(response['bad_example']['is_channel_signature_valid'])
response = await self.resolve('@olds/bad_example')
self.assertEqual(response, {
'@olds/bad_example': {'error': '@olds/bad_example did not resolve to a claim'}
'@olds/bad_example': {
'error': {
'name': 'not_found',
'text': 'Could not find claim at "@olds/bad_example".',
}
}
})
@@ -0,0 +1,151 @@
import logging
import pathlib
import time
from .test_claim_commands import ClaimTestCase
from lbry.conf import TranscodeConfig
from lbry.file_analysis import VideoFileAnalyzer
log = logging.getLogger(__name__)
class MeasureTime:
def __init__(self, text):
print(text, end="...", flush=True)
def __enter__(self):
self.start = time.perf_counter()
def __exit__(self, exc_type, exc_val, exc_tb):
end = time.perf_counter()
print(f" done in {end - self.start:.6f}s", flush=True)
class TranscodeValidation(ClaimTestCase):
def make_name(self, name, extension=""):
path = pathlib.Path(self.video_file_name)
return path.parent / f"{path.stem}_{name}{extension or path.suffix}"
async def asyncSetUp(self):
await super().asyncSetUp()
self.conf = TranscodeConfig()
self.conf.volume_analysis_time = 0 # disable it as the test file isn't very good here
self.analyzer = VideoFileAnalyzer(self.conf)
file_ogg = self.make_name("ogg", ".ogg")
self.video_file_ogg = str(file_ogg)
if not file_ogg.exists():
command = f'-i "{self.video_file_name}" -c:v libtheora -q:v 4 -c:a libvorbis -q:a 4 ' \
f'-c:s copy -c:d copy "{file_ogg}"'
with MeasureTime(f"Creating {file_ogg.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
file_webm = self.make_name("webm", ".webm")
self.video_file_webm = str(file_webm)
if not file_webm.exists():
command = f'-i "{self.video_file_name}" -c:v libvpx-vp9 -crf 36 -b:v 0 -cpu-used 2 ' \
f'-c:a libopus -b:a 128k -c:s copy -c:d copy "{file_webm}"'
with MeasureTime(f"Creating {file_webm.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
async def test_should_work(self):
new_file_name = await self.analyzer.verify_or_repair(True, False, self.video_file_name)
self.assertEqual(self.video_file_name, new_file_name)
new_file_name = await self.analyzer.verify_or_repair(True, False, self.video_file_ogg)
self.assertEqual(self.video_file_ogg, new_file_name)
new_file_name = await self.analyzer.verify_or_repair(True, False, self.video_file_webm)
self.assertEqual(self.video_file_webm, new_file_name)
async def test_volume(self):
self.conf.volume_analysis_time = 200
with self.assertRaisesRegex(Exception, "lower than prime"):
await self.analyzer.verify_or_repair(True, False, self.video_file_name)
async def test_container(self):
file_name = self.make_name("bad_container", ".avi")
if not file_name.exists():
command = f'-i "{self.video_file_name}" -c copy -map 0 "{file_name}"'
with MeasureTime(f"Creating {file_name.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
with self.assertRaisesRegex(Exception, "Container format is not in the approved list"):
await self.analyzer.verify_or_repair(True, False, file_name)
fixed_file = await self.analyzer.verify_or_repair(True, True, file_name)
pathlib.Path(fixed_file).unlink()
async def test_video_codec(self):
file_name = self.make_name("bad_video_codec_1")
if not file_name.exists():
command = f'-i "{self.video_file_name}" -c copy -map 0 -c:v libx265 -preset superfast "{file_name}"'
with MeasureTime(f"Creating {file_name.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
with self.assertRaisesRegex(Exception, "Video codec is not in the approved list"):
await self.analyzer.verify_or_repair(True, False, file_name)
with self.assertRaisesRegex(Exception, "faststart flag was not used"):
await self.analyzer.verify_or_repair(True, False, file_name)
fixed_file = await self.analyzer.verify_or_repair(True, True, file_name)
pathlib.Path(fixed_file).unlink()
async def test_video_format(self):
file_name = self.make_name("bad_video_format_1")
if not file_name.exists():
command = f'-i "{self.video_file_name}" -c copy -map 0 -c:v libx264 ' \
f'-vf format=yuv444p "{file_name}"'
with MeasureTime(f"Creating {file_name.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
with self.assertRaisesRegex(Exception, "pixel format does not match the approved"):
await self.analyzer.verify_or_repair(True, False, file_name)
fixed_file = await self.analyzer.verify_or_repair(True, True, file_name)
pathlib.Path(fixed_file).unlink()
async def test_audio_codec(self):
file_name = self.make_name("bad_audio_codec_1", ".mkv")
if not file_name.exists():
command = f'-i "{self.video_file_name}" -c copy -map 0 -c:a pcm_s16le "{file_name}"'
with MeasureTime(f"Creating {file_name.name}"):
output, code = await self.analyzer._execute("ffmpeg", command)
self.assertEqual(code, 0, output)
with self.assertRaisesRegex(Exception, "Audio codec is not in the approved list"):
await self.analyzer.verify_or_repair(True, False, file_name)
fixed_file = await self.analyzer.verify_or_repair(True, True, file_name)
pathlib.Path(fixed_file).unlink()
async def test_extension_choice(self):
scan_data = await self.analyzer._get_scan_data(True, self.video_file_name)
extension = self.analyzer._get_best_container_extension(scan_data, "")
self.assertEqual(extension, pathlib.Path(self.video_file_name).suffix[1:])
scan_data = await self.analyzer._get_scan_data(True, self.video_file_ogg)
extension = self.analyzer._get_best_container_extension(scan_data, "")
self.assertEqual(extension, "ogg")
scan_data = await self.analyzer._get_scan_data(True, self.video_file_webm)
extension = self.analyzer._get_best_container_extension(scan_data, "")
self.assertEqual(extension, "webm")
extension = self.analyzer._get_best_container_extension("", "libx264 -crf 23")
self.assertEqual("mp4", extension)
extension = self.analyzer._get_best_container_extension("", "libvpx-vp9 -crf 23")
self.assertEqual("webm", extension)
extension = self.analyzer._get_best_container_extension("", "libtheora")
self.assertEqual("ogg", extension)
async def test_no_ffmpeg(self):
self.conf.ffmpeg_folder = "I don't really exist/"
with self.assertRaisesRegex(Exception, "Unable to locate"):
await self.analyzer.verify_or_repair(True, False, self.video_file_name)
@@ -199,8 +199,9 @@ class WalletEncryptionAndSynchronization(CommandTestCase):
await self.confirm_tx(sendtxid, self.daemon2.ledger)
def assertWalletEncrypted(self, wallet_path, encrypted):
wallet = json.load(open(wallet_path))
self.assertEqual(wallet['accounts'][0]['private_key'][1:4] != 'prv', encrypted)
with open(wallet_path) as opened:
wallet = json.load(opened)
self.assertEqual(wallet['accounts'][0]['private_key'][1:4] != 'prv', encrypted)
async def test_sync(self):
daemon, daemon2 = self.daemon, self.daemon2
+11 -2
View File
@@ -87,7 +87,10 @@ class EpicAdventuresOfChris45(CommandTestCase):
response = await self.resolve('lbry://@spam/hovercraft')
self.assertEqual(
response['lbry://@spam/hovercraft'],
{'error': 'lbry://@spam/hovercraft did not resolve to a claim'}
{'error': {
'name': 'not_found',
'text': 'Could not find claim at "lbry://@spam/hovercraft".'
}}
)
# After abandoning he just waits for his LBCs to be returned to his account
@@ -186,4 +189,10 @@ class EpicAdventuresOfChris45(CommandTestCase):
# He them checks that the claim doesn't resolve anymore.
response = await self.resolve(uri)
self.assertEqual(response[uri], {'error': f'{uri} did not resolve to a claim'})
self.assertEqual(
response[uri],
{'error': {
'name': 'not_found',
'text': f'Could not find claim at "{uri}".'
}}
)
@@ -219,6 +219,7 @@ class TestBlobExchange(BlobExchangeTestBase):
server_protocol = BlobServerProtocol(self.loop, self.server_blob_manager, self.server.lbrycrd_address)
transport = asyncio.Transport(extra={'peername': ('ip', 90)})
received_data = BytesIO()
transport.is_closing = lambda: received_data.closed
transport.write = received_data.write
server_protocol.connection_made(transport)
blob_request = BlobRequest.make_request_for_blob_hash(blob_hash).serialize()
+2 -1
View File
@@ -11,7 +11,7 @@ from lbry.dht.node import Node
from lbry.dht.peer import PeerManager, make_kademlia_peer
from lbry.dht.blob_announcer import BlobAnnouncer
from lbry.extras.daemon.storage import SQLiteStorage
from unittest import skip
class TestBlobAnnouncer(AsyncioTestCase):
async def setup_node(self, peer_addresses, address, node_id):
@@ -75,6 +75,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
await peer.ping()
return peer
@skip("Something from a previous test is leaking into this test and causing it to fail intermittently")
async def test_announce_blobs(self):
blob1 = binascii.hexlify(b'1' * 48).decode()
blob2 = binascii.hexlify(b'2' * 48).decode()
+264 -32
View File
@@ -3,12 +3,14 @@ import ecdsa
import hashlib
import logging
from binascii import hexlify
from lbry.wallet.constants import COIN, NULL_HASH32
from typing import List, Tuple
from lbry.wallet.constants import COIN, NULL_HASH32
from lbry.schema.claim import Claim
from lbry.schema.result import Censor
from lbry.wallet.server.db import reader, writer
from lbry.wallet.server.coin import LBCRegTest
from lbry.wallet.server.db.trending import TRENDING_WINDOW
from lbry.wallet.server.db.trending import zscore
from lbry.wallet.server.db.canonical import FindShortestID
from lbry.wallet.server.block_processor import Timer
from lbry.wallet.transaction import Transaction, Input, Output
@@ -28,6 +30,15 @@ def get_tx():
return Transaction().add_inputs([get_input()])
def search(**constraints) -> List:
return reader.search_claims(Censor(), **constraints)
def censored_search(**constraints) -> Tuple[List, Censor]:
rows, _, _, _, censor = reader.search(constraints)
return rows, censor
class TestSQLDB(unittest.TestCase):
query_timeout = 0.25
@@ -36,10 +47,16 @@ class TestSQLDB(unittest.TestCase):
self.daemon_height = 1
self.coin = LBCRegTest()
db_url = 'file:test_sqldb?mode=memory&cache=shared'
self.sql = writer.SQLDB(self, db_url)
self.sql = writer.SQLDB(self, db_url, [], [], [zscore])
self.addCleanup(self.sql.close)
self.sql.open()
reader.initializer(logging.getLogger(__name__), db_url, 'regtest', self.query_timeout)
reader.initializer(
logging.getLogger(__name__), db_url, 'regtest',
self.query_timeout, block_and_filter=(
self.sql.blocked_streams, self.sql.blocked_channels,
self.sql.filtered_streams, self.sql.filtered_channels
)
)
self.addCleanup(reader.cleanup)
self.timer = Timer('BlockProcessor')
self._current_height = 0
@@ -74,9 +91,9 @@ class TestSQLDB(unittest.TestCase):
Input.spend(channel)
)
def get_stream(self, title, amount, name='foo', channel=None):
def get_stream(self, title, amount, name='foo', channel=None, **kwargs):
claim = Claim()
claim.stream.title = title
claim.stream.update(title=title, **kwargs)
result = self._make_tx(Output.pay_claim_name_pubkey_hash(amount, name, claim, b'abc'))
if channel:
result[0].outputs[0].sign(channel)
@@ -96,6 +113,14 @@ class TestSQLDB(unittest.TestCase):
result[0]._reset()
return result
def get_repost(self, claim_id, amount, channel):
claim = Claim()
claim.repost.reference.claim_id = claim_id
result = self._make_tx(Output.pay_claim_name_pubkey_hash(amount, 'repost', claim, b'abc'))
result[0].outputs[0].sign(channel)
result[0]._reset()
return result
def get_abandon(self, tx):
claim = Transaction(tx[0].raw).outputs[0]
return self._make_tx(
@@ -319,7 +344,7 @@ class TestClaimtrie(TestSQLDB):
advance, state = self.advance, self.state
stream = self.get_stream('Claim A', 10*COIN)
advance(10, [stream, self.get_stream_update(stream, 11*COIN)])
self.assertTrue(reader._search())
self.assertTrue(search()[0])
def test_double_updates_in_same_block(self):
advance, state = self.advance, self.state
@@ -327,13 +352,13 @@ class TestClaimtrie(TestSQLDB):
advance(10, [stream])
update = self.get_stream_update(stream, 11*COIN)
advance(20, [update, self.get_stream_update(update, 9*COIN)])
self.assertTrue(reader._search())
self.assertTrue(search()[0])
def test_create_and_abandon_in_same_block(self):
advance, state = self.advance, self.state
stream = self.get_stream('Claim A', 10*COIN)
advance(10, [stream, self.get_abandon(stream)])
self.assertFalse(reader._search())
self.assertFalse(search())
def test_update_and_abandon_in_same_block(self):
advance, state = self.advance, self.state
@@ -341,14 +366,14 @@ class TestClaimtrie(TestSQLDB):
advance(10, [stream])
update = self.get_stream_update(stream, 11*COIN)
advance(20, [update, self.get_abandon(update)])
self.assertFalse(reader._search())
self.assertFalse(search())
def test_create_update_and_delete_in_same_block(self):
advance, state = self.advance, self.state
stream = self.get_stream('Claim A', 10*COIN)
update = self.get_stream_update(stream, 11*COIN)
advance(10, [stream, update, self.get_abandon(update)])
self.assertFalse(reader._search())
self.assertFalse(search())
def test_support_added_and_removed_in_same_block(self):
advance, state = self.advance, self.state
@@ -356,7 +381,7 @@ class TestClaimtrie(TestSQLDB):
advance(10, [stream])
support = self.get_support(stream, COIN)
advance(20, [support, self.get_abandon(support)])
self.assertEqual(reader._search()[0]['support_amount'], 0)
self.assertEqual(search()[0]['support_amount'], 0)
@staticmethod
def _get_x_with_claim_id_prefix(getter, prefix, cached_iteration=None, **kwargs):
@@ -385,7 +410,7 @@ class TestClaimtrie(TestSQLDB):
txo_chan_ab = tx_chan_ab[0].outputs[0]
advance(1, [tx_chan_a])
advance(2, [tx_chan_ab])
r_ab, r_a = reader._search(order_by=['creation_height'], limit=2)
(r_ab, r_a) = search(order_by=['creation_height'], limit=2)
self.assertEqual("@foo#a", r_a['short_url'])
self.assertEqual("@foo#ab", r_ab['short_url'])
self.assertIsNone(r_a['canonical_url'])
@@ -398,7 +423,7 @@ class TestClaimtrie(TestSQLDB):
tx_abc = self.get_stream_with_claim_id_prefix('abc', 65)
advance(3, [tx_a])
advance(4, [tx_ab, tx_abc])
r_abc, r_ab, r_a = reader._search(order_by=['creation_height', 'tx_position'], limit=3)
(r_abc, r_ab, r_a) = search(order_by=['creation_height', 'tx_position'], limit=3)
self.assertEqual("foo#a", r_a['short_url'])
self.assertEqual("foo#ab", r_ab['short_url'])
self.assertEqual("foo#abc", r_abc['short_url'])
@@ -412,51 +437,51 @@ class TestClaimtrie(TestSQLDB):
ab2_claim = tx_ab2[0].outputs[0]
advance(6, [tx_a2])
advance(7, [tx_ab2])
r_ab2, r_a2 = reader._search(order_by=['creation_height'], limit=2)
(r_ab2, r_a2) = search(order_by=['creation_height'], limit=2)
self.assertEqual(f"foo#{a2_claim.claim_id[:2]}", r_a2['short_url'])
self.assertEqual(f"foo#{ab2_claim.claim_id[:4]}", r_ab2['short_url'])
self.assertEqual("@foo#a/foo#a", r_a2['canonical_url'])
self.assertEqual("@foo#a/foo#ab", r_ab2['canonical_url'])
self.assertEqual(2, reader._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(2, search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
# change channel public key, invaliding stream claim signatures
advance(8, [self.get_channel_update(txo_chan_a, COIN, key=b'a')])
r_ab2, r_a2 = reader._search(order_by=['creation_height'], limit=2)
(r_ab2, r_a2) = search(order_by=['creation_height'], limit=2)
self.assertEqual(f"foo#{a2_claim.claim_id[:2]}", r_a2['short_url'])
self.assertEqual(f"foo#{ab2_claim.claim_id[:4]}", r_ab2['short_url'])
self.assertIsNone(r_a2['canonical_url'])
self.assertIsNone(r_ab2['canonical_url'])
self.assertEqual(0, reader._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(0, search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
# reinstate previous channel public key (previous stream claim signatures become valid again)
channel_update = self.get_channel_update(txo_chan_a, COIN, key=b'c')
advance(9, [channel_update])
r_ab2, r_a2 = reader._search(order_by=['creation_height'], limit=2)
(r_ab2, r_a2) = search(order_by=['creation_height'], limit=2)
self.assertEqual(f"foo#{a2_claim.claim_id[:2]}", r_a2['short_url'])
self.assertEqual(f"foo#{ab2_claim.claim_id[:4]}", r_ab2['short_url'])
self.assertEqual("@foo#a/foo#a", r_a2['canonical_url'])
self.assertEqual("@foo#a/foo#ab", r_ab2['canonical_url'])
self.assertEqual(2, reader._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(0, reader._search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(2, search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(0, search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
# change channel of stream
self.assertEqual("@foo#a/foo#ab", reader._search(claim_id=ab2_claim.claim_id, limit=1)[0]['canonical_url'])
self.assertEqual("@foo#a/foo#ab", search(claim_id=ab2_claim.claim_id, limit=1)[0]['canonical_url'])
tx_ab2 = self.get_stream_update(tx_ab2, COIN, txo_chan_ab)
advance(10, [tx_ab2])
self.assertEqual("@foo#ab/foo#a", reader._search(claim_id=ab2_claim.claim_id, limit=1)[0]['canonical_url'])
self.assertEqual("@foo#ab/foo#a", search(claim_id=ab2_claim.claim_id, limit=1)[0]['canonical_url'])
# TODO: currently there is a bug where stream leaving a channel does not update that channels claims count
self.assertEqual(2, reader._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(2, search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
# TODO: after bug is fixed remove test above and add test below
#self.assertEqual(1, reader._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(1, reader._search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
#self.assertEqual(1, search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(1, search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
# claim abandon updates claims_in_channel
advance(11, [self.get_abandon(tx_ab2)])
self.assertEqual(0, reader._search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
self.assertEqual(0, search(claim_id=txo_chan_ab.claim_id, limit=1)[0]['claims_in_channel'])
# delete channel, invaliding stream claim signatures
advance(12, [self.get_abandon(channel_update)])
r_a2, = reader._search(order_by=['creation_height'], limit=1)
(r_a2,) = search(order_by=['creation_height'], limit=1)
self.assertEqual(f"foo#{a2_claim.claim_id[:2]}", r_a2['short_url'])
self.assertIsNone(r_a2['canonical_url'])
@@ -508,13 +533,13 @@ class TestTrending(TestSQLDB):
up_biggly = self.get_stream('Claim E', COIN)
claims = advance(1, [up_biggly, up_medium, up_small, no_trend, downwards])
for window in range(1, 8):
advance(TRENDING_WINDOW * window, [
advance(zscore.TRENDING_WINDOW * window, [
self.get_support(downwards, (20-window)*COIN),
self.get_support(up_small, int(20+(window/10)*COIN)),
self.get_support(up_medium, (20+(window*(2 if window == 7 else 1)))*COIN),
self.get_support(up_biggly, (20+(window*(3 if window == 7 else 1)))*COIN),
])
results = reader._search(order_by=['trending_local'])
results = search(order_by=['trending_local'])
self.assertEqual([c.claim_id for c in claims], [hexlify(c['claim_hash'][::-1]).decode() for c in results])
self.assertEqual([10, 6, 2, 0, -2], [int(c['trending_local']) for c in results])
self.assertEqual([53, 38, -32, 0, -6], [int(c['trending_global']) for c in results])
@@ -524,5 +549,212 @@ class TestTrending(TestSQLDB):
def test_edge(self):
problematic = self.get_stream('Problem', COIN)
self.advance(1, [problematic])
self.advance(TRENDING_WINDOW, [self.get_support(problematic, 53000000000)])
self.advance(TRENDING_WINDOW * 2, [self.get_support(problematic, 500000000)])
self.advance(zscore.TRENDING_WINDOW, [self.get_support(problematic, 53000000000)])
self.advance(zscore.TRENDING_WINDOW * 2, [self.get_support(problematic, 500000000)])
class TestContentBlocking(TestSQLDB):
def test_blocking_and_filtering(self):
# content claims and channels
tx0 = self.get_channel('A Channel', COIN, '@channel1')
regular_channel = tx0[0].outputs[0]
tx1 = self.get_stream('Claim One', COIN, 'claim1')
tx2 = self.get_stream('Claim Two', COIN, 'claim2', regular_channel)
tx3 = self.get_stream('Claim Three', COIN, 'claim3')
self.advance(1, [tx0, tx1, tx2, tx3])
claim1, claim2, claim3 = tx1[0].outputs[0], tx2[0].outputs[0], tx3[0].outputs[0]
# block and filter channels
tx0 = self.get_channel('Blocking Channel', COIN, '@block')
tx1 = self.get_channel('Filtering Channel', COIN, '@filter')
blocking_channel = tx0[0].outputs[0]
filtering_channel = tx1[0].outputs[0]
self.sql.blocking_channel_hashes.add(blocking_channel.claim_hash)
self.sql.filtering_channel_hashes.add(filtering_channel.claim_hash)
self.advance(2, [tx0, tx1])
self.assertEqual({}, dict(self.sql.blocked_streams))
self.assertEqual({}, dict(self.sql.blocked_channels))
self.assertEqual({}, dict(self.sql.filtered_streams))
self.assertEqual({}, dict(self.sql.filtered_channels))
# nothing blocked
results, _ = reader.resolve([
claim1.claim_name, claim2.claim_name,
claim3.claim_name, regular_channel.claim_name
])
self.assertEqual(claim1.claim_hash, results[0]['claim_hash'])
self.assertEqual(claim2.claim_hash, results[1]['claim_hash'])
self.assertEqual(claim3.claim_hash, results[2]['claim_hash'])
self.assertEqual(regular_channel.claim_hash, results[3]['claim_hash'])
# nothing filtered
results, censor = censored_search()
self.assertEqual(6, len(results))
self.assertEqual(0, censor.total)
self.assertEqual({}, censor.censored)
# block claim reposted to blocking channel, also gets filtered
repost_tx1 = self.get_repost(claim1.claim_id, COIN, blocking_channel)
repost1 = repost_tx1[0].outputs[0]
self.advance(3, [repost_tx1])
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.blocked_streams)
)
self.assertEqual({}, dict(self.sql.blocked_channels))
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.filtered_streams)
)
self.assertEqual({}, dict(self.sql.filtered_channels))
# claim is blocked from results by direct repost
results, censor = censored_search(text='Claim')
self.assertEqual(2, len(results))
self.assertEqual(claim2.claim_hash, results[0]['claim_hash'])
self.assertEqual(claim3.claim_hash, results[1]['claim_hash'])
self.assertEqual(1, censor.total)
self.assertEqual({blocking_channel.claim_hash: 1}, censor.censored)
results, _ = reader.resolve([claim1.claim_name])
self.assertEqual(
f"Resolve of 'claim1' was censored by channel with claim id '{blocking_channel.claim_id}'.",
results[0].args[0]
)
results, _ = reader.resolve([
claim2.claim_name, regular_channel.claim_name # claim2 and channel still resolved
])
self.assertEqual(claim2.claim_hash, results[0]['claim_hash'])
self.assertEqual(regular_channel.claim_hash, results[1]['claim_hash'])
# block claim indirectly by blocking its parent channel
repost_tx2 = self.get_repost(regular_channel.claim_id, COIN, blocking_channel)
repost2 = repost_tx2[0].outputs[0]
self.advance(4, [repost_tx2])
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.blocked_streams)
)
self.assertEqual(
{repost2.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.blocked_channels)
)
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.filtered_streams)
)
self.assertEqual(
{repost2.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.filtered_channels)
)
# claim in blocked channel is filtered from search and can't resolve
results, censor = censored_search(text='Claim')
self.assertEqual(1, len(results))
self.assertEqual(claim3.claim_hash, results[0]['claim_hash'])
self.assertEqual(2, censor.total)
self.assertEqual({blocking_channel.claim_hash: 2}, censor.censored)
results, _ = reader.resolve([
claim2.claim_name, regular_channel.claim_name # claim2 and channel don't resolve
])
self.assertEqual(
f"Resolve of 'claim2' was censored by channel with claim id '{blocking_channel.claim_id}'.",
results[0].args[0]
)
self.assertEqual(
f"Resolve of '@channel1' was censored by channel with claim id '{blocking_channel.claim_id}'.",
results[1].args[0]
)
results, _ = reader.resolve([claim3.claim_name]) # claim3 still resolved
self.assertEqual(claim3.claim_hash, results[0]['claim_hash'])
# filtered claim is only filtered and not blocked
repost_tx3 = self.get_repost(claim3.claim_id, COIN, filtering_channel)
repost3 = repost_tx3[0].outputs[0]
self.advance(5, [repost_tx3])
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.blocked_streams)
)
self.assertEqual(
{repost2.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.blocked_channels)
)
self.assertEqual(
{repost1.claim.repost.reference.claim_hash: blocking_channel.claim_hash,
repost3.claim.repost.reference.claim_hash: filtering_channel.claim_hash},
dict(self.sql.filtered_streams)
)
self.assertEqual(
{repost2.claim.repost.reference.claim_hash: blocking_channel.claim_hash},
dict(self.sql.filtered_channels)
)
# filtered claim doesn't return in search but is resolveable
results, censor = censored_search(text='Claim')
self.assertEqual(0, len(results))
self.assertEqual(3, censor.total)
self.assertEqual({blocking_channel.claim_hash: 2, filtering_channel.claim_hash: 1}, censor.censored)
results, _ = reader.resolve([claim3.claim_name]) # claim3 still resolved
self.assertEqual(claim3.claim_hash, results[0]['claim_hash'])
# abandon unblocks content
self.advance(6, [
self.get_abandon(repost_tx1),
self.get_abandon(repost_tx2),
self.get_abandon(repost_tx3)
])
self.assertEqual({}, dict(self.sql.blocked_streams))
self.assertEqual({}, dict(self.sql.blocked_channels))
self.assertEqual({}, dict(self.sql.filtered_streams))
self.assertEqual({}, dict(self.sql.filtered_channels))
results, censor = censored_search(text='Claim')
self.assertEqual(3, len(results))
self.assertEqual(0, censor.total)
results, censor = censored_search()
self.assertEqual(6, len(results))
self.assertEqual(0, censor.total)
results, _ = reader.resolve([
claim1.claim_name, claim2.claim_name,
claim3.claim_name, regular_channel.claim_name
])
self.assertEqual(claim1.claim_hash, results[0]['claim_hash'])
self.assertEqual(claim2.claim_hash, results[1]['claim_hash'])
self.assertEqual(claim3.claim_hash, results[2]['claim_hash'])
self.assertEqual(regular_channel.claim_hash, results[3]['claim_hash'])
def test_pagination(self):
one, two, three, four, five, six, seven, filter_channel = self.advance(1, [
self.get_stream('One', COIN),
self.get_stream('Two', COIN),
self.get_stream('Three', COIN),
self.get_stream('Four', COIN),
self.get_stream('Five', COIN),
self.get_stream('Six', COIN),
self.get_stream('Seven', COIN),
self.get_channel('Filtering Channel', COIN, '@filter'),
])
self.sql.filtering_channel_hashes.add(filter_channel.claim_hash)
# nothing filtered
results, censor = censored_search(order_by='^height', offset=1, limit=3)
self.assertEqual(3, len(results))
self.assertEqual(
[two.claim_hash, three.claim_hash, four.claim_hash],
[r['claim_hash'] for r in results]
)
self.assertEqual(0, censor.total)
# content filtered
repost1, repost2 = self.advance(2, [
self.get_repost(one.claim_id, COIN, filter_channel),
self.get_repost(two.claim_id, COIN, filter_channel),
])
results, censor = censored_search(order_by='^height', offset=1, limit=3)
self.assertEqual(3, len(results))
self.assertEqual(
[four.claim_hash, five.claim_hash, six.claim_hash],
[r['claim_hash'] for r in results]
)
self.assertEqual(2, censor.total)
self.assertEqual({filter_channel.claim_hash: 2}, censor.censored)
+3
View File
@@ -375,6 +375,9 @@ class TestQueries(AsyncioTestCase):
self.assertListEqual([0, 3, 2, 1], [tx.height for tx in txs])
self.assertListEqual([tx4.id, tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
async def test_empty_history(self):
self.assertEqual((None, []), await self.ledger.get_local_status_and_history(''))
class TestUpgrade(AsyncioTestCase):
+15 -1
View File
@@ -39,6 +39,14 @@ class TestAESEncryptDecrypt(TestCase):
with self.assertRaises(InvalidPasswordError):
aes_decrypt('notbubblegum', aes_encrypt('bubblegum', self.message))
def test_edge_case_invalid_password_valid_padding_invalid_unicode(self):
with self.assertRaises(InvalidPasswordError):
aes_decrypt(
'notbubblegum',
'gy3/mNq3FWB/xAXirOQnlAqQLuvhLGXZaeGBUIg1w6yY4PDLDT7BU83XOfBsJol'
'uWU5zEU4+upOFH35HDqyV8EMQhcKSufN9WkT1izEbFtweBUTK8nTSkV7NBppE1Jaz'
)
def test_better_encrypt_decrypt(self):
self.assertEqual(
b'valuable value',
@@ -46,9 +54,15 @@ class TestAESEncryptDecrypt(TestCase):
'super secret',
better_aes_encrypt('super secret', b'valuable value')))
def test_better_decrypt_error(self):
@mock.patch('os.urandom', side_effect=lambda i: b'd'*i)
def test_better_decrypt_error(self, _):
with self.assertRaises(InvalidPasswordError):
better_aes_decrypt(
'super secret but wrong',
better_aes_encrypt('super secret', b'valuable value')
)
def test_edge_case_invalid_password_valid_everything(self):
value = b'czo4MTkyOjE2OjE6VrwsN8FSJlegxHVEQePoyjWT1k8yAXBCUbbGCFKcsNY='
self.assertEqual(b'valuable value', better_aes_decrypt('super secret', value))
self.assertNotEqual(b'valuable value', better_aes_decrypt('super secret but wrong', value))