Compare commits

..
193 Commits
Author SHA1 Message Date
Jack Robison ac846b4df3 v0.62.0 2020-03-01 20:29:32 -05:00
Jack Robison 0d427c9b90 Merge pull request #2836 from lbryio/wallet-server-lru-caches
Add LRU caches for blocks and block hashes in the wallet server
2020-03-01 15:19:28 -05:00
Jack Robison dc6194f862 perf counter 2020-03-01 15:17:21 -05:00
Jack Robison de50214e1f block lru cache 2020-03-01 15:17:21 -05:00
Jack Robison 5ec4a88c35 block hash lru cache 2020-03-01 15:17:05 -05:00
Jack Robison 31c141e757 Merge pull request #2835 from lbryio/wallet-server-threadpools
Improve wallet server performance with separate thread pools for leveldb, the block processor, and mempool
2020-03-01 15:15:20 -05:00
Jack Robison 9d5760d899 fix test 2020-03-01 14:41:14 -05:00
Jack Robison 7945e1ea3c mempool threadpool 2020-03-01 12:40:13 -05:00
Jack Robison d94c40e371 leveldb threadpool 2020-03-01 12:40:13 -05:00
Jack Robison 31f22122e8 block processor threadpool 2020-03-01 12:40:13 -05:00
Lex Berezhny 506582aa2b Merge pull request #2834 from lbryio/list_resolve_includes_local_data
when using `--resolve` with local claim `*_list` commands, update resolved result with local metadata (such as `is_mine`)
2020-02-29 15:48:49 -05:00
Lex Berezhny a02b251c9b when using --resolve with local claim list commands, update resolved result with local metadata (such as is_mine and is_mine) 2020-02-29 09:42:11 -05:00
Lex Berezhny 34cbb6fa79 Merge pull request #2831 from lbryio/claim_type_index_improvement
update `claim_type_*` db indexes to be more performant
2020-02-27 14:27:24 -05:00
Lex Berezhny 33679b56fd update claim_type_* indexes to be more peformant 2020-02-27 12:07:38 -05:00
Lex Berezhny 8897c4d560 Merge pull request #2816 from osilkin98/removes-anonymous
removes ability to comment anonymously
2020-02-27 10:37:47 -05:00
Oleg Silkin f0c18ccbe7 Removes testing for anonymous comments, fixes up existing asserts 2020-02-26 19:59:38 -05:00
Oleg Silkin e560d83c51 drops support for commenting without a channel 2020-02-26 19:58:03 -05:00
Lex Berezhny eca7addc67 v0.61.0 2020-02-24 10:01:03 -05:00
Lex Berezhny 263f3ba5c9 Merge pull request #2828 from lbryio/update_lbrycrd
update lbrycrd in tests to v0.17.4.3
2020-02-22 14:47:48 -05:00
Lex Berezhny f514123ef0 update lbrycrd 2020-02-22 13:42:28 -05:00
Lex Berezhny 9f461db0d0 Merge pull request #2827 from lbryio/repost_inherit_tags
reposts inherit the tags of the original claim, filtered/blocked claims cause their reposts to also be filtered/blocked
2020-02-22 13:04:31 -05:00
Lex Berezhny 7de8670616 blocked original repost causes all reposts to also be blocked 2020-02-22 12:49:20 -05:00
Lex Berezhny 8c7908b200 reposts inherit the tags of the original claim 2020-02-22 12:23:11 -05:00
Lex Berezhny e7722e039f Merge pull request #2826 from lbryio/fix_not_channel_ids
`claim_search --not_channel_ids` excludes the channel itself and not just claims in the channel
2020-02-21 23:01:00 -05:00
Lex Berezhny 039bc0208a fix tests 2020-02-21 22:22:28 -05:00
Lex Berezhny d57900a069 claim_search --not_channel_ids excludes the channel itself and not just claims in the channel 2020-02-21 21:59:46 -05:00
Jack Robison c1153302aa v0.60.1 2020-02-21 16:13:30 -05:00
Victor Shyba 1086a3297f check its broadcasted and use a retriable call 2020-02-21 17:51:46 -03:00
Jack Robison 5c613934ca Revert "v0.60.1"
This reverts commit 7f03b13579.
2020-02-21 15:05:33 -05:00
Jack Robison 6d7e9092f8 Merge pull request #2825 from lbryio/tx_from_stream_controller
use the stream controller tx instead of local history
2020-02-21 15:04:57 -05:00
Victor Shyba 8bb6f328dc use the stream controller tx instead of local history 2020-02-21 16:41:23 -03:00
Jack Robison 7f03b13579 v0.60.1 2020-02-21 14:14:15 -05:00
Jack Robison 09008ea991 Merge pull request #2824 from lbryio/skip_wallet_server_payment
max wallet server payment fee defaults to 0 and component doesnt start when its not a positive value
2020-02-21 13:27:58 -05:00
Jack Robison ee234212e6 Merge branch 'master' into skip_wallet_server_payment 2020-02-21 13:26:38 -05:00
Jack Robison 277b243f52 Merge pull request #2772 from lbryio/reflector-status
Add `is_fully_reflected` to `file_list` response
2020-02-21 13:21:36 -05:00
Jack Robison 0973ac753f add is_fully_reflected to file_list response 2020-02-21 12:49:19 -05:00
Victor Shyba f41cfbfb97 max wallet server payment fee defaults to 0 and component doesnt start in that case 2020-02-21 14:47:09 -03:00
Lex Berezhny a70980c81a reverting v0.60.1 release 2020-02-21 12:43:43 -05:00
Lex Berezhny 12a962f656 Merge pull request #2822 from lbryio/stream_controller_payment
use stream controller and documented errors for wallet server payments
2020-02-21 12:34:07 -05:00
Lex Berezhny 5936444f3e more reliable wait for wallet server payment test 2020-02-21 12:18:44 -05:00
Lex Berezhny c7d42f00c6 shorten error message for ServerPaymentFeeAboveMaxAllowed 2020-02-21 10:16:56 -05:00
Lex Berezhny b1318a9958 minor cleanup 2020-02-21 10:05:46 -05:00
Victor Shyba d2560d260c use stream controller and documented errors 2020-02-21 00:04:37 -03:00
Jack Robison f40a61cf9a v0.60.1 2020-02-20 17:56:54 -05:00
Jack Robison e0623578bf Merge pull request #2821 from lbryio/ffmpeg-find
add `ffmpeg_find` api to check ffmpeg installation status, don't recheck for ffmpeg in `status`
2020-02-20 17:48:36 -05:00
Jack Robison ead8daaa14 doc 2020-02-20 17:27:18 -05:00
Jack Robison 23b4b9e230 add ffmpeg_find api, don't recheck for it in status 2020-02-20 16:43:41 -05:00
Jack Robison 947017e334 Merge pull request #2820 from lbryio/disconnect-on-oversized
disconnect from client sending message larger than MAX_RECEIVE
2020-02-20 16:24:26 -05:00
Jack Robison 7fd0d6507f disconnect from client sending message larger than MAX_RECEIVE 2020-02-20 16:08:21 -05:00
Jack Robison ad1e9ef086 Merge pull request #2819 from lbryio/max-receive
add MAX_RECEIVE setting to wallet server
2020-02-20 14:38:11 -05:00
Jack Robison 2f1d08e417 add MAX_RECEIVE wallet server setting 2020-02-20 14:11:16 -05:00
Lex Berezhny 55f4eb80ba Merge pull request #2815 from lbryio/apply_share_usage_data_live
apply share_usage_data as its set, without restarting
2020-02-20 13:35:47 -05:00
Victor Shyba 7c160ff65e remove unused parameters 2020-02-20 14:38:13 -03:00
Victor Shyba fc5d5faaed use conf directly isntead of lambda 2020-02-20 14:27:39 -03:00
Victor Shyba 5394f1763c simplify external ip logic 2020-02-20 12:12:40 -03:00
Victor Shyba 050b67c9d6 apply share_usage_data as its set 2020-02-20 12:12:40 -03:00
Lex Berezhny 4b87cb45ee Merge pull request #2707 from lbryio/pay_wallet_servers
wallet servers requiring a daily fee will automatically get paid by client
2020-02-18 17:40:23 -05:00
Victor Shyba f0e1db319c make wallet server payments a component 2020-02-18 19:18:30 -03:00
Victor Shyba 3950715237 add max_wallet_server_fee conf to limit daily wallet server payments 2020-02-18 18:10:58 -03:00
Victor Shyba ae9ba14b59 use both donation and payment addresses separately 2020-02-18 18:10:58 -03:00
Victor Shyba ad6c6fbe35 fixes from review and add analytics 2020-02-18 18:10:58 -03:00
Victor Shyba ffa5c20c88 fix hanging test 2020-02-18 18:10:58 -03:00
Victor Shyba 5a6218eeca improve tests, fix types 2020-02-18 18:10:58 -03:00
Victor Shyba 200531dd96 wait for tx instead 2020-02-18 18:10:58 -03:00
Victor Shyba 15a2f048ac pay wallet server test and initial prototype 2020-02-18 18:10:58 -03:00
Victor Shyba d317a4042c change daily_fee to be lbc instead of dewies 2020-02-18 18:10:58 -03:00
Victor Shyba c2d717aba5 old code from #2683 2020-02-18 18:10:58 -03:00
Lex Berezhny ef74777df1 v0.60.0 2020-02-17 17:52:11 -05:00
Lex Berezhny f6dbf99fb5 Merge pull request #2811 from lbryio/index_fixes
wallet server indexes
2020-02-17 17:43:55 -05:00
Lex Berezhny 0b2d9e15b4 added order bys for fee_amount 2020-02-17 17:24:48 -05:00
Lex Berezhny d14e5e75e8 all three order bys for duration filter 2020-02-17 17:24:48 -05:00
Lex Berezhny df11ef34d2 index cleanup 2020-02-17 17:24:48 -05:00
Lex Berezhny 4fc619262c replacing indexes on trending_global, trending_mixed to be trending_group, trending_mixed 2020-02-17 17:24:48 -05:00
Lex Berezhny 2750eee86d Merge pull request #2810 from lbryio/no_default_order_by
removed default `order_by` for `claim_search`
2020-02-17 17:04:41 -05:00
Lex Berezhny 71cb03345b removed default order_by for claim_search 2020-02-17 16:26:29 -05:00
Lex Berezhny 22c8ca6c40 Merge pull request #2806 from lbryio/privacyDefault
change default privacy setting
2020-02-17 16:21:34 -05:00
Victor Shyba 237a8965eb fix tests 2020-02-17 18:00:23 -03:00
jessop 7d872c7863 change default privacy setting 2020-02-13 18:56:11 -05:00
Jack Robison 0d08858dfb v0.59.2 2020-02-13 17:22:21 -05:00
Jack Robison 5c6d63c93d Merge pull request #2803 from lbryio/fix-2802
fix claim apis failing with --resolve if no claims are present
2020-02-13 15:15:56 -05:00
Jack Robison c8c10d2bb0 fix claim apis failing with --resolve if no claims are present
fixes https://github.com/lbryio/lbry-sdk/issues/2802
2020-02-13 14:58:51 -05:00
Jack Robison f4d3e9ea6a add development wallet server deploy script 2020-02-13 13:54:46 -05:00
Jack Robison 3713d3488d Merge pull request #2800 from lbryio/fix-2746
Fix race condition setting/clearing the claim_search and resolve cache
2020-02-13 11:39:27 -05:00
Jack Robison 9b46d03c91 fix race between setting items in and clearing the resolve/claim_search cache 2020-02-13 11:17:21 -05:00
Jack Robison fe4e738580 Merge pull request #2798 from lbryio/repost-index
Add sqlite index for reposted claims
2020-02-13 10:33:36 -05:00
Jack Robison 205b0c4263 call get_platform only once 2020-02-13 10:04:50 -05:00
Jack Robison 78eef25f1a add reposted_claim_hash index
fixes https://github.com/lbryio/lbry-sdk/issues/2782
2020-02-12 17:39:57 -05:00
Lex Berezhny c9305fd070 Merge pull request #2796 from lbryio/xenial_build
linux build of LBRY SDK for Ubuntu 16.04 Xenial
2020-02-12 14:28:41 -05:00
Lex Berezhny 20774280b9 Merge pull request #2790 from lbryio/sql_in_for_single_value
SQL generation fix to handle IN operation for one value lists
2020-02-12 14:27:36 -05:00
Lex Berezhny 74bd2557af linux build of LBRY SDK for Ubuntu 16.05 Xenial 2020-02-12 14:20:06 -05:00
Lex Berezhny 605fc8ecd8 claim_search by --claim_type=repost support 2020-02-12 11:51:35 -05:00
Lex Berezhny 6b745c53dc make sure SQL IN works with python set 2020-02-12 11:41:32 -05:00
Lex Berezhny 98c60b38fc disable too-many-nested-blocks lint rule 2020-02-12 10:47:40 -05:00
Lex Berezhny be4515ec9a use sets for __in constraint values 2020-02-12 10:39:25 -05:00
Lex Berezhny dcb1b64696 SQL generation fix to handle IN operation for one value lists 2020-02-12 10:31:27 -05:00
Jack Robison 1190a60c7a v0.59.1 2020-02-11 16:56:37 -05:00
Jack Robison 82ecf207c6 Merge pull request #2789 from lbryio/update-default-servers
update default wallet servers
2020-02-11 16:36:31 -05:00
Jack Robison 84c7f1bf58 update test 2020-02-11 16:13:55 -05:00
Jack Robison 5ac453fe07 update default wallet servers 2020-02-11 13:51:15 -05:00
Lex Berezhny c2f39d653d v0.59.0 2020-02-10 12:08:24 -05:00
Lex Berezhny 748178f536 Merge pull request #2780 from lbryio/release_current
manually incremented version and added support to release script to r…
2020-02-09 20:41:00 -05:00
Lex Berezhny ffbef69dc7 manually incremented version and added support to release script to release current version 2020-02-09 20:26:15 -05:00
Lex Berezhny 3757124323 Merge pull request #2771 from lbryio/update_url_regex
update url regex to include missing cases
2020-02-09 18:17:35 -05:00
Victor Shyba e65f214b3c fix test using space in name 2020-02-09 17:55:29 -05:00
Victor Shyba f14004e56b update url regex to cases tom reported 2020-02-09 17:55:29 -05:00
Lex Berezhny dadc004dd6 Merge pull request #2765 from eggplantbren/master
fixed some issues with AR trending
2020-02-09 17:53:27 -05:00
Brendon J. Brewer 3697d9e1f0 Tweaked some parameters, back to 134 2020-02-09 17:38:34 -05:00
Brendon J. Brewer 94524f7330 lint 2020-02-09 17:38:34 -05:00
Brendon J. Brewer 17d8a3e5d6 Use claim_hash not claim_id 2020-02-09 17:38:24 -05:00
Brendon J. Brewer 39996d7612 Only create file during install if logging is turned on 2020-02-09 17:37:55 -05:00
Lex Berezhny 601ee4320f Merge pull request #2768 from mkroman/master
update cffi to v1.13.2
2020-02-09 17:35:06 -05:00
Mikkel Kroman 6e4f6fa92d Update cffi to v1.13.2
This fixes compilation issues for CPython 3.8+
2020-02-09 17:19:53 -05:00
Lex Berezhny b7103c29dd Merge pull request #2773 from lbryio/fix_video_analysis_error
fix video analysis error
2020-02-09 17:19:23 -05:00
Brannon King e53209e5ae handle early lbrycrd exit in tests 2020-02-09 17:02:16 -05:00
Brannon King 501fbd3114 handle strange file metadata 2020-02-09 17:02:16 -05:00
Lex Berezhny 5626f43e2b Merge pull request #2779 from lbryio/github_actions
build community PRs using GitHub Actions
2020-02-09 16:49:40 -05:00
Lex Berezhny 0185cb48fb run lint and tests in parallel 2020-02-09 16:34:04 -05:00
Lex Berezhny 9a49eb06da fix import path in test_transcoding.py 2020-02-09 16:15:20 -05:00
Lex Berezhny 3fbc012231 moved blockchain/test_transcoding.py -> other/test_transcoding.py 2020-02-09 16:15:20 -05:00
Lex Berezhny 3938cf33d8 take github actions for a spin 2020-02-09 16:15:04 -05:00
Lex Berezhny 38b3d0c87c Merge pull request #2777 from lbryio/claim_list_multi_type
`claim_list` argument `--claim_type` can now be repeated to pass a list of claim_types
2020-02-08 23:34:34 -05:00
Lex Berezhny 15a2fa6199 claim_list --claim_type argument can be repeated 2020-02-08 23:34:04 -05:00
Lex Berezhny e834209d40 Merge pull request #2776 from lbryio/resolve_includes_censoring_channels_url
`resolve` results which are censored now include full details of channel which did the censoring
2020-02-08 23:32:44 -05:00
Lex Berezhny 9607d21828 censored searches/resolves include metadata of channel which did the censoring 2020-02-07 18:50:29 -05:00
Lex Berezhny 6fbbf36143 pylint 2020-02-07 18:44:30 -05:00
Lex Berezhny db25f3282e lbry.error: save arguments on self and support for functions around arguments 2020-02-07 18:25:06 -05:00
Jack Robison ceb92838e7 v0.58.2 2020-02-06 11:37:09 -05:00
Jack Robison afb98f2cfc Merge pull request #2770 from lbryio/disable-save-content-claim
Add `save_resolved_claims` config setting for better performance when not using file_x commands
2020-02-06 11:32:49 -05:00
Jack Robison ed785fb087 add save_resolved_claims config setting to disable saving claims upon resolving them 2020-02-06 11:27:26 -05:00
Jack Robison 3921180d77 v0.58.1 2020-02-04 15:12:55 -05: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
75 changed files with 2544 additions and 709 deletions

No files matched your search

+79
View File
@@ -0,0 +1,79 @@
name: ci
on: pull_request
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- run: make install tools
- run: make lint
tests-unit:
name: "tests / unit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- run: make install tools
- working-directory: lbry
env:
HOME: /tmp
run: coverage run -p --source=lbry -m unittest discover -vv tests.unit
tests-integration:
name: "tests / integration"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- datanetwork
- blockchain
- other
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- if: matrix.test == 'other'
run: sudo apt install -y --no-install-recommends ffmpeg
- run: pip install tox-travis
- run: tox -e ${{ matrix.test }}
build:
needs: ["lint", "tests-unit", "tests-integration"]
name: "build"
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Setup
run: |
pip install pyinstaller
pip install -e .
- if: startsWith(matrix.os, 'windows') == false
name: Build & Run (Unix)
run: |
pyinstaller --onefile --name lbrynet lbry/extras/cli.py
chmod +x dist/lbrynet
dist/lbrynet --version
- if: startsWith(matrix.os, 'windows')
name: Build & Run (Windows)
run: |
pip install pywin32
pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/extras/cli.py
dist/lbrynet.exe --version
+2 -1
View File
@@ -5,6 +5,7 @@
/.tox
/.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
+5 -2
View File
@@ -52,6 +52,8 @@ test:blockchain-integration:
test:other-integration:
stage: test
script:
- apt-get update
- apt-get install -y --no-install-recommends ffmpeg
- pip install tox-travis
- tox -e other
@@ -82,14 +84,15 @@ test:json-api:
build:linux:
extends: .build
image: ubuntu:18.04 # cant use python3.7 image - binary won't run on ubuntu
image: ubuntu:16.04
variables:
OS: linux
before_script:
- apt-get update
- apt-get install -y --no-install-recommends software-properties-common zip curl build-essential
- add-apt-repository -y ppa:deadsnakes/ppa
- apt-get install -y --no-install-recommends python3.7-dev python3-setuptools python3-wheel
- apt-get update
- apt-get install -y --no-install-recommends python3.7-dev
- python3.7 <(curl -q https://bootstrap.pypa.io/get-pip.py) # make sure we get pip with python3.7
build:mac:
+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,
+1 -1
View File
@@ -26,7 +26,7 @@ services:
ports:
- "50001:50001" # rpc port
- "50005:50005" # websocket port
- "2112:2112" # prometheus
#- "2112:2112" # uncomment to enable prometheus
volumes:
- "wallet_server:/database"
environment:
+187 -139
View File
@@ -47,10 +47,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1579400254,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp1ozq8ity\",\n \"download_path\": \"/tmp/tmp1ozq8ity/tmppsu__ylo\",\n \"file_name\": \"tmppsu__ylo\",\n \"height\": 214,\n \"key\": \"b7d93a1d57d3e61812c674a34a4f3961\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01c7482562bfe65919bd8f74f3c067fbf4f62cd43fa5f4d8ab7ca870112e7310d70d239ea4d507688327acf4b80eb68fc7a5138726aa8bcd6a61c926732b2f5edf6c36fb5977cbb0c0b36e08980a78166af7fbb9660a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"c0a2bb6f6e97c10717c53e24d8057cafbdc095b9a9f6f78d2bab385a38dcfd226f9731c2dee9eba3463d73bacbc41e94\",\n \"stream_name\": \"tmppsu__ylo\",\n \"streaming_url\": \"http://localhost:5280/stream/a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"suggested_file_name\": \"tmppsu__ylo\",\n \"timestamp\": 1579400270,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\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/tmpc8ov7w53\", \"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/tmpc8ov7w53",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpc8ov7w53\", \"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\": \"010000000167e85c88fde387f326fba37b2612c3a805b2ed9ad4f9e5b46307a48029fa6d87010000006a473044022028798a357db4cf4403bc4cee03faf1b946a88dfa381599d1bfae2cacd3fab5f30220486161df34b2456b078f6d5b930bf437ef846ff6e6d68405cecdf866df177039012102d1577d55cb8cde272aca54b60c9b2be77d45d62367d15a09e05936c1ba3d00d2ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7063386f7637773533180b22186170706c69636174696f6e2f6f637465742d73747265616d3230846e3586adcc755850c7db569c5aaa1fb27e575e33be00c43fe67af34a0932668b3cb4959b38bfd6053beffc9cf7f7766d7576a914709db1a433f5f89b2dd707a1a172889b5ad8b35388ace0b46217000000001976a914b1be5eed89b7362def12fac0f7eda5046d3defa288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mq8BBn6fuhMt5EY9reRSUSwkAWBDpiFUhi\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400270,\n \"txid\": \"876dfa2980a40763b4e5f9d49aedb205a8c312267ba3fb26f387e3fd885ce867\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqnQtJbG1yPUh9czkmvQWvkCyCB4HdYtdk\",\n \"amount\": \"1.0\",\n \"claim_id\": \"147e85f9f871ac68c1162c6bb0b0a065d67c1c30\",\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#147e85f9f871ac68c1162c6bb0b0a065d67c1c30\",\n \"timestamp\": null,\n \"txid\": \"1653397207802b93eaca0f53d8ca4c86e56f532a3bb7d68731b6e8ba4faf95d8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc8ov7w53\",\n \"sd_hash\": \"846e3586adcc755850c7db569c5aaa1fb27e575e33be00c43fe67af34a0932668b3cb4959b38bfd6053beffc9cf7f776\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mwimxCnDnH6Bxpvn3Am4Cq7wzqej7B9oF6\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1653397207802b93eaca0f53d8ca4c86e56f532a3bb7d68731b6e8ba4faf95d8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"1653397207802b93eaca0f53d8ca4c86e56f532a3bb7d68731b6e8ba4faf95d8\"\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"]}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"]}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\": {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#b\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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\": 1579400270,\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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\": 1579400269,\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\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}"
}
]
},
@@ -284,7 +296,7 @@
"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\": \"6bX88naHw5g5pVDihups1vDJAUJX3tPnSTzzX8gqn8GqqhDDAGS8gXYeHYYhkfMeav\",\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\": \"691772a32fc37ac70ef8cff4ca4d3e3ff3f6e46271d61ebf927976d0fec1aec8\",\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.010761522004031576,\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}"
}
]
},
@@ -306,7 +318,7 @@
"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\": \"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.53.3\",\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.53.3\"\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\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\", \"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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1579400238.4076705,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfLMWqQPugfYqk2VbqyAav7taMiAdCUZVBf77qycF8dLQRYCdcZYfEnYn3wwp6WJiXATSf4i1zQPQeDAmhz9ayKfjGQH74aH\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YoPJj44W65CxK41Y1JMVVRVMeECvckMt29MtUNRqK7xGbfyP4PU7giFaGg3k8cFikmVCYvmSwUmJCHQ7Wqoj7G8nM73L6CK\",\n \"seed\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\"\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}).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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1579400238.2787437,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfLMWqQPugfYqk2VbqyAav7taMiAdCUZVBf77qycF8dLQRYCdcZYfEnYn3wwp6WJiXATSf4i1zQPQeDAmhz9ayKfjGQH74aH\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YoPJj44W65CxK41Y1JMVVRVMeECvckMt29MtUNRqK7xGbfyP4PU7giFaGg3k8cFikmVCYvmSwUmJCHQ7Wqoj7G8nM73L6CK\",\n \"seed\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\"\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000132b8996b03c88232743ed37c9bd5ef57ef57892e42135d46f02f2ae95b341bda000000006b483045022100e401824a767f4cbad7329c6f1ad563bec85e002eebbf0d1b170e5924d3ab85a702202c2d06303dec4a65274f125f2aadba5307614392213dd79b77b9aae204730fbf0121036207aaaac5d1bcaf702f1d662cb1aa1d35b7796d74a0c3b0e45ff3c0abe8aa38ffffffff0200c2eb0b000000001976a91483bf0505a3da64584762ba81cb4612c1e57b89fa88ac90d7ae2f000000001976a914f4748e91a505e9b414274111b7753dda6dcf7d5f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkAjveCss25NmkHkokv9a43V868iuvSqcQ\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1579400268,\n \"txid\": \"da1b345be92a2ff0465d13422e8957ef57efd59b7cd33e743282c8036b99b832\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n3oWoNoXgKSWq8ksK8iXes7EkQNh9ZiYLb\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\"\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"from_account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\" --from_account=\"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"from_account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001004d6230575edb11cc650227154cd6e580a6d9682bf335885f291a7959f083d7000000006a47304402205dc6e0ca05752fbc6a1417d7fbfe19d506565b1bf6454d5cf0956d372373e96b0220391150e2bd6c02230bf1b65298255bef91d0ffdf76362dc6ad44e214cfab37f001210262c4cb530de06e209b04a735d6a9378ce0400e2e7425764350498d418d1c4968ffffffff03c0687804000000001976a91483bf0505a3da64584762ba81cb4612c1e57b89fa88acc0687804000000001976a91483bf0505a3da64584762ba81cb4612c1e57b89fa88ac6cb9fa02000000001976a91494954a46cdbadfd282700522f5b4c4e0c4f2544b88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1579400269,\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mu4b9JhJBCaDmdkpSmQURFvhbYy9uUmnr9\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\"\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000037240bfdc7562de1616a14ac8d00ea71e4021126cdf98dc3e755740fc03dd6b67000000006b483045022100ed59201d80743f92e275fdb41099b2db1b25577bd6e8e2bdde6712f37560bcfe02206664ef1be775a1a5c293c05d9c1549c88577cf5e7c6aeb088ea70fdcae98792d01210262c4cb530de06e209b04a735d6a9378ce0400e2e7425764350498d418d1c4968ffffffff7240bfdc7562de1616a14ac8d00ea71e4021126cdf98dc3e755740fc03dd6b67010000006b48304502210097df72fdc6f40bb4b119baba6d6232065aa86e06082a7d84776eb442e8847f720220483c841aaed85c5e063e59885bf65891dae92561c47d68147096c4d534a275d201210262c4cb530de06e209b04a735d6a9378ce0400e2e7425764350498d418d1c4968ffffffff7240bfdc7562de1616a14ac8d00ea71e4021126cdf98dc3e755740fc03dd6b67020000006b483045022100cdafc9dd334b238845fdbbec3f1e90f18f608cff017fc2ae1df569f8d9ff744c022032459996bfe81fdc20e89fe59bb82131c52d77f6fe3ddd791665c9aaea807a28012102827e9ee79680f998b2072aac822e794621ab77994880c0f811215aa7556c3796ffffffff015027eb0b000000001976a914291cb899cee628ed4076d8aff8c17e3b9ff8685e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1579400269,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400269,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mu4b9JhJBCaDmdkpSmQURFvhbYy9uUmnr9\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1579400269,\n \"txid\": \"676bdd03fc4057753edc98df6c1221401ea70ed0c84aa11616de6275dcbf4072\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjGLQViMN89giFBMxP4E8VAMUcbxyjywk7\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"e356d9edcef5b1f9dc1620d7c703f13a4046b49e3ffc4e924778b1ac6600b3fe\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"e356d9edcef5b1f9dc1620d7c703f13a4046b49e3ffc4e924778b1ac6600b3fe\"\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\": \"mtoi8LVg42arZktjQKe9Kjkn3hB5RfQjtR\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mtoi8LVg42arZktjQKe9Kjkn3hB5RfQjtR\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WZzDVYzTURW6cCCz7UcQh8zCz2gLc3eif8LciP36qBtz1nyWjKm5qL5zQbFwTT6GoFBDy84fqiyVt6BDDr17s51vLbF9sAk\",\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}).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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1579400238.2787437,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfLMWqQPugfYqk2VbqyAav7taMiAdCUZVBf77qycF8dLQRYCdcZYfEnYn3wwp6WJiXATSf4i1zQPQeDAmhz9ayKfjGQH74aH\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YoPJj44W65CxK41Y1JMVVRVMeECvckMt29MtUNRqK7xGbfyP4PU7giFaGg3k8cFikmVCYvmSwUmJCHQ7Wqoj7G8nM73L6CK\",\n \"seed\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\"\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\", \"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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1579400238.461284,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfLMWqQPugfYqk2VbqyAav7taMiAdCUZVBf77qycF8dLQRYCdcZYfEnYn3wwp6WJiXATSf4i1zQPQeDAmhz9ayKfjGQH74aH\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YoPJj44W65CxK41Y1JMVVRVMeECvckMt29MtUNRqK7xGbfyP4PU7giFaGg3k8cFikmVCYvmSwUmJCHQ7Wqoj7G8nM73L6CK\",\n \"seed\": \"blossom warfare trial oil essay six develop bless remember recipe wasp avoid\"\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\": \"mqMjLadUVYcKcoUD6bDjtymz3mw5o85a9f\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mqMjLadUVYcKcoUD6bDjtymz3mw5o85a9f",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mqMjLadUVYcKcoUD6bDjtymz3mw5o85a9f\"}}).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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mhBD332VegShAorKpxukWrEWmbUzfdzDhS\",\n \"pubkey\": \"tpubDA9GDAntyJu55PTWeX41jxL6f4ZW1EGTUiYjcfXbpbpz2GBPp6Yi2x1FVA2d12KnUPDYuKPUWGw1Dh9ZntinTb8D7ZUFAKCKyN93Hdqvqms\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"miwwrn6FK5FY6sQbDcU7YNcd6oTHtwJvQH\",\n \"pubkey\": \"tpubDA9GDAntyJu52wuCcgVYDVds4DcRGs71e2TH4k5yfFudwwjq5439ojn1o24jDtew9AggW7TUcF34NT54mPeZEZazy4bWQYwtf5GEgY3V2SQ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mjwdqgZ3k5cTKLzzqj6jeKHWbPpauWrBwv\",\n \"pubkey\": \"tpubDA9GDAntyJu4NL6PR5ZY1orKdmJJmQUb16RH2pvPhrxbqyEzVvAT3MSQn7LinV1VonLQBGhckU6eeELehxpGb12aLscaiUuY1soB38Zq84t\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mmE9RDU2T1HD9oX9SNVoQA7vD3A359qkRR\",\n \"pubkey\": \"tpubDA9GDAntyJu4SnoQ8QZEPs9SAKh1qkuJ2j6iStdRTpr6LwARWVfwdve4y6DyyCcBKTpotUPGypdiiw1PSJuTBNbApaq2SZGHsU7td35AyPQ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mn8QjQsVrYXU8zYorX95cYPwa79Z7uNxq1\",\n \"pubkey\": \"tpubDA9GDAntyJu4qb6PvTo3wt3dQYE46LJM3czxuhSgrzst8LGSrux8NxHNeEMgxCHXnPyruimAw5Yp1tuS3nyRUUowEfPjKrCWmBE3jSuyrac\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"moKAJoi8inN2KjDeqJZcyqzPWotVbUHuVe\",\n \"pubkey\": \"tpubDA9GDAntyJu4fu7FweQwbXz15syBjxW3Qmnyyt8wjWPgoLPpe7Kx76Z2yVb6nwMXE3vVvYJTYyrL9BePyiUxK4s56fP6W7HCq8F8qPcr2Ae\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mpSC61mQBsRYVx57wvwRf7TJ3SR1uf4YJk\",\n \"pubkey\": \"tpubDA9GDAntyJu4RgxjLgKhVanz5KdQy2kGJhLkP62Qhu2ToZSV4u6m1fwkdTNve8ideaEix1rKFVnenUKGUL3iTZpixHH8bsAAE1CutJFhupm\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mpSdwtjqtiSix4WPWPDmEQWyd9ND54dcXn\",\n \"pubkey\": \"tpubDA9GDAntyJu4H2jN5FGPJdo2NKGHnNcoZfACWe2goMeKwy69UB7J3FpMhCDffHSXuHhVG8gJrf8Qm6cAcimhwmFN18oWF8ZE1h7s6SeNUYW\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mqyx9wR5hV4h7eg8731X1XxTTq9GhXzo8E\",\n \"pubkey\": \"tpubDA9GDAntyJu4vyXxpCj5dtueXk7vY1bD3jPdpAnDDrPDQWCmT92ATZxCJCZNnxD77JgwamFvLHzRVbqMVdny4dSunNKntVSwig81XsZ9MA7\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mrW3GqozotWt25hEfnQCnwRCgAEgnqVVUa\",\n \"pubkey\": \"tpubDA9GDAntyJu4o5HeVMXjD64V8bJRU9VsHfRkoCigJsUjW4SunbFmtifvLazZKPDcfmoWgz6kR3NHpE1yXZozQU65MmK1HPS9Zd8fwCzGY3V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"pubkey\": \"tpubDA9GDAntyJu4ExrVLbVAKrFQE46Fg5bcHtLRuYeHi7WEvTzVfwUmmHzhQ79HC45h9uKPLmWN7Y5SRzi31kxonKpDtxyLcUQjSYLXSgMdx1M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mskMFx1gcztwp3GVX4pQhpebSQHxUSWbg9\",\n \"pubkey\": \"tpubDA9GDAntyJu4JciDnjGGkpLCzn3M11GZ6uW9ipEaMHM5nsDeAkoW8yLaBc4tHVhQKP7GMoNp2ySnbwKsezXC39hLcGTyMWXibYcNWPcvv6d\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mtCpZhdUga64KZxcie9UzJGRBhLY99pB6s\",\n \"pubkey\": \"tpubDA9GDAntyJu4uNESG5uscZXCCNwqF3tJWw7VgABooB4VQ6SSszVbLBNbXTbhFdDoZEe9UHuLScKzjMU6X8FjvuL4iumBpDqA6nTxJheMQwa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mtX3UmbqJQ8wNShAjKNDMd1dvrzh3tHitR\",\n \"pubkey\": \"tpubDA9GDAntyJu4zsgAwf58DXNW9uajnXp6hNDExgWKEwFSg7vTf1UkWsfXmamCSH6PBc2h4mcznVY5dLnGpwV1d8fhdGoUX6dUvaSYT2GycGo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mu4b9JhJBCaDmdkpSmQURFvhbYy9uUmnr9\",\n \"pubkey\": \"tpubDA9GDAntyJu4Kin1srBhnMwUZ9bMrUXvKBudKxkeumaCDe9JzbBy7oHZVDArCHhpcy67tweE8LMNhYxQYShZ6PqefMSMF4hQGWFUeAi9D88\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mv4KUj3getjB1DwQ2GxP3ncVox9T3h5wDj\",\n \"pubkey\": \"tpubDA9GDAntyJu4YPg9jamaGsUjnf5KBpfvrRqtYVfAV6iqJg1zbF96ixnBV4E3ynvgYZgRf7GzKeTZ4BfPWGXWY1tUCk4Q2rMogze7UG3vcZu\",\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\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mhBD332VegShAorKpxukWrEWmbUzfdzDhS\",\n \"pubkey\": \"tpubDA9GDAntyJu55PTWeX41jxL6f4ZW1EGTUiYjcfXbpbpz2GBPp6Yi2x1FVA2d12KnUPDYuKPUWGw1Dh9ZntinTb8D7ZUFAKCKyN93Hdqvqms\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"miwwrn6FK5FY6sQbDcU7YNcd6oTHtwJvQH\",\n \"pubkey\": \"tpubDA9GDAntyJu52wuCcgVYDVds4DcRGs71e2TH4k5yfFudwwjq5439ojn1o24jDtew9AggW7TUcF34NT54mPeZEZazy4bWQYwtf5GEgY3V2SQ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mjwdqgZ3k5cTKLzzqj6jeKHWbPpauWrBwv\",\n \"pubkey\": \"tpubDA9GDAntyJu4NL6PR5ZY1orKdmJJmQUb16RH2pvPhrxbqyEzVvAT3MSQn7LinV1VonLQBGhckU6eeELehxpGb12aLscaiUuY1soB38Zq84t\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mmE9RDU2T1HD9oX9SNVoQA7vD3A359qkRR\",\n \"pubkey\": \"tpubDA9GDAntyJu4SnoQ8QZEPs9SAKh1qkuJ2j6iStdRTpr6LwARWVfwdve4y6DyyCcBKTpotUPGypdiiw1PSJuTBNbApaq2SZGHsU7td35AyPQ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mn8QjQsVrYXU8zYorX95cYPwa79Z7uNxq1\",\n \"pubkey\": \"tpubDA9GDAntyJu4qb6PvTo3wt3dQYE46LJM3czxuhSgrzst8LGSrux8NxHNeEMgxCHXnPyruimAw5Yp1tuS3nyRUUowEfPjKrCWmBE3jSuyrac\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"moKAJoi8inN2KjDeqJZcyqzPWotVbUHuVe\",\n \"pubkey\": \"tpubDA9GDAntyJu4fu7FweQwbXz15syBjxW3Qmnyyt8wjWPgoLPpe7Kx76Z2yVb6nwMXE3vVvYJTYyrL9BePyiUxK4s56fP6W7HCq8F8qPcr2Ae\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mpSC61mQBsRYVx57wvwRf7TJ3SR1uf4YJk\",\n \"pubkey\": \"tpubDA9GDAntyJu4RgxjLgKhVanz5KdQy2kGJhLkP62Qhu2ToZSV4u6m1fwkdTNve8ideaEix1rKFVnenUKGUL3iTZpixHH8bsAAE1CutJFhupm\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mpSdwtjqtiSix4WPWPDmEQWyd9ND54dcXn\",\n \"pubkey\": \"tpubDA9GDAntyJu4H2jN5FGPJdo2NKGHnNcoZfACWe2goMeKwy69UB7J3FpMhCDffHSXuHhVG8gJrf8Qm6cAcimhwmFN18oWF8ZE1h7s6SeNUYW\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mqyx9wR5hV4h7eg8731X1XxTTq9GhXzo8E\",\n \"pubkey\": \"tpubDA9GDAntyJu4vyXxpCj5dtueXk7vY1bD3jPdpAnDDrPDQWCmT92ATZxCJCZNnxD77JgwamFvLHzRVbqMVdny4dSunNKntVSwig81XsZ9MA7\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mrW3GqozotWt25hEfnQCnwRCgAEgnqVVUa\",\n \"pubkey\": \"tpubDA9GDAntyJu4o5HeVMXjD64V8bJRU9VsHfRkoCigJsUjW4SunbFmtifvLazZKPDcfmoWgz6kR3NHpE1yXZozQU65MmK1HPS9Zd8fwCzGY3V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"msXZeTbziXSNU1iSU2tvYkHGgHWtmN9LqV\",\n \"pubkey\": \"tpubDA9GDAntyJu4ExrVLbVAKrFQE46Fg5bcHtLRuYeHi7WEvTzVfwUmmHzhQ79HC45h9uKPLmWN7Y5SRzi31kxonKpDtxyLcUQjSYLXSgMdx1M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mskMFx1gcztwp3GVX4pQhpebSQHxUSWbg9\",\n \"pubkey\": \"tpubDA9GDAntyJu4JciDnjGGkpLCzn3M11GZ6uW9ipEaMHM5nsDeAkoW8yLaBc4tHVhQKP7GMoNp2ySnbwKsezXC39hLcGTyMWXibYcNWPcvv6d\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mtCpZhdUga64KZxcie9UzJGRBhLY99pB6s\",\n \"pubkey\": \"tpubDA9GDAntyJu4uNESG5uscZXCCNwqF3tJWw7VgABooB4VQ6SSszVbLBNbXTbhFdDoZEe9UHuLScKzjMU6X8FjvuL4iumBpDqA6nTxJheMQwa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mtX3UmbqJQ8wNShAjKNDMd1dvrzh3tHitR\",\n \"pubkey\": \"tpubDA9GDAntyJu4zsgAwf58DXNW9uajnXp6hNDExgWKEwFSg7vTf1UkWsfXmamCSH6PBc2h4mcznVY5dLnGpwV1d8fhdGoUX6dUvaSYT2GycGo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mu4b9JhJBCaDmdkpSmQURFvhbYy9uUmnr9\",\n \"pubkey\": \"tpubDA9GDAntyJu4Kin1srBhnMwUZ9bMrUXvKBudKxkeumaCDe9JzbBy7oHZVDArCHhpcy67tweE8LMNhYxQYShZ6PqefMSMF4hQGWFUeAi9D88\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgfeXcmpqs1EQkuxsAzKFwXWTk15F9hDpT\",\n \"address\": \"mv4KUj3getjB1DwQ2GxP3ncVox9T3h5wDj\",\n \"pubkey\": \"tpubDA9GDAntyJu4YPg9jamaGsUjnf5KBpfvrRqtYVfAV6iqJg1zbF96ixnBV4E3ynvgYZgRf7GzKeTZ4BfPWGXWY1tUCk4Q2rMogze7UG3vcZu\",\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\": \"mqMjLadUVYcKcoUD6bDjtymz3mw5o85a9f\"\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\": \"f2c7e91c86074ee51fbd5fb7a609baf15237790c286bb57682a30aaff8f635d614c16acbfaa2b63a28f62f10692b6fc4\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete f2c7e91c86074ee51fbd5fb7a609baf15237790c286bb57682a30aaff8f635d614c16acbfaa2b63a28f62f10692b6fc4",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"f2c7e91c86074ee51fbd5fb7a609baf15237790c286bb57682a30aaff8f635d614c16acbfaa2b63a28f62f10692b6fc4\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted f2c7e91c86074ee51fbd5fb7a609baf15237790c286bb57682a30aaff8f635d614c16acbfaa2b63a28f62f10692b6fc4\"\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 \"f2c7e91c86074ee51fbd5fb7a609baf15237790c286bb57682a30aaff8f635d614c16acbfaa2b63a28f62f10692b6fc4\",\n \"3fab0258c15b9cacf5f42e3d531d64f0bf50e398903a172ef461b5337cf4b3394e85b5bd00fd044315884a310cbb8c1c\",\n \"4f2f2a425212f91080b92ee4edeac1ac88138133df17419984969791aae9f5ce4640952b41cd27686ed0c6692db77573\",\n \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\"\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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000014f152a43af3447df92b5502f205594b0b27c5c3abe4441fe4e571230b4f719e5000000006a4730440220054c34959eb83de5d08179f34d0e3fc24f8bbe995ec076bff9c494c3f0cc4d520220393d7b25ca273813a4baef15f9f4483e42f48f3f8dcd64ad326686df48d7c6fc01210221ef54d238f749a1d2deb3dd483977d0788ffea39fe7ddb90105a640c8dd5df0ffffffff0134b7f505000000001976a9142d49e03ebc21902a3c69968fc5e9671ef0826ed188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjeRCgGffix8mdBKxWWp1UCeci5fiENzke\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"9d03d5164405955e62c84ae0855bf2f5cebe560f3c881c522ce322d99ab4edfc\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"9d03d5164405955e62c84ae0855bf2f5cebe560f3c881c522ce322d99ab4edfc\"\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\": \"0100000001004d6230575edb11cc650227154cd6e580a6d9682bf335885f291a7959f083d7010000006b483045022100cd41aa71dc9baaf282518a1a828a8aee40b5240c7c46552bbdc4edbcf0d95a630220641ace025295940d042018e6ddaeac6d630867c886e01ed2f34144438bb752ab01210346a0dc2ed9b6f183df7dcab18a08029e39ab410e90d036b5158e9e17f18349e8ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea006d7576a9148b60feaab143c74c08b53029db8c6de10dedd3c588acc462a029000000001976a9140f5183703edf7ab410e57cf32d5e1b8cf4d0557388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3oWoNoXgKSWq8ksK8iXes7EkQNh9ZiYLb\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400269,\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": null,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mgux5apnZu14xZczXd8XJsCYpfqtyis7fL\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\"\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\": \"01000000014f152a43af3447df92b5502f205594b0b27c5c3abe4441fe4e571230b4f719e5010000006a473044022061d8b7d44cc8d4341f6a6413ec4ab49e1bb255c9c0a89ae878689bdd935c90d20220417383a7e4fcbd344b3db67e8cbb3222a972012c6be5b6de56a07c1656f6b3d2012103d66dfdc764a5619ad0900de587b4e939eaebf57275b4362ce09a6734a2d6499bffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004b43253b247edef2e75be3a1bba5783c4a4bd4369e0952717fbfcc26877ea78dd3f0fd0af0d088b63936595a175ed6645fa6bc58c3cd92f9d592b0ee93323835c121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9141d96781c411576a0ef8098d1ad193cd754462c5088ace221d305000000001976a91479fb112f3ee8ac1754a98f86bdc30ffd6c633b7488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvjpjwcyFwQ9LduzW28nHywqRMzS2H7wnV\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miDQ9Q6oPAYgtjecojcdNBjSZkfb523m2e\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f11f553c0a8d3bb5d341e397570db0325adcf865\",\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#f11f553c0a8d3bb5d341e397570db0325adcf865\",\n \"timestamp\": null,\n \"txid\": \"40191b15d2bc3eaff9289ebd7bbba0e192a416c3deceb4b1978b19580ef461db\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004b43253b247edef2e75be3a1bba5783c4a4bd4369e0952717fbfcc26877ea78dd3f0fd0af0d088b63936595a175ed6645fa6bc58c3cd92f9d592b0ee93323835c\",\n \"public_key_id\": \"myPsvzUSyDKbmyNh6u97527qikAUz1Crcp\",\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\": \"mrdvpiSawqx4bm35RPdTrHYvN4Eqy7KpXq\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"40191b15d2bc3eaff9289ebd7bbba0e192a416c3deceb4b1978b19580ef461db\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"40191b15d2bc3eaff9289ebd7bbba0e192a416c3deceb4b1978b19580ef461db\"\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\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\"\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\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\"\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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"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 3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"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\": \"01000000027ae11f08d3bfe1d7aa0c030140a5f661267784bacf26ad94fc4d59b0c73b90b6000000006b483045022100aa830c924d60c7891fa07bf8c113f495da6d9fc4518a187811f7899d6425c18e02203f40187984b2c36ac131c0bb0d6a6dd564a815eaffc897aa30b8938a7c28d25601210221ef54d238f749a1d2deb3dd483977d0788ffea39fe7ddb90105a640c8dd5df0fffffffffeb30066acb17847924efc3f9eb446403af103c7d72016dcf9b1f5ceedd956e3000000006b483045022100aa318cb4c5640147c9c5263f33632def50caae65e2100e159f8b8a8640ae07ab02204c9a430ca449040d3f318dd4a90931c730a96926baffdb09a63acfec3a3675510121024827cb142e9a1b919e8a5e27cb9bad94c8455254bb8ca8ff1b267f2bed67bd20ffffffff0200e1f50500000000a6b708406368616e6e656c14c7482562bfe65919bd8f74f3c067fbf4f62cd43f4c6a00125a0a583056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00420b4e6577204368616e6e656c6d6d76a9148b60feaab143c74c08b53029db8c6de10dedd3c588ac6ebeea0b000000001976a914a6f8fd2194ac23e5ea3b611a9ff14ed34c5b3c0d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mjGLQViMN89giFBMxP4E8VAMUcbxyjywk7\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1579400269,\n \"txid\": \"e356d9edcef5b1f9dc1620d7c703f13a4046b49e3ffc4e924778b1ac6600b3fe\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": null,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mvjpjwcyFwQ9LduzW28nHywqRMzS2H7wnV\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\"\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\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\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\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\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}"
}
]
},
@@ -1713,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",
@@ -1805,14 +1835,14 @@
"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\": [], \"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 \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#b\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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\": 1579400270,\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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\": 1579400269,\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\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}"
"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\": [], \"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\": [], \"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 \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3/astream#b\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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\": 1579400270,\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#3\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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\": 1579400269,\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"short_url\": \"lbry://@channel#3\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\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}"
"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}"
}
]
}
@@ -2223,9 +2253,9 @@
"examples": [
{
"title": "Abandon a comment",
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\"}}).json()",
"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}"
}
]
@@ -2281,17 +2311,17 @@
"examples": [
{
"title": "Posting a comment as your channel",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=bfdbf31b0af4091febc7cd1a2945ea5fa93f0711",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"0d89339695ee2cf301fd7224d6c313d2c226887e3ffd42c96d9f25185b8c54bbba65d311f20416502b808542a9d88e0568c386e93e8ae607d1f283cca7f26580\",\n \"signing_ts\": \"1579400249\",\n \"timestamp\": 1579400250\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\", \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\", \"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=71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"06b54746ce74e42aa7760ce9d3b609b5ab30a4b59f0e3eb2c67cdc00eba7d7e0\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\",\n \"signature\": \"d45617c4ab93c956c50454e0bad50e3006813d6ebe5693647f0f2f9a23aff7576b90bb08844f314bd92ce36d98c677c58c263b9b8f9c5d6d3cdae14d89af396d\",\n \"signing_ts\": \"1579400250\",\n \"timestamp\": 1579400251\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}"
}
]
},
@@ -2372,17 +2402,17 @@
"examples": [
{
"title": "List all comments on a claim",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"include_replies\": true, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list bfdbf31b0af4091febc7cd1a2945ea5fa93f0711 --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"06b54746ce74e42aa7760ce9d3b609b5ab30a4b59f0e3eb2c67cdc00eba7d7e0\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\",\n \"signature\": \"d45617c4ab93c956c50454e0bad50e3006813d6ebe5693647f0f2f9a23aff7576b90bb08844f314bd92ce36d98c677c58c263b9b8f9c5d6d3cdae14d89af396d\",\n \"signing_ts\": \"1579400250\",\n \"timestamp\": 1579400251\n },\n {\n \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"0d89339695ee2cf301fd7224d6c313d2c226887e3ffd42c96d9f25185b8c54bbba65d311f20416502b808542a9d88e0568c386e93e8ae607d1f283cca7f26580\",\n \"signing_ts\": \"1579400249\",\n \"timestamp\": 1579400250\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\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\", \"include_replies\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list bfdbf31b0af4091febc7cd1a2945ea5fa93f0711 --parent_id=71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"parent_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\", \"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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"signature\": \"0d89339695ee2cf301fd7224d6c313d2c226887e3ffd42c96d9f25185b8c54bbba65d311f20416502b808542a9d88e0568c386e93e8ae607d1f283cca7f26580\",\n \"signing_ts\": \"1579400249\",\n \"timestamp\": 1579400250\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}"
}
]
},
@@ -2413,9 +2443,9 @@
"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\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"71e2866380adfc3595879353a57608e2b4dcda36bf311b102265bbca5b8f37d1\"}}).json()",
"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}"
}
]
@@ -2506,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\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"}}).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}"
}
]
@@ -2639,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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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\": \"b7d93a1d57d3e61812c674a34a4f3961\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01c7482562bfe65919bd8f74f3c067fbf4f62cd43fa5f4d8ab7ca870112e7310d70d239ea4d507688327acf4b80eb68fc7a5138726aa8bcd6a61c926732b2f5edf6c36fb5977cbb0c0b36e08980a78166af7fbb9660a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"c0a2bb6f6e97c10717c53e24d8057cafbdc095b9a9f6f78d2bab385a38dcfd226f9731c2dee9eba3463d73bacbc41e94\",\n \"stream_name\": \"tmppsu__ylo\",\n \"streaming_url\": \"http://localhost:5280/stream/a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"suggested_file_name\": \"tmppsu__ylo\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"1473978f00fed53c4b18ddf24b9990a954eb4b00\",\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\": \"134f4e871ad788d059bc8e2b3fe31ebf\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mggQVVstsxpesZJrF3TefabV5ZQ2pp9rBD\",\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\": \"1579400247\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpsyd4i3_g.png\",\n \"sd_hash\": \"4f2f2a425212f91080b92ee4edeac1ac88138133df17419984969791aae9f5ce4640952b41cd27686ed0c6692db77573\",\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\": \"876dfa2980a40763b4e5f9d49aedb205a8c312267ba3fb26Line 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\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"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\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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\": \"b7d93a1d57d3e61812c674a34a4f3961\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01c7482562bfe65919bd8f74f3c067fbf4f62cd43fa5f4d8ab7ca870112e7310d70d239ea4d507688327acf4b80eb68fc7a5138726aa8bcd6a61c926732b2f5edf6c36fb5977cbb0c0b36e08980a78166af7fbb9660a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"c0a2bb6f6e97c10717c53e24d8057cafbdc095b9a9f6f78d2bab385a38dcfd226f9731c2dee9eba3463d73bacbc41e94\",\n \"stream_name\": \"tmppsu__ylo\",\n \"streaming_url\": \"http://localhost:5280/stream/a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"suggested_file_name\": \"tmppsu__ylo\",\n \"timestamp\": 1579400270,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\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}"
}
]
},
@@ -2763,10 +2793,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1579400254,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp1ozq8ity\",\n \"download_path\": \"/tmp/tmp1ozq8ity/tmppsu__ylo_1\",\n \"file_name\": \"tmppsu__ylo_1\",\n \"height\": 214,\n \"key\": \"b7d93a1d57d3e61812c674a34a4f3961\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01c7482562bfe65919bd8f74f3c067fbf4f62cd43fa5f4d8ab7ca870112e7310d70d239ea4d507688327acf4b80eb68fc7a5138726aa8bcd6a61c926732b2f5edf6c36fb5977cbb0c0b36e08980a78166af7fbb9660a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"purchase_receipt\": null,\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"c0a2bb6f6e97c10717c53e24d8057cafbdc095b9a9f6f78d2bab385a38dcfd226f9731c2dee9eba3463d73bacbc41e94\",\n \"stream_name\": \"tmppsu__ylo\",\n \"streaming_url\": \"http://localhost:5280/stream/a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"suggested_file_name\": \"tmppsu__ylo\",\n \"timestamp\": 1579400270,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\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}"
}
]
},
@@ -3047,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/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmp1ozq8ity\",\n \"download_dir\": \"/tmp/tmp1ozq8ity\",\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/tmp1ozq8ity\",\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}"
}
]
},
@@ -3122,10 +3152,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon bfdbf31b0af4091febc7cd1a2945ea5fa93f0711",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001500433ee87ae4b6f16240b7f2b5b43834ac32c9b49fc8250a67d62fa3f1f705d000000006a47304402202e9ade76631162d8694ca7f67a1ac7e255e3e65eb290b8847b4bdba1d0a9a3b1022025aed44a70e2ba5a59713213fa566507deca483483f9d14444167bfe9231ea3501210249220d8b62e50bc2554469a35becdb252fc98336058afafbb2bf0b1ea8926200ffffffff0134b7f505000000001976a91428f1254f7d792510b4c745109d84b09d9ec35fd288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjFSCpwDqXiDrwroNTLwTnkfqT8U3p9Y9x\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"34804102d654b8d05953b4bd81b3023f384352e9b62d2b858ad259ac7b67839b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"34804102d654b8d05953b4bd81b3023f384352e9b62d2b858ad259ac7b67839b\"\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}"
}
]
},
@@ -3165,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",
@@ -3326,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/tmppsu__ylo\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmppsu__ylo",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmppsu__ylo\", \"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\": \"01000000017ae11f08d3bfe1d7aa0c030140a5f661267784bacf26ad94fc4d59b0c73b90b6010000006a47304402200b9d3230d5fefcc25c25ed698f4ff07756c4b68ca4eb1e2b0e375d7ff218367302205cbe18806f1c2048f5189080acd5693f36e2770f87c47b3dd182a5217852c6350121032f98a457e4b23c99b3ecf17dc0ca3fb088400c0bd818f93c9e27eb2b3e5db4efffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b6d7576a9143ce13aed49065382390a945c0ffaa39f10401a4888ac38fb9423000000001976a91446cd176a3f02ed515c9c47d4554d80091f0fe16688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgux5apnZu14xZczXd8XJsCYpfqtyis7fL\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400269,\n \"txid\": \"b6903bc7b0594dfc94ad26cfba84772661f6a54001030caad7e1bfd3081fe17a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"timestamp\": null,\n \"txid\": \"960cfa157e4279343626da119b389f16dc11d9f5cd70b4333305348d8dabd50d\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mmyKHVCN9y2Ld4bstWW7jMBrUzd1eYuLu9\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"960cfa157e4279343626da119b389f16dc11d9f5cd70b4333305348d8dabd50d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"960cfa157e4279343626da119b389f16dc11d9f5cd70b4333305348d8dabd50d\"\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/tmpsyd4i3_g.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\": 1579400247, \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpsyd4i3_g.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=1579400247 --channel_id=\"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsyd4i3_g.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\": 1579400247, \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010dd5ab8d8d34053333b470cdf5d911dc169f389b11da26363479427e15fa0c96010000006b4830450221008b3a286c9c6ecb9f14c875c33b4eb1a8cf64478dfe564f0d95082a61488af3040220363afe6e832f5bb6f6ebaaafb710bc560cce9ae8aa7b1f7b13e71e09512a15220121032b0568f9ad906425aaa666aa33b367304fc1f1f452bbfd878501e78b0279136affffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101c7482562bfe65919bd8f74f3c067fbf4f62cd43f9bf76a5a0c03757ca393073f855ffbebc226220c971a2a940b7bd16a67c5a6a84b0634c03adfee9c0f9011a1f13f98312e70b5eaa2ecd1e75d1e4ee6043eea0b0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d707379643469335f672e706e6718632209696d6167652f706e6732304f2f2a425212f91080b92ee4edeac1ac88138133df17419984969791aae9f5ce4640952b41cd27686ed0c6692db77573120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728b7f88ef1053222080112196f0cc1bce498b9f602f5a0553a8398c62884f7ba8cc916c584188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a9140cc1bce498b9f602f5a0553a8398c62884f7ba8c88acac5e7d1d000000001976a914696273c68ecdd2f6919f1294253cd6a10f48b3a288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mmyKHVCN9y2Ld4bstWW7jMBrUzd1eYuLu9\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400270,\n \"txid\": \"960cfa157e4279343626da119b389f16dc11d9f5cd70b4333305348d8dabd50d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mggQVVstsxpesZJrF3TefabV5ZQ2pp9rBD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1473978f00fed53c4b18ddf24b9990a954eb4b00\",\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#1473978f00fed53c4b18ddf24b9990a954eb4b00\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"876dfa2980a40763b4e5f9d49aedb205a8c312267ba3fb26f387e3fd885ce867\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mggQVVstsxpesZJrF3TefabV5ZQ2pp9rBD\",\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\": \"1579400247\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpsyd4i3_g.png\",\n \"sd_hash\": \"4f2f2a425212f91080b92ee4edeac1ac88138133df17419984969791aae9f5ce4640952b41cd27686ed0c6692db77573\",\n \"size\": \"99\"\n },\n \"strLine 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
}
]
},
@@ -3367,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\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\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\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1579400270,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\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}"
}
]
},
@@ -3704,10 +3752,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update bfdbf31b0af4091febc7cd1a2945ea5fa93f0711 --channel_id=\"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\", \"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\": \"01000000020dd5ab8d8d34053333b470cdf5d911dc169f389b11da26363479427e15fa0c96000000006a47304402201177d3c1018a1ba4cacbe12f5b353882321af4a3ec110d5d32c80cd53363fa0702206b779bade0fb1c80ba914bed41b2174a9d8f00e37856aadb5c5661903b58d5ab01210249220d8b62e50bc2554469a35becdb252fc98336058afafbb2bf0b1ea8926200ffffffffdb61f40e58198b97b1b4cedec316a492e1a0bb7bbd9e28f9af3ebcd2151b1940010000006b483045022100bc62bc7cfe201921998f2019d3702034bc011bcf9f7e1f9de2027924fae8f5f6022023b452c8687b8ce07168b8befb6f1ad1f008445a1b7e1db0d94499283c4a0183012103982c03f90e7196836e8033ce0f70e3a394829b9a14f057fb3c60776bdfef60c2ffffffff0200e1f50500000000fd2301b7076173747265616d1411073fa95fea45291acdc7eb1f09f40a1bf3dbbf4ce801c7482562bfe65919bd8f74f3c067fbf4f62cd43fa5f4d8ab7ca870112e7310d70d239ea4d507688327acf4b80eb68fc7a5138726aa8bcd6a61c926732b2f5edf6c36fb5977cbb0c0b36e08980a78166af7fbb9660a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707073755f5f796c6f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b6d6d76a9143ce13aed49065382390a945c0ffaa39f10401a4888ac32a0d205000000001976a914af3f9b41e32d887a1a3b04d532bf4c260b5b535488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"timestamp\": 1579400270,\n \"txid\": \"960cfa157e4279343626da119b389f16dc11d9f5cd70b4333305348d8dabd50d\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmppsu__ylo\",\n \"sd_hash\": \"a40fb1a597f6933a1d60bd8f461a109a4e50247a5aea4709d20ef75b2e3da600632621b9d463fa9f9b6ce3ffbc3ebc3b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mrdvpiSawqx4bm35RPdTrHYvN4Eqy7KpXq\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1579400269,\n \"txid\": \"40191b15d2bc3eaff9289ebd7bbba0e192a416c3deceb4b1978b19580ef461db\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mm4reqApxMGhBDpeWEVfhAeCWGrtkMpn9r\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\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#bfdbf31b0af4091febc7cd1a2945ea5fa93f0711\",\n \"signing_channel\": {\n \"address\": \"mtDvR2y9mdUW6zGkoKbDrnEFjDv3zjYbUD\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\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#3fd42cf6f4fb67c0f3748fbd1959e6bf622548c7\",\n \"timestamp\": 1579400269,\n \"txid\": \"e519f7b43012574efe4144be3a5c7cb2b09455202f50b592df4734af432a154f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000457b1f020041b2ad401abb5135e306ea03ee4353f7da63b98cb81fdeee3fa0fcf768cce00a36cb3f72ecb16af6b1606f7f8a303b7a6892e93e1946122cbf6ea00\",\n \"public_key_id\": \"mrW9NiUf9kwrAghgoSb13EViJDjzEs1NXk\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"5d701f3ffa627da65082fc499b2cc34a83435b2b7f0b24166f4bae87ee330450\",\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
}
]
}
@@ -3952,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-18 21:17\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1579400269,\n \"txid\": \"d783f059791a295f8835f32b68d9a680e5d64c15270265cc11db5e5730624d00\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2020-01-18 21:17\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1579400268,\n \"txid\": \"da1b345be92a2ff0465d13422e8957ef57efd59b7cd33e743282c8036b99b832\",\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.54.1"
__version__ = "0.62.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):
+30 -11
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')
@@ -545,6 +558,7 @@ class Config(CLIConfig):
"Don't download streams with fees exceeding this amount. When set to "
"null, the amount is unbounded.", {'currency': 'USD', 'amount': 50.0}
)
max_wallet_server_fee = String("Maximum daily LBC amount allowed as payment for wallet servers.", "0.0")
# reflector settings
reflect_streams = Toggle(
@@ -560,15 +574,15 @@ class Config(CLIConfig):
('reflector.lbry.com', 5566)
])
lbryum_servers = Servers("SPV wallet servers", [
('spv1.lbry.com', 50001),
('spv2.lbry.com', 50001),
('spv3.lbry.com', 50001),
('spv4.lbry.com', 50001),
('spv5.lbry.com', 50001),
('spv6.lbry.com', 50001),
('spv7.lbry.com', 50001),
('spv8.lbry.com', 50001),
('spv9.lbry.com', 50001),
('spv11.lbry.com', 50001),
('spv12.lbry.com', 50001),
('spv13.lbry.com', 50001),
('spv14.lbry.com', 50001),
('spv15.lbry.com', 50001),
('spv16.lbry.com', 50001),
('spv17.lbry.com', 50001),
('spv18.lbry.com', 50001),
('spv19.lbry.com', 50001),
])
known_dht_nodes = Servers("Known nodes for bootstrapping connection to the DHT", [
('lbrynet1.lbry.com', 4444), # US EAST
@@ -588,7 +602,7 @@ class Config(CLIConfig):
save_files = Toggle("Save downloaded files when calling `get` by default", True)
components_to_skip = Strings("components which will be skipped during start-up of daemon", [])
share_usage_data = Toggle(
"Whether to share usage stats and diagnostic info with LBRY.", True,
"Whether to share usage stats and diagnostic info with LBRY.", False,
previous_names=['upload_log', 'upload_log', 'share_debug_info']
)
track_bandwidth = Toggle("Track bandwidth usage", True)
@@ -603,6 +617,11 @@ class Config(CLIConfig):
"Strategy to use when selecting UTXOs for a transaction",
STRATEGIES, "standard")
save_resolved_claims = Toggle(
"Save content claims to the database when they are resolved to keep file_list up to date, "
"only disable this if file_x commands are not needed", True
)
@property
def streaming_host(self):
return self.streaming_server.split(':')[0]
+9 -5
View File
@@ -51,11 +51,15 @@ 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.
412 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
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 '{claim_id(censor_hash)}'.
420 | KeyFeeAboveMaxAllowed | {message}
421 | InvalidPassword | Password is invalid.
422 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
431 | ServerPaymentInvalidAddress | Invalid address from wallet server: '{address}' - skipping payment round.
432 | ServerPaymentWalletLocked | Cannot spend funds with locked wallet, skipping payment round.
433 | ServerPaymentFeeAboveMaxAllowed | Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.
**5xx** | Blob | **Blobs**
500 | BlobNotFound | Blob not found.
501 | BlobPermissionDenied | Permission denied to read blob.
+60 -1
View File
@@ -1,4 +1,4 @@
from .base import BaseError
from .base import BaseError, claim_id
class UserInputError(BaseError):
@@ -16,18 +16,22 @@ class CommandError(UserInputError):
class CommandDoesNotExistError(CommandError):
def __init__(self, command):
self.command = command
super().__init__(f"Command '{command}' does not exist.")
class CommandDeprecatedError(CommandError):
def __init__(self, command):
self.command = command
super().__init__(f"Command '{command}' is deprecated.")
class CommandInvalidArgumentError(CommandError):
def __init__(self, argument, command):
self.argument = argument
self.command = command
super().__init__(f"Invalid argument '{argument}' to command '{command}'.")
@@ -37,6 +41,7 @@ class CommandTemporarilyUnavailableError(CommandError):
"""
def __init__(self, command):
self.command = command
super().__init__(f"Command '{command}' is temporarily unavailable.")
@@ -46,6 +51,7 @@ class CommandPermanentlyUnavailableError(CommandError):
"""
def __init__(self, command):
self.command = command
super().__init__(f"Command '{command}' is permanently unavailable.")
@@ -58,12 +64,15 @@ class InputValueError(UserInputError, ValueError):
class GenericInputValueError(InputValueError):
def __init__(self, value, argument):
self.value = value
self.argument = argument
super().__init__(f"The value '{value}' for argument '{argument}' is not valid.")
class InputValueIsNoneError(InputValueError):
def __init__(self, argument):
self.argument = argument
super().__init__(f"None or null is not valid value for argument '{argument}'.")
@@ -79,6 +88,7 @@ class ConfigWriteError(ConfigurationError):
"""
def __init__(self, path):
self.path = path
super().__init__(f"Cannot write configuration file '{path}'.")
@@ -88,6 +98,7 @@ class ConfigReadError(ConfigurationError):
"""
def __init__(self, path):
self.path = path
super().__init__(f"Cannot find provided configuration file '{path}'.")
@@ -97,18 +108,21 @@ class ConfigParseError(ConfigurationError):
"""
def __init__(self, path):
self.path = path
super().__init__(f"Failed to parse the configuration file '{path}'.")
class ConfigMissingError(ConfigurationError):
def __init__(self, path):
self.path = path
super().__init__(f"Configuration file '{path}' is missing setting that has no default / fallback.")
class ConfigInvalidError(ConfigurationError):
def __init__(self, path):
self.path = path
super().__init__(f"Configuration file '{path}' has setting with invalid value.")
@@ -188,18 +202,29 @@ class DataDownloadError(WalletError):
class ResolveError(WalletError):
def __init__(self, url):
self.url = url
super().__init__(f"Failed to resolve '{url}'.")
class ResolveTimeoutError(WalletError):
def __init__(self, url):
self.url = url
super().__init__(f"Failed to resolve '{url}' within the timeout.")
class ResolveCensoredError(WalletError):
def __init__(self, url, censor_hash):
self.url = url
self.censor_hash = censor_hash
super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{claim_id(censor_hash)}'.")
class KeyFeeAboveMaxAllowedError(WalletError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
@@ -212,9 +237,32 @@ class InvalidPasswordError(WalletError):
class IncompatibleWalletServerError(WalletError):
def __init__(self, server, port):
self.server = server
self.port = port
super().__init__(f"'{server}:{port}' has an incompatibly old version.")
class ServerPaymentInvalidAddressError(WalletError):
def __init__(self, address):
self.address = address
super().__init__(f"Invalid address from wallet server: '{address}' - skipping payment round.")
class ServerPaymentWalletLockedError(WalletError):
def __init__(self):
super().__init__("Cannot spend funds with locked wallet, skipping payment round.")
class ServerPaymentFeeAboveMaxAllowedError(WalletError):
def __init__(self, daily_fee, max_fee):
self.daily_fee = daily_fee
self.max_fee = max_fee
super().__init__(f"Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.")
class BlobError(BaseError):
"""
**Blobs**
@@ -272,30 +320,35 @@ class DownloadCancelledError(BlobError):
class DownloadSDTimeoutError(BlobError):
def __init__(self, download):
self.download = download
super().__init__(f"Failed to download sd blob {download} within timeout.")
class DownloadDataTimeoutError(BlobError):
def __init__(self, download):
self.download = download
super().__init__(f"Failed to download data blobs for sd hash {download} within timeout.")
class InvalidStreamDescriptorError(BlobError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
class InvalidDataError(BlobError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
class InvalidBlobHashError(BlobError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
@@ -308,12 +361,14 @@ class ComponentError(BaseError):
class ComponentStartConditionNotMetError(ComponentError):
def __init__(self, components):
self.components = components
super().__init__(f"Unresolved dependencies for: {components}")
class ComponentsNotStartedError(ComponentError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
@@ -326,16 +381,20 @@ class CurrencyExchangeError(BaseError):
class InvalidExchangeRateResponseError(CurrencyExchangeError):
def __init__(self, source, reason):
self.source = source
self.reason = reason
super().__init__(f"Failed to get exchange rate from {source}: {reason}")
class CurrencyConversionError(CurrencyExchangeError):
def __init__(self, message):
self.message = message
super().__init__(f"{message}")
class InvalidCurrencyError(CurrencyExchangeError):
def __init__(self, currency):
self.currency = currency
super().__init__(f"Invalid currency: {currency} is not a supported currency.")
+7
View File
@@ -1,2 +1,9 @@
from binascii import hexlify
def claim_id(claim_hash):
return hexlify(claim_hash[::-1]).decode()
class BaseError(Exception):
pass
+17 -4
View File
@@ -13,10 +13,12 @@ class {name}({parents}):{doc}
"""
INIT = """
def __init__({args}):
def __init__({args}):{fields}
super().__init__({format}"{message}")
"""
FUNCTIONS = ['claim_id']
class ErrorClass:
@@ -50,10 +52,20 @@ 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):
for func in FUNCTIONS:
if arg.startswith(f'{func}('):
arg = arg[len(f'{func}('):-1]
break
args.append(arg)
return args
@staticmethod
def get_fields(args):
if len(args) > 1:
return f''.join(f'\n{INDENT*2}self.{field} = {field}' for field in args[1:])
return ''
@staticmethod
def get_doc_string(doc):
if doc:
@@ -69,7 +81,8 @@ class ErrorClass:
args = self.get_arguments()
if self.is_leaf:
out.write((CLASS + INIT).format(
name=self.class_name, parents=', '.join(parents), args=', '.join(args),
name=self.class_name, parents=', '.join(parents),
args=', '.join(args), fields=self.get_fields(args),
message=self.message, doc=self.get_doc_string(self.comment), format='f' if len(args) > 1 else ''
))
else:
@@ -102,7 +115,7 @@ def find_parent(stack, child):
def generate(out):
out.write('from .base import BaseError\n')
out.write(f"from .base import BaseError, {', '.join(FUNCTIONS)}\n")
stack = {}
for error in get_errors():
error.render(out, find_parent(stack, error))
+7 -4
View File
@@ -3,6 +3,7 @@ import sys
import shutil
import signal
import pathlib
import platform
import json
import asyncio
import argparse
@@ -255,13 +256,15 @@ def setup_logging(logger: logging.Logger, args: argparse.Namespace, conf: Config
else:
logger.getChild('lbry').setLevel(logging.DEBUG)
if conf.share_usage_data:
loggly_handler = get_loggly_handler()
loggly_handler.setLevel(logging.ERROR)
logger.getChild('lbry').addHandler(loggly_handler)
loggly_handler = get_loggly_handler(conf)
loggly_handler.setLevel(logging.ERROR)
logger.getChild('lbry').addHandler(loggly_handler)
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)
+9 -6
View File
@@ -110,7 +110,6 @@ class AnalyticsManager:
self.cookies = {}
self.url = ANALYTICS_ENDPOINT
self._write_key = utils.deobfuscate(ANALYTICS_TOKEN)
self._enabled = conf.share_usage_data
self._tracked_data = collections.defaultdict(list)
self.context = _make_context(system_info.get_platform())
self.installation_id = installation_id
@@ -118,20 +117,24 @@ class AnalyticsManager:
self.task: typing.Optional[asyncio.Task] = None
self.external_ip: typing.Optional[str] = None
@property
def enabled(self):
return self.conf.share_usage_data
@property
def is_started(self):
return self.task is not None
async def start(self):
if self._enabled and self.task is None:
self.external_ip = await utils.get_external_ip()
if self.task is None:
self.task = asyncio.create_task(self.run())
async def run(self):
while True:
await self._send_heartbeat()
if self.enabled:
self.external_ip = await utils.get_external_ip()
await self._send_heartbeat()
await asyncio.sleep(1800)
self.external_ip = await utils.get_external_ip()
def stop(self):
if self.task is not None and not self.task.done():
@@ -154,7 +157,7 @@ class AnalyticsManager:
async def track(self, event: typing.Dict):
"""Send a single tracking event"""
if self._enabled:
if self.enabled:
log.debug('Sending track event: %s', event)
await self._post(event)
+30
View File
@@ -21,6 +21,7 @@ from lbry.extras.daemon.component import Component
from lbry.extras.daemon.exchange_rate_manager import ExchangeRateManager
from lbry.extras.daemon.storage import SQLiteStorage
from lbry.wallet import WalletManager
from lbry.wallet.usage_payment import WalletServerPayer
log = logging.getLogger(__name__)
@@ -29,6 +30,7 @@ log = logging.getLogger(__name__)
DATABASE_COMPONENT = "database"
BLOB_COMPONENT = "blob_manager"
WALLET_COMPONENT = "wallet"
WALLET_SERVER_PAYMENTS_COMPONENT = "wallet_server_payments"
DHT_COMPONENT = "dht"
HASH_ANNOUNCER_COMPONENT = "hash_announcer"
STREAM_MANAGER_COMPONENT = "stream_manager"
@@ -160,6 +162,34 @@ class WalletComponent(Component):
self.wallet_manager = None
class WalletServerPaymentsComponent(Component):
component_name = WALLET_SERVER_PAYMENTS_COMPONENT
depends_on = [WALLET_COMPONENT]
def __init__(self, component_manager):
super().__init__(component_manager)
self.usage_payment_service = WalletServerPayer(
max_fee=self.conf.max_wallet_server_fee, analytics_manager=self.component_manager.analytics_manager,
)
@property
def component(self) -> typing.Optional[WalletServerPayer]:
return self.usage_payment_service
async def start(self):
wallet_manager = self.component_manager.get_component(WALLET_COMPONENT)
await self.usage_payment_service.start(wallet_manager.ledger, wallet_manager.default_wallet)
async def stop(self):
await self.usage_payment_service.stop()
async def get_status(self):
return {
'max_fee': self.usage_payment_service.max_fee,
'running': self.usage_payment_service.running
}
class BlobComponent(Component):
component_name = BLOB_COMPONENT
depends_on = [DATABASE_COMPONENT]
+92 -48
View File
@@ -44,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
@@ -296,6 +297,8 @@ class Daemon(metaclass=JSONRPCServerType):
def __init__(self, conf: Config, component_manager: typing.Optional[ComponentManager] = None):
self.conf = conf
self.platform_info = system_info.get_platform()
self._video_file_analyzer = VideoFileAnalyzer(conf)
self._node_id = None
self._installation_id = None
self.session_id = base58.b58encode(utils.generate_id()).decode()
@@ -305,7 +308,7 @@ class Daemon(metaclass=JSONRPCServerType):
skip_components=conf.components_to_skip or []
)
self.component_startup_task = None
self._connection_status: typing.Tuple[float, bool] = [self.component_manager.loop.time(), False]
self._connection_status: typing.Tuple[float, bool] = (self.component_manager.loop.time(), False)
logging.getLogger('aiohttp.access').setLevel(logging.WARN)
rpc_app = web.Application()
@@ -355,7 +358,7 @@ class Daemon(metaclass=JSONRPCServerType):
@classmethod
def get_api_definitions(cls):
prefix = 'jsonrpc_'
not_grouped = ['routing_table_get']
not_grouped = ['routing_table_get', 'ffmpeg_find']
api = {
'groups': {
group_name[:-len('_DOC')].lower(): getattr(cls, group_name).strip()
@@ -447,7 +450,7 @@ class Daemon(metaclass=JSONRPCServerType):
async def start(self):
log.info("Starting LBRYNet Daemon")
log.debug("Settings: %s", json.dumps(self.conf.settings_dict, indent=2))
log.info("Platform: %s", json.dumps(system_info.get_platform(), indent=2))
log.info("Platform: %s", json.dumps(self.platform_info, indent=2))
await self.analytics_manager.send_server_startup()
await self.rpc_runner.setup()
await self.streaming_runner.setup()
@@ -762,6 +765,26 @@ class Daemon(metaclass=JSONRPCServerType):
asyncio.get_event_loop().call_later(0, shutdown)
return "Shutting down"
async def jsonrpc_ffmpeg_find(self):
"""
Get ffmpeg installation information
Usage:
ffmpeg_find
Options:
None
Returns:
(dict) Dictionary of ffmpeg information
{
'available': (bool) found ffmpeg,
'which': (str) path to ffmpeg,
'analyze_audio_volume': (bool) should ffmpeg analyze audio
}
"""
return await self._video_file_analyzer.status(recheck=True)
async def jsonrpc_status(self):
"""
Get daemon status
@@ -851,6 +874,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,
@@ -861,6 +885,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()
@@ -890,9 +915,7 @@ class Daemon(metaclass=JSONRPCServerType):
'build': (str) "dev" | "qa" | "rc" | "release",
}
"""
platform_info = system_info.get_platform()
log.info("Get version info: %s", json.dumps(platform_info))
return platform_info
return self.platform_info
@requires(WALLET_COMPONENT)
async def jsonrpc_resolve(self, urls: typing.Union[str, list], wallet_id=None):
@@ -1398,7 +1421,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)
@@ -2144,14 +2167,16 @@ 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.
Usage:
claim_list [--claim_type=<claim_type>]
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
@@ -2159,6 +2184,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]}
"""
@@ -2170,7 +2196,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):
@@ -2198,6 +2224,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>...]
@@ -2284,6 +2311,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
@@ -2448,7 +2477,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)
@@ -2604,7 +2633,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)
@@ -2663,26 +2692,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]}
"""
@@ -2694,7 +2724,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):
@@ -2801,6 +2831,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>...]
@@ -2816,6 +2847,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
@@ -2976,7 +3012,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)
@@ -2987,12 +3023,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>]
@@ -3009,6 +3046,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
@@ -3100,6 +3142,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(
@@ -3123,7 +3167,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)
@@ -3308,17 +3352,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)
@@ -3331,7 +3374,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)
@@ -3390,26 +3433,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]}
"""
@@ -3421,7 +3465,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)
@@ -3554,7 +3598,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)
@@ -3708,7 +3752,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)
@@ -3860,7 +3904,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)
@@ -3960,7 +4004,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)
@@ -4364,7 +4408,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 = []
@@ -4540,7 +4584,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
comment_create (<comment> | --comment=<comment>)
(<claim_id> | --claim_id=<claim_id> | --parent_id=<parent_id>)
[--channel_id=<channel_id>] [--channel_name=<channel_name>]
(--channel_id=<channel_id> | --channel_name=<channel_name>)
[--channel_account_id=<channel_account_id>...] [--wallet_id=<wallet_id>]
Options:
@@ -4568,23 +4612,23 @@ class Daemon(metaclass=JSONRPCServerType):
}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
channel = await self.get_channel_or_error(
wallet, channel_account_id, channel_id, channel_name, for_signing=True
)
comment_body = {
'comment': comment.strip(),
'claim_id': claim_id,
'parent_id': parent_id,
'channel_id': channel.claim_id,
'channel_name': channel.claim_name,
}
channel = await self.get_channel_or_none(
wallet, channel_account_id, channel_id, channel_name, for_signing=True
)
if channel:
comment_body.update({
'channel_id': channel.claim_id,
'channel_name': channel.claim_name,
})
comment_client.sign_comment(comment_body, channel)
comment_client.sign_comment(comment_body, channel)
response = await comment_client.jsonrpc_post(self.conf.comment_server, 'create_comment', comment_body)
if 'signature' in response:
response['is_claim_signature_valid'] = comment_client.is_comment_signed_by_channel(response, channel)
response.update({
'is_claim_signature_valid': comment_client.is_comment_signed_by_channel(response, channel)
})
return response
@requires(WALLET_COMPONENT)
@@ -4828,7 +4872,7 @@ class Daemon(metaclass=JSONRPCServerType):
async def resolve(self, accounts, urls):
results = await self.ledger.resolve(accounts, urls)
if results:
if self.conf.save_resolved_claims and results:
try:
claims = self.stream_manager._convert_to_old_resolve_output(self.wallet_manager, results)
await self.storage.save_claims_for_resolve([
+2 -1
View File
@@ -294,7 +294,8 @@ class JSONResponseEncoder(JSONEncoder):
'added_on': managed_stream.added_on,
'height': tx_height,
'confirmations': (best_height + 1) - tx_height if tx_height > 0 else tx_height,
'timestamp': self.ledger.headers[tx_height]['timestamp'] if 0 < tx_height <= best_height else None
'timestamp': self.ledger.headers[tx_height]['timestamp'] if 0 < tx_height <= best_height else None,
'is_fully_reflected': managed_stream.is_fully_reflected
}
def encode_claim(self, claim):
+15 -9
View File
@@ -3,10 +3,12 @@ import json
import logging.handlers
import traceback
import typing
from aiohttp.client_exceptions import ClientError
import aiohttp
from lbry import utils, __version__
if typing.TYPE_CHECKING:
from lbry.conf import Config
LOGGLY_TOKEN = 'BQEzZmMzLJHgAGxkBF00LGD0YGuyATVgAmqxAQEuAQZ2BQH4'
@@ -36,17 +38,19 @@ class JsonFormatter(logging.Formatter):
class HTTPSLogglyHandler(logging.Handler):
def __init__(self, loggly_token: str, fqdn=False, localname=None, facility=None, cookies=None):
def __init__(self, loggly_token: str, config: 'Config'):
super().__init__()
self.fqdn = fqdn
self.localname = localname
self.facility = facility
self.cookies = cookies or {}
self.cookies = {}
self.url = "https://logs-01.loggly.com/inputs/{token}/tag/{tag}".format(
token=utils.deobfuscate(loggly_token), tag='lbrynet-' + __version__
)
self._loop = asyncio.get_event_loop()
self._session = aiohttp.ClientSession()
self._config = config
@property
def enabled(self):
return self._config.share_usage_data
@staticmethod
def get_full_message(record):
@@ -62,12 +66,14 @@ class HTTPSLogglyHandler(logging.Handler):
cookies=self.cookies) as response:
self.cookies.update(response.cookies)
except ClientError:
if self._loop.is_running() and retry:
if self._loop.is_running() and retry and self.enabled:
await self._session.close()
self._session = aiohttp.ClientSession()
return await self._emit(record, retry=False)
def emit(self, record):
if not self.enabled:
return
try:
asyncio.ensure_future(self._emit(record), loop=self._loop)
except RuntimeError: # TODO: use a second loop
@@ -83,7 +89,7 @@ class HTTPSLogglyHandler(logging.Handler):
pass
def get_loggly_handler():
handler = HTTPSLogglyHandler(LOGGLY_TOKEN)
def get_loggly_handler(config):
handler = HTTPSLogglyHandler(LOGGLY_TOKEN, config=config)
handler.setFormatter(JsonFormatter())
return handler
+8 -4
View File
@@ -112,7 +112,7 @@ def _batched_select(transaction, query, parameters, batch_size=900):
def _get_lbry_file_stream_dict(rowid, added_on, stream_hash, file_name, download_dir, data_rate, status,
sd_hash, stream_key, stream_name, suggested_file_name, claim, saved_file,
raw_content_fee):
raw_content_fee, fully_reflected):
return {
"rowid": rowid,
"added_on": added_on,
@@ -129,7 +129,8 @@ def _get_lbry_file_stream_dict(rowid, added_on, stream_hash, file_name, download
"saved_file": bool(saved_file),
"content_fee": None if not raw_content_fee else Transaction(
binascii.unhexlify(raw_content_fee)
)
),
"fully_reflected": fully_reflected
}
@@ -138,11 +139,14 @@ def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Di
signed_claims = {}
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 transaction.execute(
"select file.rowid, file.*, stream.*, c.* "
"select file.rowid, file.*, stream.*, c.*, "
" case when (SELECT 1 FROM reflected_stream r WHERE r.sd_hash=stream.sd_hash) "
" is null then 0 else 1 end as fully_reflected "
"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 "
"order by c.rowid desc").fetchall():
claim_args, fully_reflected = tuple(claim_args[:-1]), claim_args[-1]
claim = StoredContentClaim(*claim_args)
if claim.channel_claim_id:
if claim.channel_claim_id not in signed_claims:
@@ -152,7 +156,7 @@ def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Di
_get_lbry_file_stream_dict(
rowid, added_on, stream_hash, file_name, download_dir, data_rate, status,
sd_hash, stream_key, stream_name, suggested_file_name, claim, saved_file,
raw_content_fee
raw_content_fee, fully_reflected
)
)
for claim_name, claim_id in _batched_select(
+357
View File
@@ -0,0 +1,357 @@
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
self._checked_ffmpeg = False
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(errors='replace') + stderr.decode(errors='replace'), 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, recheck=False):
if reset:
self._available_encoders = ""
self._ffmpeg_installed = False
self._which = None
if self._checked_ffmpeg and not recheck:
installed = self._ffmpeg_installed
else:
installed = True
try:
await self._verify_ffmpeg_installed()
except FileNotFoundError:
installed = False
self._checked_ffmpeg = True
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}"')
match = re.search(r"Before avformat_find_stream_info.+?\s+seeks:(\d+)\s+", result)
if match and 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)
+53 -33
View File
@@ -4,7 +4,23 @@ 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)
def set_reference(reference, claim_hash, rows):
if claim_hash:
for txo in rows:
if claim_hash == txo['claim_hash']:
reference.tx_hash = txo['txo_hash'][:32]
reference.nout = struct.unpack('<I', txo['txo_hash'][32:])[0]
reference.height = txo['height']
return
class Censor:
@@ -22,7 +38,9 @@ class Censor:
for claim_hash, lookup in (
(row['claim_hash'], self.streams),
(row['claim_hash'], self.channels),
(row['channel_hash'], self.channels)):
(row['channel_hash'], self.channels),
(row['reposted_claim_hash'], self.streams),
(row['reposted_claim_hash'], self.channels)):
censoring_channel_hash = lookup.get(claim_hash)
if censoring_channel_hash:
was_censored = True
@@ -33,12 +51,12 @@ class Censor:
self.total += 1
return was_censored
def to_message(self, outputs: OutputsMessage):
def to_message(self, outputs: OutputsMessage, extra_txo_rows):
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
blocked = outputs.blocked.add()
blocked.count = count
set_reference(blocked.channel, censoring_channel_hash, extra_txo_rows)
class Outputs:
@@ -60,21 +78,35 @@ class Outputs:
for txo_message in self.extra_txos:
self.message_to_txo(txo_message, tx_map)
txos = [self.message_to_txo(txo_message, tx_map) for txo_message in self.txos]
return txos, self.inflate_blocked()
return txos, self.inflate_blocked(tx_map)
def inflate_blocked(self):
def inflate_blocked(self, tx_map):
return {
"total": self.blocked_total,
"channels": {
hexlify(message.channel_hash[::-1]).decode(): message.count
for message in self.blocked
}
"channels": [{
'channel': self.message_to_txo(blocked.channel, tx_map),
'blocked': blocked.count
} for blocked in self.blocked]
}
def message_to_txo(self, txo_message, tx_map):
if txo_message.WhichOneof('meta') == 'error':
return None
txo = tx_map[txo_message.tx_hash].outputs[txo_message.nout]
error = {
'error': {
'name': txo_message.error.Code.Name(txo_message.error.code),
'text': txo_message.error.text,
}
}
if error['error']['name'] == BLOCKED:
error['error']['censor'] = self.message_to_txo(
txo_message.error.blocked.channel, tx_map
)
return error
tx = tx_map.get(txo_message.tx_hash)
if not tx:
return
txo = tx.outputs[txo_message.nout]
if txo_message.WhichOneof('meta') == 'claim':
claim = txo_message.claim
txo.meta = {
@@ -134,7 +166,7 @@ class Outputs:
if total is not None:
page.total = total
if blocked is not None:
blocked.to_message(page)
blocked.to_message(page, extra_txo_rows)
for row in txo_rows:
cls.row_to_message(row, page.txos.add(), extra_txo_rows)
for row in extra_txo_rows:
@@ -146,9 +178,12 @@ 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
set_reference(txo_message.error.blocked.channel, txo.censor_hash, extra_txo_rows)
return
txo_message.tx_hash = txo['txo_hash'][:32]
txo_message.nout, = struct.unpack('<I', txo['txo_hash'][32:])
@@ -171,20 +206,5 @@ class Outputs:
txo_message.claim.trending_mixed = txo['trending_mixed']
txo_message.claim.trending_local = txo['trending_local']
txo_message.claim.trending_global = txo['trending_global']
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:
for txo in rows:
if claim_hash == txo['claim_hash']:
reference = getattr(message.claim, attr)
reference.tx_hash = txo['txo_hash'][:32]
reference.nout = struct.unpack('<I', txo['txo_hash'][32:])[0]
reference.height = txo['height']
break
set_reference(txo_message.claim.channel, txo['channel_hash'], extra_txo_rows)
set_reference(txo_message.claim.repost, txo['reposted_claim_hash'], extra_txo_rows)
+6 -5
View File
@@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='result.proto',
package='pb',
syntax='proto3',
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')
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\"5\n\x07\x42locked\x12\r\n\x05\x63ount\x18\x01 \x01(\r\x12\x1b\n\x07\x63hannel\x18\x02 \x01(\x0b\x32\n.pb.Outputb\x06proto3')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@@ -388,9 +388,9 @@ _BLOCKED = _descriptor.Descriptor(
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(""),
name='channel', full_name='pb.Blocked.channel', 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,
options=None),
@@ -407,7 +407,7 @@ _BLOCKED = _descriptor.Descriptor(
oneofs=[
],
serialized_start=884,
serialized_end=930,
serialized_end=937,
)
_OUTPUTS.fields_by_name['txos'].message_type = _OUTPUT
@@ -426,6 +426,7 @@ _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
_BLOCKED.fields_by_name['channel'].message_type = _OUTPUT
DESCRIPTOR.message_types_by_name['Outputs'] = _OUTPUTS
DESCRIPTOR.message_types_by_name['Output'] = _OUTPUT
DESCRIPTOR.message_types_by_name['ClaimMeta'] = _CLAIMMETA
+1 -1
View File
@@ -7,7 +7,7 @@ def _create_url_regex():
# see https://spec.lbry.com/ and test_url.py
invalid_names_regex = \
r"[^=&#:$@%?;\"/\\<>%{}|^~`\[\]" \
r"\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]+"
r"\u0000-\u0020\uD800-\uDFFF\uFFFE-\uFFFF]+"
def _named(name, regex):
return "(?P<" + name + ">" + regex + ")"
+6 -2
View File
@@ -111,6 +111,10 @@ class ManagedStream:
self.started_writing = asyncio.Event(loop=self.loop)
self.finished_write_attempt = asyncio.Event(loop=self.loop)
@property
def is_fully_reflected(self) -> bool:
return self.fully_reflected.is_set()
@property
def descriptor(self) -> StreamDescriptor:
return self.downloader.descriptor
@@ -429,9 +433,9 @@ class ManagedStream:
await self.loop.create_connection(lambda: protocol, host, port)
await protocol.send_handshake()
sent_sd, needed = await protocol.send_descriptor()
if sent_sd:
if sent_sd: # reflector needed the sd blob
sent.append(self.sd_hash)
if not sent_sd and not needed:
if not sent_sd and not needed: # reflector already has the stream
if not self.fully_reflected.is_set():
self.fully_reflected.set()
await self.blob_manager.storage.update_reflected_stream(self.sd_hash, f"{host}:{port}")
+28 -15
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):
@@ -116,7 +116,7 @@ class StreamManager:
async def add_stream(self, rowid: int, sd_hash: str, file_name: Optional[str],
download_directory: Optional[str], status: str,
claim: Optional['StoredContentClaim'], content_fee: Optional['Transaction'],
added_on: Optional[int]):
added_on: Optional[int], fully_reflected: bool):
try:
descriptor = await self.blob_manager.get_stream_descriptor(sd_hash)
except InvalidStreamDescriptorError as err:
@@ -127,6 +127,8 @@ class StreamManager:
claim, content_fee=content_fee, rowid=rowid, descriptor=descriptor,
analytics_manager=self.analytics_manager, added_on=added_on
)
if fully_reflected:
stream.fully_reflected.set()
self.streams[sd_hash] = stream
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
@@ -159,7 +161,7 @@ class StreamManager:
file_info['rowid'], file_info['sd_hash'], file_name,
download_directory, file_info['status'],
file_info['claim'], file_info['content_fee'],
file_info['added_on']
file_info['added_on'], file_info['fully_reflected']
)))
if add_stream_tasks:
await asyncio.gather(*add_stream_tasks, loop=self.loop)
@@ -185,10 +187,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 = []
@@ -212,26 +214,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]
+13 -2
View File
@@ -253,6 +253,11 @@ class IntegrationTestCase(AsyncioTestCase):
lambda e: e.tx.id == txid
)
def on_address_update(self, address):
return self.ledger.on_transaction.where(
lambda e: e.address == address
)
def on_transaction_address(self, tx, address):
return self.ledger.on_transaction.where(
lambda e: e.tx.id == tx.id and e.address == address
@@ -544,7 +549,7 @@ class CommandTestCase(IntegrationTestCase):
)
async def resolve(self, uri):
return await self.out(self.daemon.jsonrpc_resolve(uri))
return (await self.out(self.daemon.jsonrpc_resolve(uri)))[uri]
async def claim_search(self, **kwargs):
return (await self.out(self.daemon.jsonrpc_claim_search(**kwargs)))['items']
@@ -555,9 +560,15 @@ 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']
def assertItemCount(self, result, count): # pylint: disable=invalid-name
self.assertEqual(result['total_items'], count)
self.assertEqual(count, result['total_items'])
+1 -1
View File
@@ -2,7 +2,7 @@ __node_daemon__ = 'lbrycrdd'
__node_cli__ = 'lbrycrd-cli'
__node_bin__ = ''
__node_url__ = (
'https://github.com/lbryio/lbrycrd/releases/download/v0.17.3.2/lbrycrd-linux-1732.zip'
'https://github.com/lbryio/lbrycrd/releases/download/v0.17.4.3/lbrycrd-linux-1743.zip'
)
__spvserver__ = 'lbry.wallet.server.coin.LBCRegTest'
+17 -10
View File
@@ -134,16 +134,20 @@ def constraints_to_sql(constraints, joiner=' AND ', prepend_key=''):
col, op = col[:-len('__not_like')], 'NOT LIKE'
elif key.endswith('__in') or key.endswith('__not_in'):
if key.endswith('__in'):
col, op = col[:-len('__in')], 'IN'
col, op, one_val_op = col[:-len('__in')], 'IN', '='
else:
col, op = col[:-len('__not_in')], 'NOT IN'
col, op, one_val_op = col[:-len('__not_in')], 'NOT IN', '!='
if constraint:
if isinstance(constraint, (list, set, tuple)):
keys = []
for i, val in enumerate(constraint):
keys.append(f':{key}{tag}_{i}')
values[f'{key}{tag}_{i}'] = val
sql.append(f'{col} {op} ({", ".join(keys)})')
if len(constraint) == 1:
values[f'{key}{tag}'] = next(iter(constraint))
sql.append(f'{col} {one_val_op} :{key}{tag}')
else:
keys = []
for i, val in enumerate(constraint):
keys.append(f':{key}{tag}_{i}')
values[f'{key}{tag}_{i}'] = val
sql.append(f'{col} {op} ({", ".join(keys)})')
elif isinstance(constraint, str):
sql.append(f'{col} {op} ({constraint})')
else:
@@ -631,6 +635,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)
@@ -738,9 +743,11 @@ class Database(SQLiteMixin):
@staticmethod
def constrain_claims(constraints):
claim_type = constraints.pop('claim_type', None)
if claim_type is not None:
constraints['txo_type'] = TXO_TYPES[claim_type]
claim_types = constraints.pop('claim_type', None)
if isinstance(claim_types, str) and claim_types:
claim_types = [claim_types]
if isinstance(claim_types, list) and claim_types:
constraints['txo_type__in'] = [TXO_TYPES[ct] for ct in claim_types]
else:
constraints['txo_type__in'] = CLAIM_TYPES
+37 -13
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
@@ -630,7 +630,8 @@ class Ledger(metaclass=LedgerRegistry):
raise asyncio.TimeoutError('Timed out waiting for transaction.')
async def _inflate_outputs(self, query, accounts) -> Tuple[List[Output], dict, int, int]:
outputs = Outputs.from_base64(await query)
encoded_outputs = await query
outputs = Outputs.from_base64(encoded_outputs or b'') # TODO: why is the server returning None?
txs = []
if len(outputs.txs) > 0:
txs: List[Transaction] = await asyncio.gather(*(
@@ -661,13 +662,13 @@ 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], dict, int, int]:
@@ -732,20 +733,43 @@ 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):
resolved.update_annotations(txo)
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)
+11 -3
View File
@@ -1,5 +1,6 @@
import logging
import asyncio
import json
from time import perf_counter
from operator import itemgetter
from typing import Dict, Optional, Tuple
@@ -68,7 +69,14 @@ class ClientSession(BaseClientSession):
log.info("timeout sending %s to %s:%i", method, *self.server)
raise asyncio.TimeoutError
if done:
return request.result()
try:
return request.result()
except ConnectionResetError:
log.error(
"wallet server (%s) reset connection upon our %s request, json of %i args is %i bytes",
self.server[0], method, len(args), len(json.dumps(args))
)
raise
except (RPCError, ProtocolError) as e:
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
*self.server, *e.args)
@@ -94,7 +102,7 @@ class ClientSession(BaseClientSession):
await self.create_connection(self.timeout)
await self.ensure_server_version()
self._on_connect_cb()
elif (perf_counter() - self.last_send) > self.max_seconds_idle or self.response_time is None:
if (perf_counter() - self.last_send) > self.max_seconds_idle or self.response_time is None:
await self.ensure_server_version()
retry_delay = default_delay
except RPCError as e:
@@ -148,7 +156,7 @@ class ClientSession(BaseClientSession):
class Network:
PROTOCOL_VERSION = __version__
MINIMUM_REQUIRED = (0, 54, 0)
MINIMUM_REQUIRED = (0, 59, 0)
def __init__(self, ledger):
self.ledger = ledger
+5
View File
@@ -173,6 +173,9 @@ class SPVNode:
async def start(self, blockchain_node: 'BlockchainNode', extraconf=None):
self.data_path = tempfile.mkdtemp()
conf = {
'DESCRIPTION': '',
'PAYMENT_ADDRESS': '',
'DAILY_FEE': '0',
'DB_DIRECTORY': self.data_path,
'DAEMON_URL': blockchain_node.rpc_url,
'REORG_LIMIT': '100',
@@ -228,6 +231,7 @@ class BlockchainProcess(asyncio.SubprocessProtocol):
def process_exited(self):
self.stopped.set()
self.ready.set()
class BlockchainNode:
@@ -315,6 +319,7 @@ class BlockchainNode:
BlockchainProcess, *command
)
await self.protocol.ready.wait()
assert not self.protocol.stopped.is_set()
async def stop(self, cleanup=True):
try:
+17 -3
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:
@@ -379,14 +380,17 @@ 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():
try:
message = await self.framer.receive_message()
except MemoryError as e:
self.logger.warning(f'{e!r}')
continue
except MemoryError:
self.logger.warning('received oversized message from %s:%s, dropping connection',
self._address[0], self._address[1])
self._close()
return
self.last_recv = time.perf_counter()
self.recv_count += 1
@@ -405,6 +409,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:
@@ -417,10 +422,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
@@ -454,6 +467,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):
+14 -8
View File
@@ -1,6 +1,7 @@
import time
import asyncio
from struct import pack, unpack
from concurrent.futures.thread import ThreadPoolExecutor
import lbry
from lbry.schema.claim import Claim
@@ -9,6 +10,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:
@@ -144,6 +146,7 @@ class BlockProcessor:
self.blocks_event = asyncio.Event()
self.prefetcher = Prefetcher(daemon, env.coin, self.blocks_event)
self.logger = class_logger(__name__, self.__class__.__name__)
self.executor = ThreadPoolExecutor(1)
# Meta
self.next_cache_check = 0
@@ -163,6 +166,8 @@ class BlockProcessor:
# is consistent with self.height
self.state_lock = asyncio.Lock()
self.search_cache = {}
async def run_in_thread_with_lock(self, func, *args):
# Run in a thread to prevent blocking. Shielded so that
# cancellations from shutdown don't lose work - when the task
@@ -171,7 +176,7 @@ class BlockProcessor:
# consistent and not being updated elsewhere.
async def run_in_thread_locked():
async with self.state_lock:
return await asyncio.get_event_loop().run_in_executor(None, func, *args)
return await asyncio.get_event_loop().run_in_executor(self.executor, func, *args)
return await asyncio.shield(run_in_thread_locked())
async def check_and_advance_blocks(self, raw_blocks):
@@ -188,14 +193,17 @@ 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)
for cache in self.search_cache.values():
cache.clear()
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()
@@ -652,6 +660,7 @@ class BlockProcessor:
self.logger.info('flushing to DB for a clean shutdown...')
await self.flush(True)
self.db.close()
self.executor.shutdown(wait=True)
def force_chain_reorg(self, count):
"""Force a reorg of the given number of blocks.
@@ -727,7 +736,6 @@ class LBRYBlockProcessor(BlockProcessor):
self.logger.info(f"LbryumX Block Processor - Validating signatures: {self.should_validate_signatures}")
self.sql: SQLDB = self.db.sql
self.timer = Timer('BlockProcessor')
self.search_cache = {}
def advance_blocks(self, blocks):
self.sql.begin()
@@ -742,8 +750,6 @@ class LBRYBlockProcessor(BlockProcessor):
self.timer.run(self.sql.execute, self.sql.SEARCH_INDEXES, timer_name='executing SEARCH_INDEXES')
if self.env.individual_tag_indexes:
self.timer.run(self.sql.execute, self.sql.TAG_INDEXES, timer_name='executing TAG_INDEXES')
for cache in self.search_cache.values():
cache.clear()
def advance_txs(self, height, txs, header):
timer = self.timer.sub_timers['advance_blocks']
+40 -6
View File
@@ -3,13 +3,14 @@ import itertools
import json
import time
from functools import wraps
from pylru import lrucache
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."""
@@ -42,6 +43,8 @@ class Daemon:
self._height = None
self.available_rpcs = {}
self.connector = aiohttp.TCPConnector()
self._block_hash_cache = lrucache(1000000)
self._block_cache = lrucache(100000)
async def close(self):
if self.connector:
@@ -106,6 +109,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 +123,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 +152,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 +174,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 +184,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 +197,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.
@@ -201,12 +222,25 @@ class Daemon:
async def block_hex_hashes(self, first, count):
"""Return the hex hashes of count block starting at height first."""
if first + count < (self.cached_height() or 0) - 200:
return await self._cached_block_hex_hashes(first, count)
params_iterable = ((h, ) for h in range(first, first + count))
return await self._send_vector('getblockhash', params_iterable)
async def _cached_block_hex_hashes(self, first, count):
"""Return the hex hashes of count block starting at height first."""
cached = self._block_hash_cache.get((first, count))
if cached:
return cached
params_iterable = ((h, ) for h in range(first, first + count))
self._block_hash_cache[(first, count)] = await self._send_vector('getblockhash', params_iterable)
return self._block_hash_cache[(first, count)]
async def deserialised_block(self, hex_hash):
"""Return the deserialised block with the given hex hash."""
return await self._send_single('getblock', (hex_hash, True))
if not self._block_cache.get(hex_hash):
self._block_cache[hex_hash] = await self._send_single('getblock', (hex_hash, True))
return self._block_cache[hex_hash]
async def raw_blocks(self, hex_hashes):
"""Return the raw binary blocks with the given hex hashes."""
+1
View File
@@ -1,6 +1,7 @@
CLAIM_TYPES = {
'stream': 1,
'channel': 2,
'repost': 3
}
STREAM_TYPES = {
+57 -28
View File
@@ -8,10 +8,11 @@ from binascii import unhexlify
from decimal import Decimal
from contextvars import ContextVar
from functools import wraps
from itertools import chain
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, Censor
@@ -37,7 +38,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',
@@ -265,7 +266,7 @@ def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
else:
constraints['claim.claim_id__like'] = f'{claim_id[:40]}%'
elif 'claim_ids' in constraints:
constraints['claim.claim_id__in'] = constraints.pop('claim_ids')
constraints['claim.claim_id__in'] = set(constraints.pop('claim_ids'))
if 'reposted_claim_id' in constraints:
constraints['claim.reposted_claim_hash'] = unhexlify(constraints.pop('reposted_claim_id'))[::-1]
@@ -281,15 +282,16 @@ def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
if 'channel_ids' in constraints:
channel_ids = constraints.pop('channel_ids')
if channel_ids:
constraints['claim.channel_hash__in'] = [
constraints['claim.channel_hash__in'] = {
unhexlify(cid)[::-1] for cid in channel_ids
]
}
if 'not_channel_ids' in constraints:
not_channel_ids = constraints.pop('not_channel_ids')
if not_channel_ids:
not_channel_ids_binary = [
not_channel_ids_binary = {
unhexlify(ncid)[::-1] for ncid in not_channel_ids
]
}
constraints['claim.claim_hash__not_in#not_channel_ids'] = not_channel_ids_binary
if constraints.get('has_channel_signature', False):
constraints['claim.channel_hash__not_in'] = not_channel_ids_binary
else:
@@ -315,17 +317,23 @@ def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
constraints['claim.txo_hash'] = tx_hash + struct.pack('<I', nout)
if 'claim_type' in constraints:
constraints['claim.claim_type'] = CLAIM_TYPES[constraints.pop('claim_type')]
claim_types = constraints.pop('claim_type')
if isinstance(claim_types, str):
claim_types = [claim_types]
if claim_types:
constraints['claim.claim_type__in'] = {
CLAIM_TYPES[claim_type] for claim_type in claim_types
}
if 'stream_types' in constraints:
stream_types = constraints.pop('stream_types')
if stream_types:
constraints['claim.stream_type__in'] = [
constraints['claim.stream_type__in'] = {
STREAM_TYPES[stream_type] for stream_type in stream_types
]
}
if 'media_types' in constraints:
media_types = constraints.pop('media_types')
if media_types:
constraints['claim.media_type__in'] = media_types
constraints['claim.media_type__in'] = set(media_types)
if 'fee_currency' in constraints:
constraints['claim.fee_currency'] = constraints.pop('fee_currency').lower()
@@ -388,9 +396,13 @@ def search_claims(censor: Censor, **constraints) -> List:
)
def _get_referenced_rows(censor: Censor, txo_rows: List[dict]):
def _get_referenced_rows(txo_rows: List[dict], censor_channels: List[bytes]):
censor = ctx.get().get_resolve_censor()
repost_hashes = set(filter(None, map(itemgetter('reposted_claim_hash'), txo_rows)))
channel_hashes = set(filter(None, map(itemgetter('channel_hash'), txo_rows)))
channel_hashes = set(chain(
filter(None, map(itemgetter('channel_hash'), txo_rows)),
censor_channels
))
reposted_txos = []
if repost_hashes:
@@ -404,7 +416,6 @@ def _get_referenced_rows(censor: Censor, txo_rows: List[dict]):
# 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, Censor]:
assert set(constraints).issubset(SEARCH_PARAMS), \
@@ -414,12 +425,10 @@ def search(constraints) -> Tuple[List, List, int, int, Censor]:
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"]
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)
extra_txo_rows = _get_referenced_rows(txo_rows, search_censor.censored.keys())
return txo_rows, extra_txo_rows, constraints['offset'], total, search_censor
@@ -427,7 +436,8 @@ def search(constraints) -> Tuple[List, List, int, int, Censor]:
def resolve(urls) -> Tuple[List, List]:
txo_rows = [resolve_url(raw_url) for raw_url in urls]
extra_txo_rows = _get_referenced_rows(
ctx.get().get_resolve_censor(), [r for r in txo_rows if isinstance(r, dict)]
[txo for txo in txo_rows if isinstance(txo, dict)],
[txo.censor_hash for txo in txo_rows if isinstance(txo, ResolveCensoredError)]
)
return txo_rows, extra_txo_rows
@@ -452,6 +462,8 @@ def resolve_url(raw_url):
matches = search_claims(censor, **query, limit=1)
if matches:
channel = matches[0]
elif censor.censored:
return ResolveCensoredError(raw_url, next(iter(censor.censored)))
else:
return LookupError(f'Could not find channel in "{raw_url}".')
@@ -470,12 +482,22 @@ def resolve_url(raw_url):
matches = search_claims(censor, **query, limit=1)
if matches:
return matches[0]
elif censor.censored:
return ResolveCensoredError(raw_url, next(iter(censor.censored)))
else:
return LookupError(f'Could not find stream in "{raw_url}".')
return LookupError(f'Could not find claim at "{raw_url}".')
return channel
CLAIM_HASH_OR_REPOST_HASH_SQL = f"""
CASE WHEN claim.claim_type = {CLAIM_TYPES['repost']}
THEN claim.reposted_claim_hash
ELSE claim.claim_hash
END
"""
def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_count=False):
any_items = set(cleaner(constraints.pop(f'any_{attr}s', []))[:ATTRIBUTE_ARRAY_MAX_LENGTH])
all_items = set(cleaner(constraints.pop(f'all_{attr}s', []))[:ATTRIBUTE_ARRAY_MAX_LENGTH])
@@ -495,7 +517,8 @@ def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_coun
index_name = COMMON_TAGS[item]
any_queries[f'#_common_tag_{index_name}'] = f"""
EXISTS(
SELECT 1 FROM tag INDEXED BY tag_{index_name}_idx WHERE claim.claim_hash=tag.claim_hash
SELECT 1 FROM tag INDEXED BY tag_{index_name}_idx
WHERE {CLAIM_HASH_OR_REPOST_HASH_SQL}=tag.claim_hash
AND tag = '{item}'
)
"""
@@ -508,7 +531,7 @@ def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_coun
)
any_queries[f'#_any_common_tags'] = f"""
EXISTS(
SELECT 1 FROM tag WHERE claim.claim_hash=tag.claim_hash
SELECT 1 FROM tag WHERE {CLAIM_HASH_OR_REPOST_HASH_SQL}=tag.claim_hash
AND tag IN ({values})
)
"""
@@ -522,14 +545,16 @@ def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_coun
f':$any_{attr}{i}' for i in range(len(any_items))
)
if for_count or attr == 'tag':
any_queries[f'claim.claim_hash__in#_any_{attr}'] = f"""
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
any_queries[f'#_any_{attr}'] = f"""
{CLAIM_HASH_OR_REPOST_HASH_SQL} IN (
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
)
"""
else:
any_queries[f'#_any_{attr}'] = f"""
EXISTS(
SELECT 1 FROM {attr} WHERE
claim.claim_hash={attr}.claim_hash
{CLAIM_HASH_OR_REPOST_HASH_SQL}={attr}.claim_hash
AND {attr} IN ({values})
)
"""
@@ -548,15 +573,17 @@ def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_coun
f':$all_{attr}{i}' for i in range(len(all_items))
)
if for_count:
constraints[f'claim.claim_hash__in#_all_{attr}'] = f"""
constraints[f'#_all_{attr}'] = f"""
{CLAIM_HASH_OR_REPOST_HASH_SQL} IN (
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
GROUP BY claim_hash HAVING COUNT({attr}) = :$all_{attr}_count
)
"""
else:
constraints[f'#_all_{attr}'] = f"""
{len(all_items)}=(
SELECT count(*) FROM {attr} WHERE
claim.claim_hash={attr}.claim_hash
{CLAIM_HASH_OR_REPOST_HASH_SQL}={attr}.claim_hash
AND {attr} IN ({values})
)
"""
@@ -569,14 +596,16 @@ def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_coun
f':$not_{attr}{i}' for i in range(len(not_items))
)
if for_count:
constraints[f'claim.claim_hash__not_in#_not_{attr}'] = f"""
constraints[f'#_not_{attr}'] = f"""
{CLAIM_HASH_OR_REPOST_HASH_SQL} NOT IN (
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
)
"""
else:
constraints[f'#_not_{attr}'] = f"""
NOT EXISTS(
SELECT 1 FROM {attr} WHERE
claim.claim_hash={attr}.claim_hash
{CLAIM_HASH_OR_REPOST_HASH_SQL}={attr}.claim_hash
AND {attr} IN ({values})
)
"""
@@ -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:
if trending_score >= 0.0:
multiplier = 0.1/((trending_score/time_boost + softened_change_in_amount) + 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
+55 -31
View File
@@ -17,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
@@ -65,6 +63,7 @@ class SQLDB:
media_type text,
fee_amount integer default 0,
fee_currency text,
duration integer,
-- reposts
reposted_claim_hash bytes,
@@ -95,6 +94,7 @@ class SQLDB:
create index if not exists claim_txo_hash_idx on claim (txo_hash);
create index if not exists claim_activation_height_idx on claim (activation_height, claim_hash);
create index if not exists claim_expiration_height_idx on claim (expiration_height);
create index if not exists claim_reposted_claim_hash_idx on claim (reposted_claim_hash);
"""
CREATE_SUPPORT_TABLE = """
@@ -130,31 +130,42 @@ class SQLDB:
-- used by any tag clouds
create index if not exists tag_tag_idx on tag (tag, claim_hash);
-- common ORDER BY
create unique index if not exists claim_effective_amount_idx on claim (effective_amount, claim_hash, release_time);
create unique index if not exists claim_release_time_idx on claim (release_time, claim_hash);
create unique index if not exists claim_trending_global_mixed_idx on claim (trending_global, trending_mixed, claim_hash);
create unique index if not exists claim_trending_group_mixed_idx on claim (trending_group, trending_mixed, claim_hash);
create unique index if not exists filter_fee_amount_order_release_time_idx on claim (fee_amount, release_time, claim_hash);
-- naked order bys (no filters)
create unique index if not exists claim_release_idx on claim (release_time, claim_hash);
create unique index if not exists claim_trending_idx on claim (trending_group, trending_mixed, claim_hash);
create unique index if not exists claim_effective_amount_idx on claim (effective_amount, 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);
-- claim_type filter + order by
create unique index if not exists claim_type_release_idx on claim (release_time, claim_type, claim_hash);
create unique index if not exists claim_type_trending_idx on claim (trending_group, trending_mixed, claim_type, claim_hash);
create unique index if not exists claim_type_effective_amount_idx on claim (effective_amount, claim_type, claim_hash);
create unique index if not exists channel_hash_release_time_idx on claim (channel_hash, release_time, claim_hash);
-- stream_type filter + order by
create unique index if not exists stream_type_release_idx on claim (stream_type, release_time, claim_hash);
create unique index if not exists stream_type_trending_idx on claim (stream_type, trending_group, trending_mixed, claim_hash);
create unique index if not exists stream_type_effective_amount_idx on claim (stream_type, effective_amount, claim_hash);
-- channel_hash filter + order by
create unique index if not exists channel_hash_release_idx on claim (channel_hash, release_time, claim_hash);
create unique index if not exists channel_hash_trending_idx on claim (channel_hash, trending_group, trending_mixed, claim_hash);
create unique index if not exists channel_hash_effective_amount_idx on claim (channel_hash, effective_amount, claim_hash);
-- duration filter + order by
create unique index if not exists duration_release_idx on claim (duration, release_time, claim_hash);
create unique index if not exists duration_trending_idx on claim (duration, trending_group, trending_mixed, claim_hash);
create unique index if not exists duration_effective_amount_idx on claim (duration, effective_amount, claim_hash);
-- fee_amount + order by
create unique index if not exists fee_amount_release_idx on claim (fee_amount, release_time, claim_hash);
create unique index if not exists fee_amount_trending_idx on claim (fee_amount, trending_group, trending_mixed, claim_hash);
create unique index if not exists fee_amount_effective_amount_idx on claim (fee_amount, effective_amount, claim_hash);
-- TODO: verify that all indexes below are used
create index if not exists claim_height_normalized_idx on claim (height, normalized asc);
create index if not exists claim_resolve_idx on claim (normalized, claim_id);
create index if not exists claim_id_idx on claim (claim_id, claim_hash);
create index if not exists claim_timestamp_idx on claim (timestamp);
create index if not exists claim_public_key_hash_idx on claim (public_key_hash);
create index if not exists claim_stream_type_idx on claim (stream_type);
create index if not exists claim_media_type_idx on claim (media_type);
create index if not exists claim_signature_valid_idx on claim (signature_valid);
"""
@@ -165,14 +176,14 @@ 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: str, blocking_channels: list, filtering_channels: list):
def __init__(
self, main, path: str, blocking_channels: list, filtering_channels: list, trending: list):
self.main = main
self._db_path = path
self.db = None
@@ -190,6 +201,7 @@ class SQLDB:
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(
@@ -208,13 +220,14 @@ 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:
@@ -236,10 +249,10 @@ class SQLDB:
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
"SELECT repost.channel_hash, repost.reposted_claim_hash, target.claim_type "
"FROM claim as repost JOIN claim AS target ON (target.claim_hash=repost.reposted_claim_hash)", **{
'repost.reposted_claim_hash__is_not_null': 1,
'repost.channel_hash__in': channel_hashes
}
)
for blocked_claim in self.execute(*sql):
@@ -318,6 +331,7 @@ class SQLDB:
'title': None,
'description': None,
'author': None,
'duration': None,
'claim_type': None,
'stream_type': None,
'media_type': None,
@@ -341,6 +355,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:
@@ -350,6 +368,7 @@ class SQLDB:
if isinstance(fee.amount, Decimal):
claim_record['fee_amount'] = int(fee.amount*1000)
elif claim.is_repost:
claim_record['claim_type'] = CLAIM_TYPES['repost']
claim_record['reposted_claim_hash'] = claim.repost.reference.claim_hash
elif claim.is_channel:
claim_record['claim_type'] = CLAIM_TYPES['channel']
@@ -374,12 +393,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,
@@ -397,7 +416,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)
@@ -834,7 +853,8 @@ 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
@@ -845,11 +865,15 @@ class LBRYLevelDB(LevelDB):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
path = os.path.join(self.env.db_dir, 'claims.db')
# space separated list of channel URIs used for filtering bad content
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):
+11 -1
View File
@@ -72,16 +72,18 @@ class Env:
self.tor_proxy_host = self.default('TOR_PROXY_HOST', 'localhost')
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
# The electrum client takes the empty string as unspecified
self.payment_address = self.default('PAYMENT_ADDRESS', '')
self.donation_address = self.default('DONATION_ADDRESS', '')
# Server limits to help prevent DoS
self.max_send = self.integer('MAX_SEND', 1000000)
self.max_receive = self.integer('MAX_RECEIVE', 1000000)
self.max_subs = self.integer('MAX_SUBS', 250000)
self.max_sessions = self.sane_max_sessions()
self.max_session_subs = self.integer('MAX_SESSION_SUBS', 50000)
self.session_timeout = self.integer('SESSION_TIMEOUT', 600)
self.drop_client = self.custom("DROP_CLIENT", None, re.compile)
self.description = self.default('DESCRIPTION', '')
self.daily_fee = self.integer('DAILY_FEE', 0)
self.daily_fee = self.string_amount('DAILY_FEE', '0')
# Identities
clearnet_identity = self.clearnet_identity()
@@ -107,6 +109,14 @@ class Env:
raise cls.Error(f'required envvar {envvar} not set')
return value
@classmethod
def string_amount(cls, envvar, default):
value = environ.get(envvar, default)
amount_pattern = re.compile("[0-9]{0,10}(\.[0-9]{1,8})?")
if len(value) > 0 and not amount_pattern.fullmatch(value):
raise cls.Error(f'{value} is not a valid amount for {envvar}')
return value
@classmethod
def integer(cls, envvar, default):
value = environ.get(envvar)
+8 -6
View File
@@ -20,7 +20,7 @@ from collections import namedtuple
from functools import partial
from glob import glob
from struct import pack, unpack
from concurrent.futures.thread import ThreadPoolExecutor
import attr
from lbry.wallet.server import util
@@ -63,6 +63,7 @@ class LevelDB:
self.logger = util.class_logger(__name__, self.__class__.__name__)
self.env = env
self.coin = env.coin
self.executor = ThreadPoolExecutor(max(1, os.cpu_count() - 1))
# Setup block header size handlers
if self.coin.STATIC_BLOCK_HEADERS:
@@ -139,6 +140,7 @@ class LevelDB:
def close(self):
self.utxo_db.close()
self.history.close_db()
self.executor.shutdown(wait=True)
async def open_for_compacting(self):
await self._open_dbs(True, True)
@@ -406,7 +408,7 @@ class LevelDB:
return self.headers_file.read(offset, size), disk_count
return b'', 0
return await asyncio.get_event_loop().run_in_executor(None, read_headers)
return await asyncio.get_event_loop().run_in_executor(self.executor, read_headers)
def fs_tx_hash(self, tx_num):
"""Return a par (tx_hash, tx_height) for the given tx number.
@@ -445,7 +447,7 @@ class LevelDB:
return [fs_tx_hash(tx_num) for tx_num in tx_nums]
while True:
history = await asyncio.get_event_loop().run_in_executor(None, read_history)
history = await asyncio.get_event_loop().run_in_executor(self.executor, read_history)
if all(hash is not None for hash, height in history):
return history
self.logger.warning(f'limited_history: tx hash '
@@ -611,7 +613,7 @@ class LevelDB:
return utxos
while True:
utxos = await asyncio.get_event_loop().run_in_executor(None, read_utxos)
utxos = await asyncio.get_event_loop().run_in_executor(self.executor, read_utxos)
if all(utxo.tx_hash is not None for utxo in utxos):
return utxos
self.logger.warning(f'all_utxos: tx hash not '
@@ -664,5 +666,5 @@ class LevelDB:
return hashX, value
return [lookup_utxo(*hashX_pair) for hashX_pair in hashX_pairs]
hashX_pairs = await asyncio.get_event_loop().run_in_executor(None, lookup_hashXs)
return await asyncio.get_event_loop().run_in_executor(None, lookup_utxos, hashX_pairs)
hashX_pairs = await asyncio.get_event_loop().run_in_executor(self.executor, lookup_hashXs)
return await asyncio.get_event_loop().run_in_executor(self.executor, lookup_utxos, hashX_pairs)
+15 -10
View File
@@ -6,12 +6,13 @@
# and warranty status of this software.
"""Mempool handling."""
import os
import asyncio
import itertools
import time
from abc import ABC, abstractmethod
from collections import defaultdict
from concurrent.futures.thread import ThreadPoolExecutor
import attr
@@ -105,14 +106,15 @@ class MemPool:
# Prevents mempool refreshes during fee histogram calculation
self.lock = asyncio.Lock()
self.wakeup = asyncio.Event()
self.executor = ThreadPoolExecutor(max(os.cpu_count() - 1, 1))
async def _logging(self, synchronized_event):
"""Print regular logs of mempool stats."""
self.logger.info('beginning processing of daemon mempool. '
'This can take some time...')
start = time.time()
start = time.perf_counter()
await synchronized_event.wait()
elapsed = time.time() - start
elapsed = time.perf_counter() - start
self.logger.info(f'synced in {elapsed:.2f}s')
while True:
self.logger.info(f'{len(self.txs):,d} txs '
@@ -121,12 +123,15 @@ class MemPool:
await synchronized_event.wait()
async def _refresh_histogram(self, synchronized_event):
while True:
await synchronized_event.wait()
async with self.lock:
# Threaded as can be expensive
await asyncio.get_event_loop().run_in_executor(None, self._update_histogram, 100_000)
await asyncio.sleep(self.coin.MEMPOOL_HISTOGRAM_REFRESH_SECS)
try:
while True:
await synchronized_event.wait()
async with self.lock:
# Threaded as can be expensive
await asyncio.get_event_loop().run_in_executor(self.executor, self._update_histogram, 100_000)
await asyncio.sleep(self.coin.MEMPOOL_HISTOGRAM_REFRESH_SECS)
finally:
self.executor.shutdown(wait=True)
def _update_histogram(self, bin_size):
# Build a histogram by fee rate
@@ -289,7 +294,7 @@ class MemPool:
return txs
# Thread this potentially slow operation so as not to block
tx_map = await asyncio.get_event_loop().run_in_executor(None, deserialize_txs)
tx_map = await asyncio.get_event_loop().run_in_executor(self.executor, deserialize_txs)
# Determine all prevouts not in the mempool, and fetch the
# UTXO information from the database. Failed prevout lookups
+40 -4
View File
@@ -1,20 +1,56 @@
import os
from aiohttp import web
from prometheus_client import Counter, Info, generate_latest as prom_generate_latest
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
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
})
REQUESTS_COUNT = Counter("requests_count", "Number of requests received", namespace=NAMESPACE, labelnames=("method",))
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:
+107 -70
View File
@@ -27,7 +27,10 @@ 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
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
from lbry.wallet.rpc.framing import NewlineFramer
import lbry.wallet.server.version as VERSION
from lbry.wallet.rpc import (
@@ -142,13 +145,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 +327,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,
@@ -626,6 +622,7 @@ class SessionBase(RPCSession):
def __init__(self, session_mgr, db, mempool, peer_mgr, kind):
connection = JSONRPCConnection(JSONRPCAutoDetect)
self.env = session_mgr.env
super().__init__(connection=connection)
self.logger = util.class_logger(__name__, self.__class__.__name__)
self.session_mgr = session_mgr
@@ -633,9 +630,7 @@ class SessionBase(RPCSession):
self.mempool = mempool
self.peer_mgr = peer_mgr
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
@@ -647,6 +642,9 @@ class SessionBase(RPCSession):
async def notify(self, touched, height_changed):
pass
def default_framer(self):
return NewlineFramer(self.env.max_receive)
def peer_address_str(self, *, for_log=True):
"""Returns the peer's IP address and port as a human-readable
string, respecting anon logs if the output is for a log."""
@@ -679,13 +677,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,9 +710,10 @@ class SessionBase(RPCSession):
"""Handle an incoming request. ElectrumX doesn't receive
notifications from client sessions.
"""
REQUESTS_COUNT.labels(method=request.method).inc()
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)()
@@ -785,16 +787,57 @@ class LBRYElectrumX(SessionBase):
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.payment_address': cls.payment_address,
'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: LBRYLevelDB = self.bp.db
@@ -816,7 +859,8 @@ class LBRYElectrumX(SessionBase):
'protocol_max': max_str,
'genesis_hash': env.coin.GENESIS_HASH,
'description': env.description,
'payment_address': env.donation_address,
'payment_address': env.payment_address,
'donation_address': env.donation_address,
'daily_fee': env.daily_fee,
'hash_function': 'sha256',
}
@@ -841,7 +885,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):
@@ -869,7 +918,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'
@@ -888,6 +943,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
)
@@ -896,32 +952,40 @@ 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)
metrics.start()
cache = self.session_mgr.search_cache[query_name]
cache_key = str(kwargs)
if cache_key not in cache:
cache[cache_key] = ResultCacheItem()
cache_item = cache[cache_key]
cache_item = cache.get(cache_key)
if cache_item is None:
cache_item = cache[cache_key] = ResultCacheItem()
elif cache_item.result is not None:
metrics.cache_response()
return cache_item.result
async with cache_item.lock:
if cache_item.result is None:
cache_item.result = await self.run_in_executor(
@@ -932,6 +996,9 @@ 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:
return await self.run_and_cache_query('search', reader.search_to_bytes, kwargs)
@@ -1301,11 +1368,16 @@ class LBRYElectrumX(SessionBase):
('$SERVER_VERSION', self.version),
('$DAEMON_VERSION', daemon_version),
('$DAEMON_SUBVERSION', network_info['subversion']),
('$PAYMENT_ADDRESS', self.env.payment_address),
('$DONATION_ADDRESS', self.env.donation_address),
]:
banner = banner.replace(*pair)
return banner
async def payment_address(self):
"""Return the payment address as a string, empty if there is none."""
return self.env.payment_address
async def donation_address(self):
"""Return the donation address as a string, empty if there is none."""
return self.env.donation_address
@@ -1355,6 +1427,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
@@ -1366,7 +1439,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.
@@ -1381,8 +1458,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):
@@ -1476,45 +1552,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."""
+78
View File
@@ -0,0 +1,78 @@
import asyncio
import logging
from lbry.error import (
ServerPaymentFeeAboveMaxAllowedError,
ServerPaymentInvalidAddressError,
ServerPaymentWalletLockedError
)
from lbry.wallet.dewies import lbc_to_dewies
from lbry.wallet.stream import StreamController
from lbry.wallet.transaction import Output, Transaction
log = logging.getLogger(__name__)
class WalletServerPayer:
def __init__(self, payment_period=24 * 60 * 60, max_fee='1.0', analytics_manager=None):
self.ledger = None
self.wallet = None
self.running = False
self.task = None
self.payment_period = payment_period
self.analytics_manager = analytics_manager
self.max_fee = max_fee
self._on_payment_controller = StreamController()
self.on_payment = self._on_payment_controller.stream
self.on_payment.listen(None, on_error=lambda e: logging.warning(e.args[0]))
async def pay(self):
while self.running:
await asyncio.sleep(self.payment_period)
features = await self.ledger.network.retriable_call(self.ledger.network.get_server_features)
address = features['payment_address']
amount = str(features['daily_fee'])
if not address or not amount:
continue
if not self.ledger.is_valid_address(address):
self._on_payment_controller.add_error(ServerPaymentInvalidAddressError(address))
continue
if self.wallet.is_locked:
self._on_payment_controller.add_error(ServerPaymentWalletLockedError())
continue
amount = lbc_to_dewies(features['daily_fee']) # check that this is in lbc and not dewies
limit = lbc_to_dewies(self.max_fee)
if amount > limit:
self._on_payment_controller.add_error(
ServerPaymentFeeAboveMaxAllowedError(features['daily_fee'], self.max_fee)
)
continue
tx = await Transaction.create(
[],
[Output.pay_pubkey_hash(amount, self.ledger.address_to_hash160(address))],
self.wallet.get_accounts_or_all(None),
self.wallet.get_account_or_default(None)
)
await self.ledger.broadcast(tx)
if self.analytics_manager:
await self.analytics_manager.send_credits_sent()
self._on_payment_controller.add(tx)
async def start(self, ledger=None, wallet=None):
if lbc_to_dewies(self.max_fee) < 1:
return
self.ledger = ledger
self.wallet = wallet
self.running = True
self.task = asyncio.ensure_future(self.pay())
self.task.add_done_callback(lambda _: log.info("Stopping wallet server payments."))
async def stop(self):
if self.running:
self.running = False
self.task.cancel()
+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()
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# usage: update_dev_wallet_server.sh <host to update>
TARGET_HOST=$1
SCRIPTS_DIR=`dirname $0`
LBRY_DIR=`dirname $SCRIPTS_DIR`
# build the image
docker build -f $LBRY_DIR/docker/Dockerfile.wallet_server -t lbry/wallet-server:development $LBRY_DIR
IMAGE=`docker image inspect lbry/wallet-server:development | sed -n "s/^.*Id\":\s*\"sha256:\s*\(\S*\)\".*$/\1/p"`
# push the image to the server
ssh $TARGET_HOST docker image prune --force
docker save $IMAGE | ssh $TARGET_HOST docker load
ssh $TARGET_HOST docker tag $IMAGE lbry/wallet-server:development
# restart the wallet server
ssh $TARGET_HOST docker-compose down
ssh $TARGET_HOST WALLET_SERVER_TAG="development" docker-compose up -d
+1 -1
View File
@@ -333,7 +333,7 @@ class Examples(CommandTestCase):
)
reply = await r(
'You can r',
'Use the parent_id param to make replies',
'comment', 'create',
'--comment="I have photographic evidence confirming Sasquatch exists"',
f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}'
+6 -2
View File
@@ -124,7 +124,11 @@ def release(args):
current_version = Version.from_content(version_file)
print(f'Current Version: {current_version}')
new_version = current_version.increment(args.action)
if args.action == 'current':
new_version = current_version
else:
new_version = current_version.increment(args.action)
print(f' New Version: {new_version}')
previous_release = repo.release_from_tag(args.start_tag or current_version.tag)
@@ -241,7 +245,7 @@ def main():
parser.add_argument("--confirm", default=False, action="store_true",
help="without this flag, it will only print what it will do but will not actually do it")
parser.add_argument("--start-tag", help="custom starting tag for changelog generation")
parser.add_argument("action", choices=['test', 'major', 'minor', 'micro'])
parser.add_argument("action", choices=['test', 'current', 'major', 'minor', 'micro'])
args = parser.parse_args()
if args.action == "test":
+1 -1
View File
@@ -12,7 +12,7 @@ async def main():
try:
hostname = sys.argv[1]
except IndexError:
hostname = 'spv1.lbry.com'
hostname = 'spv11.lbry.com'
loop = asyncio.get_event_loop()
client = ClientSession(network=None, server=(hostname, 50001))
+1
View File
@@ -32,6 +32,7 @@ disable=
too-many-branches,
too-many-arguments,
too-many-statements,
too-many-nested-blocks,
too-many-public-methods,
too-many-instance-attributes,
protected-access,
+1 -1
View File
@@ -40,7 +40,7 @@ setup(
'colorama==0.3.7',
'distro==1.4.0',
'base58==1.0.0',
'cffi==1.12.1',
'cffi==1.13.2',
'cryptography==2.5',
'protobuf==3.6.1',
'msgpack==0.6.1',
@@ -1,10 +1,10 @@
import asyncio
import os.path
import tempfile
import logging
from binascii import unhexlify
from urllib.request import urlopen
from lbry.error import InsufficientFundsError
from lbry.extras.daemon.daemon import DEFAULT_PAGE_SIZE
@@ -73,6 +73,19 @@ class ClaimSearchCommand(ClaimTestCase):
(result['txid'], result['claim_id'])
)
async def test_disconnect_on_memory_error(self):
claim_ids = [
'0000000000000000000000000000000000000000',
] * 23828
self.assertListEqual([], await self.claim_search(claim_ids=claim_ids))
# 23829 claim ids makes the request just large enough
claim_ids = [
'0000000000000000000000000000000000000000',
] * 23829
with self.assertRaises(ConnectionResetError):
await self.claim_search(claim_ids=claim_ids)
async def test_basic_claim_search(self):
await self.create_channel()
channel_txo = self.channel['outputs'][0]
@@ -250,6 +263,7 @@ class ClaimSearchCommand(ClaimTestCase):
chan1_id = self.get_claim_id(await self.channel_create('@chan1'))
chan2_id = self.get_claim_id(await self.channel_create('@chan2'))
chan3_id = self.get_claim_id(await self.channel_create('@chan3'))
chan4 = await self.channel_create('@chan4', '0.1')
claim1 = await self.stream_create('claim1')
claim2 = await self.stream_create('claim2', channel_id=chan1_id)
@@ -272,6 +286,7 @@ class ClaimSearchCommand(ClaimTestCase):
await match([claim6, claim5, claim4, claim1], not_channel_ids=[chan1_id], claim_type='stream')
await match([claim6, claim3, claim2, claim1], not_channel_ids=[chan2_id], claim_type='stream')
await match([claim6, claim1], not_channel_ids=[chan1_id, chan2_id], claim_type='stream')
await match([claim6, claim1, chan4], not_channel_ids=[chan1_id, chan2_id])
# not_channel_ids + valid_channel_signature
await match([claim5, claim4, claim3, claim2, claim1],
@@ -309,12 +324,14 @@ class ClaimSearchCommand(ClaimTestCase):
octet = await self.stream_create()
video = await self.stream_create('chrome', file_path=self.video_file_name)
image = await self.stream_create('blank-image', data=self.image_data, suffix='.png')
repost = await self.stream_repost(self.get_claim_id(image))
channel = await self.channel_create()
unknown = self.sout(tx)
# claim_type
await self.assertFindsClaims([image, video, octet, unknown], claim_type='stream')
await self.assertFindsClaims([channel], claim_type='channel')
await self.assertFindsClaims([repost], claim_type='repost')
# stream_type
await self.assertFindsClaims([octet, unknown], stream_types=['binary'])
@@ -322,12 +339,19 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([image], stream_types=['image'])
await self.assertFindsClaims([image, video], stream_types=['video', 'image'])
# stream_type
# media_type
await self.assertFindsClaims([octet, unknown], media_types=['application/octet-stream'])
await self.assertFindsClaims([video], media_types=['video/mp4'])
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 +399,99 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([], text='cloud')
class ClaimCommands(ClaimTestCase):
async def test_claim_list_type_filtering(self):
await self.channel_create()
await self.stream_create()
r = await self.claim_list(claim_type='channel')
self.assertEqual(1, len(r))
self.assertEqual('channel', r[0]['value_type'])
r = await self.claim_list(claim_type='stream')
self.assertEqual(1, len(r))
self.assertEqual('stream', r[0]['value_type'])
r = await self.claim_list(claim_type=['stream', 'channel'])
self.assertEqual(2, len(r))
self.assertEqual({'stream', 'channel'}, {c['value_type'] for c in r})
async def test_claim_stream_channel_list_with_resolve(self):
self.assertListEqual([], await self.claim_list(resolve=True))
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'])
# check that metadata is transfered
self.assertTrue(r[0]['is_mine'])
class ChannelCommands(CommandTestCase):
async def test_create_channel_names(self):
@@ -715,8 +832,11 @@ class StreamCommands(ClaimTestCase):
self.assertTrue(signed['outputs'][0]['is_channel_signature_valid'])
async def test_repost(self):
sql = self.conductor.spv_node.server.bp.sql
sql.execute(sql.TAG_INDEXES)
await self.channel_create('@goodies', '1.0')
tx = await self.stream_create('newstuff', '1.1', channel_name='@goodies')
tx = await self.stream_create('newstuff', '1.1', channel_name='@goodies', tags=['foo', 'gaming'])
claim_id = self.get_claim_id(tx)
self.assertEqual((await self.claim_search(name='newstuff'))[0]['meta']['reposted'], 0)
@@ -727,6 +847,16 @@ class StreamCommands(ClaimTestCase):
self.assertEqual((await self.claim_search(name='newstuff'))[0]['meta']['reposted'], 1)
self.assertEqual((await self.claim_search(reposted_claim_id=claim_id))[0]['claim_id'], repost_id)
# tags are inherited (non-common / indexed tags)
self.assertItemCount(await self.daemon.jsonrpc_claim_search(any_tags=['foo'], claim_type=['stream', 'repost']), 2)
self.assertItemCount(await self.daemon.jsonrpc_claim_search(all_tags=['foo'], claim_type=['stream', 'repost']), 2)
self.assertItemCount(await self.daemon.jsonrpc_claim_search(not_tags=['foo'], claim_type=['stream', 'repost']), 0)
# "common" / indexed tags work too
self.assertIn('gaming', sql.TAG_INDEXES) # if this breaks, next test doesn't make sense
self.assertItemCount(await self.daemon.jsonrpc_claim_search(any_tags=['gaming'], claim_type=['stream', 'repost']), 2)
self.assertItemCount(await self.daemon.jsonrpc_claim_search(all_tags=['gaming'], claim_type=['stream', 'repost']), 2)
self.assertItemCount(await self.daemon.jsonrpc_claim_search(not_tags=['gaming'], claim_type=['stream', 'repost']), 0)
await self.channel_create('@reposting-goodies', '1.0')
await self.stream_repost(claim_id, 'repost-on-channel', '1.1', channel_name='@reposting-goodies')
self.assertItemCount(await self.daemon.jsonrpc_claim_list(claim_type='repost'), 2)
@@ -746,38 +876,114 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(search['reposted_claim']['meta']['reposted'], 2)
self.assertEqual(search['reposted_claim']['signing_channel']['name'], '@goodies')
resolved = await self.resolve(['@reposting-goodies/repost-on-channel', 'newstuff-again'])
resolved = await self.out(
self.daemon.jsonrpc_resolve(['@reposting-goodies/repost-on-channel', 'newstuff-again'])
)
self.assertEqual(resolved['@reposting-goodies/repost-on-channel'], search)
self.assertEqual(resolved['newstuff-again']['reposted_claim']['name'], 'newstuff')
async def test_filtering_channels_for_removing_content(self):
await self.channel_create('@some_channel', '1.0')
await self.stream_create('good_content', '1.1', channel_name='@some_channel', tags=['good'])
await self.channel_create('@some_channel', '0.1')
await self.stream_create('good_content', '0.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.stream_create('bad_content', '0.1', channel_name='@some_channel', tags=['bad'])
)
blocking_channel_id = self.get_claim_id(
await self.channel_create('@filtering', '1.0')
filtering_channel_id = self.get_claim_id(
await self.channel_create('@filtering', '0.1')
)
self.conductor.spv_node.server.db.sql.filtering_channel_hashes.add(
unhexlify(blocking_channel_id)[::-1]
unhexlify(filtering_channel_id)[::-1]
)
await self.stream_repost(bad_content_id, 'filter1', '1.1', channel_name='@filtering')
self.assertEqual(0, len(self.conductor.spv_node.server.db.sql.filtered_streams))
await self.stream_repost(bad_content_id, 'filter1', '0.1', channel_name='@filtering')
self.assertEqual(1, len(self.conductor.spv_node.server.db.sql.filtered_streams))
# search for blocked content directly
# search for filtered content directly
result = await self.out(self.daemon.jsonrpc_claim_search(name='bad_content'))
blocked = result['blocked']
self.assertEqual([], result['items'])
self.assertEqual({"channels": {blocking_channel_id: 1}, "total": 1}, result['blocked'])
self.assertEqual(1, blocked['total'])
self.assertEqual(1, len(blocked['channels']))
self.assertEqual(1, blocked['channels'][0]['blocked'])
self.assertTrue(blocked['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# search channel containing blocked content
# search inside channel containing filtered content
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel'))
filtered = result['blocked']
self.assertEqual(1, len(result['items']))
self.assertEqual({"channels": {blocking_channel_id: 1}, "total": 1}, result['blocked'])
self.assertEqual(1, filtered['total'])
self.assertEqual(1, len(filtered['channels']))
self.assertEqual(1, filtered['channels'][0]['blocked'])
self.assertTrue(filtered['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# 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'])
self.assertEqual({"channels": [], "total": 0}, result['blocked'])
# filtered content can still be resolved
result = await self.resolve('lbry://@some_channel/bad_content')
self.assertEqual(bad_content_id, result['claim_id'])
blocking_channel_id = self.get_claim_id(
await self.channel_create('@blocking', '0.1')
)
self.conductor.spv_node.server.db.sql.blocking_channel_hashes.add(
unhexlify(blocking_channel_id)[::-1]
)
self.assertEqual(0, len(self.conductor.spv_node.server.db.sql.blocked_streams))
await self.stream_repost(bad_content_id, 'block1', '0.1', channel_name='@blocking')
self.assertEqual(1, len(self.conductor.spv_node.server.db.sql.blocked_streams))
# blocked content is not resolveable
error = (await self.resolve('lbry://@some_channel/bad_content'))['error']
self.assertEqual(error['name'], 'BLOCKED')
self.assertTrue(error['text'].startswith("Resolve of 'lbry://@some_channel/bad_content' was censored"))
self.assertTrue(error['censor']['short_url'].startswith('lbry://@blocking#'))
# a filtered/blocked channel impacts all content inside it
bad_channel_id = self.get_claim_id(
await self.channel_create('@bad_channel', '0.1', tags=['bad-stuff'])
)
worse_content_id = self.get_claim_id(
await self.stream_create('worse_content', '0.1', channel_name='@bad_channel', tags=['bad-stuff'])
)
# check search before filtering channel
result = await self.out(self.daemon.jsonrpc_claim_search(any_tags=['bad-stuff'], order_by=['height']))
self.assertEqual(2, result['total_items'])
self.assertEqual('worse_content', result['items'][0]['name'])
self.assertEqual('@bad_channel', result['items'][1]['name'])
# filter channel out
self.assertEqual(0, len(self.conductor.spv_node.server.db.sql.filtered_channels))
await self.stream_repost(bad_channel_id, 'filter2', '0.1', channel_name='@filtering')
self.assertEqual(1, len(self.conductor.spv_node.server.db.sql.filtered_channels))
# same claim search as previous now returns 0 results
result = await self.out(self.daemon.jsonrpc_claim_search(any_tags=['bad-stuff'], order_by=['height']))
filtered = result['blocked']
self.assertEqual(0, len(result['items']))
self.assertEqual(3, filtered['total'])
self.assertEqual(1, len(filtered['channels']))
self.assertEqual(3, filtered['channels'][0]['blocked'])
self.assertTrue(filtered['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# filtered channel should still resolve
result = await self.resolve('lbry://@bad_channel')
self.assertEqual(bad_channel_id, result['claim_id'])
result = await self.resolve('lbry://@bad_channel/worse_content')
self.assertEqual(worse_content_id, result['claim_id'])
# block channel
self.assertEqual(0, len(self.conductor.spv_node.server.db.sql.blocked_channels))
await self.stream_repost(bad_channel_id, 'block2', '0.1', channel_name='@blocking')
self.assertEqual(1, len(self.conductor.spv_node.server.db.sql.blocked_channels))
# channel, claim in channel or claim individually no longer resolve
self.assertEqual((await self.resolve('lbry://@bad_channel'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED')
async def test_publish_updates_file_list(self):
tx = await self.stream_create(title='created')
@@ -1234,15 +1440,14 @@ class StreamCommands(ClaimTestCase):
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 2)
r = await self.resolve('lbry://@abc/foo')
self.assertEqual(
r['lbry://@abc/foo']['claim_id'],
r['claim_id'],
self.get_claim_id(tx3)
)
# publishing again clears channel
tx4 = await self.publish('foo', languages='uk-UA', tags=['Anime', 'anime '])
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 2)
r = await self.resolve('lbry://foo')
claim = r['lbry://foo']
claim = await self.resolve('lbry://foo')
self.assertEqual(claim['txid'], tx4['outputs'][0]['txid'])
self.assertNotIn('signing_channel', claim)
self.assertEqual(claim['value']['languages'], ['uk-UA'])
@@ -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'])
+17 -23
View File
@@ -1,5 +1,4 @@
import logging
import os
import asyncio
import lbry
@@ -8,7 +7,6 @@ from unittest.mock import Mock
from lbry.wallet.network import Network
from lbry.wallet.orchstr8.node import SPVNode
from lbry.wallet.rpc import RPCSession
from lbry.wallet.rpc import RPCError
from lbry.testcase import IntegrationTestCase, AsyncioTestCase
@@ -30,15 +28,20 @@ class NetworkTests(IntegrationTestCase):
'pruning': None,
'description': '',
'payment_address': '',
'daily_fee': 0,
'donation_address': '',
'daily_fee': '0',
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
await self.conductor.spv_node.stop()
address = (await self.account.get_addresses(limit=1))[0]
os.environ.update({
'DESCRIPTION': 'Fastest server in the west.',
'DONATION_ADDRESS': address,
'DAILY_FEE': '42'})
await self.conductor.spv_node.start(self.conductor.blockchain_node)
payment_address, donation_address = await self.account.get_addresses(limit=2)
await self.conductor.spv_node.start(
self.conductor.blockchain_node,
extraconf={
'DESCRIPTION': 'Fastest server in the west.',
'PAYMENT_ADDRESS': payment_address,
'DONATION_ADDRESS': donation_address,
'DAILY_FEE': '42'
}
)
await self.ledger.network.on_connected.first
self.assertDictEqual({
'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
@@ -48,8 +51,9 @@ class NetworkTests(IntegrationTestCase):
'protocol_min': '0.54.0',
'pruning': None,
'description': 'Fastest server in the west.',
'payment_address': address,
'daily_fee': 42,
'payment_address': payment_address,
'donation_address': donation_address,
'daily_fee': '42',
'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
@@ -141,16 +145,12 @@ class ReconnectTests(IntegrationTestCase):
class ServerPickingTestCase(AsyncioTestCase):
async def _make_fake_server(self, latency=1.0, port=1, raise_version_rpc_error=False, return_versions=None):
async def _make_fake_server(self, latency=1.0, port=1):
# local fake server with artificial latency
class FakeSession(RPCSession):
async def handle_request(self, request):
await asyncio.sleep(latency)
if request.method == 'server.version':
if raise_version_rpc_error:
raise RPCError(1, 'derp')
if return_versions:
return return_versions
return tuple(request.args)
return {'height': 1}
server = await self.loop.create_server(lambda: FakeSession(), host='127.0.0.1', port=port)
@@ -160,10 +160,7 @@ class ServerPickingTestCase(AsyncioTestCase):
async def _make_bad_server(self, port=42420):
async def echo(reader, writer):
while True:
try:
writer.write(await asyncio.wait_for(reader.read(), 1))
except asyncio.TimeoutError:
pass
writer.write(await reader.read())
server = await asyncio.start_server(echo, host='127.0.0.1', port=port)
self.addCleanup(server.close)
return '127.0.0.1', port
@@ -177,9 +174,6 @@ class ServerPickingTestCase(AsyncioTestCase):
('example.that.doesnt.resolve', 9000),
await self._make_fake_server(latency=1.0, port=1340),
await self._make_fake_server(latency=0.1, port=1337),
await self._make_fake_server(latency=0, port=1338, raise_version_rpc_error=True),
await self._make_fake_server(latency=0, port=1341, return_versions=('0.0.1', '2.0')),
await self._make_fake_server(latency=0, port=1342, return_versions=('0.1', '2.0')),
await self._make_fake_server(latency=0.4, port=1339),
],
'connect_timeout': 3
@@ -148,7 +148,7 @@ class PurchaseCommandTests(CommandTestCase):
url = result[0]['canonical_url']
resolve = await self.resolve(url)
self.assertEqual(result[0]['claim_id'], resolve[url]['purchase_receipt']['claim_id'])
self.assertEqual(result[0]['claim_id'], resolve['purchase_receipt']['claim_id'])
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 0)
await self.daemon.jsonrpc_get('lbry://a')
@@ -12,9 +12,10 @@ from lbry.crypto.base58 import Base58
class BaseResolveTestCase(CommandTestCase):
async def assertResolvesToClaimId(self, name, claim_id):
other = (await self.resolve(name))[name]
other = await self.resolve(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'])
@@ -28,23 +29,20 @@ class ResolveCommand(BaseResolveTestCase):
# resolving a channel @abc
response = await self.resolve('lbry://@abc')
self.assertSetEqual({'lbry://@abc'}, set(response))
self.assertEqual(response['lbry://@abc']['name'], '@abc')
self.assertEqual(response['lbry://@abc']['value_type'], 'channel')
self.assertEqual(response['lbry://@abc']['meta']['claims_in_channel'], 0)
self.assertEqual(response['name'], '@abc')
self.assertEqual(response['value_type'], 'channel')
self.assertEqual(response['meta']['claims_in_channel'], 0)
await self.stream_create('foo', '0.01', channel_id=channel_id)
await self.stream_create('foo2', '0.01', channel_id=channel_id)
# resolving a channel @abc with some claims in it
response['lbry://@abc']['confirmations'] += 2
response['lbry://@abc']['meta']['claims_in_channel'] = 2
response['confirmations'] += 2
response['meta']['claims_in_channel'] = 2
self.assertEqual(response, await self.resolve('lbry://@abc'))
# resolving claim foo within channel @abc
response = await self.resolve('lbry://@abc/foo')
self.assertSetEqual({'lbry://@abc/foo'}, set(response))
claim = response['lbry://@abc/foo']
claim = await self.resolve('lbry://@abc/foo')
self.assertEqual(claim['name'], 'foo')
self.assertEqual(claim['value_type'], 'stream')
self.assertEqual(claim['signing_channel']['name'], '@abc')
@@ -59,13 +57,12 @@ class ResolveCommand(BaseResolveTestCase):
)
# resolving claim foo by itself
self.assertEqual(claim, (await self.resolve('lbry://foo'))['lbry://foo'])
self.assertEqual(claim, await self.resolve('lbry://foo'))
# resolving from the given permanent url
permanent_url = response['lbry://@abc/foo']['permanent_url']
self.assertEqual(claim, (await self.resolve(permanent_url))[permanent_url])
self.assertEqual(claim, await self.resolve(claim['permanent_url']))
# resolving multiple at once
response = await self.resolve(['lbry://foo', 'lbry://foo2'])
response = await self.out(self.daemon.jsonrpc_resolve(['lbry://foo', 'lbry://foo2']))
self.assertSetEqual({'lbry://foo', 'lbry://foo2'}, set(response))
claim = response['lbry://foo2']
self.assertEqual(claim['name'], 'foo2')
@@ -80,7 +77,7 @@ class ResolveCommand(BaseResolveTestCase):
# resolve handles invalid data
await self.blockchain_claim_name("gibberish", hexlify(b"{'invalid':'json'}").decode(), "0.1")
await self.generate(1)
response = await self.resolve("lbry://gibberish")
response = await self.out(self.daemon.jsonrpc_resolve("lbry://gibberish"))
self.assertSetEqual({'lbry://gibberish'}, set(response))
claim = response['lbry://gibberish']
self.assertEqual(claim['name'], 'gibberish')
@@ -88,10 +85,10 @@ class ResolveCommand(BaseResolveTestCase):
# resolve retries
await self.conductor.spv_node.stop()
resolving_future = asyncio.ensure_future(self.resolve('foo'))
resolve_task = asyncio.create_task(self.resolve('foo'))
await self.conductor.spv_node.start(self.conductor.blockchain_node)
await self.ledger.on_ready.first
self.assertIsNotNone((await resolving_future)['foo']['claim_id'])
self.assertIsNotNone((await resolve_task)['claim_id'])
async def test_winning_by_effective_amount(self):
# first one remains winner unless something else changes
@@ -181,15 +178,18 @@ class ResolveCommand(BaseResolveTestCase):
# Original channel doesn't exists anymore, so the signature is invalid. For invalid signatures, resolution is
# 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'}
})
response = (await self.resolve('lbry://on-channel-claim'))['lbry://on-channel-claim']
self.assertEqual(
{'error': {
'name': 'NOT_FOUND',
'text': 'Could not find claim at "lbry://@abc/on-channel-claim".',
}},
await self.resolve('lbry://@abc/on-channel-claim')
)
response = await self.resolve('lbry://on-channel-claim')
self.assertFalse(response['is_channel_signature_valid'])
self.assertEqual({'channel_id': abandoned_channel_id}, response['signing_channel'])
direct_uri = 'lbry://on-channel-claim#' + orphan_claim_id
response = (await self.resolve(direct_uri))[direct_uri]
response = await self.resolve(direct_uri)
self.assertFalse(response['is_channel_signature_valid'])
self.assertEqual({'channel_id': abandoned_channel_id}, response['signing_channel'])
await self.stream_abandon(claim_id=orphan_claim_id)
@@ -199,7 +199,7 @@ class ResolveCommand(BaseResolveTestCase):
valid_claim = await self.stream_create('on-channel-claim', '0.00000001', channel_id=channel['claim_id'])
# resolves normally
response = await self.resolve(uri)
self.assertTrue(response[uri]['is_channel_signature_valid'])
self.assertTrue(response['is_channel_signature_valid'])
# ooops! claimed a valid conflict! (this happens on the wild, mostly by accident or race condition)
await self.stream_create(
@@ -208,8 +208,8 @@ class ResolveCommand(BaseResolveTestCase):
# it still resolves! but to the older claim
response = await self.resolve(uri)
self.assertTrue(response[uri]['is_channel_signature_valid'])
self.assertEqual(response[uri]['txid'], valid_claim['txid'])
self.assertTrue(response['is_channel_signature_valid'])
self.assertEqual(response['txid'], valid_claim['txid'])
claims = await self.claim_search(name='on-channel-claim')
self.assertEqual(2, len(claims))
self.assertEqual(
@@ -229,8 +229,8 @@ class ResolveCommand(BaseResolveTestCase):
r1 = await self.resolve(f'lbry://{one}')
r2 = await self.resolve(f'lbry://{two}')
self.assertEqual(winner_id, r1[f'lbry://{one}']['claim_id'])
self.assertEqual(winner_id, r2[f'lbry://{two}']['claim_id'])
self.assertEqual(winner_id, r1['claim_id'])
self.assertEqual(winner_id, r2['claim_id'])
async def test_resolve_old_claim(self):
channel = await self.daemon.jsonrpc_channel_create('@olds', '1.0')
@@ -243,7 +243,7 @@ class ResolveCommand(BaseResolveTestCase):
await self.confirm_tx(tx.id)
response = await self.resolve('@olds/example')
self.assertTrue(response['@olds/example']['is_channel_signature_valid'])
self.assertTrue(response['is_channel_signature_valid'])
claim.publisherSignature.signature = bytes(reversed(claim.publisherSignature.signature))
tx = await Transaction.claim_create(
@@ -254,11 +254,14 @@ class ResolveCommand(BaseResolveTestCase):
await self.confirm_tx(tx.id)
response = await self.resolve('bad_example')
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'}
})
self.assertFalse(response['is_channel_signature_valid'])
self.assertEqual(
{'error': {
'name': 'NOT_FOUND',
'text': 'Could not find claim at "@olds/bad_example".',
}},
await self.resolve('@olds/bad_example')
)
class ResolveAfterReorg(BaseResolveTestCase):
@@ -278,36 +281,36 @@ class ResolveAfterReorg(BaseResolveTestCase):
channel_id = self.get_claim_id(
await self.channel_create(channel_name, '0.01')
)
self.assertNotIn('error', (await self.resolve(channel_name))[channel_name])
self.assertNotIn('error', await self.resolve(channel_name))
await self.reorg(206)
self.assertNotIn('error', (await self.resolve(channel_name))[channel_name])
self.assertNotIn('error', await self.resolve(channel_name))
stream_name = 'foo'
stream_id = self.get_claim_id(
await self.stream_create(stream_name, '0.01', channel_id=channel_id)
)
self.assertNotIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(stream_name))
await self.reorg(206)
self.assertNotIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(stream_name))
await self.support_create(stream_id, '0.01')
self.assertNotIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(stream_name))
await self.reorg(206)
self.assertNotIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(stream_name))
await self.stream_abandon(stream_id)
self.assertNotIn('error', (await self.resolve(channel_name))[channel_name])
self.assertIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(channel_name))
self.assertIn('error', await self.resolve(stream_name))
await self.reorg(206)
self.assertNotIn('error', (await self.resolve(channel_name))[channel_name])
self.assertIn('error', (await self.resolve(stream_name))[stream_name])
self.assertNotIn('error', await self.resolve(channel_name))
self.assertIn('error', await self.resolve(stream_name))
await self.channel_abandon(channel_id)
self.assertIn('error', (await self.resolve(channel_name))[channel_name])
self.assertIn('error', (await self.resolve(stream_name))[stream_name])
self.assertIn('error', await self.resolve(channel_name))
self.assertIn('error', await self.resolve(stream_name))
await self.reorg(206)
self.assertIn('error', (await self.resolve(channel_name))[channel_name])
self.assertIn('error', (await self.resolve(stream_name))[stream_name])
self.assertIn('error', await self.resolve(channel_name))
self.assertIn('error', await self.resolve(stream_name))
def generate_signed_legacy(address: bytes, output: Output):
@@ -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
@@ -2,8 +2,10 @@ import asyncio
import lbry
import lbry.wallet
from lbry.error import ServerPaymentFeeAboveMaxAllowedError
from lbry.wallet.network import ClientSession
from lbry.testcase import IntegrationTestCase
from lbry.testcase import IntegrationTestCase, CommandTestCase
from lbry.wallet.orchstr8.node import SPVNode
class TestSessions(IntegrationTestCase):
@@ -49,3 +51,46 @@ class TestSegwitServer(IntegrationTestCase):
async def test_at_least_it_starts(self):
await asyncio.wait_for(self.ledger.network.get_headers(0, 1), 1.0)
class TestUsagePayment(CommandTestCase):
async def test_single_server_payment(self):
wallet_pay_service = self.daemon.component_manager.get_component('wallet_server_payments')
wallet_pay_service.payment_period = 1
# only starts with a positive max key fee
wallet_pay_service.max_fee = "0.0"
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
self.assertFalse(wallet_pay_service.running)
wallet_pay_service.max_fee = "1.0"
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
self.assertTrue(wallet_pay_service.running)
await wallet_pay_service.stop()
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
address = await self.blockchain.get_raw_change_address()
_, history = await self.ledger.get_local_status_and_history(address)
self.assertEqual(history, [])
node = SPVNode(self.conductor.spv_module, node_number=2)
await node.start(self.blockchain, extraconf={"PAYMENT_ADDRESS": address, "DAILY_FEE": "1.1"})
self.addCleanup(node.stop)
self.daemon.jsonrpc_settings_set('lbryum_servers', [f"{node.hostname}:{node.port}"])
await self.daemon.jsonrpc_wallet_reconnect()
features = await self.ledger.network.get_server_features()
self.assertEqual(features["payment_address"], address)
self.assertEqual(features["daily_fee"], "1.1")
with self.assertRaises(ServerPaymentFeeAboveMaxAllowedError):
await asyncio.wait_for(wallet_pay_service.on_payment.first, timeout=3)
await node.stop(False)
await node.start(self.blockchain, extraconf={"PAYMENT_ADDRESS": address, "DAILY_FEE": "1.0"})
self.daemon.jsonrpc_settings_set('lbryum_servers', [f"{node.hostname}:{node.port}"])
await self.daemon.jsonrpc_wallet_reconnect()
features = await self.ledger.network.get_server_features()
self.assertEqual(features["payment_address"], address)
self.assertEqual(features["daily_fee"], "1.0")
tx = await asyncio.wait_for(wallet_pay_service.on_payment.first, timeout=3)
self.assertIsNotNone(await self.blockchain.get_raw_transaction(tx.id)) # verify its broadcasted
self.assertEqual(tx.outputs[0].amount, 100000000)
self.assertEqual(tx.outputs[0].get_address(self.ledger), address)
+17 -10
View File
@@ -40,7 +40,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
# And is the channel resolvable and empty?
response = await self.resolve('lbry://@spam')
self.assertEqual(response['lbry://@spam']['value_type'], 'channel')
self.assertEqual(response['value_type'], 'channel')
# "What goes well with spam?" ponders Chris...
# "A hovercraft with eels!" he exclaims.
@@ -64,7 +64,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
# Also checks that his new story can be found on the blockchain before
# giving the link to all his friends.
response = await self.resolve('lbry://@spam/hovercraft')
self.assertEqual(response['lbry://@spam/hovercraft']['value_type'], 'stream')
self.assertEqual(response['value_type'], 'stream')
# He goes to tell everyone about it and in the meantime 5 blocks are confirmed.
await self.generate(5)
@@ -84,10 +84,12 @@ class EpicAdventuresOfChris45(CommandTestCase):
await self.confirm_tx(abandon['txid'])
# And now checks that the claim doesn't resolve anymore.
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".'
}},
await self.resolve('lbry://@spam/hovercraft')
)
# After abandoning he just waits for his LBCs to be returned to his account
@@ -137,8 +139,8 @@ class EpicAdventuresOfChris45(CommandTestCase):
# And check if his support showed up
resolve_result = await self.resolve(uri)
# It obviously did! Because, blockchain baby \O/
self.assertEqual(resolve_result[uri]['amount'], '1.0')
self.assertEqual(resolve_result[uri]['meta']['effective_amount'], '1.2')
self.assertEqual(resolve_result['amount'], '1.0')
self.assertEqual(resolve_result['meta']['effective_amount'], '1.2')
await self.generate(5)
# Now he also wanted to support the original creator of the Award Winning Novel
@@ -151,7 +153,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
# And again checks if it went to the just right place
resolve_result = await self.resolve(uri)
# Which it obviously did. Because....?????
self.assertEqual(resolve_result[uri]['meta']['effective_amount'], '1.5')
self.assertEqual(resolve_result['meta']['effective_amount'], '1.5')
await self.generate(5)
# Seeing the ravishing success of his novel Chris adds support to his claim too
@@ -185,5 +187,10 @@ class EpicAdventuresOfChris45(CommandTestCase):
await self.confirm_tx(abandon['txid'])
# 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(
{'error': {
'name': 'NOT_FOUND',
'text': f'Could not find claim at "{uri}".'
}},
await self.resolve(uri)
)
+2 -2
View File
@@ -7,7 +7,7 @@ from lbry.extras import cli
from lbry.extras.daemon.components import (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, STREAM_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT
)
from lbry.extras.daemon.daemon import Daemon
@@ -22,7 +22,7 @@ class CLIIntegrationTest(AsyncioTestCase):
conf.components_to_skip = (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, STREAM_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT
)
Daemon.component_attributes = {}
self.daemon = Daemon(conf)
@@ -278,7 +278,9 @@ class CommentCommands(CommandTestCase):
channel = (await self.channel_create('@JimmyBuffett'))['outputs'][0]
stream = (await self.stream_create())['outputs'][0]
self.assertEqual(0, len((await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']))
empty_list = await self.daemon.jsonrpc_comment_list(stream['claim_id'])
self.assertEqual(0, len(empty_list['items']))
comment = await self.daemon.jsonrpc_comment_create(
claim_id=stream['claim_id'],
channel_id=channel['claim_id'],
@@ -296,66 +298,41 @@ class CommentCommands(CommandTestCase):
comment='Let\'s all go to Margaritaville',
parent_id=comments[0]['comment_id']
)
comments = (await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']
self.assertEqual(2, len(comments))
self.assertEqual(comments[0]['channel_id'], channel2['claim_id'])
self.assertEqual(comments[0]['parent_id'], comments[1]['comment_id'])
comment = await self.daemon.jsonrpc_comment_create(
claim_id=stream['claim_id'],
comment='Anonymous comment'
)
comments = (await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']
self.assertEqual(comment['comment_id'], comments[0]['comment_id'])
async def test02_unsigned_comment_list(self):
stream = (await self.stream_create())['outputs'][0]
comments = []
num_items = 28
for i in range(num_items):
comment = await self.daemon.jsonrpc_comment_create(
comment=f'{i}',
claim_id=stream['claim_id'],
)
self.assertIn('comment_id', comment)
comments.append(comment)
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
comment_list = await self.daemon.jsonrpc_comment_list(stream['claim_id'])
for field in list_fields:
self.assertIn(field, comment_list)
self.assertEqual(comment_list['total_items'], num_items)
for comment in comment_list['items']:
self.assertEqual(comment['comment'], comments.pop()['comment'])
signed_comment_list = await self.daemon.jsonrpc_comment_list(
claim_id=stream['claim_id'],
is_channel_signature_valid=True
)
self.assertIs(len(signed_comment_list['items']), 0)
async def test03_signed_comments_list(self):
channel = (await self.channel_create('@JimmyBuffett'))['outputs'][0]
stream = (await self.stream_create())['outputs'][0]
comments = []
for i in range(28):
comment = await self.daemon.jsonrpc_comment_create(
comment=f'{i}',
claim_id=stream['claim_id'],
channel_id=channel['claim_id'],
)
self.assertIn('comment_id', comment)
comments.append(comment)
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
self.assertIn('comment_id', comment)
comment_list = await self.daemon.jsonrpc_comment_list(
claim_id=stream['claim_id']
)
for field in list_fields:
self.assertIn(field, comment_list)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
set(comment_list)
)
self.assertIs(comment_list['page_size'], 50)
self.assertIs(comment_list['page'], 1)
self.assertIs(comment_list['total_items'], 28)
for comment in comment_list['items']:
self.assertEqual(comment['comment'], comments.pop()['comment'])
comment_temp = comments.pop()
self.assertEqual(comment['comment'], comment_temp['comment'])
signed_comment_list = await self.daemon.jsonrpc_comment_list(
claim_id=stream['claim_id'],
@@ -365,13 +342,15 @@ class CommentCommands(CommandTestCase):
async def test04_comment_abandons(self):
rswanson = (await self.channel_create('@RonSwanson'))['outputs'][0]
stream = (await self.stream_create('Pawnee Town Hall of Fame by Leslie Knope'))['outputs'][0]
stream = (await self.stream_create('Pawnee_Tow_Hall_of_Fame_by_Leslie_Knope'))['outputs'][0]
comment = await self.daemon.jsonrpc_comment_create(
comment='KNOPE! WHAT DID I TELL YOU ABOUT PUTTING MY INFORMATION UP LIKE THAT',
claim_id=stream['claim_id'],
channel_id=rswanson['claim_id']
)
self.assertIn('signature', comment)
abandoned = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
self.assertIn(comment['comment_id'], abandoned)
self.assertTrue(abandoned[comment['comment_id']]['abandoned'])
@@ -383,7 +362,7 @@ class CommentCommands(CommandTestCase):
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
moth_id = moth['claim_id']
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
stream = await self.stream_create('Cool_Lamps_to_Sit_On', channel_id=moth_id)
claim_id = stream['outputs'][0]['claim_id']
comment1 = await self.daemon.jsonrpc_comment_create(
@@ -436,12 +415,12 @@ class CommentCommands(CommandTestCase):
for item in items_visible + items_hidden:
self.assertIn(item, comments['items'])
async def test06_comment_list_test(self):
async def test06_comment_list(self):
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
moth_id = moth['claim_id']
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
stream = await self.stream_create('Cool_Lamps_to_Sit_On', channel_id=moth['claim_id'])
claim_id = stream['outputs'][0]['claim_id']
hidden_comment = await self.daemon.jsonrpc_comment_create(
comment='Who on earth would want to sit around on a lamp all day',
claim_id=claim_id,
@@ -451,44 +430,48 @@ class CommentCommands(CommandTestCase):
owner_comment = await self.daemon.jsonrpc_comment_create(
comment='Go away you yellow freak',
claim_id=claim_id,
channel_id=moth_id,
channel_id=moth['claim_id'],
)
other_comment = await self.daemon.jsonrpc_comment_create(
comment='I got my swim trunks and my flippy-floppies',
claim_id=claim_id,
channel_id=bee['claim_id']
)
anon_comment = await self.daemon.jsonrpc_comment_create(
claim_id=claim_id,
comment='Anonymous comment'
)
all_comments = [anon_comment, other_comment, owner_comment, hidden_comment]
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
all_comments = [other_comment, owner_comment, hidden_comment]
normal_list = await self.daemon.jsonrpc_comment_list(claim_id)
for field in list_fields:
self.assertIn(field, normal_list)
self.assertEqual(normal_list['total_items'], 4)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
set(normal_list)
)
self.assertEqual(normal_list['total_items'], 3)
self.assertTrue(normal_list['has_hidden_comments'])
for i, cmnt in enumerate(all_comments):
self.assertEqual(cmnt['comment_id'], normal_list['items'][i]['comment_id'])
hidden = await self.daemon.jsonrpc_comment_list(claim_id, hidden=True)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
set(hidden)
)
self.assertTrue(hidden['has_hidden_comments'])
for field in list_fields:
self.assertIn(field, hidden)
self.assertEqual(hidden['total_items'], 1)
visible = await self.daemon.jsonrpc_comment_list(claim_id, visible=True)
for field in list_fields:
self.assertIn(field, visible)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
set(visible)
)
self.assertTrue(visible['has_hidden_comments'])
self.assertEqual(visible['total_items'], normal_list['total_items'] - hidden['total_items'])
valid_list = await self.daemon.jsonrpc_comment_list(claim_id, is_channel_signature_valid=True)
for field in list_fields:
self.assertIn(field, valid_list)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
set(valid_list)
)
self.assertTrue(visible['has_hidden_comments'])
self.assertEqual(len(valid_list['items']), len(normal_list['items']) - 1)
self.assertEqual(len(valid_list['items']), len(normal_list['items']))
async def test07_edit_comments(self):
luda = (await self.channel_create('@Ludacris'))['outputs'][0]
@@ -537,18 +520,3 @@ class CommentCommands(CommandTestCase):
comment='If you see it and you mean then you know you have to go',
comment_id=original_cid
)
# editing an anonymous comment
anon_comment = await self.daemon.jsonrpc_comment_create(
comment='fast and furiouuuuuus',
claim_id=claim_id
)
anon_cid = anon_comment.get('comment_id')
self.assertIsNotNone(anon_cid)
with self.assertRaises(ValueError):
await self.daemon.jsonrpc_comment_update(
comment='drift drift drift',
comment_id=anon_cid
)
+17 -2
View File
@@ -1,3 +1,4 @@
from lbry.extras.daemon.loggly_handler import get_loggly_handler
from lbry.testcase import CommandTestCase
@@ -11,6 +12,7 @@ class AddressManagement(CommandTestCase):
self.assertItemCount(single, 1)
self.assertEqual(single['items'][0], addresses['items'][11])
class SettingsManagement(CommandTestCase):
async def test_settings(self):
@@ -21,5 +23,18 @@ class SettingsManagement(CommandTestCase):
self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('server', 50001))
setting = self.daemon.jsonrpc_settings_clear('lbryum_servers')
self.assertEqual(setting['lbryum_servers'][0], ('spv1.lbry.com', 50001))
self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('spv1.lbry.com', 50001))
self.assertEqual(setting['lbryum_servers'][0], ('spv11.lbry.com', 50001))
self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('spv11.lbry.com', 50001))
# test_privacy_settings (merged for reducing test time, unmerge when its fast)
# tests that changing share_usage_data propagates to the relevant properties
self.assertFalse(self.daemon.jsonrpc_settings_get()['share_usage_data'])
loggly = get_loggly_handler(self.daemon.conf)
self.addCleanup(loggly.close)
self.assertFalse(self.daemon.analytics_manager.enabled)
self.assertFalse(loggly.enabled)
self.daemon.jsonrpc_settings_set('share_usage_data', True)
self.assertTrue(self.daemon.jsonrpc_settings_get()['share_usage_data'])
self.assertTrue(self.daemon.analytics_manager.enabled)
self.assertTrue(loggly.enabled)
self.daemon.jsonrpc_settings_set('share_usage_data', False)
+151
View File
@@ -0,0 +1,151 @@
import logging
import pathlib
import time
from ..blockchain.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)
@@ -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()
@@ -27,6 +27,7 @@ class TestComponentManager(AsyncioTestCase):
components.HashAnnouncerComponent,
components.PeerProtocolServerComponent,
components.StreamManagerComponent,
components.WalletServerPaymentsComponent
]
]
self.component_manager = ComponentManager(Config())
+4 -4
View File
@@ -57,10 +57,6 @@ class TestURLParsing(unittest.TestCase):
url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff')
# unicode regex edges
_url = lambda name: url(name, stream_name=name)
_url('\u0009')
_url('\u000a')
_url('\u000d')
_url('\u0020')
_url('\uD799')
_url('\uE000')
_url('\uFFFD')
@@ -79,6 +75,10 @@ class TestURLParsing(unittest.TestCase):
fail("lbry://\uDFFE")
fail("lbry://\uFFFF")
fail("lbry://;")
fail("lbry://no\ttab")
fail("lbry://no space")
fail("lbry://no\rcr")
fail("lbry://no\new\nline")
fail("lbry://\"")
fail("lbry://\\")
fail("lbry:///")
+4
View File
@@ -122,6 +122,10 @@ async def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
class TestStreamManager(BlobExchangeTestBase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.client_config.share_usage_data = True
async def setup_stream_manager(self, balance=10.0, fee=None, old_sort=False):
file_path = os.path.join(self.server_dir, "test_file")
with open(file_path, 'wb') as f:
+12 -6
View File
@@ -64,8 +64,9 @@ class CLILoggingTest(AsyncioTestCase):
self.assertTrue(log.isEnabledFor(logging.INFO))
self.assertFalse(log.isEnabledFor(logging.DEBUG))
self.assertFalse(log.isEnabledFor(logging.DEBUG))
self.assertEqual(len(log.handlers), 1)
self.assertEqual(len(log.handlers), 2)
self.assertIsInstance(log.handlers[0], logging.handlers.RotatingFileHandler)
self.assertFalse(log.handlers[1].enabled)
async with get_logger(["start", "--verbose"]) as log:
self.assertTrue(log.getChild("lbry").isEnabledFor(logging.DEBUG))
@@ -80,16 +81,22 @@ class CLILoggingTest(AsyncioTestCase):
self.assertFalse(log.getChild("torba").isEnabledFor(logging.DEBUG))
async def test_loggly(self):
async with get_logger(["start"], share_usage_data=False) as log:
self.assertEqual(len(log.getChild("lbry").handlers), 2) # file and console
async with get_logger(["start"]) as log: # default share_usage_data=True
async with get_logger(["start"]) as log: # default share_usage_data=False
log = log.getChild("lbry")
self.assertIsInstance(log.handlers[0], logging.StreamHandler)
self.assertIsInstance(log.handlers[1], logging.StreamHandler)
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
self.assertFalse(log.handlers[2].enabled)
async with get_logger(["start"], share_usage_data=True) as log:
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 3)
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
async with get_logger(["start"], share_usage_data=True) as log: # explicit share_usage_data=True
self.assertTrue(log.handlers[2].enabled)
async with get_logger(["start"], share_usage_data=False) as log: # explicit share_usage_data=False
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 3)
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
self.assertFalse(log.handlers[2].enabled)
async def test_quiet(self):
async with get_logger(["start"]) as log: # default is loud
@@ -100,7 +107,6 @@ class CLILoggingTest(AsyncioTestCase):
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 2)
self.assertIsNot(type(log.handlers[0]), logging.StreamHandler)
self.assertIsNot(type(log.handlers[1]), logging.StreamHandler)
class CLITest(AsyncioTestCase):
+17 -8
View File
@@ -10,7 +10,7 @@ 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
@@ -47,7 +47,7 @@ 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(
@@ -533,7 +533,7 @@ 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),
@@ -549,8 +549,8 @@ 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):
@@ -617,7 +617,10 @@ class TestContentBlocking(TestSQLDB):
self.assertEqual(1, censor.total)
self.assertEqual({blocking_channel.claim_hash: 1}, censor.censored)
results, _ = reader.resolve([claim1.claim_name])
self.assertEqual('Could not find stream in "claim1".', results[0].args[0])
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
])
@@ -654,8 +657,14 @@ class TestContentBlocking(TestSQLDB):
results, _ = reader.resolve([
claim2.claim_name, regular_channel.claim_name # claim2 and channel don't resolve
])
self.assertEqual('Could not find stream in "claim2".', results[0].args[0])
self.assertEqual('Could not find channel in "@channel1".', results[1].args[0])
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'])
+12
View File
@@ -98,6 +98,12 @@ class TestQueryBuilder(unittest.TestCase):
'txo_name__in0_1': 'def456'
})
)
self.assertTupleEqual(
constraints_to_sql({'txo.name__in': {'abc123'}}),
('txo.name = :txo_name__in0', {
'txo_name__in0': 'abc123',
})
)
self.assertTupleEqual(
constraints_to_sql({'txo.age__in': 'SELECT age from ages_table'}),
('txo.age IN (SELECT age from ages_table)', {})
@@ -118,6 +124,12 @@ class TestQueryBuilder(unittest.TestCase):
'txo_name__not_in0_1': 'def456'
})
)
self.assertTupleEqual(
constraints_to_sql({'txo.name__not_in': ('abc123',)}),
('txo.name != :txo_name__not_in0', {
'txo_name__not_in0': 'abc123',
})
)
self.assertTupleEqual(
constraints_to_sql({'txo.age__not_in': 'SELECT age from ages_table'}),
('txo.age NOT IN (SELECT age from ages_table)', {})