Compare commits

..
214 Commits
Author SHA1 Message Date
Lex Berezhny 3d241500cf v0.94.0 2021-04-14 19:55:35 -04:00
Lex Berezhny ded8224f66 update docs 2021-04-14 19:52:50 -04:00
Lex Berezhny f8814881a1 ability to set sd_hash, file_name and file_hash when updating a stream claim 2021-04-14 19:52:50 -04:00
Victor Shyba cc2852cd48 new implementation for limit_claims_per_channel 2021-04-14 18:32:16 -04:00
Lex Berezhny 467637a9eb fix test 2021-04-14 11:24:58 -04:00
Lex Berezhny 3cfc292d84 lint 2021-04-14 11:24:58 -04:00
Lex Berezhny 6acf94a810 moved balance calculation to SQL 2021-04-14 11:24:58 -04:00
Jack Robison 31367fb4c4 show hostnames of spvs 2021-04-13 11:51:27 -04:00
Jack Robison 12d6074e3b fix typing 2021-04-13 11:51:27 -04:00
Lex Berezhny ff30386051 lint 2021-04-06 21:22:27 -04:00
shubhendra 601f99ac16 Remove unnecessary generator
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
shubhendra 87fe5c6101 Refactor the comparison involving not
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
shubhendra 68399ca31c Iterate dictionary directly
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
shubhendra 2a6d7fd80f Remove methods with unnecessary super delegation.
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
shubhendra 4725f510d8 Remove unnecessary use of comprehension
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
shubhendra be0ba22222 Remove unnecessary comprehension
Signed-off-by: shubhendra <withshubh@gmail.com>
2021-04-06 21:22:27 -04:00
Lex Berezhny c8781392be added unit test for Access-Control HTTP headers 2021-04-06 17:12:05 -04:00
John Leith b97164fcfb adding access control headers 2021-04-06 17:12:05 -04:00
Lex Berezhny 0dfb92281b v0.93.0 2021-03-30 20:59:47 -04:00
Victor Shyba 4fe80c40da also apply to test:json-api 2021-03-30 17:00:15 -04:00
Victor Shyba f0fac5115a update tox to pass ELASTIC_HOST 2021-03-30 17:00:15 -04:00
Victor Shyba 46dd389d0d add elasticsearch service to gitlab 2021-03-30 17:00:15 -04:00
Jack Robison 1e28e21ab5 Merge pull request #3248 from lbryio/add-es-host-setting
add ELASTIC_HOST and ELASTIC_PORT settings to hub
2021-03-30 13:09:18 -04:00
Jack Robison 7832c62c5d add ELASTIC_HOST and ELASTIC_PORT settings to hub 2021-03-30 12:48:13 -04:00
Lex Berezhny d025ee9dbe revert release 2021-03-30 11:29:17 -04:00
Lex Berezhny a9a9cb4319 v0.93.0 2021-03-30 10:15:31 -04:00
Victor Shyba aa727cb9b1 show channels regardless of no_source 2021-03-30 09:47:08 -04:00
Victor Shyba b8c9a99f20 fix no_source for reposts 2021-03-30 09:47:08 -04:00
Lex Berezhny aff995b0d0 temporary fix for mempool sync failing during reorg 2021-03-29 16:11:03 -04:00
Jack Robison 2cc7e5dfdc Merge pull request #3153 from lbryio/elasticsearch
hub: use Elasticsearch for `claim_search` and `resolve` calls
2021-03-24 16:44:14 -04:00
Victor Shyba 5235a150b1 add prog name to sync arg parser 2021-03-24 17:07:17 -03:00
Victor Shyba c6372ea9de hub->lbry-hub 2021-03-24 17:03:57 -03:00
Victor Shyba 7df4cc44c4 fixes from review 2021-03-24 16:30:33 -03:00
Victor Shyba d47cf40544 add reader.py for test_sqldb tests 2021-03-19 19:58:13 -03:00
Victor Shyba 7f5d88e95c remove dead/broken/unused API 2021-03-19 19:58:13 -03:00
Victor Shyba d09663c066 remove flush call 2021-03-19 19:58:13 -03:00
Victor Shyba ef97c9b69f torba-server -> hub 2021-03-19 19:58:13 -03:00
Victor Shyba d855e6c8b1 move elasticsearch things into its own module 2021-03-19 19:58:13 -03:00
Victor Shyba cd66f7eb43 if not no_totals, use default page size 2021-03-19 19:58:13 -03:00
Victor Shyba 6a35a7ba4c expand content filtering tests for no_totals 2021-03-19 19:58:13 -03:00
Victor Shyba a3e146dc68 sort on index time 2021-03-19 19:58:13 -03:00
Victor Shyba b81305a4a9 index and allow has_source 2021-03-19 19:58:13 -03:00
Victor Shyba 73884b34bc apply no_totals 2021-03-19 19:58:13 -03:00
Victor Shyba 6166a34db2 check cache item before locking 2021-03-19 19:58:13 -03:00
Victor Shyba 6fa7da4b1c less slices 2021-03-19 19:58:13 -03:00
Victor Shyba c3e426c491 fix search by channel for invalid channel 2021-03-19 19:58:13 -03:00
Victor Shyba 21e023f0db fix search by channel 2021-03-19 19:58:13 -03:00
Victor Shyba 063be001b3 cache inner parsing 2021-03-19 19:58:13 -03:00
Victor Shyba 5dff02e8bc on resolve, get all claims at once 2021-03-19 19:58:13 -03:00
Victor Shyba 60a59407d8 cache the encoded output instead 2021-03-19 19:58:13 -03:00
Victor Shyba 20a5aecfca fix lib exception to asyncio TimeoutError 2021-03-19 19:58:13 -03:00
Victor Shyba c2e7b5a67d restore some of the interrupt metrics 2021-03-19 19:58:13 -03:00
Victor Shyba 8f32303d07 apply search timeout 2021-03-19 19:58:13 -03:00
Victor Shyba 891b1e7782 track results up to 200 2021-03-19 19:58:13 -03:00
Victor Shyba f26394fd3b report deletions on docs that doesnt exist, but dont raise 2021-03-19 19:58:13 -03:00
Victor Shyba 4d83d42b4c fix equality instead of mod 2021-03-19 19:58:13 -03:00
Victor Shyba 57f1108df2 fix query being json serializable 2021-03-19 19:58:13 -03:00
Victor Shyba 2641a9abe5 make better resolve cache 2021-03-19 19:58:13 -03:00
Victor Shyba 6b193ab350 make indexing cooperative 2021-03-19 19:58:13 -03:00
Victor Shyba b1bb37511c use right key on cache 2021-03-19 19:58:13 -03:00
Victor Shyba 319187d6d6 log mempool task exceptions 2021-03-19 19:58:13 -03:00
Victor Shyba 02eb789f84 caching for resolve 2021-03-19 19:58:13 -03:00
Victor Shyba 5a9338a27f use a dict on set_reference 2021-03-19 19:58:13 -03:00
Victor Shyba eb6924277f round time to 10 minutes and fetch referenced by id 2021-03-19 19:58:13 -03:00
Victor Shyba 325419404d update dockerfile 2021-03-19 19:58:13 -03:00
Victor Shyba bd8f371fd5 bump referenced rows query limit up 2021-03-19 19:58:13 -03:00
Victor Shyba 1783ff2845 dont delete claims on reorg 2021-03-19 19:58:13 -03:00
Victor Shyba d388527ffa log indexing errors 2021-03-19 19:58:13 -03:00
Victor Shyba 19494088bd generate from queue 2021-03-19 19:58:13 -03:00
Victor Shyba 920dad524a simplify sync and use asyncio Queue instead 2021-03-19 19:58:13 -03:00
Victor Shyba ec89bcac8e improve sync script for no-downtime maintenance 2021-03-19 19:58:13 -03:00
Victor Shyba a916c1f4ad check if db file exists before sync 2021-03-19 19:58:13 -03:00
Victor Shyba a9a0ac92d7 ignore unset flag 2021-03-19 19:58:13 -03:00
Victor Shyba da8a8bd1ef filter+fts and tests for edge cases 2021-03-19 19:58:13 -03:00
Victor Shyba d9c746891d pin python3.7 2021-03-19 19:58:13 -03:00
Victor Shyba 67817005b5 check ES synced without a process and wait for ES 2021-03-19 19:58:13 -03:00
Jack Robison 24d11de5a7 torba-elastic-sync 2021-03-19 19:58:13 -03:00
Victor Shyba 9251c87323 refresh after sync 2021-03-19 19:58:13 -03:00
Victor Shyba e12fab90d1 docker compose update 2021-03-19 19:58:13 -03:00
Victor Shyba 0a194b5b01 claim_ids query 2021-03-19 19:58:13 -03:00
Victor Shyba 8d028adc53 be a writer by default 2021-03-19 19:58:13 -03:00
Victor Shyba dfca15395e claim id is also a keyword 2021-03-19 19:58:13 -03:00
Victor Shyba e21f2362fe apply reorg deletion as well 2021-03-19 19:58:13 -03:00
Victor Shyba 1ce328e8a9 cache signature inspection 2021-03-19 19:58:13 -03:00
Victor Shyba 038a5f999f cache encoded headers 2021-03-19 19:58:13 -03:00
Victor Shyba 5d3704c7ea reader mode 2021-03-19 19:58:13 -03:00
Victor Shyba 87037c06c9 remove reader code 2021-03-19 19:58:13 -03:00
Victor Shyba dd412c0f50 delete sqlite fts 2021-03-19 19:58:13 -03:00
Victor Shyba bf44befff6 backport fixes from server 2021-03-19 19:58:13 -03:00
Victor Shyba e61874bb6f only repeat search if it has blocked items 2021-03-19 19:58:13 -03:00
Victor Shyba 1e5331768f fix some of the tests 2021-03-19 19:58:13 -03:00
Victor Shyba ec9a3a4f7c do not page filtered 2021-03-19 19:58:13 -03:00
Victor Shyba e439a3a8dc advanced resolve 2021-03-19 19:58:13 -03:00
Victor Shyba 19f70d7a11 create changelog trigger 2021-03-19 19:58:13 -03:00
Victor Shyba afe7ed5b05 adjust size 2021-03-19 19:58:13 -03:00
Victor Shyba d4bf004d74 use a thread pool to sync changes 2021-03-19 19:58:13 -03:00
Victor Shyba e4d06a088b include the channel being filtered/blocked 2021-03-19 19:58:13 -03:00
Victor Shyba 0929088b12 missing refresh step 2021-03-19 19:58:13 -03:00
Victor Shyba 7b4838fc9b dont update more than 400 items a time 2021-03-19 19:58:13 -03:00
Victor Shyba 0cf9533248 narrow update by query 2021-03-19 19:58:13 -03:00
Victor Shyba 84ff0b8a9f general timeout 2021-03-19 19:58:13 -03:00
Victor Shyba d467dcfeaf increase sync queue 2021-03-19 19:58:13 -03:00
Victor Shyba 8e68ba4751 fix join, refresh before update 2021-03-19 19:58:13 -03:00
Victor Shyba 0f2a85ba9f simplify sync 2021-03-19 19:58:13 -03:00
Victor Shyba 7674a0a91e backport fixes from testing server 2021-03-19 19:58:13 -03:00
Victor Shyba 5bc1a66572 32 slices and add censor type to fields 2021-03-19 19:58:13 -03:00
Victor Shyba 9b56067213 raise request timeout for content filtering 2021-03-19 19:58:13 -03:00
Victor Shyba 9a9df2fc3c apply filtering only to whats unfiltered 2021-03-19 19:58:13 -03:00
Victor Shyba 9989d8d1d4 refresh after delete 2021-03-19 19:58:13 -03:00
Victor Shyba f9471f297e apply filter and block from ES script lang 2021-03-19 19:58:13 -03:00
Victor Shyba 146b693e4a exclude title and description 2021-03-19 19:58:13 -03:00
Victor Shyba 7295b7e329 make sync parallel 2021-03-19 19:58:13 -03:00
Victor Shyba e2441ea3e7 use prefix from ES docs 2021-03-19 19:58:13 -03:00
Victor Shyba 119e51912e fix partial id 2021-03-19 19:58:13 -03:00
Victor Shyba dd950f5b0d tag can have empty space 2021-03-19 19:58:13 -03:00
Victor Shyba 78a9bad1e1 no indexer_task 2021-03-19 19:58:13 -03:00
Victor Shyba 0c6eaf5484 fix resolve partial id 2021-03-19 19:58:13 -03:00
Victor Shyba 1010068ddb disable refresh interval. start with 3 shards 2021-03-19 19:58:13 -03:00
Victor Shyba 82eec3d8d7 use multiple clients on sync script indexing 2021-03-19 19:58:13 -03:00
Victor Shyba ee7b37d3f3 also normalize the name supplied by user 2021-03-19 19:58:13 -03:00
Victor Shyba 143d82d242 normalized, not normalized_name 2021-03-19 19:58:13 -03:00
Victor Shyba 8b91b38855 update winners in one go 2021-03-19 19:58:13 -03:00
Victor Shyba 1098f0d2a3 use normalized name instead 2021-03-19 19:58:13 -03:00
Victor Shyba ab53cec022 fix is_controlling sync 2021-03-19 19:58:13 -03:00
Victor Shyba 6f5f8e5648 add elasticsearch dep 2021-03-19 19:58:13 -03:00
Victor Shyba edfd707c22 run ES on github actions 2021-03-19 19:58:13 -03:00
Victor Shyba 1870f30af8 add sync script 2021-03-19 19:58:13 -03:00
Victor Shyba 90106f5f08 all test_claim_commands tests green 2021-03-19 19:58:13 -03:00
Victor Shyba 9924b7b438 reposts and tag inheritance 2021-03-19 19:58:13 -03:00
Victor Shyba aa37faab0a use porter analyzer with weights on full text search 2021-03-19 19:58:13 -03:00
Victor Shyba dc10f8ce72 ignore errors when deleting 2021-03-19 19:58:13 -03:00
Victor Shyba 996686c1da claim search and resolve translated to ES queries 2021-03-19 19:58:13 -03:00
Victor Shyba 488785d013 add indexer task 2021-03-19 19:58:13 -03:00
Victor Shyba 3abdc01230 index ES during sync 2021-03-19 19:58:13 -03:00
Victor Shyba 8da04a584f start waiting before generate 2021-03-19 18:01:29 -03:00
Victor Shyba 27cc61d45e limit test time to 2 minutes, then consider it a failure and log what was running 2021-03-19 18:01:29 -03:00
Lex Berezhny 7371c30064 v0.92.0 2021-03-15 13:07:30 -04:00
Lex Berezhny 140d163895 removed redundant comment 2021-03-14 10:11:42 -04:00
Victor Shyba dc33bdc1dc update api json 2021-03-14 10:11:42 -04:00
Victor Shyba 74df4fab83 change column to has_source and document both flags 2021-03-14 10:11:42 -04:00
Victor Shyba 1e5cd3d7a1 typo, fix tests 2021-03-14 10:11:42 -04:00
Victor Shyba a54e9b64aa add no_source claim_search filter 2021-03-14 10:11:42 -04:00
Victor Shyba 74660704e3 fix update 2021-03-14 10:11:42 -04:00
Victor Shyba 7439893a2a fix get for sourceless claims 2021-03-14 10:11:42 -04:00
Victor Shyba e27e49e9dc call update only once 2021-03-14 10:11:42 -04:00
Victor Shyba 34ed729c59 there is no 'sd_hash' parameter for this API 2021-03-14 10:11:42 -04:00
Victor Shyba adaeeca3fd let file_path be optional 2021-03-14 10:11:42 -04:00
Jack Robison dac75563d3 add --no_file_path param to publish, stream_create, and stream_update 2021-03-14 10:11:42 -04:00
Alex Grintsvayg cbc76adcaa only return unspent txos if is_spent flag is not used. fixes #2923 2021-03-13 06:44:20 -05:00
Lex Berezhny 69a9cb383d oops 2021-03-12 13:29:55 -05:00
Lex Berezhny 4343073c00 clients can connect to wallet server even when they are not reachable by UDP 2021-03-12 13:29:55 -05:00
Jack Robison fe60d4be88 Merge pull request #3221 from lbryio/subscribe_hash_on_call
Improve performance of address subscriptions and transaction proofs
2021-03-10 15:58:50 -05:00
Victor Shyba ae337807f5 get merkles outside thread cooperatively 2021-03-10 13:05:17 -03:00
Victor Shyba 9ae30ac08e during subscribe, hash address only when its time 2021-03-10 12:51:58 -03:00
Lex Berezhny 62fa85c0a4 fix test 2021-03-09 13:27:36 -05:00
Lex Berezhny 7bb873dad9 removed connection_status field from the status command, use wallet.connected instead to determine if SDK is connected 2021-03-09 13:27:36 -05:00
Lex Berezhny 5f6c1c14cb v0.91.0 2021-03-04 00:04:25 -05:00
Lex Berezhny d43189ad33 regenerate docs 2021-03-04 00:03:16 -05:00
Lex Berezhny fcad76fc51 lint 2021-03-04 00:03:16 -05:00
Lex Berezhny 97e6e1684e simplifying 2021-03-04 00:03:16 -05:00
zeppi 67a0d3e926 update docs 2021-03-04 00:03:16 -05:00
zeppi 183fb9f9ff provide --resolve tag for collection claim, separate from resolving its contents
bugfix and docs generation

review changes
2021-03-04 00:03:16 -05:00
Lex Berezhny 9815ddef1f fixes stalling client reconnect issue 2021-03-03 23:31:59 -05:00
Lex Berezhny f6d0847453 v0.90.1 2021-03-01 11:57:40 -05:00
Lex Berezhny b0b9f0d65f regenerate docs 2021-03-01 11:52:17 -05:00
Lex Berezhny 0cec80f676 fixes transaction signing bug when tx had no change outputs 2021-03-01 11:20:08 -05:00
Patrick Keane 48c64143e3 Add no_totals argument to claim search 2021-02-26 10:41:15 -05:00
Patrick Keane a8712422bc Update daemon.py 2021-02-21 23:45:18 -05:00
Patrick Keane 97f65bd283 Minor spelling correction(s). 2021-02-21 23:45:18 -05:00
Lex Berezhny fd3c1c50f1 v0.90.0 2021-02-16 11:13:14 -05:00
Lex Berezhny b153e4bb9f added support to claim_search for filtering collections via --claim_type 2021-02-16 11:08:54 -05:00
Lex Berezhny db9856a8db use median exchange rate when several exchange rates are available 2021-02-15 14:09:32 -05:00
Lex Berezhny 75ecea265d ensures content purchase fails appropriately when exchange rate is not available 2021-02-11 13:57:33 -05:00
Lex Berezhny be8751cb73 integration test fixes 2021-02-10 22:14:13 -05:00
Lex Berezhny fb25ecb4a1 unittest 2021-02-10 22:14:13 -05:00
Lex Berezhny f1cb7d27ac lint 2021-02-10 22:14:13 -05:00
Lex Berezhny dee494e12f converting from USD, BTC to LBC is now done via several exchange rate providers: Bittrex, Cryptonator, CoinEx, hotbit and UPbit 2021-02-10 22:14:13 -05:00
Lex Berezhny b13a121915 v0.89.0 2021-02-09 10:12:05 -05:00
Lex Berezhny 7486ee9537 do not tx._reset() in generate_channel_private_key 2021-02-08 09:56:03 -05:00
Lex Berezhny 4a20ccc28e tx._reset() the transaction after more internal changes 2021-02-08 09:56:03 -05:00
Lex Berezhny f80dd2b307 tx._reset() the transaction after internal changes 2021-02-08 09:56:03 -05:00
Lex Berezhny b208cf6d32 significant performance improvement when creating transactions and with txo spend specifically 2021-02-08 09:56:03 -05:00
Lex Berezhny 39e78ff17e updated exchange rate manager to use v3 bittrex API (old one is deprecated) 2021-02-03 14:15:19 -05:00
Alex Grin a8177ea7fe Merge pull request #3171 from lbryio/fix-collectionChannel 2021-02-02 14:16:42 -05:00
Alex Grin bedcfc154b Merge branch 'master' into fix-collectionChannel 2021-02-02 11:25:52 -05:00
zeppi 4c38b4aa3c docs and reenable gitlab json generation 2021-02-01 19:19:46 -05:00
Victor Shyba f6cfe266e0 specify Returns correctly for docs gen 2021-02-01 19:19:46 -05:00
zeppi 4905e65f14 fix comment tests and json generat 2021-02-01 19:19:46 -05:00
Lex Berezhny ccb250b410 txo_list --resolve now works for signed supports by resolving the signing channel 2021-01-26 20:53:36 -05:00
zeppi aca57ffc62 allows cli to accept channel_id for collections 2021-01-26 10:02:01 -05:00
Dispatch 7f375f42d8 Fix / Add correct mimetypes for HLS / DASH 2021-01-25 15:55:56 -05:00
Lex Berezhny eedcc2034d fixes #3166 2021-01-25 10:56:48 -05:00
Jack Robison 24c9a167d7 dockerfile 2021-01-22 12:28:04 -05:00
Jack Robison 909df8ef1f dockerfile 2021-01-22 11:54:56 -05:00
Jack Robison 3b27cb3671 v0.88.0 2021-01-22 10:41:06 -05:00
Lex Berezhny 3fe0db4a7d fix integration tests 2021-01-22 07:51:13 -05:00
Lex Berezhny 8b55814ab2 fixes #2943 bug where get forced user to purchase their own priced stream 2021-01-22 07:51:13 -05:00
Jack Robison 575e471553 Merge pull request #3161 from lbryio/ledger-compatibility
handle connections from ledger clients in spv server
2021-01-22 00:09:50 -05:00
Jack Robison 0f5f1aebed accept connections from ledger clients in spv server 2021-01-21 21:37:39 -05:00
Jack Robison 50e17eb1ab Merge pull request #3148 from lbryio/udp-wallet-server-status
UDP based spv server status, improved server selection
2021-01-21 20:55:16 -05:00
Jack Robison 158cc2f660 skip test_single_server_payment 2021-01-21 19:29:59 -05:00
Jack Robison 1066a31acd fix test 2021-01-21 18:46:28 -05:00
Jack Robison 1f9d0f4582 pylint 2021-01-21 16:30:54 -05:00
Jack Robison a6d65233f1 fallback to getting external ip from spv servers instead of internal apis 2021-01-21 16:20:53 -05:00
Jack Robison eff2fe7a1b update tests 2021-01-21 16:20:01 -05:00
Jack Robison 20efdc70b3 use UDP ping for wallet server selection
-only connect to one spv server at a time
-remove session pool
2021-01-21 16:15:42 -05:00
Jack Robison f0d8fb8f1a add UDP based ping protocol for spv servers 2021-01-21 16:08:33 -05:00
Jack Robison f7a380e9b7 start prometheus before block processing 2021-01-21 16:01:33 -05:00
Jack Robison e9c7cf6f63 logging 2021-01-21 14:51:59 -05:00
Jack Robison 68f1661452 add LRUCache with no prometheus metrics 2021-01-21 14:37:08 -05:00
Jack Robison 36fd1b91ae cache server features 2021-01-21 14:37:08 -05:00
Jack Robison a4ec430ac0 improve subscription performance 2021-01-21 14:37:08 -05:00
Jack Robison 519614b2fd skip libtorrent component in tests 2021-01-21 14:37:08 -05:00
Lex Berezhny bf0118c8ef added support for --not_channel_id to txo_list commands 2021-01-21 14:03:59 -05:00
71 changed files with 2872 additions and 1795 deletions

No files matched your search

+11
View File
@@ -37,6 +37,17 @@ jobs:
- blockchain
- other
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.6.0
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
+15 -8
View File
@@ -1,5 +1,11 @@
default:
image: python:3.7
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
variables:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
#cache:
@@ -41,13 +47,14 @@ test:datanetwork-integration:
stage: test
script:
- pip install tox-travis
- tox -e datanetwork --recreate
- ELASTIC_HOST=elasticsearch tox -e datanetwork --recreate
test:blockchain-integration:
stage: test
script:
- curl "http://elasticsearch:9200/_cat/health"
- pip install tox-travis
- tox -e blockchain
- ELASTIC_HOST=elasticsearch tox -e blockchain
test:other-integration:
stage: test
@@ -55,13 +62,13 @@ test:other-integration:
- apt-get update
- apt-get install -y --no-install-recommends ffmpeg
- pip install tox-travis
- tox -e other
- ELASTIC_HOST=elasticsearch tox -e other
#test:json-api:
# stage: test
# script:
# - make install tools
# - HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
test:json-api:
stage: test
script:
- make install tools
- ELASTIC_HOST=elasticsearch HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
+4 -2
View File
@@ -1,4 +1,4 @@
FROM ubuntu:19.10
FROM debian:10-slim
ARG user=lbry
ARG db_dir=/database
@@ -13,7 +13,9 @@ RUN apt-get update && \
wget \
tar unzip \
build-essential \
python3 \
pkg-config \
libleveldb-dev \
python3.7 \
python3-dev \
python3-pip \
python3-wheel \
+26 -22
View File
@@ -1,36 +1,40 @@
version: "3"
volumes:
lbrycrd:
wallet_server:
es01:
services:
lbrycrd:
image: lbry/lbrycrd:${LBRYCRD_TAG:-latest-release}
restart: always
ports: # accessible from host
- "9246:9246" # rpc port
expose: # internal to docker network. also this doesn't do anything. its for documentation only.
- "9245" # node-to-node comms port
volumes:
- "lbrycrd:/data/.lbrycrd"
environment:
- RUN_MODE=default
# Curently not snapshot provided
#- SNAPSHOT_URL=${LBRYCRD_SNAPSHOT_URL-https://lbry.com/snapshot/blockchain}
- RPC_ALLOW_IP=0.0.0.0/0
wallet_server:
depends_on:
- es01
image: lbry/wallet-server:${WALLET_SERVER_TAG:-latest-release}
depends_on:
- lbrycrd
restart: always
network_mode: host
ports:
- "50001:50001" # rpc port
- "50005:50005" # websocket port
#- "2112:2112" # uncomment to enable prometheus
- "2112:2112" # uncomment to enable prometheus
volumes:
- "wallet_server:/database"
env_file: [/home/lbry/wallet-server-env]
environment:
# Curently not snapshot provided
# - SNAPSHOT_URL=${WALLET_SERVER_SNAPSHOT_URL-https://lbry.com/snapshot/wallet}
- DAEMON_URL=http://lbry:lbry@lbrycrd:9245
- DAEMON_URL=http://lbry:lbry@127.0.0.1:9245
- TCP_PORT=50001
- PROMETHEUS_PORT=2112
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: es01
environment:
- node.name=es01
- discovery.type=single-node
- indices.query.bool.max_clause_count=4096
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms8g -Xmx8g" # no more than 32, remember to disable swap
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es01:/usr/share/elasticsearch/data
ports:
- 127.0.0.1:9200:9200
+3 -1
View File
@@ -20,4 +20,6 @@ if [[ -n "$SNAPSHOT_URL" ]] && [[ ! -f /database/claims.db ]]; then
rm "$filename"
fi
/home/lbry/.local/bin/torba-server "$@"
/home/lbry/.local/bin/lbry-hub-elastic-sync /database/claims.db
echo 'starting server'
/home/lbry/.local/bin/lbry-hub "$@"
+311 -149
View File
@@ -46,7 +46,7 @@
{
"name": "wallet_id",
"type": "str",
"description": "wallet to check for claim purchase reciepts",
"description": "wallet to check for claim purchase receipts",
"is_required": false
}
],
@@ -54,10 +54,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1602862436,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpzzr985r8\",\n \"download_path\": \"/tmp/tmpzzr985r8/tmpk0n0x2sb\",\n \"file_name\": \"tmpk0n0x2sb\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"7acc8b9eac8e533c57b933928ab6fad0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01f2d6950adda2502b543f042e4e8496b63a2bc95d1391e6159e2874bf75624f77339a61abf38b4da3237a5a52ad92aece2cefae8742c427064051fadb0dcfcc8f957b190341110ce64b8fd3f5cc874e16db11cbdc0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6b8f6829a8820cd430d23b3de7dd67ad77a11d912b04ac5577014d51af877a0c3a094e8d3d9bc2ae6b2c13c2ea44e477\",\n \"stream_name\": \"tmpk0n0x2sb\",\n \"streaming_url\": \"http://localhost:5280/stream/d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"suggested_file_name\": \"tmpk0n0x2sb\",\n \"timestamp\": 1602862457,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1618443025,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp8wvxwurx\",\n \"download_path\": \"/tmp/tmp8wvxwurx/tmpoegrqi7y\",\n \"file_name\": \"tmpoegrqi7y\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -83,6 +83,18 @@
"description": "path to file to be associated with name.",
"is_required": false
},
{
"name": "file_name",
"type": "str",
"description": "name of file to be associated with stream.",
"is_required": false
},
{
"name": "file_hash",
"type": "str",
"description": "hash of file to be associated with stream.",
"is_required": false
},
{
"name": "validate_file",
"type": "bool",
@@ -191,6 +203,12 @@
"description": "audio/video duration in seconds, automatically calculated",
"is_required": false
},
{
"name": "sd_hash",
"type": "str",
"description": "sd_hash of stream",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
@@ -250,10 +268,10 @@
"examples": [
{
"title": "Publish a file",
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzg66qsrc\", \"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/tmpzg66qsrc",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzg66qsrc\", \"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\": \"0100000001b5c2fa21042c9c7902e2210e72f6e732356ce3fa8284a6d62b2230ada4c68778010000006b483045022100e650ed64dda5492752201f302c36d49ba40a2650eaaf1b241a1afb4cf2712b3d022070e3e9d610155cf3a0e61f7d84d92989927b7f159b52ea67cb18899f642b0049012102980b4392de9b4cd0090d3e81f5f85ef2f08c6dc2280eeb2bcfb58c6ddbf75908ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a67363671737263180b22186170706c69636174696f6e2f6f637465742d73747265616d32300a4cf1efdc3d85ef48863f9fafd675bb9cc4e83c7f4bbec17f99e4dd6004a21c3317d08107e3e00e8d205102e2490e646d7576a914f16d76520d9764aa8658b40a8d7fd0a6a73ef41a88ace0b46217000000001976a9143c9f3b8c3c8f0a63a43f32ef3c5615875db424b288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqeTenbgAseTRfcPJpmSXpUjRMNphrhjGu\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1602862457,\n \"txid\": \"7887c6a4ad30222bd6a68482fae36c3532e7f6720e21e202799c2c0421fac2b5\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3XWGrLR13rLfqCpeJDGFkb3DmyDr8a2Ry\",\n \"amount\": \"1.0\",\n \"claim_id\": \"dc9071a98355d66734dd63cac49ddf4cc1d7f871\",\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#dc9071a98355d66734dd63cac49ddf4cc1d7f871\",\n \"timestamp\": null,\n \"txid\": \"7e9f8a03143f9697dbf796d74e163f8457c7aa8dfea7e9fb3ee078ad3d8defaa\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzg66qsrc\",\n \"sd_hash\": \"0a4cf1efdc3d85ef48863f9fafd675bb9cc4e83c7f4bbec17f99e4dd6004a21c3317d08107e3e00e8d205102e2490e64\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mm3VbEqmHhZ1vu69EMJC467JiPQQgbApbW\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"7e9f8a03143f9697dbf796d74e163f8457c7aa8dfea7e9fb3ee078ad3d8defaa\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"7e9f8a03143f9697dbf796d74e163f8457c7aa8dfea7e9fb3ee078ad3d8defaa\"\n }\n}"
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpjvdrb9mb\", \"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/tmpjvdrb9mb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpjvdrb9mb\", \"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\": \"010000000190f8282e51282b9c895496217ad872148bf766a73fd648aa8d0a3add68e37341010000006b483045022100ccf0fdf9740f4a201a447b3214b0cfdcdc8e7e002633852857d94eb3fe5e04ee022033466c5244db5dd86ce8ac4c217bdb91652bf596464a188b2512d2dc3fdad25c0121031bdedfa580a6ef204b6ed862bc1e2a7486dcfc3025fdea75b1d3ccb994c2b8d7ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706a76647262396d62180b22186170706c69636174696f6e2f6f637465742d73747265616d3230401fede72bffe7bae03fadee9f71b02298d596c6196a113c188e88179e2cec9a3ff2eabc0728a1122fbcccda064bed056d7576a914a7d1b376546d5185ca8213893533d18fb8f2c38688ac54826311000000001976a914603cc8baf0e5a91a27af508232c3fda4fc2f0fdc88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgiHMZg93NhGBhT1gopuZd6ZHkrFbaaFq7\",\n \"amount\": \"3.941448\",\n \"confirmations\": 3,\n \"height\": 217,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvpJMNYgqeBTBymiPCJqTTX7ZDMXZecy5M\",\n \"amount\": \"1.0\",\n \"claim_id\": \"705c80f0b6f70f212e0053afce483e34b5c864f4\",\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#705c80f0b6f70f212e0053afce483e34b5c864f4\",\n \"timestamp\": null,\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpjvdrb9mb\",\n \"sd_hash\": \"401fede72bffe7bae03fadee9f71b02298d596c6196a113c188e88179e2cec9a3ff2eabc0728a1122fbcccda064bed05\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpHoyphaL4UPPA2xyzukAcKBR9LX5MuxoU\",\n \"amount\": \"2.917341\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"3.941448\",\n \"total_output\": \"3.917341\",\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\"\n }\n}"
}
]
},
@@ -270,7 +288,7 @@
{
"name": "wallet_id",
"type": "str",
"description": "wallet to check for claim purchase reciepts",
"description": "wallet to check for claim purchase receipts",
"is_required": false
},
{
@@ -314,10 +332,10 @@
"examples": [
{
"title": "Resolve a claim",
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\": {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5/astream#f\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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\": 1602862457,\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#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\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\": 1602862456,\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#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"short_url\": \"lbry://@channel#5\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\": {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
}
]
},
@@ -339,7 +357,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\": \"network_connection\",\n \"message\": \"Your internet connection appears to have been interrupted\"\n },\n \"ffmpeg_status\": {\n \"analyze_audio_volume\": true,\n \"available\": true,\n \"which\": \"/usr/bin/ffmpeg\"\n },\n \"file_manager\": {\n \"managed_files\": 0\n },\n \"installation_id\": \"V15UZPpbGpTXg7L4Z4e2PSwvkHpu9GfrP5kaev1rpg3CPeUt7HsbA6FwfVtHh8EAe\",\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 \"file_manager\": true,\n \"libtorrent_component\": true,\n \"wallet\": true,\n \"wallet_server_payments\": true\n },\n \"wallet\": {\n \"available_servers\": 1,\n \"best_blockhash\": \"6b8c8af9b97544b81320fc87bce1b342d4eae95e7bedfa0b68c2051cdbd51f28\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected\": \"127.0.0.1:50002\",\n \"connected_features\": {\n \"daily_fee\": \"0\",\n \"description\": \"\",\n \"donation_address\": \"\",\n \"genesis_hash\": \"6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556\",\n \"hash_function\": \"sha256\",\n \"hosts\": {},\n \"payment_address\": \"\",\n \"protocol_max\": \"0.99.0\",\n \"protocol_min\": \"0.54.0\",\n \"pruning\": null,\n \"server_version\": \"0.83.0\",\n \"trending_algorithm\": \"zscore\"\n },\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.010411103023216128,\n \"port\": 50002\n }\n ]\n },\n \"wallet_server_payments\": {\n \"max_fee\": \"0.0\",\n \"running\": false\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 \"ffmpeg_status\": {\n \"analyze_audio_volume\": true,\n \"available\": true,\n \"which\": \"/usr/bin/ffmpeg\"\n },\n \"file_manager\": {\n \"managed_files\": 0\n },\n \"installation_id\": \"A4wihkSEkF2FPuxriMgtMqKs3YRMfKqBQECtBc7VqMbeQbdyzeYxvaGDKddocF3273\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\",\n \"libtorrent_component\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"file_manager\": true,\n \"wallet\": true,\n \"wallet_server_payments\": true\n },\n \"wallet\": {\n \"available_servers\": 1,\n \"best_blockhash\": \"c5c00ff4c8a99ada6f6131e1b9681b1e0f0352cfddae5e083e53c5a0f53b5632\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected\": \"localhost:50002\",\n \"connected_features\": {\n \"daily_fee\": \"0\",\n \"description\": \"\",\n \"donation_address\": \"\",\n \"genesis_hash\": \"6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556\",\n \"hash_function\": \"sha256\",\n \"hosts\": {},\n \"payment_address\": \"\",\n \"protocol_max\": \"0.99.0\",\n \"protocol_min\": \"0.54.0\",\n \"pruning\": null,\n \"server_version\": \"0.93.0\",\n \"trending_algorithm\": \"zscore\"\n },\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.009554634998494294,\n \"port\": 50002\n }\n ]\n },\n \"wallet_server_payments\": {\n \"max_fee\": \"0.0\",\n \"running\": false\n }\n }\n}"
}
]
},
@@ -361,7 +379,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.83.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.83.0\"\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.93.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.9\",\n \"version\": \"0.93.0\"\n }\n}"
}
]
}
@@ -415,10 +433,10 @@
"examples": [
{
"title": "Add an account from seed",
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"canyon divert wave luxury danger furnace age music fetch circle ship penalty\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\", \"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\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602862425,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdKjSM3yfb29VuJBXyr9SJYQ7iAwXEsPA4NnGgDgFJu9KF3xDQJqEKPJLZbSd7EUAaYVqM9HMz92tG2BcDX2A1u59NVmBCM3\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WnmEEheFzRocUKhU9BLLsqztzgypf9BYts33JcVqVPmBRBZkMfZCqjpgbRbmKwSisEW3w5Ex256TmeqXZfiMUEbRFn5TZPG\",\n \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\", \"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\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
}
]
},
@@ -456,9 +474,9 @@
},
{
"title": "Get balance for specific account by id",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}).json()",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).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}"
}
]
@@ -493,7 +511,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\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602862425,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdKjSM3yfb29VuJBXyr9SJYQ7iAwXEsPA4NnGgDgFJu9KF3xDQJqEKPJLZbSd7EUAaYVqM9HMz92tG2BcDX2A1u59NVmBCM3\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WnmEEheFzRocUKhU9BLLsqztzgypf9BYts33JcVqVPmBRBZkMfZCqjpgbRbmKwSisEW3w5Ex256TmeqXZfiMUEbRFn5TZPG\",\n \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\"\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\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
}
]
},
@@ -548,24 +566,24 @@
"examples": [
{
"title": "Transfer 2 LBC from default account to specific account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001593d803c01161d9d524478df75cef6c11da8d87614e5223d31d1f3ab4a754308000000006b483045022100d755e3d2cc4065107b641336906586a7b159842d903782e6b160c90c39aef6dc02204ad601b3c40820c9695890025fb16a9545b8fd333f0370631773d62b2148b6cc012102da03d047c77c88fc85700096abca5ab15ce21e95ad4ff1e71d908fa3cc190995ffffffff0200c2eb0b000000001976a914bbd66d8f43ae842b769d041309a95819cbde14e388ac90d7ae2f000000001976a914bb6805e32be149c2d7510ba04c327fd34288016c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mx9RtSnJXpvcsMBshzEfvEmpsqtQJh9HTN\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 0,\n \"timestamp\": 1602862455,\n \"txid\": \"0843754aabf3d1313d22e51476d8a81dc1f6ce75df7844529d1d16013c803d59\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxe9XeEC5YThvqweuLJywuccfe7FGTmD4c\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxbsGa4jf99tDFJtiFtxyVJ7N3xPUsD9qo\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000013bdd51995f94e53f67e228fcd1671abb1408f323a4149d54990ab2bb66b82b5b000000006a47304402205c826a87146e31e4f46366aad0dc94b729e6c50fe2b751e9ff09699642386e6402205a75d8fc65091facf6c98d7b056dc8e4b54b8e7c1ed3c25c8ba14b7fa44166d401210308d5d163a7d95504d3ee87df25306049989b48497c979e23d683abaea3a01816ffffffff0200c2eb0b000000001976a914c18783f1248df509b6fc72dca4a0c2dddbb206d988ac90d7ae2f000000001976a914728be3452ae563fedebd08b7095928eed5f3dcb388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkchdhJsAo2aK3uixecvmdkqX7Rqfr6BVT\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 0,\n \"timestamp\": 1618443043,\n \"txid\": \"5b2bb866bbb20a99549d14a423f30814bb1a67d1fc28e2673fe5945f9951dd3b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"myAF3rPAzpACseXDsTu2DZJcJNM1xdginP\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqxcuVhZfQhpBDVBXzBAaqrrdXtRHhX64i\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\"\n }\n}"
},
{
"title": "Spread LBC between multiple addresses",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"from_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\" --from_account=\"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"from_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000158533d2d042f919166ee2e1579846af0b49c4caf9db4cd82a7ca37362f374769000000006b483045022100c76e4f1ee55950017492b9bad6178e5f231e2b78b76b87cdb3b896e645525f3a02206c29691cfd6aa7dea5c8cefe77a019c056039b4ae69c794655116a6c583c6f070121021fa6ee5903084a3c68cf3219b09b83ffd1b25eae5d5ad66a708c1259e774c4cfffffffff03c0687804000000001976a9146a86d0525868bfe9f0287eb0792ac22dd73be8a488acc0687804000000001976a9146a86d0525868bfe9f0287eb0792ac22dd73be8a488ac6cb9fa02000000001976a914de0d514e0b0ec3cf293ec252dbbbad5842ac88cf88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxe9XeEC5YThvqweuLJywuccfe7FGTmD4c\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1602862456,\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1m4FxpboAMcDtbVjnFoiqYTnoTmbUPm9H\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --from_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b756701c12d340a9e629170326519d14e8c21ce1f71a3ac312275a98589f5e69000000006a4730440220352d5a1a84da2f0ba43f10e0275d79061176e2e8eb6ff1a9ec0f1f75c3388f4e02204fe559bd804e8f6e22c7059e2f5c9ec557ad23507e099674886b4237f1070681012102f0febe86a60274f0c53d21b59790fb44d8cda492953420eefece6807d1363b5affffffff03c0687804000000001976a9145a13bc90a6697226abea3c52290a19ef02fd7b1788acc0687804000000001976a9145a13bc90a6697226abea3c52290a19ef02fd7b1788ac6cb9fa02000000001976a914bd9def831d0cfbc8dec17de12d81f60ed86661fd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myAF3rPAzpACseXDsTu2DZJcJNM1xdginP\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxoZCsGM4svQVmca79sRbnkvjEqRor6AQZ\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\"\n }\n}"
},
{
"title": "Transfer all LBC to a specified account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000340b3f85547d4e70e3ad3196f98be9b468a9e43db0336338e504d3c34d8cbb632000000006b4830450221009286f4bb5c7772a63a8f112c778030299e5bd881eb438f7096c6fcfea2f298b20220610535e1cf672f1bae3769e68831ffd2548503d1b0c754408a4313562609266201210252ccb7fdb5a3df0ace8fec6ccfeafd779a3e7c8140e90837265284525e9220f6ffffffff40b3f85547d4e70e3ad3196f98be9b468a9e43db0336338e504d3c34d8cbb632010000006b483045022100c7f1430fda72968855d0023e05c664867290510b716dfaf248d9fee78af4e5b2022007ac25af1b07efb5fef962b8937d9164fea7739c50712538d26e44f67e3d317901210252ccb7fdb5a3df0ace8fec6ccfeafd779a3e7c8140e90837265284525e9220f6ffffffff40b3f85547d4e70e3ad3196f98be9b468a9e43db0336338e504d3c34d8cbb632020000006a47304402202e070692322d651350ad87d2a5a8af921a8b2b4c559247d07b9d74e64ce6bc41022034c4496122a92b2a22b7164d168e1b2746e80fe874dcb0f9dab5a16b1db0bb320121037074c41a3706b2b2694945c608d0b382ed414c60d5c3d2c688fe8f529a11952cffffffff015027eb0b000000001976a9143b6f1c1f03cf44fe2fb73c719d9360ce53426ce088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1602862456,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1602862456,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1m4FxpboAMcDtbVjnFoiqYTnoTmbUPm9H\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1602862456,\n \"txid\": \"32b6cbd8343c4d508e333603db439e8a469bbe986f19d33a0ee7d44755f8b340\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkwDGRHqKvQXW9zwfumqrJUhiBDWbzPr1M\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"4b414b1e4adc47f05e343c46f0ad5193935628beb51056f6d26589bcba9b4916\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"4b414b1e4adc47f05e343c46f0ad5193935628beb51056f6d26589bcba9b4916\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000038a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1000000006a47304402206678fa31d1cd7651dce9afdfe08d1d98b394d86c2bc2fa64f1f681e76541c05902202061bb6e3bc5ecfa49c51ff3b03d1486f6713406e8b66a434619db6b3a320cdf012102b0407e165d3f51c33d16024b6d3e05812bfc013fc709d2e4dc8b44bfeed40ef6ffffffff8a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1010000006a4730440220475c3c75bfecb5feb8774fd2ef2bb5bbb1f3ebe04f00a5baa452c3f2a5e7ca3e022023e57d0ec657d8fe7747100058a59183ae3b45dcb88454837c5d3b5f386fab29012102b0407e165d3f51c33d16024b6d3e05812bfc013fc709d2e4dc8b44bfeed40ef6ffffffff8a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1020000006b48304502210091d958cd83caf2c5569a694b6a5541bd83808ab848e3446c65dd0aaf63c8cfd202205966c66f64e3a2fe559c4889d44ff4416a72cfef4cbe58f712cdab4fd3e8cdcd0121037279e5dfdffe221ec3be66e3055697f9aa0cd76eff334102c4b62f350d2d9df1ffffffff015027eb0b000000001976a91447fa1ff84aea46fa180e2e25536f3f860ce4fbad88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxoZCsGM4svQVmca79sRbnkvjEqRor6AQZ\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mn5XueyJPEcHFvQUVjcuNgzGzcTJh18N9V\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\"\n }\n}"
}
]
},
@@ -623,7 +641,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\": \"myTjaQ7rr9opqoawJAkBwiAjVhTbgq8tXM\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #myTjaQ7rr9opqoawJAkBwiAjVhTbgq8tXM\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y8SWimAJbLYDuxaPvKDYMbSZQxqfHBRj11AbPTjykWJ87TReUKEeBqMMDYfwa7cPGKtWV22VXw6Y8gf13tXNt94cuyJ9Jzp\",\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\": \"mqvKp5ZDF8cdHGLWgUK1FcQXM8g4crXaJR\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mqvKp5ZDF8cdHGLWgUK1FcQXM8g4crXaJR\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XMJAjX6cW15csWwWuB9CkWTaUNVQ2ZPczoUG9oDQ9oATi7gKh9ZbgzpqAcBKYC9ojpc8AkrExLVJVZoWipGz5efd4dBoPpn\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -668,10 +686,10 @@
"examples": [
{
"title": "Remove an account",
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}).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\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602862425,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdKjSM3yfb29VuJBXyr9SJYQ7iAwXEsPA4NnGgDgFJu9KF3xDQJqEKPJLZbSd7EUAaYVqM9HMz92tG2BcDX2A1u59NVmBCM3\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WnmEEheFzRocUKhU9BLLsqztzgypf9BYts33JcVqVPmBRBZkMfZCqjpgbRbmKwSisEW3w5Ex256TmeqXZfiMUEbRFn5TZPG\",\n \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).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\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
}
]
},
@@ -764,10 +782,10 @@
"examples": [
{
"title": "Modify maximum number of times a change address can be reused",
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\", \"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\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602862425,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdKjSM3yfb29VuJBXyr9SJYQ7iAwXEsPA4NnGgDgFJu9KF3xDQJqEKPJLZbSd7EUAaYVqM9HMz92tG2BcDX2A1u59NVmBCM3\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WnmEEheFzRocUKhU9BLLsqztzgypf9BYts33JcVqVPmBRBZkMfZCqjpgbRbmKwSisEW3w5Ex256TmeqXZfiMUEbRFn5TZPG\",\n \"seed\": \"canyon divert wave luxury danger furnace age music fetch circle ship penalty\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3 --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"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\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
}
]
}
@@ -803,9 +821,9 @@
"examples": [
{
"title": "Check if address is mine",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvW5fF65d8WiGavNWjJcuQ6uRoa4AsSmLZ\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mvW5fF65d8WiGavNWjJcuQ6uRoa4AsSmLZ",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvW5fF65d8WiGavNWjJcuQ6uRoa4AsSmLZ\"}}).json()",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -852,14 +870,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\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mh9VwE8HKhw3QjPCPZh3PU6e3juobVGeME\",\n \"pubkey\": \"tpubDA9GDAntyJu4nEGYmLc4ihro5xv9bSSwfZTPEQQfN25mm2exgoUugfQE4ZMM3boheswEyS3zJMMYneaz2AuYowwhYFPZhYrPv5ktZz5xMQV\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mh9fMDTWpwF954grmVnzzntFSWXk8KYy8B\",\n \"pubkey\": \"tpubDA9GDAntyJu4L5oH2g4AeUbTqNd4mnJF7T1xamBiV5hJTwLdqPT3YsGZToqMEZvWu4266AyyraszWAybYcAPP8PJonQPj3J2odScqVUvvxd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mj3pFoj1BLFA293quWByDf2WrSVn76Bvbz\",\n \"pubkey\": \"tpubDA9GDAntyJu4pLDopCn5sXCqmJSMD8f4J2mErt5E3pPmvY2o2xauN9wc2cgA217stad8Und2yumurTL5xpSqbnC95NC3wFik8VTqbWE9HbN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mmKD7WwB8A86K7RAtf7ncr79wgbvzfsJpe\",\n \"pubkey\": \"tpubDA9GDAntyJu4N6C1Craod75L2Kf1dK2KDCS3Q2s2xxWFo2KGtp9xhMVLjwQzCVYwDDXT7ZG2uNCjthqEJZdSeGcH7WgBSYcpJkwBPciGyKn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mmmGb7DUQec3QFrbi1m3MWC232phHGGDrX\",\n \"pubkey\": \"tpubDA9GDAntyJu53kygACiiUPY4Fm6Gf3AvGBk86noTQ6yZoczchTeiz49XnbaCHVnXM7tJRfnrUR73DUbAg4LMJNU5evYmbBfsuA87bn2U58M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mnY7nggBwEtNAKhpYhQWzA1AfeFo7G5AyD\",\n \"pubkey\": \"tpubDA9GDAntyJu4VEy1YcEvFNLKNTWEZFdPM9CFeLoreu4d7cmtTeHcTMkdE4i2sw4YAi5saSd6NEY9oh9WgiLcApK3GrBaoNUeRtG5BZxAnwD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moK5kBNW2hTfUpNPe1ZaQLgEq4Z8N5cj1A\",\n \"pubkey\": \"tpubDA9GDAntyJu4dudWYrKMLH5k8xe7F9BfzEt1tE16AQgRfaaknKQmGz1Z8Bt4ws3ZgFoD5D8ZF5fW1ziHaC7cJvgNagsP7jCXN5DsVuwCe99\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moRQq9jHEJ6sL9cX6wq4A7EKTh5f8n8U9h\",\n \"pubkey\": \"tpubDA9GDAntyJu4RWtNN1XU4ny3qgphTYxToGUQRHZgJoS29hz7UcmLmsTeDUeToyfckDz94okiNkE6oRHh3v71auGJV6rai5Sff2sQxk3mBGB\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moRkYbPJKGS8ihvNaedGzKQcskudaGdo6j\",\n \"pubkey\": \"tpubDA9GDAntyJu4Fvmm66NdhqkSx2xZJTbjCPhu1zTECuxM5RCTzmuozN9VyAFg8uM3S3nt1EKQqMycTnBoNFTThNHRuWYNz5rH7E9Jx9MyCun\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mpqZ2sJifp18baqMntvEp3tgR8Kevo6vyV\",\n \"pubkey\": \"tpubDA9GDAntyJu4tboRaZAXEepzyJEDT29hxnu12gPpWoubZKEnM7XbbnenooLDtq6f7941UTEzkSrQs2ddRmEy14isbjgyHdvA163wcoMxrzN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mpvW6Ck65nk9fNUmMGmSdPFxTX4CsGw8Eb\",\n \"pubkey\": \"tpubDA9GDAntyJu4qzJ1846T1k1ynJfKK6NcLRm2NKrMpqnHADxzWkod9D2pBC9TtY4mQLmrTcmt18kVJaWnqXEMDC2zTWccf1MFNddpyxdexZa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"pubkey\": \"tpubDA9GDAntyJu4Q1UUt4uC8M5gp7phTP2E1FeU46kYzXb5VBGf5nU7cyUNsyPX2yLU76vp1ZLvkxJYCd6HeAptBfjE5T6YqfWtBYcKmGJLQ1q\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mqHzaj6FHs9AePR7W5fFLTik7YDUaFUZRx\",\n \"pubkey\": \"tpubDA9GDAntyJu4iQrq8iPMTQ1YBzjcnMQuLUArHUPJ3snffAYaiYX1K691wxwnuLk1nLQq4wafiw7JDYEAWxNRr9BHwkqiyWq4ZDg3pgc1R7J\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mr5hNzrQodvcRT7S7Jo7TdrGF8o5QYPSsx\",\n \"pubkey\": \"tpubDA9GDAntyJu4vriftRQep2iT7d7ZJfsNNhMgXCsNZsa7J6Czt1WEyNE2WQkuqsWswafmx6yYmqQQei3HHUedeqiBhiMdHxWUzVZvohGLXgs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mr9FzGLW7kH4t2vVJsqc98R9DNMnZT1PDZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4LoaQBgqDM1xUkcUtRsS117uA9CDSmFrTR4GGi5X65VoUf7VDRE2oRKnrXDv2bNdfyMBJ23UQpcWhBHZhKM7GsbswhmhEw4T\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mrGjJdkoEE5okDJDVJjNPYRm8xJks7TYc1\",\n \"pubkey\": \"tpubDA9GDAntyJu4fT9pBRSPRketsXUkxLhvswEZEG4Fx1e99GDUmpJnRyZoiyN3PaE1ToWazfcx74VQoNqzfhMxDARiGQVPu6JZVcuRRxGAw7d\",\n \"Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mgqnNuhucGD9J7oYpUQcnZZztNzFSYJ5KS\",\n \"pubkey\": \"tpubDA9GDAntyJu4HmbR7c7EyWzFEKDECeqSb14d3YifaKU2Ph9tFSxAmCQrKKgxagHuzZrEVeYxuHXkwu6JKp8Scd5b9L3hSSJ5qY22atQS6Hq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxJfiUAYvhfuFihZNepmCwjzz7NvVuNxJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vs2Z4LncJZjs8zZy8b5hETsFXqoDbtd1GiwScZh4o2ffbjWsAG4Z34XFzugEMJs68cVTpVk6BdZPK4W44e6HivecHSBds85\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxsm9s8sAx5jmLahg1SrpvzaRffzj2AA7\",\n \"pubkey\": \"tpubDA9GDAntyJu4vMuDsT868vpXrEV33yw2cgp1B1LgSCUK6zJ7CTfowxZKLNyQxH36ujY8Ekoemnwja6x6aviULQfg5B4V4D8Mgea1USgf4HX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhzmw7ydKYLCbVMLq15MQyyEUFgcHzQ3BL\",\n \"pubkey\": \"tpubDA9GDAntyJu4o3MVQctgf8eKejPeix4M3qfK75Kx1aCzmqeqDm8mD5sYgoYEP7zYfKMxSkFqMNMgdV92JtasAyWYivQSFMax5oDtkNAAcmu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miLxXdofiV32WV8pqC1k7r4A4LBzQyAFDi\",\n \"pubkey\": \"tpubDA9GDAntyJu4ZV7fiiaij7vcEuzSVegX7XKhB4XHzMDpJfkxaPT1G7jFnZMdx39C52xS29k1TPweNhf3vAyxiSa8PEFqf5iZe49T3ioDs7V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miuGQtobwUUUvNVYSbTy1Rtkc1EwQHY12g\",\n \"pubkey\": \"tpubDA9GDAntyJu4hDzmiupeL5gMHr4xQcjPuTPRS7H1H2MYKnTj3Phti68KUpvoCKWzKhE9XbaQDkLUgWnw3gqANiWas238UUSBzgfM9ndxQmL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mk3HM14wCBxHyxy8bW49gCzJvkQ4zBtA3m\",\n \"pubkey\": \"tpubDA9GDAntyJu51GuH5BfoNbnjBQ9VMoG9CoVTFvq24bhNoMjtxSr9xR5NVaoYkUSoU3e2zqmpyNPjC1VSLvKiTybjhB9gWUhz4BVQJDDurGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"pubkey\": \"tpubDA9GDAntyJu4UAUZUQXucMiBxSLCojQ4qkTKpjDVrKbTfZAi1UPyGVbFoYkfH87NGuvqkDwGpikjibKqktc5ofRMeue9zTo4HWqKWV69qXJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpFELTTYqemLBmtgafsWSDTjutyDRdLAEm\",\n \"pubkey\": \"tpubDA9GDAntyJu4spsCHNCRFzZhVK6HNQjQi6WABo37kbnKhjAJeJrLShTHfDoKjce5QsHLFW1KugkfETunuoD1273ExyKbBia65ymB9s1YV22\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpQWL9xSrM4XkJ4FH8qtM5CTMckZMSqgKo\",\n \"pubkey\": \"tpubDA9GDAntyJu4QYiUCu3Wmgw6WJbtJAFKNQWQFuUVUgyAwdV1d8UHfbKuAN5Zmvwq5tnL6NXEhbyYPiiX185rCdzcfAcUJQR3Wy9DNe7qcPd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrRxg9qGbxfukSGUftm58D9oTw29o4mmiL\",\n \"pubkey\": \"tpubDA9GDAntyJu4nDDD8uGStKa5iDtyBQ6g25zKUsq4iTXDnRjEUQRRPKNdSN1MUzEgN5xaVYSgZ7sRZwJo3g6Xnsr7obc73rWmsrnxYbpUUnr\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrcS9djBy5HwSmrxtYtdf6kT1wixUBWa3m\",\n \"pubkey\": \"tpubDA9GDAntyJu4MxuucuCeLLfSHpXt6ungx72gZFR5JNWfURbxfbErrc5DX5k6yDc1ghWp1mdFnZ5qDKHJvtjRZn3VEoh6jyegcGr2yGMLXFc\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msMfQ56iSHYhnqTyUVAm3Tigmewcr8QavS\",\n \"pubkey\": \"tpubDA9GDAntyJu4GpzmR35c1g6vaFQWyXZBCp9xKQGfFKEcp7CMBAm5xz3yVrvzCmKSHb8zuQAYLfP49jE72jf1YXDxHEunsXvYXLKZp1quoBw\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msNmT5M49QemHnpgTNMisterDhWVqB6bYh\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLyvR2JgoNw4kWpPsRoGFhF8YQqe6iw5sWb97M4T53EVZTv3EZfDJuWprKSvYez2MgBuHdinWPeWJ9jZiKwb635boPGfRaS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msPFkCpS8PNATXFXYfUQ1uJH7B5Shipd2b\",\n \"pubkey\": \"tpubDA9GDAntyJu52WXPRnpT6LxVmLjzPg51pC18JSrZrCBhAE8FPpVE5j85Xk4ZHETYgBFrzCkLYT8Z6Rm2TwM1ZUnkdVWMVuz39y8PJiGXfNi\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"muda8aJu3N3ZNDTWg3kyGMQckWv4LaoVGj\",\n \"pubkey\": \"tpubDA9GDAntyJu4jUs2HWumGFzTpNW9spcXWfyTHhVCGDB8pwvm627NXCd2UeYzT22oFgBdDyJw1fZ4wR38x31fkeaLua6n4q5QrMggXcFFV8X\",\n \"Line truncated
},
{
"title": "List addresses in specified account",
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mh9VwE8HKhw3QjPCPZh3PU6e3juobVGeME\",\n \"pubkey\": \"tpubDA9GDAntyJu4nEGYmLc4ihro5xv9bSSwfZTPEQQfN25mm2exgoUugfQE4ZMM3boheswEyS3zJMMYneaz2AuYowwhYFPZhYrPv5ktZz5xMQV\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mh9fMDTWpwF954grmVnzzntFSWXk8KYy8B\",\n \"pubkey\": \"tpubDA9GDAntyJu4L5oH2g4AeUbTqNd4mnJF7T1xamBiV5hJTwLdqPT3YsGZToqMEZvWu4266AyyraszWAybYcAPP8PJonQPj3J2odScqVUvvxd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mj3pFoj1BLFA293quWByDf2WrSVn76Bvbz\",\n \"pubkey\": \"tpubDA9GDAntyJu4pLDopCn5sXCqmJSMD8f4J2mErt5E3pPmvY2o2xauN9wc2cgA217stad8Und2yumurTL5xpSqbnC95NC3wFik8VTqbWE9HbN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mmKD7WwB8A86K7RAtf7ncr79wgbvzfsJpe\",\n \"pubkey\": \"tpubDA9GDAntyJu4N6C1Craod75L2Kf1dK2KDCS3Q2s2xxWFo2KGtp9xhMVLjwQzCVYwDDXT7ZG2uNCjthqEJZdSeGcH7WgBSYcpJkwBPciGyKn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mmmGb7DUQec3QFrbi1m3MWC232phHGGDrX\",\n \"pubkey\": \"tpubDA9GDAntyJu53kygACiiUPY4Fm6Gf3AvGBk86noTQ6yZoczchTeiz49XnbaCHVnXM7tJRfnrUR73DUbAg4LMJNU5evYmbBfsuA87bn2U58M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mnY7nggBwEtNAKhpYhQWzA1AfeFo7G5AyD\",\n \"pubkey\": \"tpubDA9GDAntyJu4VEy1YcEvFNLKNTWEZFdPM9CFeLoreu4d7cmtTeHcTMkdE4i2sw4YAi5saSd6NEY9oh9WgiLcApK3GrBaoNUeRtG5BZxAnwD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moK5kBNW2hTfUpNPe1ZaQLgEq4Z8N5cj1A\",\n \"pubkey\": \"tpubDA9GDAntyJu4dudWYrKMLH5k8xe7F9BfzEt1tE16AQgRfaaknKQmGz1Z8Bt4ws3ZgFoD5D8ZF5fW1ziHaC7cJvgNagsP7jCXN5DsVuwCe99\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moRQq9jHEJ6sL9cX6wq4A7EKTh5f8n8U9h\",\n \"pubkey\": \"tpubDA9GDAntyJu4RWtNN1XU4ny3qgphTYxToGUQRHZgJoS29hz7UcmLmsTeDUeToyfckDz94okiNkE6oRHh3v71auGJV6rai5Sff2sQxk3mBGB\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"moRkYbPJKGS8ihvNaedGzKQcskudaGdo6j\",\n \"pubkey\": \"tpubDA9GDAntyJu4Fvmm66NdhqkSx2xZJTbjCPhu1zTECuxM5RCTzmuozN9VyAFg8uM3S3nt1EKQqMycTnBoNFTThNHRuWYNz5rH7E9Jx9MyCun\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mpqZ2sJifp18baqMntvEp3tgR8Kevo6vyV\",\n \"pubkey\": \"tpubDA9GDAntyJu4tboRaZAXEepzyJEDT29hxnu12gPpWoubZKEnM7XbbnenooLDtq6f7941UTEzkSrQs2ddRmEy14isbjgyHdvA163wcoMxrzN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mpvW6Ck65nk9fNUmMGmSdPFxTX4CsGw8Eb\",\n \"pubkey\": \"tpubDA9GDAntyJu4qzJ1846T1k1ynJfKK6NcLRm2NKrMpqnHADxzWkod9D2pBC9TtY4mQLmrTcmt18kVJaWnqXEMDC2zTWccf1MFNddpyxdexZa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mqEDRQrRnfFzaX6m2HSgdrCsCd7Vy6MDf2\",\n \"pubkey\": \"tpubDA9GDAntyJu4Q1UUt4uC8M5gp7phTP2E1FeU46kYzXb5VBGf5nU7cyUNsyPX2yLU76vp1ZLvkxJYCd6HeAptBfjE5T6YqfWtBYcKmGJLQ1q\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mqHzaj6FHs9AePR7W5fFLTik7YDUaFUZRx\",\n \"pubkey\": \"tpubDA9GDAntyJu4iQrq8iPMTQ1YBzjcnMQuLUArHUPJ3snffAYaiYX1K691wxwnuLk1nLQq4wafiw7JDYEAWxNRr9BHwkqiyWq4ZDg3pgc1R7J\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mr5hNzrQodvcRT7S7Jo7TdrGF8o5QYPSsx\",\n \"pubkey\": \"tpubDA9GDAntyJu4vriftRQep2iT7d7ZJfsNNhMgXCsNZsa7J6Czt1WEyNE2WQkuqsWswafmx6yYmqQQei3HHUedeqiBhiMdHxWUzVZvohGLXgs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mr9FzGLW7kH4t2vVJsqc98R9DNMnZT1PDZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4LoaQBgqDM1xUkcUtRsS117uA9CDSmFrTR4GGi5X65VoUf7VDRE2oRKnrXDv2bNdfyMBJ23UQpcWhBHZhKM7GsbswhmhEw4T\",\n \"used_times\": 0\n },\n {\n \"account\": \"mqEbuKqeB8k7Bar1Rg9wVXWYvhHq1cAprY\",\n \"address\": \"mrGjJdkoEE5okDJDVJjNPYRm8xJks7TYc1\",\n \"pubkey\": \"tpubDA9GDAntyJu4fT9pBRSPRketsXUkxLhvswEZEG4Fx1e99GDUmpJnRyZoiyN3PaE1ToWazfcx74VQoNqzfhMxDARiGQVPu6JZVcuRRxGAw7d\",\n \"Line truncated
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mgqnNuhucGD9J7oYpUQcnZZztNzFSYJ5KS\",\n \"pubkey\": \"tpubDA9GDAntyJu4HmbR7c7EyWzFEKDECeqSb14d3YifaKU2Ph9tFSxAmCQrKKgxagHuzZrEVeYxuHXkwu6JKp8Scd5b9L3hSSJ5qY22atQS6Hq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxJfiUAYvhfuFihZNepmCwjzz7NvVuNxJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vs2Z4LncJZjs8zZy8b5hETsFXqoDbtd1GiwScZh4o2ffbjWsAG4Z34XFzugEMJs68cVTpVk6BdZPK4W44e6HivecHSBds85\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxsm9s8sAx5jmLahg1SrpvzaRffzj2AA7\",\n \"pubkey\": \"tpubDA9GDAntyJu4vMuDsT868vpXrEV33yw2cgp1B1LgSCUK6zJ7CTfowxZKLNyQxH36ujY8Ekoemnwja6x6aviULQfg5B4V4D8Mgea1USgf4HX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhzmw7ydKYLCbVMLq15MQyyEUFgcHzQ3BL\",\n \"pubkey\": \"tpubDA9GDAntyJu4o3MVQctgf8eKejPeix4M3qfK75Kx1aCzmqeqDm8mD5sYgoYEP7zYfKMxSkFqMNMgdV92JtasAyWYivQSFMax5oDtkNAAcmu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miLxXdofiV32WV8pqC1k7r4A4LBzQyAFDi\",\n \"pubkey\": \"tpubDA9GDAntyJu4ZV7fiiaij7vcEuzSVegX7XKhB4XHzMDpJfkxaPT1G7jFnZMdx39C52xS29k1TPweNhf3vAyxiSa8PEFqf5iZe49T3ioDs7V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miuGQtobwUUUvNVYSbTy1Rtkc1EwQHY12g\",\n \"pubkey\": \"tpubDA9GDAntyJu4hDzmiupeL5gMHr4xQcjPuTPRS7H1H2MYKnTj3Phti68KUpvoCKWzKhE9XbaQDkLUgWnw3gqANiWas238UUSBzgfM9ndxQmL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mk3HM14wCBxHyxy8bW49gCzJvkQ4zBtA3m\",\n \"pubkey\": \"tpubDA9GDAntyJu51GuH5BfoNbnjBQ9VMoG9CoVTFvq24bhNoMjtxSr9xR5NVaoYkUSoU3e2zqmpyNPjC1VSLvKiTybjhB9gWUhz4BVQJDDurGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"pubkey\": \"tpubDA9GDAntyJu4UAUZUQXucMiBxSLCojQ4qkTKpjDVrKbTfZAi1UPyGVbFoYkfH87NGuvqkDwGpikjibKqktc5ofRMeue9zTo4HWqKWV69qXJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpFELTTYqemLBmtgafsWSDTjutyDRdLAEm\",\n \"pubkey\": \"tpubDA9GDAntyJu4spsCHNCRFzZhVK6HNQjQi6WABo37kbnKhjAJeJrLShTHfDoKjce5QsHLFW1KugkfETunuoD1273ExyKbBia65ymB9s1YV22\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpQWL9xSrM4XkJ4FH8qtM5CTMckZMSqgKo\",\n \"pubkey\": \"tpubDA9GDAntyJu4QYiUCu3Wmgw6WJbtJAFKNQWQFuUVUgyAwdV1d8UHfbKuAN5Zmvwq5tnL6NXEhbyYPiiX185rCdzcfAcUJQR3Wy9DNe7qcPd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrRxg9qGbxfukSGUftm58D9oTw29o4mmiL\",\n \"pubkey\": \"tpubDA9GDAntyJu4nDDD8uGStKa5iDtyBQ6g25zKUsq4iTXDnRjEUQRRPKNdSN1MUzEgN5xaVYSgZ7sRZwJo3g6Xnsr7obc73rWmsrnxYbpUUnr\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrcS9djBy5HwSmrxtYtdf6kT1wixUBWa3m\",\n \"pubkey\": \"tpubDA9GDAntyJu4MxuucuCeLLfSHpXt6ungx72gZFR5JNWfURbxfbErrc5DX5k6yDc1ghWp1mdFnZ5qDKHJvtjRZn3VEoh6jyegcGr2yGMLXFc\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msMfQ56iSHYhnqTyUVAm3Tigmewcr8QavS\",\n \"pubkey\": \"tpubDA9GDAntyJu4GpzmR35c1g6vaFQWyXZBCp9xKQGfFKEcp7CMBAm5xz3yVrvzCmKSHb8zuQAYLfP49jE72jf1YXDxHEunsXvYXLKZp1quoBw\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msNmT5M49QemHnpgTNMisterDhWVqB6bYh\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLyvR2JgoNw4kWpPsRoGFhF8YQqe6iw5sWb97M4T53EVZTv3EZfDJuWprKSvYez2MgBuHdinWPeWJ9jZiKwb635boPGfRaS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msPFkCpS8PNATXFXYfUQ1uJH7B5Shipd2b\",\n \"pubkey\": \"tpubDA9GDAntyJu52WXPRnpT6LxVmLjzPg51pC18JSrZrCBhAE8FPpVE5j85Xk4ZHETYgBFrzCkLYT8Z6Rm2TwM1ZUnkdVWMVuz39y8PJiGXfNi\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"muda8aJu3N3ZNDTWg3kyGMQckWv4LaoVGj\",\n \"pubkey\": \"tpubDA9GDAntyJu4jUs2HWumGFzTpNW9spcXWfyTHhVCGDB8pwvm627NXCd2UeYzT22oFgBdDyJw1fZ4wR38x31fkeaLua6n4q5QrMggXcFFV8X\",\n \"Line truncated
}
]
},
@@ -887,7 +905,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\": \"mvW5fF65d8WiGavNWjJcuQ6uRoa4AsSmLZ\"\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"\n}"
}
]
}
@@ -937,10 +955,10 @@
"examples": [
{
"title": "Delete a blob",
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"\n}"
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete 50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"\n}"
}
]
},
@@ -1018,7 +1036,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 \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"64389e7847bc5fbf401d21133bac00ed788c65dba6154026924dbcb72fe6aa37f9646cf78d7841685d503d8a747c6624\",\n \"a035353881b061795536e73b3fb84361a601a90cfdd928531a7c4e133800f46173f8bfd97a929844e521851805ece1b2\",\n \"f71fb71a3ddd6bd2ce60c6941c2f9faf5317510bf7ea65d56286fa17066405522ba4fc4880d0982c7cfce84375bf8507\"\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 \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\",\n \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\n \"e914d184fcd2b66774b6e684c4e7e84321a169a42f8d1a1b68a7900c5cdb68899709ad487c339ce7cb255a7a83333973\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1099,10 +1117,10 @@
"examples": [
{
"title": "Abandon a channel claim",
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 5dc92b3ab696844e2e043f542b50a2dd0a95d6f2",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000112e4e8fb6fb977bea835761def95a4747bd712b2e0fce3301defbfd75af2e83e000000006a47304402202ccafb731d9f42ab097e655526e8956c53def70018fb441489ab5ac7401a6b1702200d8c1ada5636d42a0c57bccfe16e292b078aa199fe4cc9df8c14c6cc9aa4758801210368cfa299e5d7db0b87e2ea90267a40e7de62ff496eebd05fbda7265a4de27b33ffffffff0134b7f505000000001976a914c017140cff818203be7ed9eb831d516beeae380e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"my2dgPteE6c6TiFWk8hcfijZut58dE5FM3\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"fe572f8d040b941d2a2b8c863111e6213ed47075d35add195d9718e8ef119fe0\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"fe572f8d040b941d2a2b8c863111e6213ed47075d35add195d9718e8ef119fe0\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 0eab90020ce7b538a56023804b578ab768ae7f7e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000018c7e5e938886d463184d19f3765beeeb7cdee54a04826ea456b074aa4c82371b000000006a47304402200a406c0c75ac86b78d09b1acf127754d10e6fee552bac6084de592baf5bed34b022029bffe5e2097e8b3bd07753a20e4e8f28da17ac58c9eeb64e149aba83be85f890121031eba8531bd21f9f4544320248dbe9e607654d8cd2455baa2a6935117923c36aaffffffff0134b7f505000000001976a9147d39b5aa38e3f712670d082b8e2f53583dc2db0588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 9,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mrw5tmWCPn8WTzyB8y7pQJAioKEYdDsY8w\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3cc1fcbc82b16f29467c5590e2af3868d4d28e16e45466bac58c8f17c3fdc23e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"3cc1fcbc82b16f29467c5590e2af3868d4d28e16e45466bac58c8f17c3fdc23e\"\n }\n}"
}
]
},
@@ -1232,14 +1250,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\": \"010000000158533d2d042f919166ee2e1579846af0b49c4caf9db4cd82a7ca37362f374769010000006b483045022100b6ce1836a430d4394ddbf3dffa642a800b275729604725dbc1b7c6c81c56e53c02205a4fbfcc83265681ac90fc1e18676124371f746eb4d7b383a81e063cbcdee161012103d82be71a914cffdc96e54df3ee5e7b7e224078010ecc85fd19efd25a50f23a9fffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f11596d7576a914596f53ebf6552729fea4e2dbdc62e9662b8757c788acc462a029000000001976a91471452ebd78a856d51b47902e7224373cbfa308f488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxbsGa4jf99tDFJtiFtxyVJ7N3xPUsD9qo\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1602862456,\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\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#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": null,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mqqsXcxFmcQBN6JFR1hRE4UtDYtDXp1u4f\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b756701c12d340a9e629170326519d14e8c21ce1f71a3ac312275a98589f5e69010000006b483045022100b3b82d37c5808726fdb4663a39a346c916434cc631b51dfbb3ace34516c8431702207a8072cbdf0cccc7d36a8202fbdcca7046992eaf9c05118c50763e9f60dcb9ab012102fb1f55f37d0ef3482f56a6c7b33bda4aeb720ced4de024fbacf2d33e229e92b0ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f6d7576a9143b288c8262a006dbe1a8c0ef23054dce2fabc5f388acc462a029000000001976a91440dd0374222ec32c8cbdfdabf78b047aac79ee0a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqxcuVhZfQhpBDVBXzBAaqrrdXtRHhX64i\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": null,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mmRvJcnGpU5ztvabtkF6bMZz1mAZa3FY2c\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\"\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\": \"010000000112e4e8fb6fb977bea835761def95a4747bd712b2e0fce3301defbfd75af2e83e010000006b483045022100f400356b4588a1106ca630f418e6737d39da0f522e09cbce2190ebac9d1713ac0220423d8cde9e4ede9985c47606c04bb941dea7bf2e6644f5f79b6eb169e50e8194012102dce4926e5905334758fab58a5ac2e143f6410c9bea71d9a4fd51560a8603ce0cffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a034200049909f498c2b3c3c649d91778426bfcf8dd895943e15567956a490a95b66876d7535efb3dd402c5d359c68bbebdc45118be228dfa1a553f556ce3bff01b6eb7fd121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914a45f9e7b68cd294a21fa75ee23c7fdfeb35f237b88ace221d305000000001976a9149ac52fa70e513b792b36846c00a6b23b4e72ee9988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"moH3m15AhmpjZVZUwYEQciKNAnBqug5VwM\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvW5fF65d8WiGavNWjJcuQ6uRoa4AsSmLZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"9289606d85caabe4c8adcc142eda730022d1b3bd\",\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#9289606d85caabe4c8adcc142eda730022d1b3bd\",\n \"timestamp\": null,\n \"txid\": \"cc77ce3035437425d1cd14b48ded892f1283f13d63e9756d1f589bf35d214347\",\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\": \"3056301006072a8648ce3d020106052b8104000a034200049909f498c2b3c3c649d91778426bfcf8dd895943e15567956a490a95b66876d7535efb3dd402c5d359c68bbebdc45118be228dfa1a553f556ce3bff01b6eb7fd\",\n \"public_key_id\": \"n3N9RDkMdpvemT83QfEWuJ1es1uNyVHydK\",\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\": \"mudJaL41pUBkS3VRifB26xD4YLNWDNVrau\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"cc77ce3035437425d1cd14b48ded892f1283f13d63e9756d1f589bf35d214347\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"cc77ce3035437425d1cd14b48ded892f1283f13d63e9756d1f589bf35d214347\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000018c7e5e938886d463184d19f3765beeeb7cdee54a04826ea456b074aa4c82371b010000006b483045022100cd41b0914d03d8fb08255c998533d1f6284560795d71be1e07e506164bf5b4de02201797598f0ae77c93fbcfa8d05348033576c9f08fd4604e4649bd32fb96716365012103d1fc67e9e31f0a79c3fa899a2a838a2052aac1945f5b7af86362e53fe8d6fc96ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004de37fee89d76e8bfd665cbaebf7d761ffd60b90fceb760e66519ebd1fdc9ec28bac6b5648ea59d12fe49439cff4521629b256d12c31bb326a56274612d5fbf0d121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914dee664a6af04fedaf4b72db7c10c540da96f458688ace221d305000000001976a91423ce70cde5af2946162467bffeced1ce901342a588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4dUANvGLRBQaWDSJAFWHGhrYDq9YpyzJg\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1qYJdyfzz1q54asE9aEsko1YqEPhrZgCd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0c34795b6b724825df10bd775a925b7254d7151f\",\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#0c34795b6b724825df10bd775a925b7254d7151f\",\n \"timestamp\": null,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004de37fee89d76e8bfd665cbaebf7d761ffd60b90fceb760e66519ebd1fdc9ec28bac6b5648ea59d12fe49439cff4521629b256d12c31bb326a56274612d5fbf0d\",\n \"public_key_id\": \"mqyx5B95ta17bMfhspn99D83b1XpJAw1Zm\",\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\": \"minHFWqr3L7oyfNNPReBgTkRj4rykBaUod\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\"\n }\n}"
}
]
},
@@ -1361,17 +1379,55 @@
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"resolve\": false, \"no_totals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"resolve\": false, \"no_totals\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\"\n },\n \"value_type\": \"channel\"\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\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\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\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\"\n },\n \"value_type\": \"channel\"\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\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
{
"name": "channel_sign",
"description": "Signs data using the specified channel signing key.",
"arguments": [
{
"name": "channel_name",
"type": "str",
"description": "name of channel used to sign (or use channel id)",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
"description": "claim id of channel used to sign (or use channel name)",
"is_required": false
},
{
"name": "hexdata",
"type": "str",
"description": "data to sign, encoded as hexadecimal",
"is_required": false
},
{
"name": "channel_account_id",
"type": "str",
"description": "one or more account ids for accounts to look in for channel certificates, defaults to all accounts.",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(dict) Signature if successfully made, (None) or an error otherwise\n {\n \"signature\": (str) The signature of the comment,\n \"signing_ts\": (str) The timestamp used to sign the comment,\n }",
"examples": []
},
{
"name": "channel_update",
"description": "Update an existing channel claim.",
@@ -1525,10 +1581,10 @@
"examples": [
{
"title": "Update a channel claim",
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"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 5dc92b3ab696844e2e043f542b50a2dd0a95d6f2 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"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\": \"01000000022946e645885d5cbfaef61db1ee78c0869cb0cb31d94010bc5cd85d1e11a3a160000000006a47304402206468e077adeba3c21673ed78920c859588722d3a87fb732dad55f2517a5f6c8402206e310605a42dd6292f9fdd28fd9d98641f8d1f6449c28f16a99c8d917341033b01210368cfa299e5d7db0b87e2ea90267a40e7de62ff496eebd05fbda7265a4de27b33ffffffff16499bbabc8965d2f65610b5be2856939351adf0463c345ef047dc4a1e4b414b000000006a47304402207ec9d5cca07d5f1718c2186318362332b26023bd11b0c25a847bdb45941be5b70220571fa748c26741777916e639d6e1d43b00141f24f150315abbc086640ebb261d012103386e2ac35f59e8ad77be0888e75f2fd52963138f53f1accb21ceef9f45abc74effffffff0200e1f50500000000a6b708406368616e6e656c14f2d6950adda2502b543f042e4e8496b63a2bc95d4c6a00125a0a583056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159420b4e6577204368616e6e656c6d6d76a914596f53ebf6552729fea4e2dbdc62e9662b8757c788ac6ebeea0b000000001976a914551fbe93b46bf72e02981bc529201b0ab6016ddf88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mkwDGRHqKvQXW9zwfumqrJUhiBDWbzPr1M\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1602862456,\n \"txid\": \"4b414b1e4adc47f05e343c46f0ad5193935628beb51056f6d26589bcba9b4916\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\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#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": null,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"moH3m15AhmpjZVZUwYEQciKNAnBqug5VwM\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"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 0eab90020ce7b538a56023804b578ab768ae7f7e --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"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\": \"01000000023e16dbb76483b3ee632a8513b4adbeaa4047bc263fb6d994a78063ed989b694c000000006b483045022100f24bd1711629458bae4e223a86b00f09de5a0cfc3db46abe2983f8c98c123508022036410fe58d335d4c7ed91e0fb2f1face27a268433c6c1cd43cb61dba212618280121031eba8531bd21f9f4544320248dbe9e607654d8cd2455baa2a6935117923c36aaffffffffc725bc5dfa2758b4c830afa2b95345996856f649167dafe8ad0d4e9fcd323bdd000000006a47304402204b2c819f11ec5aee2801b26feb1d1160e57833849039fec59dbf1cb51308469f022034b2cbcd3bfd89666350d9a2d0b17723035c21724d19dd631074d54e17ebed4301210339e49da6abc616cf1fd937dad637e2a987d0edfcceef85df9163ed3c3d042fd3ffffffff0200e1f50500000000a6b708406368616e6e656c147e7fae68b78a574b802360a538b5e70c0290ab0e4c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f420b4e6577204368616e6e656c6d6d76a9143b288c8262a006dbe1a8c0ef23054dce2fabc5f388ac6ebeea0b000000001976a914fd865231af47fb3f92a398f4b53e87209f9f33f588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mn5XueyJPEcHFvQUVjcuNgzGzcTJh18N9V\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": null,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n4dUANvGLRBQaWDSJAFWHGhrYDq9YpyzJg\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\"\n }\n}"
}
]
}
@@ -1616,7 +1672,7 @@
{
"name": "include_received_tips",
"type": "bool",
"description": "calculate the amount of tips recieved for claim outputs",
"description": "calculate the amount of tips received for claim outputs",
"is_required": false
}
],
@@ -1627,14 +1683,14 @@
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"resolve\": false, \"no_totals\": false, \"include_received_tips\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"resolve\": false, \"no_totals\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\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}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\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\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false, \"include_received_tips\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\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}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\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}"
}
]
},
@@ -1831,7 +1887,7 @@
{
"name": "claim_type",
"type": "str",
"description": "filter by 'channel', 'stream' or 'unknown'",
"description": "filter by 'channel', 'stream', 'repost' or 'collection'",
"is_required": false
},
{
@@ -1945,7 +2001,7 @@
{
"name": "wallet_id",
"type": "str",
"description": "wallet to check for claim purchase reciepts",
"description": "wallet to check for claim purchase receipts",
"is_required": false
},
{
@@ -1960,6 +2016,18 @@
"description": "lookup and include a boolean indicating if claim being resolved is yours",
"is_required": false
},
{
"name": "has_source",
"type": "bool",
"description": "find claims containing a source field",
"is_required": false
},
{
"name": "has_no_source",
"type": "bool",
"description": "find claims not containing a source field",
"is_required": false
},
{
"name": "new_sdk_server",
"type": "str",
@@ -1971,17 +2039,17 @@
"examples": [
{
"title": "Search for all claims in channel",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"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\": [], \"include_purchase_receipt\": false, \"include_is_my_output\": false}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}' 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\": [], \"include_purchase_receipt\": false, \"include_is_my_output\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5/astream#f\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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\": 1602862457,\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#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\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\": 1602862456,\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#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"short_url\": \"lbry://@channel#5\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\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\": 1618443045,\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\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\": 1618443044,\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\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\": [], \"include_purchase_receipt\": false, \"include_is_my_output\": false}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}' 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\": [], \"include_purchase_receipt\": false, \"include_is_my_output\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5/astream#f\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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\": 1602862457,\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#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#5\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\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\": 1602862456,\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#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"short_url\": \"lbry://@channel#5\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\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\": 1618443045,\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\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\": 1618443044,\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\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}"
}
]
}
@@ -2060,7 +2128,7 @@
"name": "claims",
"type": "list",
"description": "claim ids to be included in the collection",
"is_required": true
"is_required": false
},
{
"name": "allow_duplicate_name",
@@ -2110,6 +2178,24 @@
"description": "thumbnail url",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
"description": "claim id of the publisher channel",
"is_required": false
},
{
"name": "channel_name",
"type": "str",
"description": "name of the publisher channel",
"is_required": false
},
{
"name": "channel_account_id",
"type": "str",
"description": "one or more account ids for accounts to look in for channel certificates, defaults to all accounts.",
"is_required": false
},
{
"name": "account_id",
"type": "str",
@@ -2148,12 +2234,26 @@
}
],
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\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_received\": \"true if txo was sent from external account to this account\",\n \"is_spent\": \"true if txo is spent\",\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 \"outputs\": [\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_received\": \"true if txo was sent from external account to this account\",\n \"is_spent\": \"true if txo is spent\",\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 \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_feLine truncated
"examples": []
"examples": [
{
"title": "Create a collection of one stream",
"curl": "curl -d'{\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet collection create --name=tom --bid=1.0 --channel_id=0eab90020ce7b538a56023804b578ab768ae7f7e --claims=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001352603220e3ef634ad464b4741442cb104e01ed8591dbe042e43a3755c720a3c010000006a4730440220267c0cbb1839796bf27bfe340fd7710c38401632b67ce7468f006a035febd4e5022005479cc9d5919aa830f223426c64c2f0328183c4844d1952f3b5fbf2a17b5787012103ec8012b82ef9006ded31853c8d9f88987b41c49f6bf51987aa8926338c059c86ffffffff0200e1f5050000000091b503746f6d4c6f017e7fae68b78a574b802360a538b5e70c0290ab0ec5be96034711ff942992d7fdbb74e43de7a7a28d320d02d4f40fab1140c15626185b2eb1b63df34d4a4e0b5c881e1643e4bd3952ba05e8a279512d0dc3e571fa1a1812160a148e0cb1b66f0d0442e883b07090674b15a9778aa36d7576a914d1b6aec29af1ed142957018d3fa88c08fb82ea1888ac202c7e17000000001976a9140d1c9cbea85e8c53b4d847ca7663fc175b6b220588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4oCmyd3qN32UPMfcTx9B5HHxYdS7mWEvY\",\n \"amount\": \"4.947555\",\n \"confirmations\": 2,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"3c0a725c75a3432e04be1d59d81ee004b12c4441474b46ad34f63e0e22032635\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzdpNAErM6mUQpwhDWQvtFDBANqueRpHuy\",\n \"amount\": \"1.0\",\n \"claim_id\": \"b87ea4813529b45aa06537f487456e6672ac7993\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"tom\",\n \"normalized_name\": \"tom\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://tom#b87ea4813529b45aa06537f487456e6672ac7993\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"claim\",\n \"value\": {\n \"claims\": [\n \"a38a77a9154b679070b083e842040d6fb6b10c8e\"\n ]\n },\n \"value_type\": \"collection\"\n },\n {\n \"address\": \"mgiHMZg93NhGBhT1gopuZd6ZHkrFbaaFq7\",\n \"amount\": \"3.941448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.006107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.941448\",\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\"\n }\n}"
}
]
},
{
"name": "collection_list",
"description": "List my collection claims.",
"arguments": [
{
"name": "resolve",
"type": "bool",
"description": "resolve collection claim",
"is_required": false
},
{
"name": "resolve_claims",
"type": "int",
@@ -2186,7 +2286,15 @@
}
],
"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_received\": \"true if txo was sent from external account to this account\",\n \"is_spent\": \"true if txo is spent\",\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": []
"examples": [
{
"title": "List collections",
"curl": "curl -d'{\"method\": \"collection_list\", \"params\": {\"resolve_claims\": 1, \"resolve\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet collection list --resolve --resolve_claims=1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"collection_list\", \"params\": {\"resolve_claims\": 1, \"resolve\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzdpNAErM6mUQpwhDWQvtFDBANqueRpHuy\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/tom#b\",\n \"claim_id\": \"b87ea4813529b45aa06537f487456e6672ac7993\",\n \"claim_op\": \"create\",\n \"claims\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\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#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"confirmations\": 1,\n \"height\": 217,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 217,\n \"creation_height\": 217,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263191,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 217,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\"Line truncated
}
]
},
{
"name": "collection_resolve",
@@ -2332,12 +2440,6 @@
"description": "address where the collection is sent",
"is_required": false
},
{
"name": "new_signing_key",
"type": "bool",
"description": "generate a new signing key, will invalidate all previous publishes",
"is_required": false
},
{
"name": "preview",
"type": "bool",
@@ -2386,10 +2488,10 @@
"examples": [
{
"title": "Abandon a comment",
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"error\": {\n \"code\": -32000,\n \"data\": null,\n \"message\": \"could not get claim from sdk with claim id 5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\"\n },\n \"id\": 1,\n \"jsonrpc\": \"2.0\"\n }\n}"
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\": {\n \"abandoned\": true\n }\n }\n}"
}
]
},
@@ -2444,17 +2546,17 @@
"examples": [
{
"title": "Posting a comment as your channel",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=fe7ee643b50b724f6029f6edfe90d67b5512b3ae",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"c9cf386ed5af52fa1beb060898c5590f4c7fe02010228e1db49dc42b5bcf2d83218825876ae75f60a42cee0bf27d311904299e10fa2b6daef158a38cf4deb06c\",\n \"signing_ts\": \"1602862434\",\n \"timestamp\": 1602862434\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
},
{
"title": "Use the parent_id param to make replies",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\", \"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=34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_id\": \"\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"bc36b0956118363b6b4ca20fed91c76f1e596ce0fc0ca0545366298fc6b22186\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\",\n \"signature\": \"459065ca93c600a81d51ea2038a6afad7eb0d03c94bd674f3b73cb14a0b65815d09eb788c40c30163e04cc1e48c6238f6c78a7ecda62aaf0e7afd7cd3b98b66a\",\n \"signing_ts\": \"1602862434\",\n \"timestamp\": 1602862435\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"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=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103 --claim_id=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
}
]
},
@@ -2541,17 +2643,17 @@
"examples": [
{
"title": "List all comments on a claim",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list fe7ee643b50b724f6029f6edfe90d67b5512b3ae --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"include_replies\": true, \"skip_validation\": 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\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"c9cf386ed5af52fa1beb060898c5590f4c7fe02010228e1db49dc42b5bcf2d83218825876ae75f60a42cee0bf27d311904299e10fa2b6daef158a38cf4deb06c\",\n \"signing_ts\": \"1602862434\",\n \"timestamp\": 1602862434\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\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list a38a77a9154b679070b083e842040d6fb6b10c8e --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"include_replies\": true, \"skip_validation\": 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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n },\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\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\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"parent_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list fe7ee643b50b724f6029f6edfe90d67b5512b3ae --parent_id=34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"parent_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 0,\n \"total_pages\": 0\n }\n}"
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list a38a77a9154b679070b083e842040d6fb6b10c8e --parent_id=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"include_replies\": false, \"skip_validation\": 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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n },\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -2720,10 +2822,10 @@
"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\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"34ffe236decc147c7c0c7e0c24c2e5380a312c1084e6ed7bb2c3332a89e95cbf\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"error\": {\n \"code\": -32000,\n \"data\": null,\n \"message\": \"could not get claim from sdk with claim id 5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\"\n },\n \"id\": 1,\n \"jsonrpc\": \"2.0\"\n }\n}"
"curl": "curl -d'{\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Where there was once sasquatch, there is not\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": null,\n \"signature\": \"b003b1f6887f02128e0eaba8017ab3077a75a3283d6e3dad40b8dc48c250a26621329eaae09320561b4e70e480806a8fdce543b339bcc430b755ffe70e4ebe4b\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
}
]
}
@@ -2813,9 +2915,9 @@
"examples": [
{
"title": "Delete a file",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"}}).json()",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"a38a77a9154b679070b083e842040d6fb6b10c8e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -2976,14 +3078,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\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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 \"is_fully_reflected\": true,\n \"key\": \"7acc8b9eac8e533c57b933928ab6fad0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01f2d6950adda2502b543f042e4e8496b63a2bc95d1391e6159e2874bf75624f77339a61abf38b4da3237a5a52ad92aece2cefae8742c427064051fadb0dcfcc8f957b190341110ce64b8fd3f5cc874e16db11cbdc0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6b8f6829a8820cd430d23b3de7dd67ad77a11d912b04ac5577014d51af877a0c3a094e8d3d9bc2ae6b2c13c2ea44e477\",\n \"stream_name\": \"tmpk0n0x2sb\",\n \"streaming_url\": \"http://localhost:5280/stream/d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"suggested_file_name\": \"tmpk0n0x2sb\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"uploading_to_reflector\": false,\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\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"dca7d8cee4b0dca9ac27d279bce24163b34d3237\",\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 \"is_fully_reflected\": true,\n \"key\": \"a3f6d1b054670be4d383c657da6e56cd\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"msnpXocjCvdA7rj6Pnn8v1NTxaHMXcAwJ2\",\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\": \"1602862432\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpej_krqnp.png\",\n \"sd_hash\": \"f71fb71a3ddd6bd2ce60c6941c2f9faf5317510bf7ea65d56286fa17066405522ba4fc4880d0982c7cfce84375bf8507\",\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\": \"Line 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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\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 \"is_fully_reflected\": true,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"e95315d7a89a8a0a785c83199e33e224678d5ffe\",\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 \"is_fully_reflected\": true,\n \"key\": \"2c3e1c66e4d1d8cac475ebdf7e777c99\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\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\": \"1618443021\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp3qk0qygt.png\",\n \"sd_hash\": \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\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\": \"Line truncated
},
{
"title": "List files matching a parameter",
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"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\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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 \"is_fully_reflected\": true,\n \"key\": \"7acc8b9eac8e533c57b933928ab6fad0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01f2d6950adda2502b543f042e4e8496b63a2bc95d1391e6159e2874bf75624f77339a61abf38b4da3237a5a52ad92aece2cefae8742c427064051fadb0dcfcc8f957b190341110ce64b8fd3f5cc874e16db11cbdc0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6b8f6829a8820cd430d23b3de7dd67ad77a11d912b04ac5577014d51af877a0c3a094e8d3d9bc2ae6b2c13c2ea44e477\",\n \"stream_name\": \"tmpk0n0x2sb\",\n \"streaming_url\": \"http://localhost:5280/stream/d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"suggested_file_name\": \"tmpk0n0x2sb\",\n \"timestamp\": 1602862457,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"uploading_to_reflector\": false,\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\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"a38a77a9154b679070b083e842040d6fb6b10c8e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"is_fully_reflected\": true,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 0\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -3100,10 +3202,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1602862436,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpzzr985r8\",\n \"download_path\": \"/tmp/tmpzzr985r8/tmpk0n0x2sb_1\",\n \"file_name\": \"tmpk0n0x2sb_1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"7acc8b9eac8e533c57b933928ab6fad0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01f2d6950adda2502b543f042e4e8496b63a2bc95d1391e6159e2874bf75624f77339a61abf38b4da3237a5a52ad92aece2cefae8742c427064051fadb0dcfcc8f957b190341110ce64b8fd3f5cc874e16db11cbdc0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6b8f6829a8820cd430d23b3de7dd67ad77a11d912b04ac5577014d51af877a0c3a094e8d3d9bc2ae6b2c13c2ea44e477\",\n \"stream_name\": \"tmpk0n0x2sb\",\n \"streaming_url\": \"http://localhost:5280/stream/d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"suggested_file_name\": \"tmpk0n0x2sb\",\n \"timestamp\": 1602862457,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1618443025,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp8wvxwurx\",\n \"download_path\": \"/tmp/tmp8wvxwurx/tmpoegrqi7y_1\",\n \"file_name\": \"tmpoegrqi7y_1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -3384,7 +3486,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 \"allowed_origin\": \"\",\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"audio_encoder\": \"aac -b:a 160k\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api/v2\",\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/tmpzzr985r8\",\n \"download_dir\": \"/tmp/tmpzzr985r8\",\n \"download_timeout\": 30.0,\n \"ffmpeg_path\": \"\",\n \"fixed_peer_delay\": 2.0,\n \"fixed_peers\": [\n [\n \"127.0.0.1\",\n 5567\n ]\n ],\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 \"max_wallet_server_fee\": \"0.0\",\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 \"save_blobs\": true,\n \"save_files\": true,\n \"save_resolved_claims\": 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 \"transaction_cache_size\": 100000,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"video_bitrate_maximum\": 5000000,\n \"video_encoder\": \"libx264 -crf 24 -preset faster -pix_fmt yuv420p\",\n \"video_scaler\": \"-vf \\\"scale=if(gte(iw\\\\,ih)\\\\,min(1920\\\\,iw)\\\\,-2):if(lt(iw\\\\,ih)\\\\,min(1920\\\\,ih)\\\\,-2)\\\" -maxrate 5500K -bufsize 5000K\",\n \"volume_analysis_time\": 240,\n \"volume_filter\": \"\",\n \"wallet_dir\": \"/tmp/tmpzzr985r8\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"allowed_origin\": \"\",\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"audio_encoder\": \"aac -b:a 160k\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"http://localhost:2903/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\",\n \"libtorrent_component\"\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/tmp8wvxwurx\",\n \"download_dir\": \"/tmp/tmp8wvxwurx\",\n \"download_timeout\": 30.0,\n \"ffmpeg_path\": \"\",\n \"fixed_peer_delay\": 2.0,\n \"fixed_peers\": [\n [\n \"127.0.0.1\",\n 5567\n ]\n ],\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 \"max_wallet_server_fee\": \"0.0\",\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 \"save_blobs\": true,\n \"save_files\": true,\n \"save_resolved_claims\": 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 \"transaction_cache_size\": 10000,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"video_bitrate_maximum\": 5000000,\n \"video_encoder\": \"libx264 -crf 24 -preset faster -pix_fmt yuv420p\",\n \"video_scaler\": \"-vf \\\"scale=if(gte(iw\\\\,ih)\\\\,min(1920\\\\,iw)\\\\,-2):if(lt(iw\\\\,ih)\\\\,min(1920\\\\,ih)\\\\,-2)\\\" -maxrate 5500K -bufsize 5000K\",\n \"volume_analysis_time\": 240,\n \"volume_filter\": \"\",\n \"wallet_dir\": \"/tmp/tmp8wvxwurx\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
}
]
},
@@ -3459,10 +3561,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon fe7ee643b50b724f6029f6edfe90d67b5512b3ae",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000016e67d1371cecb45aec93d8b04c216444b7309ad7800ca1ef883d539816b720c6000000006a47304402201a739f6404a0d2b3c7e6f37167b0b8b7d334cf6921df2a0e957f0fdf28810d0f02201738ca4c8a0406a2a1cf6e3a2f1edb3c9696c5e0dc3a2a3f262b7528446895b20121021ef1cb2d0e5f2d4afebf3f9a2c51b78d55a2fa584070831c33a540f7900b7d27ffffffff0134b7f505000000001976a9145013cace93019f49485a11c39bf6c22d246d5f6d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnpN4b33fqF5jCN4yRJU1ts5ZSvfBRDWcX\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3ee7e6c2c25b891aa56475edbe8583d6e8e324692890ef8eb013c6506879a408\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"3ee7e6c2c25b891aa56475edbe8583d6e8e324692890ef8eb013c6506879a408\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001abd0fd74424994db38aa6d0f5f8f928084f0107e6a111b9513e540c09e89ca68000000006b483045022100e03d8fb57669a36521399aa458918ffd07c88b0b46987270aaae552ec64161740220702fb7bf96728e9aaaa8cdb658f20637e043c9324e4a87c19de19f154fbedabc0121034d37b695b20296aa259fe7a1fc31a2e299c7ac65f5bda020e7f3d2b747e1d72affffffff0134b7f505000000001976a914f44e3067122b2c22d80a1dd911cfc6a23d77ec8f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3niqXr7i2Dnr4qNd8KXyzLGecwZ6hN5hv\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"863d3da7eac44aabfca6718351a32d2944383abf48f31c1e4a20818247f0e5c6\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"863d3da7eac44aabfca6718351a32d2944383abf48f31c1e4a20818247f0e5c6\"\n }\n}"
}
]
},
@@ -3500,7 +3602,19 @@
"name": "file_path",
"type": "str",
"description": "path to file to be associated with name.",
"is_required": true
"is_required": false
},
{
"name": "file_name",
"type": "str",
"description": "name of file to be associated with stream.",
"is_required": false
},
{
"name": "file_hash",
"type": "str",
"description": "hash of file to be associated with stream.",
"is_required": false
},
{
"name": "validate_file",
@@ -3616,6 +3730,12 @@
"description": "audio/video duration in seconds, automatically calculated",
"is_required": false
},
{
"name": "sd_hash",
"type": "str",
"description": "sd_hash of stream",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
@@ -3675,17 +3795,17 @@
"examples": [
{
"title": "Create a stream claim without metadata",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpk0n0x2sb\", \"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/tmpk0n0x2sb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpk0n0x2sb\", \"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\": \"01000000012946e645885d5cbfaef61db1ee78c0869cb0cb31d94010bc5cd85d1e11a3a160010000006b483045022100c2f28f3469f168c9bae13f8db2d5efa37cb806c3c6130ca4c85d22c49da0d3220220717880093ff7d0142930c2012176cc89667aa82d3b6d3cc8aa79bf4934602ff1012103e475aa118245138c9c60728635f29a02c3f7509332d7a73cf7f50321527e089fffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d6d7576a914cec22985383752987fece466729c85a74f17a45588ac38fb9423000000001976a914f84bdf86b89b4754c88e23739b81a59b4d74173988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqqsXcxFmcQBN6JFR1hRE4UtDYtDXp1u4f\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1602862456,\n \"txid\": \"60a1a3111e5dd85cbc1040d931cbb09c86c078eeb11df6aebf5c5d8845e64629\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"timestamp\": null,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n49pmPPUVED3aiwTfRe75yKpjXBhGCFx4n\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoegrqi7y\", \"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/tmpoegrqi7y",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoegrqi7y\", \"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\": \"01000000013e16dbb76483b3ee632a8513b4adbeaa4047bc263fb6d994a78063ed989b694c010000006b483045022100eedde718729e57c9067ce65287c1936e9c95711bbc7b5c92397786ed265aa72502203cd5c50aeadeb2e0c7356386c33c9a15402fd973d9e125273fcbea6113385c4b012102e981259c2fff728c870ae1f037f03a0dbb71e63a083375b23a65bfec3ab7557fffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf76d7576a914b6eefba0730cb3bd7d5e13285f7acbcc7fae273c88ac38fb9423000000001976a914f2e0d23b629fdb04743939f4f5e8c123b07a3cba88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mmRvJcnGpU5ztvabtkF6bMZz1mAZa3FY2c\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": null,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3fB9L3NDF2GvyRmgLbN7yunFbRfhLonoh\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\"\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/tmpej_krqnp.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\": 1602862432, \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpej_krqnp.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=1602862432 --channel_id=\"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpej_krqnp.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\": 1602862432, \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001aad6f24c89f81b38c35e8bcf0aeded3ff360ef6ab8a38c4327a04369b760ec6d010000006a473044022069b670698da195fcbcf94c16d60a145c633ea83d1cb42ef2405b4fdcc28e650a022035d8648a3ee03e2c212c308a2018a5bbb8dcc8412640af2bc865f17ca9083ebb0121025d0514acddc1ed8a9f55fdb651595a9184dd00637c9cb7a9903968ae6aea2c90ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101f2d6950adda2502b543f042e4e8496b63a2bc95d8a307fd753f2435d4cdec111e0f36d3a883763fb9a1e37df849fc8277afe984e31cd3864ff9016437012b5053ddfb5e43ea03d565a1a57b2effb45b87f3c4bb50ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d70656a5f6b72716e702e706e6718632209696d6167652f706e673230f71fb71a3ddd6bd2ce60c6941c2f9faf5317510bf7ea65d56286fa17066405522ba4fc4880d0982c7cfce84375bf8507120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728e0faa6fc053222080112196f86a1af441ae42e3c56d3592fbcb2e63aee63817b81bc72cb188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a91486a1af441ae42e3c56d3592fbcb2e63aee63817b88acac5e7d1d000000001976a9146f1cad0aebad9ea189bde7ed4e3b3d60780a21d888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n49pmPPUVED3aiwTfRe75yKpjXBhGCFx4n\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1602862457,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msnpXocjCvdA7rj6Pnn8v1NTxaHMXcAwJ2\",\n \"amount\": \"1.0\",\n \"claim_id\": \"dca7d8cee4b0dca9ac27d279bce24163b34d3237\",\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#dca7d8cee4b0dca9ac27d279bce24163b34d3237\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"7887c6a4ad30222bd6a68482fae36c3532e7f6720e21e202799c2c0421fac2b5\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"msnpXocjCvdA7rj6Pnn8v1NTxaHMXcAwJ2\",\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\": \"1602862432\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpej_krqnp.png\",\n \"sd_hash\": \"f71fb71a3ddd6bd2ce60c6941c2f9faf5317510bf7ea65d56286fa17066405522ba4fc4880d0982c7cfce84375bf8507\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbLine truncated
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp3qk0qygt.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\": 1618443021, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmp3qk0qygt.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=1618443021 --channel_id=\"0eab90020ce7b538a56023804b578ab768ae7f7e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp3qk0qygt.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\": 1618443021, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000013441794e4d4455ad35d7cf390a58e45a101b6bb3bbfc0fd2f91f148e0bffb269010000006a47304402203775193e4633f7963d60e8da83fad53551720f80e6b2fc51cbb46b25aefbef9802200917f13e7f5e766a5a6c04407ad5ead4210b3ae524896c5e515649679a6a315e0121036075c80e3878d380d90581e89eefc98350c3c956cf632572844afb8c3c20c97effffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101017e7fae68b78a574b802360a538b5e70c0290ab0e7c456455b5285b13b0ef426146320e87a58e37cc2ac41f7434af4cc89c6a258c50c8ed51bb74e9b97b660c92754cf3e6bbe6abf245efb8a0f7a953426768c09a0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7033716b30717967742e706e6718632209696d6167652f706e6732305835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f7267288df6dd83063222080112196fa3416b588bef6cfdfdd42502dc79efbbc7f77cacbdc2462a188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914a3416b588bef6cfdfdd42502dc79efbbc7f77cac88acac5e7d1d000000001976a914ff5da30c41efd003a04b9a1850f49b15da29efe488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3fB9L3NDF2GvyRmgLbN7yunFbRfhLonoh\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\n \"amount\": \"1.0\",\n \"claim_id\": \"e95315d7a89a8a0a785c83199e33e224678d5ffe\",\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#e95315d7a89a8a0a785c83199e33e224678d5ffe\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"3c0a725c75a3432e04be1d59d81ee004b12c4441474b46ad34f63e0e22032635\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\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\": \"1618443021\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp3qk0qygt.png\",\n \"sd_hash\": \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbLine truncated
}
]
},
@@ -3755,14 +3875,14 @@
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"resolve\": false, \"no_totals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"resolve\": false, \"no_totals\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"timestamp\": 1602862457,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\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\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\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\": 2,\n \"total_pages\": 1\n }\n}"
},
{
"title": "Paginate your stream claims",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"name\": [], \"claim_id\": [], \"is_spent\": false, \"page\": 1, \"page_size\": 20, \"resolve\": false, \"no_totals\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602862457,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"timestamp\": 1602862457,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\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\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\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\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -4024,6 +4144,12 @@
"description": "audio/video duration in seconds, automatically calculated",
"is_required": false
},
{
"name": "sd_hash",
"type": "str",
"description": "sd_hash of stream",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
@@ -4095,10 +4221,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update fe7ee643b50b724f6029f6edfe90d67b5512b3ae --channel_id=\"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\", \"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\": \"0100000002aad6f24c89f81b38c35e8bcf0aeded3ff360ef6ab8a38c4327a04369b760ec6d000000006a473044022059a3af9cb2fa8f77b777271c6b76b298d1ea8bb1c590efd1d8972b28985cbe50022063a41682e98bff3c8b478ce0c0c79940465897dd2dfcc8a420ff67204936f8030121021ef1cb2d0e5f2d4afebf3f9a2c51b78d55a2fa584070831c33a540f7900b7d27ffffffff4743215df39b581f6d75e9633df183122f89ed8db414cdd12574433530ce77cc010000006b483045022100b8886916522d73d8007f00163d4a497a3e80655d1058d884d5a1c7c2f7ea3a31022006d653c4a79ba85f5f58d6a57b3cae6fb2659495aa099b3e2fe1600a787ed20f012103907a04d6a55e4deff127af3ce813364bd35ac96c8fbf45c7dfa00aefcbc9ffeeffffffff0200e1f50500000000fd2301b7076173747265616d14aeb312557bd690feedf629604f720bb543e67efe4ce801f2d6950adda2502b543f042e4e8496b63a2bc95d1391e6159e2874bf75624f77339a61abf38b4da3237a5a52ad92aece2cefae8742c427064051fadb0dcfcc8f957b190341110ce64b8fd3f5cc874e16db11cbdc0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706b306e3078327362180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d6d6d76a914cec22985383752987fece466729c85a74f17a45588ac32a0d205000000001976a9147a143358896b6a1ffb15d9a5b24b27ba9375650088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"timestamp\": 1602862457,\n \"txid\": \"6dec60b76943a027438ca3b86aef60f33feded0acf8b5ec3381bf8894cf2d6aa\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpk0n0x2sb\",\n \"sd_hash\": \"d40576a4f0f745a868fafad794b3c5e1299cac415a911e55f6eef4395f524b63a649df4c8a75602ea1731a3c5d138b8d\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mudJaL41pUBkS3VRifB26xD4YLNWDNVrau\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1602862456,\n \"txid\": \"cc77ce3035437425d1cd14b48ded892f1283f13d63e9756d1f589bf35d214347\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzNC6CMEetGVw6QDGChpUM3HfV7DpWGZ7R\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\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#fe7ee643b50b724f6029f6edfe90d67b5512b3ae\",\n \"signing_channel\": {\n \"address\": \"mofqoKUmhmPTCoudQRXgjzGSDnCyJvZAZg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#5dc92b3ab696844e2e043f542b50a2dd0a95d6f2\",\n \"timestamp\": 1602862456,\n \"txid\": \"3ee8f25ad7bfef1d30e3fce0b212d77b74a495ef1d7635a8be77b96ffbe8e412\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200049b4cbe0f5275e7b1c170f458af09628ba75401fd95d0205ed9de9037b396f60936d555da2bc8dd09b1804b250f32d1bd07382bd3a4aaa2700b08b137b91f1159\",\n \"public_key_id\": \"mkVrRXQGgjhBaygCP3dNpbmtm5Yohno8q2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"c620b71698533d88efa10c80d79a30b74464214cb0d893ec5ab4ec1c37d1676e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n Line truncated
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update a38a77a9154b679070b083e842040d6fb6b10c8e --channel_id=\"0eab90020ce7b538a56023804b578ab768ae7f7e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"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\": \"01000000023441794e4d4455ad35d7cf390a58e45a101b6bb3bbfc0fd2f91f148e0bffb269000000006b483045022100d26bd086f854c0d671f3634073ff898bc8d2d6ead98ac2799abf4f6362310cc0022061c523e7d9f0b2e732650fe087b9259f5224bef25eaf6e1f09690d887c4a3ce50121034d37b695b20296aa259fe7a1fc31a2e299c7ac65f5bda020e7f3d2b747e1d72afffffffff805b55115aae7eb94d273b4efb6e64efc938b481e93656192d7b695c979d0e9010000006b483045022100f9d4a48eda873982b0be8875326f026bce345294fff126ee75ed684e15de6d00022046c721e26f892b59fa8f18516712864ea26c3453a7bd5ee284f511da79fbfed6012103e4cea47ad83869186635013e5f5de7b8c47b561d1f19a91c14ad04812924ce73ffffffff0200e1f50500000000fd2301b7076173747265616d148e0cb1b66f0d0442e883b07090674b15a9778aa34ce8017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf76d6d76a914b6eefba0730cb3bd7d5e13285f7acbcc7fae273c88ac32a0d205000000001976a914305d98124bb22351ab3a4f69ca61f2175816ffb488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"minHFWqr3L7oyfNNPReBgTkRj4rykBaUod\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\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#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n Line truncated
}
]
}
@@ -4474,7 +4600,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-10-16 11:34\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1602862456,\n \"txid\": \"6947372f3637caa782cdb49daf4c9cb4f06a8479152eee6691912f042d3d5358\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2020-10-16 11:34\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1602862455,\n \"txid\": \"0843754aabf3d1313d22e51476d8a81dc1f6ce75df7844529d1d16013c803d59\",\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\": \"2021-04-14 19:30\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2021-04-14 19:30\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1618443043,\n \"txid\": \"5b2bb866bbb20a99549d14a423f30814bb1a67d1fc28e2673fe5945f9951dd3b\",\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}"
}
]
},
@@ -4525,6 +4651,12 @@
"description": "claims in this channel",
"is_required": false
},
{
"name": "not_channel_id",
"type": "str or list",
"description": "claims not in this channel",
"is_required": false
},
{
"name": "name",
"type": "str or list",
@@ -4582,7 +4714,7 @@
{
"name": "include_received_tips",
"type": "bool",
"description": "calculate the amount of tips recieved for claim outputs",
"description": "calculate the amount of tips received for claim outputs",
"is_required": false
},
{
@@ -4659,6 +4791,18 @@
"description": "claim name",
"is_required": false
},
{
"name": "channel_id",
"type": "str or list",
"description": "claims in this channel",
"is_required": false
},
{
"name": "not_channel_id",
"type": "str or list",
"description": "claims not in this channel",
"is_required": false
},
{
"name": "is_spent",
"type": "bool",
@@ -4775,6 +4919,12 @@
"description": "claims in this channel",
"is_required": false
},
{
"name": "not_channel_id",
"type": "str or list",
"description": "claims not in this channel",
"is_required": false
},
{
"name": "name",
"type": "str or list",
@@ -4867,6 +5017,18 @@
"description": "claim name",
"is_required": false
},
{
"name": "channel_id",
"type": "str or list",
"description": "claims in this channel",
"is_required": false
},
{
"name": "not_channel_id",
"type": "str or list",
"description": "claims not in this channel",
"is_required": false
},
{
"name": "is_spent",
"type": "bool",
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = "0.87.0"
__version__ = "0.94.0"
version = tuple(map(int, __version__.split('.'))) # pylint: disable=invalid-name
+2 -2
View File
@@ -2,7 +2,7 @@ import os
import typing
import asyncio
import logging
from lbry.utils import LRUCache
from lbry.utils import LRUCacheWithMetrics
from lbry.blob.blob_file import is_valid_blobhash, BlobFile, BlobBuffer, AbstractBlob
from lbry.stream.descriptor import StreamDescriptor
from lbry.connection_manager import ConnectionManager
@@ -32,7 +32,7 @@ class BlobManager:
else self._node_data_store.completed_blobs
self.blobs: typing.Dict[str, AbstractBlob] = {}
self.config = config
self.decrypted_blob_lru_cache = None if not self.config.blob_lru_cache_size else LRUCache(
self.decrypted_blob_lru_cache = None if not self.config.blob_lru_cache_size else LRUCacheWithMetrics(
self.config.blob_lru_cache_size)
self.connection_manager = ConnectionManager(loop)
+7 -40
View File
@@ -3,7 +3,6 @@ import asyncio
import typing
import binascii
import socket
import time
from lbry.utils import resolve_host
from lbry.dht import constants
from lbry.dht.peer import make_kademlia_peer
@@ -18,16 +17,6 @@ if typing.TYPE_CHECKING:
log = logging.getLogger(__name__)
class NodeState:
def __init__(self,
routing_table_peers: typing.List[typing.Tuple[bytes, str, int, int]],
datastore: typing.List[typing.Tuple[bytes, str, int, int, bytes, float]]):
# List[Tuple[node_id, address, udp_port, tcp_port]]
self.routing_table_peers = routing_table_peers
# List[Tuple[node_id, address, udp_port, tcp_port, blob_hash, added_at]]
self.datastore = datastore
class Node:
def __init__(self, loop: asyncio.AbstractEventLoop, peer_manager: 'PeerManager', node_id: bytes, udp_port: int,
internal_udp_port: int, peer_port: int, external_ip: str, rpc_timeout: float = constants.RPC_TIMEOUT,
@@ -42,7 +31,6 @@ class Node:
self._join_task: asyncio.Task = None
self._refresh_task: asyncio.Task = None
self._storage = storage
self.started_listening = asyncio.Event()
async def refresh_node(self, force_once=False):
while True:
@@ -115,7 +103,6 @@ class Node:
return stored_to
def stop(self) -> None:
self.started_listening.clear()
if self.joined.is_set():
self.joined.clear()
if self._join_task:
@@ -131,35 +118,18 @@ class Node:
self.listening_port = None
log.info("Stopped DHT node")
def get_state(self) -> NodeState:
return NodeState(
routing_table_peers=[(p.node_id, p.address, p.udp_port, p.tcp_port)
for p in self.protocol.routing_table.get_peers()],
datastore=self.protocol.data_store.dump()
)
def load_state(self, state: NodeState):
now = self.loop.time()
for node_id, address, udp_port, tcp_port, blob_hash, added_at in state.datastore:
if added_at + constants.DATA_EXPIRATION < now:
continue
p = make_kademlia_peer(node_id, address, udp_port, tcp_port)
self.protocol.data_store.add_peer_to_blob(p, blob_hash)
async def start_listening(self, interface: str = '0.0.0.0') -> None:
if not self.listening_port:
self.listening_port, _ = await self.loop.create_datagram_endpoint(
lambda: self.protocol, (interface, self.internal_udp_port)
)
self.started_listening.set()
log.info("DHT node listening on UDP %s:%i", interface, self.internal_udp_port)
self.protocol.start()
else:
log.warning("Already bound to port %s", self.listening_port)
async def join_network(self, interface: str = '0.0.0.0',
known_node_urls: typing.Optional[typing.List[typing.Tuple[str, int]]] = None,
persisted_peers: typing.List[typing.Tuple[bytes, str, int, int]] = []):
known_node_urls: typing.Optional[typing.List[typing.Tuple[str, int]]] = None):
def peers_from_urls(urls: typing.Optional[typing.List[typing.Tuple[bytes, str, int, int]]]):
peer_addresses = []
for node_id, address, udp_port, tcp_port in urls:
@@ -178,15 +148,15 @@ class Node:
if not self.joined.is_set():
self.joined.set()
log.info(
"%s: joined dht, %i peers known in %i buckets",
bytes.fromhex(self.protocol.node_id)[:8],
len(self.protocol.routing_table.get_peers()),
"joined dht, %i peers known in %i buckets", len(self.protocol.routing_table.get_peers()),
self.protocol.routing_table.buckets_with_contacts()
)
else:
if self.joined.is_set():
self.joined.clear()
seed_peers = peers_from_urls(persisted_peers) if persisted_peers else []
seed_peers = peers_from_urls(
await self._storage.get_persisted_kademlia_peers()
) if self._storage else []
if not seed_peers:
try:
seed_peers.extend(peers_from_urls([
@@ -203,11 +173,8 @@ class Node:
await asyncio.sleep(1, loop=self.loop)
def start(self, interface: str,
known_node_urls: typing.Optional[typing.List[typing.Tuple[str, int]]] = None,
persisted_peers: typing.List[typing.Tuple[bytes, str, int, int]] = []):
self._join_task = self.loop.create_task(self.join_network(interface, known_node_urls, persisted_peers))
def start(self, interface: str, known_node_urls: typing.Optional[typing.List[typing.Tuple[str, int]]] = None):
self._join_task = self.loop.create_task(self.join_network(interface, known_node_urls))
def get_iterative_node_finder(self, key: bytes, shortlist: typing.Optional[typing.List['KademliaPeer']] = None,
bottom_out_limit: int = constants.BOTTOM_OUT_LIMIT,
+3 -22
View File
@@ -1,14 +1,14 @@
import typing
import asyncio
import logging
import ipaddress
from binascii import hexlify
from dataclasses import dataclass, field
from functools import lru_cache
from lbry.utils import is_valid_public_ipv4 as _is_valid_public_ipv4
from lbry.dht import constants
from lbry.dht.serialization.datagram import make_compact_address, make_compact_ip, decode_compact_address
ALLOW_LOCALHOST = False
log = logging.getLogger(__name__)
@@ -20,28 +20,9 @@ def make_kademlia_peer(node_id: typing.Optional[bytes], address: typing.Optional
return KademliaPeer(address, node_id, udp_port, tcp_port=tcp_port, allow_localhost=allow_localhost)
# the ipaddress module does not show these subnets as reserved
CARRIER_GRADE_NAT_SUBNET = ipaddress.ip_network('100.64.0.0/10')
IPV4_TO_6_RELAY_SUBNET = ipaddress.ip_network('192.88.99.0/24')
ALLOW_LOCALHOST = False
def is_valid_public_ipv4(address, allow_localhost: bool = False):
allow_localhost = bool(allow_localhost or ALLOW_LOCALHOST)
try:
parsed_ip = ipaddress.ip_address(address)
if parsed_ip.is_loopback and allow_localhost:
return True
if any((parsed_ip.version != 4, parsed_ip.is_unspecified, parsed_ip.is_link_local, parsed_ip.is_loopback,
parsed_ip.is_multicast, parsed_ip.is_reserved, parsed_ip.is_private, parsed_ip.is_reserved)):
return False
else:
return not any((CARRIER_GRADE_NAT_SUBNET.supernet_of(ipaddress.ip_network(f"{address}/32")),
IPV4_TO_6_RELAY_SUBNET.supernet_of(ipaddress.ip_network(f"{address}/32"))))
except (ipaddress.AddressValueError, ValueError):
return False
return _is_valid_public_ipv4(address, allow_localhost)
class PeerManager:
-6
View File
@@ -68,9 +68,3 @@ class DictDataStore:
for _, stored in self._data_store.items():
peers.update(set(map(lambda tup: tup[0], stored)))
return list(peers)
def dump(self) -> typing.List[typing.Tuple[bytes, str, int, int, bytes, float]]:
data = []
for k, peers in self._data_store.items():
data.extend([(p.node_id, p.address, p.udp_port, p.tcp_port, k, added_at) for (p, added_at) in peers])
return data
-6
View File
@@ -287,7 +287,6 @@ class KademliaProtocol(DatagramProtocol):
self._to_add: typing.Set['KademliaPeer'] = set()
self._wakeup_routing_task = asyncio.Event(loop=self.loop)
self.maintaing_routing_task: typing.Optional[asyncio.Task] = None
self.event_queue = asyncio.Queue(maxsize=100)
@functools.lru_cache(128)
def get_rpc_peer(self, peer: 'KademliaPeer') -> RemoteKademliaRPC:
@@ -429,11 +428,6 @@ class KademliaProtocol(DatagramProtocol):
log.debug("%s:%i RECV CALL %s %s:%i", self.external_ip, self.udp_port, message.method.decode(),
sender_contact.address, sender_contact.udp_port)
try:
self.event_queue.put_nowait((sender_contact.node_id, sender_contact.address, method, args))
except asyncio.QueueFull:
pass
if method == b'ping':
result = self.node_rpc.ping()
elif method == b'store':
+1 -1
View File
@@ -286,7 +286,7 @@ class TreeRoutingTable:
to_pop = [i for i, bucket in enumerate(self.buckets) if len(bucket) == 0]
if not to_pop:
return
log.debug("%s: join buckets %i", bytes.hex(self._parent_node_id)[:8], len(to_pop))
log.info("join buckets %i", len(to_pop))
bucket_index_to_pop = to_pop[0]
assert len(self.buckets[bucket_index_to_pop]) == 0
can_go_lower = bucket_index_to_pop - 1 >= 0
+1 -1
View File
@@ -132,7 +132,7 @@ class AnalyticsManager:
async def run(self):
while True:
if self.enabled:
self.external_ip = await utils.get_external_ip()
self.external_ip, _ = await utils.get_external_ip(self.conf.lbryum_servers)
await self._send_heartbeat()
await asyncio.sleep(1800)
+24 -18
View File
@@ -119,13 +119,14 @@ class WalletComponent(Component):
async def get_status(self):
if self.wallet_manager is None:
return
session_pool = self.wallet_manager.ledger.network.session_pool
sessions = session_pool.sessions
is_connected = self.wallet_manager.ledger.network.is_connected
sessions = []
connected = None
if self.wallet_manager.ledger.network.client:
addr_and_port = self.wallet_manager.ledger.network.client.server_address_and_port
if addr_and_port:
connected = f"{addr_and_port[0]}:{addr_and_port[1]}"
if is_connected:
addr, port = self.wallet_manager.ledger.network.client.server
connected = f"{addr}:{port}"
sessions.append(self.wallet_manager.ledger.network.client)
result = {
'connected': connected,
'connected_features': self.wallet_manager.ledger.network.server_features,
@@ -137,8 +138,8 @@ class WalletComponent(Component):
'availability': session.available,
} for session in sessions
],
'known_servers': len(sessions),
'available_servers': len(list(session_pool.available_sessions))
'known_servers': len(self.wallet_manager.ledger.network.config['default_servers']),
'available_servers': 1 if is_connected else 0
}
if self.wallet_manager.ledger.network.remote_height:
@@ -274,7 +275,7 @@ class DHTComponent(Component):
external_ip = upnp_component.external_ip
storage = self.component_manager.get_component(DATABASE_COMPONENT)
if not external_ip:
external_ip = await utils.get_external_ip()
external_ip, _ = await utils.get_external_ip(self.conf.lbryum_servers)
if not external_ip:
log.warning("failed to get external ip")
@@ -328,7 +329,7 @@ class HashAnnouncerComponent(Component):
class FileManagerComponent(Component):
component_name = FILE_MANAGER_COMPONENT
depends_on = [BLOB_COMPONENT, DATABASE_COMPONENT, WALLET_COMPONENT, LIBTORRENT_COMPONENT]
depends_on = [BLOB_COMPONENT, DATABASE_COMPONENT, WALLET_COMPONENT]
def __init__(self, component_manager):
super().__init__(component_manager)
@@ -351,7 +352,10 @@ class FileManagerComponent(Component):
wallet = self.component_manager.get_component(WALLET_COMPONENT)
node = self.component_manager.get_component(DHT_COMPONENT) \
if self.component_manager.has_component(DHT_COMPONENT) else None
torrent = self.component_manager.get_component(LIBTORRENT_COMPONENT) if TorrentSession else None
try:
torrent = self.component_manager.get_component(LIBTORRENT_COMPONENT) if TorrentSession else None
except NameError:
torrent = None
log.info('Starting the file manager')
loop = asyncio.get_event_loop()
self.file_manager = FileManager(
@@ -360,7 +364,7 @@ class FileManagerComponent(Component):
self.file_manager.source_managers['stream'] = StreamManager(
loop, self.conf, blob_manager, wallet, storage, node,
)
if TorrentSession:
if TorrentSession and LIBTORRENT_COMPONENT not in self.conf.components_to_skip:
self.file_manager.source_managers['torrent'] = TorrentManager(
loop, self.conf, torrent, storage, self.component_manager.analytics_manager
)
@@ -472,7 +476,7 @@ class UPnPComponent(Component):
pass
if external_ip and not is_valid_public_ipv4(external_ip):
log.warning("UPnP returned a private/reserved ip - %s, checking lbry.com fallback", external_ip)
external_ip = await utils.get_external_ip()
external_ip, _ = await utils.get_external_ip(self.conf.lbryum_servers)
if self.external_ip and self.external_ip != external_ip:
log.info("external ip changed from %s to %s", self.external_ip, external_ip)
if external_ip:
@@ -530,13 +534,15 @@ class UPnPComponent(Component):
async def start(self):
log.info("detecting external ip")
if not self.use_upnp:
self.external_ip = await utils.get_external_ip()
self.external_ip, _ = await utils.get_external_ip(self.conf.lbryum_servers)
return
success = False
await self._maintain_redirects()
if self.upnp:
if not self.upnp_redirects and not all([x in self.component_manager.skip_components for x in
(DHT_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT)]):
if not self.upnp_redirects and not all(
x in self.component_manager.skip_components
for x in (DHT_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT)
):
log.error("failed to setup upnp")
else:
success = True
@@ -545,9 +551,9 @@ class UPnPComponent(Component):
else:
log.error("failed to setup upnp")
if not self.external_ip:
self.external_ip = await utils.get_external_ip()
self.external_ip, probed_url = await utils.get_external_ip(self.conf.lbryum_servers)
if self.external_ip:
log.info("detected external ip using lbry.com fallback")
log.info("detected external ip using %s fallback", probed_url)
if self.component_manager.analytics_manager:
self.component_manager.loop.create_task(
self.component_manager.analytics_manager.send_upnp_setup_success_fail(
+118 -99
View File
@@ -119,13 +119,6 @@ STREAM_STAGES = [
(DOWNLOAD_TIMEOUT_CODE, 'Stream timed out')
]
CONNECTION_STATUS_CONNECTED = 'connected'
CONNECTION_STATUS_NETWORK = 'network_connection'
CONNECTION_MESSAGES = {
CONNECTION_STATUS_CONNECTED: 'No connection problems detected',
CONNECTION_STATUS_NETWORK: "Your internet connection appears to have been interrupted",
}
SHORT_ID_LEN = 20
MAX_UPDATE_FEE_ESTIMATE = 0.3
DEFAULT_PAGE_SIZE = 20
@@ -339,13 +332,13 @@ 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)
logging.getLogger('aiohttp.access').setLevel(logging.WARN)
rpc_app = web.Application()
rpc_app.router.add_get('/lbryapi', self.handle_old_jsonrpc)
rpc_app.router.add_post('/lbryapi', self.handle_old_jsonrpc)
rpc_app.router.add_post('/', self.handle_old_jsonrpc)
rpc_app.router.add_options('/', self.add_cors_headers)
self.rpc_runner = web.AppRunner(rpc_app)
streaming_app = web.Application()
@@ -358,9 +351,6 @@ class Daemon(metaclass=JSONRPCServerType):
prom_app.router.add_get('/metrics', self.handle_metrics_get_request)
self.metrics_runner = web.AppRunner(prom_app)
self.need_connection_status_refresh = asyncio.Event()
self._connection_status_task: Optional[asyncio.Task] = None
@property
def dht_node(self) -> typing.Optional['Node']:
return self.component_manager.get_component(DHT_COMPONENT)
@@ -465,31 +455,10 @@ class Daemon(metaclass=JSONRPCServerType):
if not os.path.isdir(self.conf.download_dir):
os.makedirs(self.conf.download_dir)
async def update_connection_status(self):
connected = await utils.async_check_connection()
if connected and not self._connection_status[1]:
log.info("detected internet connection is working")
elif not connected and self._connection_status[1]:
log.warning("detected internet connection was lost")
self._connection_status = (self.component_manager.loop.time(), connected)
async def keep_connection_status_up_to_date(self):
while True:
try:
await asyncio.wait_for(self.need_connection_status_refresh.wait(), 300)
except asyncio.TimeoutError:
pass
await self.update_connection_status()
self.need_connection_status_refresh.clear()
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(self.platform_info, indent=2))
self.need_connection_status_refresh.set()
self._connection_status_task = self.component_manager.loop.create_task(
self.keep_connection_status_up_to_date()
)
await self.analytics_manager.send_server_startup()
await self.rpc_runner.setup()
@@ -549,10 +518,6 @@ class Daemon(metaclass=JSONRPCServerType):
await self.component_startup_task
async def stop(self):
if self._connection_status_task:
if not self._connection_status_task.done():
self._connection_status_task.cancel()
self._connection_status_task = None
if self.component_startup_task is not None:
if self.component_startup_task.done():
await self.component_manager.stop()
@@ -575,6 +540,17 @@ class Daemon(metaclass=JSONRPCServerType):
self.analytics_manager.stop()
log.info("finished shutting down")
async def add_cors_headers(self, request):
if self.conf.allowed_origin:
return web.Response(
headers={
'Access-Control-Allow-Origin': self.conf.allowed_origin,
'Access-Control-Allow-Methods': self.conf.allowed_origin,
'Access-Control-Allow-Headers': self.conf.allowed_origin,
}
)
return None
async def handle_old_jsonrpc(self, request):
ensure_request_allowed(request, self.conf)
data = await request.json()
@@ -595,8 +571,16 @@ class Daemon(metaclass=JSONRPCServerType):
'After successfully executing the command, failed to encode result for JSON RPC response.',
{'traceback': format_exc()}
), ledger=ledger)
headers = {}
if self.conf.allowed_origin:
headers.update({
'Access-Control-Allow-Origin': self.conf.allowed_origin,
'Access-Control-Allow-Methods': self.conf.allowed_origin,
'Access-Control-Allow-Headers': self.conf.allowed_origin,
})
return web.Response(
text=encoded_result,
headers=headers,
content_type='application/json'
)
@@ -936,10 +920,6 @@ class Daemon(metaclass=JSONRPCServerType):
}
}
"""
if not self._connection_status[1]:
self.need_connection_status_refresh.set()
connection_code = CONNECTION_STATUS_CONNECTED if self._connection_status[1] else CONNECTION_STATUS_NETWORK
ffmpeg_status = await self._video_file_analyzer.status()
running_components = self.component_manager.get_components_status()
response = {
@@ -947,10 +927,6 @@ class Daemon(metaclass=JSONRPCServerType):
'is_running': all(running_components.values()),
'skipped_components': self.component_manager.skip_components,
'startup_status': running_components,
'connection_status': {
'code': connection_code,
'message': CONNECTION_MESSAGES[connection_code],
},
'ffmpeg_status': ffmpeg_status
}
for component in self.component_manager.components:
@@ -999,7 +975,7 @@ class Daemon(metaclass=JSONRPCServerType):
Options:
--urls=<urls> : (str, list) one or more urls to resolve
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase reciepts
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase receipts
--new_sdk_server=<new_sdk_server> : (str) URL of the new SDK server (EXPERIMENTAL)
--include_purchase_receipt : (bool) lookup and include a receipt if this wallet
has purchased the claim being resolved
@@ -1112,7 +1088,7 @@ class Daemon(metaclass=JSONRPCServerType):
--download_directory=<download_directory> : (str) full path to the directory to download into
--timeout=<timeout> : (int) download timeout in number of seconds
--save_file=<save_file> : (bool) save the file to the downloads directory
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase reciepts
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase receipts
Returns: {File}
"""
@@ -1580,7 +1556,7 @@ class Daemon(metaclass=JSONRPCServerType):
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
balance = await account.get_detailed_balance(
confirmations=confirmations, reserved_subtotals=True, read_only=True
confirmations=confirmations, read_only=True
)
return dict_values_to_lbc(balance)
@@ -2295,7 +2271,7 @@ class Daemon(metaclass=JSONRPCServerType):
--order_by=<order_by> : (str) field to order by: 'name', 'height', 'amount'
--no_totals : (bool) do not calculate the total number of pages and items in result set
(significant performance boost)
--include_received_tips : (bool) calculate the amount of tips recieved for claim outputs
--include_received_tips : (bool) calculate the amount of tips received for claim outputs
Returns: {Paginated[Output]}
"""
@@ -2372,8 +2348,9 @@ class Daemon(metaclass=JSONRPCServerType):
[--not_languages=<not_languages>...]
[--any_locations=<any_locations>...] [--all_locations=<all_locations>...]
[--not_locations=<not_locations>...]
[--order_by=<order_by>...] [--page=<page>] [--page_size=<page_size>]
[--order_by=<order_by>...] [--no_totals] [--page=<page>] [--page_size=<page_size>]
[--wallet_id=<wallet_id>] [--include_purchase_receipt] [--include_is_my_output]
[--has_source | --has_no_source]
[--new_sdk_server=<new_sdk_server>]
Options:
@@ -2451,7 +2428,7 @@ class Daemon(metaclass=JSONRPCServerType):
--reposted_claim_id=<reposted_claim_id>: (str) all reposts of the specified original claim id
--reposted=<reposted> : (int) claims reposted this many times (supports
equality constraints)
--claim_type=<claim_type> : (str) filter by 'channel', 'stream' or 'unknown'
--claim_type=<claim_type> : (str) filter by 'channel', 'stream', 'repost' or 'collection'
--stream_types=<stream_types> : (list) filter by 'video', 'image', 'document', etc
--media_types=<media_types> : (list) filter by 'video/mp4', 'image/png', etc
--fee_currency=<fee_currency> : (string) specify fee currency: LBC, BTC, USD
@@ -2477,11 +2454,13 @@ class Daemon(metaclass=JSONRPCServerType):
'trending_local', 'trending_global', 'activation_height'
--no_totals : (bool) do not calculate the total number of pages and items in result set
(significant performance boost)
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase reciepts
--wallet_id=<wallet_id> : (str) wallet to check for claim purchase receipts
--include_purchase_receipt : (bool) lookup and include a receipt if this wallet
has purchased the claim
--include_is_my_output : (bool) lookup and include a boolean indicating
if claim being resolved is yours
--has_source : (bool) find claims containing a source field
--has_no_source : (bool) find claims not containing a source field
--new_sdk_server=<new_sdk_server> : (str) URL of the new SDK server (EXPERIMENTAL)
Returns: {Paginated[Output]}
@@ -2493,6 +2472,8 @@ class Daemon(metaclass=JSONRPCServerType):
kwargs['signature_valid'] = 1
if kwargs.pop('invalid_channel_signature', False):
kwargs['signature_valid'] = 0
if 'has_no_source' in kwargs:
kwargs['has_source'] = not kwargs.pop('has_no_source')
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50)
kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size})
txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs)
@@ -2808,7 +2789,12 @@ class Daemon(metaclass=JSONRPCServerType):
for channel certificates, defaults to all accounts.
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns: {}
Returns:
(dict) Signature if successfully made, (None) or an error otherwise
{
"signature": (str) The signature of the comment,
"signing_ts": (str) The timestamp used to sign the comment,
}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
@@ -2901,7 +2887,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Paginated[Output]}
"""
kwargs['type'] = 'channel'
if 'is_spent' not in kwargs:
if 'is_spent' not in kwargs or not kwargs['is_spent']:
kwargs['is_not_spent'] = True
return self.jsonrpc_txo_list(*args, **kwargs)
@@ -3010,13 +2996,13 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
publish (<name> | --name=<name>) [--bid=<bid>] [--file_path=<file_path>]
[--validate_file] [--optimize_file]
[--file_name=<file_name>] [--file_hash=<file_hash>] [--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>...]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name>]
[--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name>]
[--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@@ -3026,6 +3012,8 @@ 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.
--file_name=<file_name> : (str) name of file to be associated with stream.
--file_hash=<file_hash> : (str) hash of file to be associated with stream.
--validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified.
FFmpeg is required
@@ -3088,6 +3076,7 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of publisher channel
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
@@ -3114,8 +3103,6 @@ class Daemon(metaclass=JSONRPCServerType):
if len(claims) == 0:
if 'bid' not in kwargs:
raise Exception("'bid' is a required argument for new publishes.")
if 'file_path' not in kwargs:
raise Exception("'file_path' is a required argument for new publishes.")
return await self.jsonrpc_stream_create(name, **kwargs)
elif len(claims) == 1:
assert claims[0].claim.is_stream, f"Claim at name '{name}' is not a stream claim."
@@ -3199,7 +3186,7 @@ class Daemon(metaclass=JSONRPCServerType):
@requires(WALLET_COMPONENT, FILE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT)
async def jsonrpc_stream_create(
self, name, bid, file_path, allow_duplicate_name=False,
self, name, bid, file_path=None, 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, validate_file=False, optimize_file=False, **kwargs):
@@ -3207,15 +3194,15 @@ class Daemon(metaclass=JSONRPCServerType):
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]
stream_create (<name> | --name=<name>) (<bid> | --bid=<bid>) [<file_path> | --file_path=<file_path>]
[--file_name=<file_name>] [--file_hash=<file_hash>] [--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>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name>]
[--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name>]
[--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@@ -3225,6 +3212,8 @@ 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.
--file_name=<file_name> : (str) name of file to be associated with stream.
--file_hash=<file_hash> : (str) hash of file to be associated with stream.
--validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified.
FFmpeg is required
@@ -3289,13 +3278,14 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of the publisher channel
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
for channel certificates, defaults to all accounts.
--account_id=<account_id> : (str) account to use for holding the transaction
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
--claim_address=<claim_address>: (str) address where the claim is sent to, if not specified
it will be determined automatically from the account
--preview : (bool) do not broadcast the transaction
@@ -3321,20 +3311,24 @@ class Daemon(metaclass=JSONRPCServerType):
f"Use --allow-duplicate-name flag to override."
)
file_path, spec = await self._video_file_analyzer.verify_or_repair(
validate_file, optimize_file, file_path, ignore_non_video=True
)
kwargs.update(spec)
if file_path is not None:
file_path, spec = await self._video_file_analyzer.verify_or_repair(
validate_file, optimize_file, file_path, ignore_non_video=True
)
kwargs.update(spec)
claim = Claim()
claim.stream.update(file_path=file_path, sd_hash='0' * 96, **kwargs)
if file_path is not None:
claim.stream.update(file_path=file_path, sd_hash='0' * 96, **kwargs)
else:
claim.stream.update(**kwargs)
tx = await Transaction.claim_create(
name, claim, amount, claim_address, funding_accounts, funding_accounts[0], channel
)
new_txo = tx.outputs[0]
file_stream = None
if not preview:
if not preview and file_path is not None:
file_stream = await self.file_manager.create_stream(file_path)
claim.stream.source.sd_hash = file_stream.sd_hash
new_txo.script.generate()
@@ -3350,7 +3344,8 @@ class Daemon(metaclass=JSONRPCServerType):
await self.storage.save_claims([self._old_get_temp_claim_info(
tx, new_txo, claim_address, claim, name, dewies_to_lbc(amount)
)])
await self.storage.save_content_claim(file_stream.stream_hash, new_txo.id)
if file_path is not None:
await self.storage.save_content_claim(file_stream.stream_hash, new_txo.id)
self.component_manager.loop.create_task(save_claims())
self.component_manager.loop.create_task(self.analytics_manager.send_claim_action('publish'))
@@ -3380,7 +3375,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--locations=<locations>...] [--clear_locations]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name> | --clear_channel]
[--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name> | --clear_channel]
[--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@@ -3459,6 +3454,7 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of the publisher channel
--clear_channel : (bool) remove channel signature
@@ -3530,9 +3526,10 @@ class Daemon(metaclass=JSONRPCServerType):
if replace:
claim = Claim()
claim.stream.message.source.CopyFrom(
old_txo.claim.stream.message.source
)
if old_txo.claim.stream.has_source:
claim.stream.message.source.CopyFrom(
old_txo.claim.stream.message.source
)
stream_type = old_txo.claim.stream.stream_type
if stream_type:
old_stream_type = getattr(old_txo.claim.stream.message, stream_type)
@@ -3703,14 +3700,16 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
collection_create (<name> | --name=<name>) (<bid> | --bid=<bid>)
(<claims>... | --claims=<claims>...)
[--allow_duplicate_name]
[--title=<title>] [--description=<description>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
[--thumbnail_url=<thumbnail_url>]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
[--preview] [--blocking]
(--claims=<claims>...)
[--allow_duplicate_name]
[--title=<title>] [--description=<description>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
[--thumbnail_url=<thumbnail_url>]
[--channel_id=<channel_id> | --channel_name=<channel_name>]
[--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
[--preview] [--blocking]
Options:
--name=<name> : (str) name of the collection
@@ -3761,6 +3760,10 @@ class Daemon(metaclass=JSONRPCServerType):
... --locations="{'country': 'US', 'state': 'NH'}"
--thumbnail_url=<thumbnail_url>: (str) thumbnail url
--channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of the publisher channel
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
for channel certificates, defaults to all accounts.
--account_id=<account_id> : (str) account to use for holding the transaction
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
@@ -3824,7 +3827,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--locations=<locations>...] [--clear_locations]
[--thumbnail_url=<thumbnail_url>] [--cover_url=<cover_url>]
[--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--new_signing_key]
[--claim_address=<claim_address>]
[--funding_account_ids=<funding_account_ids>...]
[--preview] [--blocking] [--replace]
@@ -3882,7 +3885,6 @@ class Daemon(metaclass=JSONRPCServerType):
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
--claim_address=<claim_address>: (str) address where the collection is sent
--new_signing_key : (bool) generate a new signing key, will invalidate all previous publishes
--preview : (bool) do not broadcast the transaction
--blocking : (bool) wait until transaction is in mempool
--replace : (bool) instead of modifying specific values on
@@ -3946,8 +3948,6 @@ class Daemon(metaclass=JSONRPCServerType):
)
new_txo = tx.outputs[0]
new_txo.script.generate()
if channel:
new_txo.sign(channel)
await tx.sign(funding_accounts)
@@ -3985,15 +3985,18 @@ class Daemon(metaclass=JSONRPCServerType):
return await self.jsonrpc_stream_abandon(*args, **kwargs)
@requires(WALLET_COMPONENT)
def jsonrpc_collection_list(self, resolve_claims=0, account_id=None, wallet_id=None, page=None, page_size=None):
def jsonrpc_collection_list(
self, resolve_claims=0, resolve=False, account_id=None,
wallet_id=None, page=None, page_size=None):
"""
List my collection claims.
Usage:
collection_list [--resolve_claims=<resolve_claims>] [<account_id> | --account_id=<account_id>]
collection_list [--resolve_claims=<resolve_claims>] [--resolve] [<account_id> | --account_id=<account_id>]
[--wallet_id=<wallet_id>] [--page=<page>] [--page_size=<page_size>]
Options:
--resolve : (bool) resolve collection claim
--resolve_claims=<resolve_claims> : (int) resolve every claim
--account_id=<account_id> : (str) id of the account to use
--wallet_id=<wallet_id> : (str) restrict results to specific wallet
@@ -4010,7 +4013,10 @@ class Daemon(metaclass=JSONRPCServerType):
else:
collections = partial(self.ledger.get_collections, wallet=wallet, accounts=wallet.accounts)
collection_count = partial(self.ledger.get_collection_count, wallet=wallet, accounts=wallet.accounts)
return paginate_rows(collections, collection_count, page, page_size, resolve_claims=resolve_claims)
return paginate_rows(
collections, collection_count, page, page_size,
resolve=resolve, resolve_claims=resolve_claims
)
async def jsonrpc_collection_resolve(
self, claim_id=None, url=None, wallet_id=None, page=1, page_size=DEFAULT_PAGE_SIZE):
@@ -4342,7 +4348,8 @@ class Daemon(metaclass=JSONRPCServerType):
@staticmethod
def _constrain_txo_from_kwargs(
constraints, type=None, txid=None, # pylint: disable=redefined-builtin
claim_id=None, channel_id=None, name=None, reposted_claim_id=None,
claim_id=None, channel_id=None, not_channel_id=None,
name=None, reposted_claim_id=None,
is_spent=False, is_not_spent=False,
is_my_input_or_output=None, exclude_internal_transfers=False,
is_my_output=None, is_not_my_output=None,
@@ -4365,6 +4372,7 @@ class Daemon(metaclass=JSONRPCServerType):
constraints['is_my_output'] = False
database.constrain_single_or_list(constraints, 'txo_type', type, lambda x: TXO_TYPES[x])
database.constrain_single_or_list(constraints, 'channel_id', channel_id)
database.constrain_single_or_list(constraints, 'channel_id', not_channel_id, negate=True)
database.constrain_single_or_list(constraints, 'claim_id', claim_id)
database.constrain_single_or_list(constraints, 'claim_name', name)
database.constrain_single_or_list(constraints, 'txid', txid)
@@ -4379,9 +4387,9 @@ class Daemon(metaclass=JSONRPCServerType):
List my transaction outputs.
Usage:
txo_list [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...]
[--claim_id=<claim_id>...] [--channel_id=<channel_id>...] [--name=<name>...]
[--is_spent | --is_not_spent]
txo_list [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...] [--claim_id=<claim_id>...]
[--channel_id=<channel_id>...] [--not_channel_id=<not_channel_id>...]
[--name=<name>...] [--is_spent | --is_not_spent]
[--is_my_input_or_output |
[[--is_my_output | --is_not_my_output] [--is_my_input | --is_not_my_input]]
]
@@ -4395,6 +4403,7 @@ class Daemon(metaclass=JSONRPCServerType):
--txid=<txid> : (str or list) transaction id of outputs
--claim_id=<claim_id> : (str or list) claim id
--channel_id=<channel_id> : (str or list) claims in this channel
--not_channel_id=<not_channel_id>: (str or list) claims not in this channel
--name=<name> : (str or list) claim name
--is_spent : (bool) only show spent txos
--is_not_spent : (bool) only show not spent txos
@@ -4409,7 +4418,7 @@ class Daemon(metaclass=JSONRPCServerType):
"--is_my_input --is_my_output --type=other"
this allows to exclude "change" payments, this
flag can be used in combination with any of the other flags
--include_received_tips : (bool) calculate the amount of tips recieved for claim outputs
--include_received_tips : (bool) calculate the amount of tips received for claim outputs
--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
@@ -4448,15 +4457,15 @@ class Daemon(metaclass=JSONRPCServerType):
@requires(WALLET_COMPONENT)
async def jsonrpc_txo_spend(
self, account_id=None, wallet_id=None, batch_size=500,
self, account_id=None, wallet_id=None, batch_size=100,
include_full_tx=False, preview=False, blocking=False, **kwargs):
"""
Spend transaction outputs, batching into multiple transactions as necessary.
Usage:
txo_spend [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...]
[--claim_id=<claim_id>...] [--channel_id=<channel_id>...] [--name=<name>...]
[--is_my_input | --is_not_my_input]
txo_spend [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...] [--claim_id=<claim_id>...]
[--channel_id=<channel_id>...] [--not_channel_id=<not_channel_id>...]
[--name=<name>...] [--is_my_input | --is_not_my_input]
[--exclude_internal_transfers] [--wallet_id=<wallet_id>]
[--preview] [--blocking] [--batch_size=<batch_size>] [--include_full_tx]
@@ -4466,6 +4475,7 @@ class Daemon(metaclass=JSONRPCServerType):
--txid=<txid> : (str or list) transaction id of outputs
--claim_id=<claim_id> : (str or list) claim id
--channel_id=<channel_id> : (str or list) claims in this channel
--not_channel_id=<not_channel_id>: (str or list) claims not in this channel
--name=<name> : (str or list) claim name
--is_my_input : (bool) show outputs created by you
--is_not_my_input : (bool) show outputs not created by you
@@ -4486,7 +4496,10 @@ class Daemon(metaclass=JSONRPCServerType):
accounts = [wallet.get_account_or_error(account_id)] if account_id else wallet.accounts
txos = await self.ledger.get_txos(
wallet=wallet, accounts=accounts, read_only=True,
**self._constrain_txo_from_kwargs({}, is_not_spent=True, is_my_output=True, **kwargs)
no_tx=True, no_channel_info=True,
**self._constrain_txo_from_kwargs(
{}, is_not_spent=True, is_my_output=True, **kwargs
)
)
txs = []
while txos:
@@ -4510,6 +4523,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
txo_list [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...]
[--channel_id=<channel_id>...] [--not_channel_id=<not_channel_id>...]
[--claim_id=<claim_id>...] [--name=<name>...]
[--is_spent] [--is_not_spent]
[--is_my_input_or_output |
@@ -4523,6 +4537,8 @@ class Daemon(metaclass=JSONRPCServerType):
--txid=<txid> : (str or list) transaction id of outputs
--claim_id=<claim_id> : (str or list) claim id
--name=<name> : (str or list) claim name
--channel_id=<channel_id> : (str or list) claims in this channel
--not_channel_id=<not_channel_id>: (str or list) claims not in this channel
--is_spent : (bool) only show spent txos
--is_not_spent : (bool) only show not spent txos
--is_my_input_or_output : (bool) txos which have your inputs or your outputs,
@@ -4557,6 +4573,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
txo_plot [--account_id=<account_id>] [--type=<type>...] [--txid=<txid>...]
[--claim_id=<claim_id>...] [--name=<name>...] [--is_spent] [--is_not_spent]
[--channel_id=<channel_id>...] [--not_channel_id=<not_channel_id>...]
[--is_my_input_or_output |
[[--is_my_output | --is_not_my_output] [--is_my_input | --is_not_my_input]]
]
@@ -4571,6 +4588,8 @@ class Daemon(metaclass=JSONRPCServerType):
--txid=<txid> : (str or list) transaction id of outputs
--claim_id=<claim_id> : (str or list) claim id
--name=<name> : (str or list) claim name
--channel_id=<channel_id> : (str or list) claims in this channel
--not_channel_id=<not_channel_id>: (str or list) claims not in this channel
--is_spent : (bool) only show spent txos
--is_not_spent : (bool) only show not spent txos
--is_my_input_or_output : (bool) txos which have your inputs or your outputs,
+109 -57
View File
@@ -2,6 +2,7 @@ import json
import time
import asyncio
import logging
from statistics import median
from decimal import Decimal
from typing import Optional, Iterable, Type
from aiohttp.client_exceptions import ContentTypeError
@@ -58,9 +59,12 @@ class MarketFeed:
raise NotImplementedError()
async def get_response(self):
async with aiohttp_request('get', self.url, params=self.params, timeout=self.request_timeout) as response:
async with aiohttp_request(
'get', self.url, params=self.params,
timeout=self.request_timeout, headers={"User-Agent": "lbrynet"}
) as response:
try:
self._last_response = await response.json()
self._last_response = await response.json(content_type=None)
except ContentTypeError as e:
self._last_response = {}
log.warning("Could not parse exchange rate response from %s: %s", self.name, e.message)
@@ -104,70 +108,115 @@ class MarketFeed:
self.event.clear()
class BittrexFeed(MarketFeed):
class BaseBittrexFeed(MarketFeed):
name = "Bittrex"
market = "BTCLBC"
url = "https://bittrex.com/api/v1.1/public/getmarkethistory"
params = {'market': 'BTC-LBC', 'count': 50}
market = None
url = None
fee = 0.0025
def get_rate_from_response(self, json_response):
if 'result' not in json_response:
if 'lastTradeRate' not in json_response:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
trades = json_response['result']
if len(trades) == 0:
raise InvalidExchangeRateResponseError(self.name, 'trades not found')
totals = sum([i['Total'] for i in trades])
qtys = sum([i['Quantity'] for i in trades])
if totals <= 0 or qtys <= 0:
raise InvalidExchangeRateResponseError(self.name, 'quantities were not positive')
vwap = totals / qtys
return float(1.0 / vwap)
return 1.0 / float(json_response['lastTradeRate'])
class LBRYFeed(MarketFeed):
name = "lbry.com"
class BittrexBTCFeed(BaseBittrexFeed):
market = "BTCLBC"
url = "https://api.lbry.com/lbc/exchange_rate"
url = "https://api.bittrex.com/v3/markets/LBC-BTC/ticker"
class BittrexUSDFeed(BaseBittrexFeed):
market = "USDLBC"
url = "https://api.bittrex.com/v3/markets/LBC-USD/ticker"
class BaseCryptonatorFeed(MarketFeed):
name = "Cryptonator"
market = None
url = None
def get_rate_from_response(self, json_response):
if 'data' not in json_response:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / json_response['data']['lbc_btc']
class LBRYBTCFeed(LBRYFeed):
market = "USDBTC"
def get_rate_from_response(self, json_response):
if 'data' not in json_response:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / json_response['data']['btc_usd']
class CryptonatorFeed(MarketFeed):
name = "cryptonator.com"
market = "BTCLBC"
url = "https://api.cryptonator.com/api/ticker/btc-lbc"
def get_rate_from_response(self, json_response):
if 'ticker' not in json_response or len(json_response['ticker']) == 0 or \
'success' not in json_response or json_response['success'] is not True:
if 'ticker' not in json_response or 'price' not in json_response['ticker']:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return float(json_response['ticker']['price'])
class CryptonatorBTCFeed(CryptonatorFeed):
market = "USDBTC"
url = "https://api.cryptonator.com/api/ticker/usd-btc"
class CryptonatorBTCFeed(BaseCryptonatorFeed):
market = "BTCLBC"
url = "https://api.cryptonator.com/api/ticker/btc-lbc"
class CryptonatorUSDFeed(BaseCryptonatorFeed):
market = "USDLBC"
url = "https://api.cryptonator.com/api/ticker/usd-lbc"
class BaseCoinExFeed(MarketFeed):
name = "CoinEx"
market = None
url = None
def get_rate_from_response(self, json_response):
if 'data' not in json_response or \
'ticker' not in json_response['data'] or \
'last' not in json_response['data']['ticker']:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / float(json_response['data']['ticker']['last'])
class CoinExBTCFeed(BaseCoinExFeed):
market = "BTCLBC"
url = "https://api.coinex.com/v1/market/ticker?market=LBCBTC"
class CoinExUSDFeed(BaseCoinExFeed):
market = "USDLBC"
url = "https://api.coinex.com/v1/market/ticker?market=LBCUSDT"
class BaseHotbitFeed(MarketFeed):
name = "hotbit"
market = None
url = "https://api.hotbit.io/api/v1/market.last"
def get_rate_from_response(self, json_response):
if 'result' not in json_response:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / float(json_response['result'])
class HotbitBTCFeed(BaseHotbitFeed):
market = "BTCLBC"
params = {"market": "LBC/BTC"}
class HotbitUSDFeed(BaseHotbitFeed):
market = "USDLBC"
params = {"market": "LBC/USDT"}
class UPbitBTCFeed(MarketFeed):
name = "UPbit"
market = "BTCLBC"
url = "https://api.upbit.com/v1/ticker"
params = {"markets": "BTC-LBC"}
def get_rate_from_response(self, json_response):
if len(json_response) != 1 or 'trade_price' not in json_response[0]:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / float(json_response[0]['trade_price'])
FEEDS: Iterable[Type[MarketFeed]] = (
LBRYFeed,
LBRYBTCFeed,
BittrexFeed,
# CryptonatorFeed,
# CryptonatorBTCFeed,
BittrexBTCFeed,
BittrexUSDFeed,
CryptonatorBTCFeed,
CryptonatorUSDFeed,
CoinExBTCFeed,
CoinExUSDFeed,
HotbitBTCFeed,
HotbitUSDFeed,
UPbitBTCFeed,
)
@@ -191,20 +240,23 @@ class ExchangeRateManager:
source.stop()
def convert_currency(self, from_currency, to_currency, amount):
rates = [market.rate for market in self.market_feeds]
log.debug("Converting %f %s to %s, rates: %s", amount, from_currency, to_currency, rates)
log.debug(
"Converting %f %s to %s, rates: %s",
amount, from_currency, to_currency,
[market.rate for market in self.market_feeds]
)
if from_currency == to_currency:
return round(amount, 8)
rates = []
for market in self.market_feeds:
if (market.has_rate and market.is_online and
market.rate.currency_pair == (from_currency, to_currency)):
return round(amount * Decimal(market.rate.spot), 8)
for market in self.market_feeds:
if (market.has_rate and market.is_online and
market.rate.currency_pair[0] == from_currency):
return round(self.convert_currency(
market.rate.currency_pair[1], to_currency, amount * Decimal(market.rate.spot)), 8)
rates.append(market.rate.spot)
if rates:
return round(amount * Decimal(median(rates)), 8)
raise CurrencyConversionError(
f'Unable to convert {amount} from {from_currency} to {to_currency}')
+16 -4
View File
@@ -85,8 +85,11 @@ class FileManager:
raise ResolveError("cannot download a channel claim, specify a /path")
try:
resolved_result = await asyncio.wait_for(
self.wallet_manager.ledger.resolve(wallet.accounts, [uri], include_purchase_receipt=True),
resolve_timeout
self.wallet_manager.ledger.resolve(
wallet.accounts, [uri],
include_purchase_receipt=True,
include_is_my_output=True
), resolve_timeout
)
except asyncio.TimeoutError:
raise ResolveTimeoutError(uri)
@@ -114,9 +117,11 @@ class FileManager:
if claim.stream.source.bt_infohash:
source_manager = self.source_managers['torrent']
existing = source_manager.get_filtered(bt_infohash=claim.stream.source.bt_infohash)
else:
elif claim.stream.source.sd_hash:
source_manager = self.source_managers['stream']
existing = source_manager.get_filtered(sd_hash=claim.stream.source.sd_hash)
else:
raise ResolveError(f"There is nothing to download at {uri} - Source is unknown or unset")
# resume or update an existing stream, if the stream changed: download it and delete the old one after
to_replace, updated_stream = None, None
@@ -170,7 +175,14 @@ class FileManager:
# pay fee
####################
if not to_replace and txo.has_price and not txo.purchase_receipt:
needs_purchasing = (
not to_replace and
not txo.is_my_output and
txo.has_price and
not txo.purchase_receipt
)
if needs_purchasing:
payment = await self.wallet_manager.create_purchase_transaction(
wallet.accounts, txo, exchange_rate_manager
)
+4
View File
@@ -303,6 +303,10 @@ class Stream(BaseClaim):
def has_fee(self) -> bool:
return self.message.HasField('fee')
@property
def has_source(self) -> bool:
return self.message.HasField('source')
@property
def source(self) -> Source:
return Source(self.message.source)
+4 -2
View File
@@ -46,8 +46,8 @@ types_map = {
'.ksh': ('text/plain', 'document'),
'.latex': ('application/x-latex', 'binary'),
'.m1v': ('video/mpeg', 'video'),
'.m3u': ('application/vnd.apple.mpegurl', 'audio'),
'.m3u8': ('application/vnd.apple.mpegurl', 'video'),
'.m3u': ('application/x-mpegurl', 'audio'),
'.m3u8': ('application/x-mpegurl', 'video'),
'.man': ('application/x-troff-man', 'document'),
'.markdown': ('text/markdown', 'document'),
'.md': ('text/markdown', 'document'),
@@ -66,6 +66,7 @@ types_map = {
'.mpeg': ('video/mpeg', 'video'),
'.mpg': ('video/mpeg', 'video'),
'.ms': ('application/x-troff-ms', 'binary'),
'.m4s': ('video/iso.segment', 'binary'),
'.nc': ('application/x-netcdf', 'binary'),
'.nws': ('message/rfc822', 'document'),
'.o': ('application/octet-stream', 'binary'),
@@ -119,6 +120,7 @@ types_map = {
'.tif': ('image/tiff', 'image'),
'.tiff': ('image/tiff', 'image'),
'.tr': ('application/x-troff', 'binary'),
'.ts': ('video/mp2t', 'video'),
'.tsv': ('text/tab-separated-values', 'document'),
'.txt': ('text/plain', 'document'),
'.ustar': ('application/x-ustar', 'binary'),
+37 -50
View File
@@ -5,74 +5,60 @@ from binascii import hexlify
from itertools import chain
from lbry.error import ResolveCensoredError
from lbry.schema.types.v2.result_pb2 import \
Outputs as OutputsMessage, \
Output as OutputMessage, \
Error as ErrorMessage
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
def set_reference(reference, txo_row):
if txo_row:
reference.tx_hash = txo_row['txo_hash'][:32]
reference.nout = struct.unpack('<I', txo_row['txo_hash'][32:])[0]
reference.height = txo_row['height']
class Censor:
__slots__ = 'streams', 'channels', 'limit_claims_per_channel', 'censored', 'claims_in_channel', 'total'
NOT_CENSORED = 0
SEARCH = 1
RESOLVE = 2
def __init__(self, streams: dict = None, channels: dict = None, limit_claims_per_channel: int = None):
self.streams = streams or {}
self.channels = channels or {}
self.limit_claims_per_channel = limit_claims_per_channel # doesn't count as censored
__slots__ = 'censor_type', 'censored'
def __init__(self, censor_type):
self.censor_type = censor_type
self.censored = {}
self.claims_in_channel = {}
self.total = 0
def is_censored(self, row):
return (row.get('censor_type') or self.NOT_CENSORED) >= self.censor_type
def apply(self, rows):
return [row for row in rows if not self.censor(row)]
def censor(self, row) -> bool:
was_censored = False
for claim_hash, lookup in (
(row['claim_hash'], self.streams),
(row['claim_hash'], self.channels),
(row['channel_hash'], self.channels),
(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
self.censored.setdefault(censoring_channel_hash, 0)
self.censored[censoring_channel_hash] += 1
break
if was_censored:
self.total += 1
if not was_censored and self.limit_claims_per_channel is not None and row['channel_hash']:
self.claims_in_channel.setdefault(row['channel_hash'], 0)
self.claims_in_channel[row['channel_hash']] += 1
if self.claims_in_channel[row['channel_hash']] > self.limit_claims_per_channel:
return True
return was_censored
if self.is_censored(row):
censoring_channel_hash = row['censoring_channel_hash']
self.censored.setdefault(censoring_channel_hash, set())
self.censored[censoring_channel_hash].add(row['tx_hash'])
return True
return False
def to_message(self, outputs: OutputsMessage, extra_txo_rows):
outputs.blocked_total = self.total
def to_message(self, outputs: OutputsMessage, extra_txo_rows: dict):
for censoring_channel_hash, count in self.censored.items():
blocked = outputs.blocked.add()
blocked.count = count
set_reference(blocked.channel, censoring_channel_hash, extra_txo_rows)
blocked.count = len(count)
set_reference(blocked.channel, extra_txo_rows.get(censoring_channel_hash))
outputs.blocked_total += len(count)
class Outputs:
__slots__ = 'txos', 'extra_txos', 'txs', 'offset', 'total', 'blocked', 'blocked_total'
def __init__(self, txos: List[OutputMessage], extra_txos: List, txs: set,
def __init__(self, txos: List, extra_txos: List, txs: set,
offset: int, total: int, blocked: List, blocked_total: int):
self.txos = txos
self.txs = txs
@@ -170,6 +156,7 @@ class Outputs:
@classmethod
def to_bytes(cls, txo_rows, extra_txo_rows, offset=0, total=None, blocked: Censor = None) -> bytes:
extra_txo_rows = {row['claim_hash']: row for row in extra_txo_rows}
page = OutputsMessage()
page.offset = offset
if total is not None:
@@ -178,12 +165,12 @@ class Outputs:
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:
for row in extra_txo_rows.values():
cls.row_to_message(row, page.extra_txos.add(), extra_txo_rows)
return page.SerializeToString()
@classmethod
def row_to_message(cls, txo, txo_message, extra_txo_rows):
def row_to_message(cls, txo, txo_message, extra_row_dict: dict):
if isinstance(txo, Exception):
txo_message.error.text = txo.args[0]
if isinstance(txo, ValueError):
@@ -192,7 +179,7 @@ class Outputs:
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)
set_reference(txo_message.error.blocked.channel, extra_row_dict.get(txo.censor_hash))
return
txo_message.tx_hash = txo['txo_hash'][:32]
txo_message.nout, = struct.unpack('<I', txo['txo_hash'][32:])
@@ -215,5 +202,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']
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)
set_reference(txo_message.claim.channel, extra_row_dict.get(txo['channel_hash']))
set_reference(txo_message.claim.repost, extra_row_dict.get(txo['reposted_claim_hash']))
+8
View File
@@ -55,6 +55,14 @@ class PathSegment(NamedTuple):
def normalized(self):
return normalize_name(self.name)
@property
def is_shortid(self):
return self.claim_id is not None and len(self.claim_id) < 40
@property
def is_fullid(self):
return self.claim_id is not None and len(self.claim_id) == 40
def to_dict(self):
q = {'name': self.name}
if self.claim_id is not None:
+2 -2
View File
@@ -183,11 +183,11 @@ class StreamDescriptor:
raise InvalidStreamDescriptorError("Does not decode as valid JSON")
if decoded['blobs'][-1]['length'] != 0:
raise InvalidStreamDescriptorError("Does not end with a zero-length blob.")
if any([blob_info['length'] == 0 for blob_info in decoded['blobs'][:-1]]):
if any(blob_info['length'] == 0 for blob_info in decoded['blobs'][:-1]):
raise InvalidStreamDescriptorError("Contains zero-length data blob")
if 'blob_hash' in decoded['blobs'][-1]:
raise InvalidStreamDescriptorError("Stream terminator blob should not have a hash")
if any([i != blob_info['blob_num'] for i, blob_info in enumerate(decoded['blobs'])]):
if any(i != blob_info['blob_num'] for i, blob_info in enumerate(decoded['blobs'])):
raise InvalidStreamDescriptorError("Stream contains out of order or skipped blobs")
descriptor = cls(
loop, blob_dir,
+22 -8
View File
@@ -23,12 +23,13 @@ from lbry.wallet.orchstr8.node import BlockchainNode, WalletNode
from lbry.extras.daemon.daemon import Daemon, jsonrpc_dumps_pretty
from lbry.extras.daemon.components import Component, WalletComponent
from lbry.extras.daemon.components import (
DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT
DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, LIBTORRENT_COMPONENT
)
from lbry.extras.daemon.componentmanager import ComponentManager
from lbry.extras.daemon.exchange_rate_manager import (
ExchangeRateManager, ExchangeRate, LBRYFeed, LBRYBTCFeed
ExchangeRateManager, ExchangeRate, BittrexBTCFeed, BittrexUSDFeed
)
from lbry.extras.daemon.storage import SQLiteStorage
from lbry.blob.blob_manager import BlobManager
@@ -83,6 +84,7 @@ class AsyncioTestCase(unittest.TestCase):
# https://bugs.python.org/issue32972
LOOP_SLOW_CALLBACK_DURATION = 0.2
TIMEOUT = 120.0
maxDiff = None
@@ -136,6 +138,8 @@ class AsyncioTestCase(unittest.TestCase):
with outcome.testPartExecutor(self, isTest=True):
maybe_coroutine = testMethod()
if asyncio.iscoroutine(maybe_coroutine):
if self.TIMEOUT:
self.loop.call_later(self.TIMEOUT, self.cancel)
self.loop.run_until_complete(maybe_coroutine)
outcome.expecting_failure = False
with outcome.testPartExecutor(self):
@@ -188,6 +192,12 @@ class AsyncioTestCase(unittest.TestCase):
if asyncio.iscoroutine(maybe_coroutine):
self.loop.run_until_complete(maybe_coroutine)
def cancel(self):
for task in asyncio.all_tasks(self.loop):
if not task.done():
task.print_stack()
task.cancel()
class AdvanceTimeTestCase(AsyncioTestCase):
@@ -281,8 +291,8 @@ class FakeExchangeRateManager(ExchangeRateManager):
def get_fake_exchange_rate_manager(rates=None):
return FakeExchangeRateManager(
[LBRYFeed(), LBRYBTCFeed()],
rates or {'BTCLBC': 3.0, 'USDBTC': 2.0}
[BittrexBTCFeed(), BittrexUSDFeed()],
rates or {'BTCLBC': 3.0, 'USDLBC': 2.0}
)
@@ -320,6 +330,7 @@ class CommandTestCase(IntegrationTestCase):
self.server_blob_manager = None
self.server = None
self.reflector = None
self.skip_libtorrent = True
async def asyncSetUp(self):
await super().asyncSetUp()
@@ -395,6 +406,8 @@ class CommandTestCase(IntegrationTestCase):
DHT_COMPONENT, UPNP_COMPONENT, HASH_ANNOUNCER_COMPONENT,
PEER_PROTOCOL_SERVER_COMPONENT
]
if self.skip_libtorrent:
conf.components_to_skip.append(LIBTORRENT_COMPONENT)
wallet_node.manager.config = conf
def wallet_maker(component_manager):
@@ -406,7 +419,7 @@ class CommandTestCase(IntegrationTestCase):
daemon = Daemon(conf, ComponentManager(
conf, skip_components=conf.components_to_skip, wallet=wallet_maker,
exchange_rate_manager=partial(ExchangeRateManagerComponent, rates={
'BTCLBC': 1.0, 'USDBTC': 2.0
'BTCLBC': 1.0, 'USDLBC': 2.0
})
))
await daemon.initialize()
@@ -435,8 +448,9 @@ class CommandTestCase(IntegrationTestCase):
async def generate(self, blocks):
""" Ask lbrycrd to generate some blocks and wait until ledger has them. """
prepare = self.ledger.on_header.where(self.blockchain.is_expected_block)
await self.blockchain.generate(blocks)
await self.ledger.on_header.where(self.blockchain.is_expected_block)
await prepare # no guarantee that it didn't happen already, so start waiting from before calling generate
async def blockchain_claim_name(self, name: str, value: str, amount: str, confirm=True):
txid = await self.blockchain._cli_cmnd('claimname', name, value, amount)
@@ -476,7 +490,7 @@ class CommandTestCase(IntegrationTestCase):
async def stream_create(
self, name='hovercraft', bid='1.0', file_path=None,
data=b'hi!', confirm=True, prefix=None, suffix=None, **kwargs):
if file_path is None:
if file_path is None and data is not None:
file_path = self.create_upload_file(data=data, prefix=prefix, suffix=suffix)
return await self.confirm_and_render(
self.daemon.jsonrpc_stream_create(name, bid, file_path=file_path, **kwargs), confirm
+127 -12
View File
@@ -105,10 +105,6 @@ def check_connection(server="lbry.com", port=80, timeout=5) -> bool:
return False
async def async_check_connection(server="lbry.com", port=80, timeout=1) -> bool:
return await asyncio.get_event_loop().run_in_executor(None, check_connection, server, port, timeout)
def random_string(length=10, chars=string.ascii_lowercase):
return ''.join([random.choice(chars) for _ in range(length)])
@@ -192,6 +188,8 @@ def cache_concurrent(async_fn):
async def resolve_host(url: str, port: int, proto: str) -> str:
if proto not in ['udp', 'tcp']:
raise Exception("invalid protocol")
if url.lower() == 'localhost':
return '127.0.0.1'
try:
if ipaddress.ip_address(url):
return url
@@ -206,7 +204,7 @@ async def resolve_host(url: str, port: int, proto: str) -> str:
))[0][4][0]
class LRUCache:
class LRUCacheWithMetrics:
__slots__ = [
'capacity',
'cache',
@@ -231,7 +229,7 @@ class LRUCache:
f"{metric_name}_cache_miss_count", "Number of cache misses", namespace=namespace
)
except ValueError as err:
log.warning("failed to set up prometheus %s_cache_miss_count metric: %s", metric_name, err)
log.debug("failed to set up prometheus %s_cache_miss_count metric: %s", metric_name, err)
self._track_metrics = False
self.hits = self.misses = None
@@ -286,12 +284,63 @@ class LRUCache:
pass
class LRUCache:
__slots__ = [
'capacity',
'cache'
]
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = collections.OrderedDict()
def get(self, key, default=None):
try:
value = self.cache.pop(key)
except KeyError:
return default
self.cache[key] = value
return value
def set(self, key, value):
try:
self.cache.pop(key)
except KeyError:
if len(self.cache) >= self.capacity:
self.cache.popitem(last=False)
self.cache[key] = value
def clear(self):
self.cache.clear()
def pop(self, key):
return self.cache.pop(key)
def __setitem__(self, key, value):
return self.set(key, value)
def __getitem__(self, item):
return self.get(item)
def __contains__(self, item) -> bool:
return item in self.cache
def __len__(self):
return len(self.cache)
def __delitem__(self, key):
self.cache.pop(key)
def __del__(self):
self.clear()
def lru_cache_concurrent(cache_size: typing.Optional[int] = None,
override_lru_cache: typing.Optional[LRUCache] = None):
override_lru_cache: typing.Optional[LRUCacheWithMetrics] = None):
if not cache_size and override_lru_cache is None:
raise ValueError("invalid cache size")
concurrent_cache = {}
lru_cache = override_lru_cache if override_lru_cache is not None else LRUCache(cache_size)
lru_cache = override_lru_cache if override_lru_cache is not None else LRUCacheWithMetrics(cache_size)
def wrapper(async_fn):
@@ -322,18 +371,84 @@ def get_ssl_context() -> ssl.SSLContext:
@contextlib.asynccontextmanager
async def aiohttp_request(method, url, **kwargs) -> typing.AsyncContextManager[aiohttp.ClientResponse]:
async with aiohttp.ClientSession() as session:
async with session.request(method, url, ssl=get_ssl_context(), **kwargs) as response:
async with session.request(method, url, **kwargs) as response:
yield response
async def get_external_ip() -> typing.Optional[str]: # used if upnp is disabled or non-functioning
# the ipaddress module does not show these subnets as reserved
CARRIER_GRADE_NAT_SUBNET = ipaddress.ip_network('100.64.0.0/10')
IPV4_TO_6_RELAY_SUBNET = ipaddress.ip_network('192.88.99.0/24')
def is_valid_public_ipv4(address, allow_localhost: bool = False):
try:
parsed_ip = ipaddress.ip_address(address)
if parsed_ip.is_loopback and allow_localhost:
return True
if any((parsed_ip.version != 4, parsed_ip.is_unspecified, parsed_ip.is_link_local, parsed_ip.is_loopback,
parsed_ip.is_multicast, parsed_ip.is_reserved, parsed_ip.is_private, parsed_ip.is_reserved)):
return False
else:
return not any((CARRIER_GRADE_NAT_SUBNET.supernet_of(ipaddress.ip_network(f"{address}/32")),
IPV4_TO_6_RELAY_SUBNET.supernet_of(ipaddress.ip_network(f"{address}/32"))))
except (ipaddress.AddressValueError, ValueError):
return False
async def fallback_get_external_ip(): # used if spv servers can't be used for ip detection
try:
async with aiohttp_request("get", "https://api.lbry.com/ip") as resp:
response = await resp.json()
if response['success']:
return response['data']['ip']
return response['data']['ip'], None
except Exception:
return
return None, None
async def _get_external_ip(default_servers) -> typing.Tuple[typing.Optional[str], typing.Optional[str]]:
# used if upnp is disabled or non-functioning
from lbry.wallet.server.udp import SPVStatusClientProtocol # pylint: disable=C0415
hostname_to_ip = {}
ip_to_hostnames = collections.defaultdict(list)
async def resolve_spv(server, port):
try:
server_addr = await resolve_host(server, port, 'udp')
hostname_to_ip[server] = (server_addr, port)
ip_to_hostnames[(server_addr, port)].append(server)
except Exception:
log.exception("error looking up dns for spv servers")
# accumulate the dns results
await asyncio.gather(*(resolve_spv(server, port) for (server, port) in default_servers))
loop = asyncio.get_event_loop()
pong_responses = asyncio.Queue()
connection = SPVStatusClientProtocol(pong_responses)
try:
await loop.create_datagram_endpoint(lambda: connection, ('0.0.0.0', 0))
# could raise OSError if it cant bind
randomized_servers = list(ip_to_hostnames.keys())
random.shuffle(randomized_servers)
for server in randomized_servers:
connection.ping(server)
try:
_, pong = await asyncio.wait_for(pong_responses.get(), 1)
if is_valid_public_ipv4(pong.ip_address):
return pong.ip_address, ip_to_hostnames[server][0]
except asyncio.TimeoutError:
pass
return None, None
finally:
connection.close()
async def get_external_ip(default_servers) -> typing.Tuple[typing.Optional[str], typing.Optional[str]]:
ip_from_spv_servers = await _get_external_ip(default_servers)
if not ip_from_spv_servers[1]:
return await fallback_get_external_ip()
return ip_from_spv_servers
def is_running_from_bundle():
+9 -31
View File
@@ -5,7 +5,6 @@ import logging
import typing
import asyncio
import random
from functools import partial
from hashlib import sha256
from string import hexdigits
from typing import Type, Dict, Tuple, Optional, Any, List
@@ -16,7 +15,7 @@ from lbry.crypto.crypt import aes_encrypt, aes_decrypt
from .bip32 import PrivateKey, PubKey, from_extended_key_string
from .mnemonic import Mnemonic
from .constants import COIN, CLAIM_TYPES, TXO_TYPES
from .constants import COIN, TXO_TYPES
from .transaction import Transaction, Input, Output
if typing.TYPE_CHECKING:
@@ -566,35 +565,14 @@ class Account:
if gap_changed:
self.wallet.save()
async def get_detailed_balance(self, confirmations=0, reserved_subtotals=False, read_only=False):
tips_balance, supports_balance, claims_balance = 0, 0, 0
get_total_balance = partial(self.get_balance, read_only=read_only, confirmations=confirmations,
include_claims=True)
total = await get_total_balance()
if reserved_subtotals:
claims_balance = await get_total_balance(txo_type__in=CLAIM_TYPES)
for txo in await self.get_support_summary():
if confirmations > 0 and not 0 < txo.tx_ref.height <= self.ledger.headers.height - (confirmations - 1):
continue
if txo.is_my_input:
supports_balance += txo.amount
else:
tips_balance += txo.amount
reserved = claims_balance + supports_balance + tips_balance
else:
reserved = await self.get_balance(
confirmations=confirmations, include_claims=True, txo_type__gt=0
)
return {
'total': total,
'available': total - reserved,
'reserved': reserved,
'reserved_subtotals': {
'claims': claims_balance,
'supports': supports_balance,
'tips': tips_balance
} if reserved_subtotals else None
}
async def get_detailed_balance(self, confirmations=0, read_only=False):
constraints = {}
if confirmations > 0:
height = self.ledger.headers.height - (confirmations-1)
constraints.update({'height__lte': height, 'height__gt': 0})
return await self.ledger.db.get_detailed_balance(
accounts=[self], read_only=read_only, **constraints
)
def get_transaction_history(self, read_only=False, **constraints):
return self.ledger.get_transaction_history(
+84 -29
View File
@@ -387,14 +387,31 @@ def interpolate(sql, values):
return sql
def constrain_single_or_list(constraints, column, value, convert=lambda x: x):
def constrain_single_or_list(constraints, column, value, convert=lambda x: x, negate=False):
if value is not None:
if isinstance(value, list):
value = [convert(v) for v in value]
if len(value) == 1:
constraints[column] = value[0]
if negate:
constraints[f"{column}__or"] = {
f"{column}__is_null": True,
f"{column}__not": value[0]
}
else:
constraints[column] = value[0]
elif len(value) > 1:
constraints[f"{column}__in"] = value
if negate:
constraints[f"{column}__or"] = {
f"{column}__is_null": True,
f"{column}__not_in": value
}
else:
constraints[f"{column}__in"] = value
elif negate:
constraints[f"{column}__or"] = {
f"{column}__is_null": True,
f"{column}__not": convert(value)
}
else:
constraints[column] = convert(value)
return constraints
@@ -687,6 +704,9 @@ class Database(SQLiteMixin):
row['txo_type'] = TXO_TYPES['stream']
elif txo.is_support:
row['txo_type'] = TXO_TYPES['support']
support = txo.can_decode_support
if support and support.is_signed:
row['channel_id'] = support.signing_channel_id
elif txo.purchase is not None:
row['txo_type'] = TXO_TYPES['purchase']
row['claim_id'] = txo.purchased_claim_id
@@ -945,16 +965,18 @@ class Database(SQLiteMixin):
sql.append("LEFT JOIN txi ON (txi.position=0 AND txi.txid=txo.txid)")
return await self.db.execute_fetchall(*query(' '.join(sql), **constraints), read_only=read_only)
async def get_txos(self, wallet=None, no_tx=False, read_only=False, **constraints):
async def get_txos(self, wallet=None, no_tx=False, no_channel_info=False, read_only=False, **constraints):
include_is_spent = constraints.get('include_is_spent', False)
include_is_my_input = constraints.get('include_is_my_input', False)
include_is_my_output = constraints.pop('include_is_my_output', False)
include_received_tips = constraints.pop('include_received_tips', False)
select_columns = [
"tx.txid, raw, tx.height, tx.position as tx_position, tx.is_verified, "
"tx.txid, tx.height, tx.position as tx_position, tx.is_verified, "
"txo_type, txo.position as txo_position, amount, script"
]
if not no_tx:
select_columns.append("raw")
my_accounts = {a.public_key.address for a in wallet.accounts} if wallet else set()
my_accounts_sql = ""
@@ -1032,32 +1054,33 @@ class Database(SQLiteMixin):
txo.received_tips = row['received_tips']
txos.append(txo)
channel_ids = set()
for txo in txos:
if txo.is_claim and txo.can_decode_claim:
if txo.claim.is_signed:
channel_ids.add(txo.claim.signing_channel_id)
if txo.claim.is_channel and wallet:
for account in wallet.accounts:
private_key = await account.get_channel_private_key(
txo.claim.channel.public_key_bytes
)
if private_key:
txo.private_key = private_key
break
if channel_ids:
channels = {
txo.claim_id: txo for txo in
(await self.get_channels(
wallet=wallet,
claim_id__in=channel_ids,
read_only=read_only
))
}
if not no_channel_info:
channel_ids = set()
for txo in txos:
if txo.is_claim and txo.can_decode_claim:
txo.channel = channels.get(txo.claim.signing_channel_id, None)
if txo.claim.is_signed:
channel_ids.add(txo.claim.signing_channel_id)
if txo.claim.is_channel and wallet:
for account in wallet.accounts:
private_key = await account.get_channel_private_key(
txo.claim.channel.public_key_bytes
)
if private_key:
txo.private_key = private_key
break
if channel_ids:
channels = {
txo.claim_id: txo for txo in
(await self.get_channels(
wallet=wallet,
claim_id__in=channel_ids,
read_only=read_only
))
}
for txo in txos:
if txo.is_claim and txo.can_decode_claim:
txo.channel = channels.get(txo.claim.signing_channel_id, None)
return txos
@@ -1119,6 +1142,38 @@ class Database(SQLiteMixin):
)
return balance[0]['total'] or 0
async def get_detailed_balance(self, accounts, read_only=False, **constraints):
constraints['accounts'] = accounts
result = (await self.select_txos(
f"COALESCE(SUM(amount), 0) AS total,"
f"COALESCE(SUM(CASE WHEN txo_type != {TXO_TYPES['other']} THEN amount ELSE 0 END), 0) AS reserved,"
f"COALESCE(SUM("
f" CASE WHEN"
f" txo_type IN ({','.join(map(str, CLAIM_TYPES))})"
f" THEN amount ELSE 0 END), 0) AS claims,"
f"COALESCE(SUM(CASE WHEN txo_type = {TXO_TYPES['support']} THEN amount ELSE 0 END), 0) AS supports,"
f"COALESCE(SUM("
f" CASE WHEN"
f" txo_type = {TXO_TYPES['support']} AND"
f" TXI.address IS NOT NULL AND"
f" TXI.address IN (SELECT address FROM account_address WHERE account = :$account__in0)"
f" THEN amount ELSE 0 END), 0) AS my_supports",
is_spent=False,
include_is_my_input=True,
read_only=read_only,
**constraints
))[0]
return {
"total": result["total"],
"available": result["total"] - result["reserved"],
"reserved": result["reserved"],
"reserved_subtotals": {
"claims": result["claims"],
"supports": result["my_supports"],
"tips": result["supports"] - result["my_supports"]
}
}
async def select_addresses(self, cols, read_only=False, **constraints):
return await self.db.execute_fetchall(*query(
f"SELECT {cols} FROM pubkey_address JOIN account_address USING (address)",
+33 -8
View File
@@ -14,7 +14,7 @@ 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
from lbry.utils import LRUCache
from lbry.utils import LRUCacheWithMetrics
from .tasks import TaskGroup
from .database import Database
@@ -155,7 +155,7 @@ class Ledger(metaclass=LedgerRegistry):
self._on_ready_controller = StreamController()
self.on_ready = self._on_ready_controller.stream
self._tx_cache = LRUCache(self.config.get("tx_cache_size", 1024), metric_name='tx')
self._tx_cache = LRUCacheWithMetrics(self.config.get("tx_cache_size", 1024), metric_name='tx')
self._update_tasks = TaskGroup()
self._other_tasks = TaskGroup() # that we dont need to start
self._utxo_reservation_lock = asyncio.Lock()
@@ -167,7 +167,7 @@ class Ledger(metaclass=LedgerRegistry):
self._known_addresses_out_of_sync = set()
self.fee_per_name_char = self.config.get('fee_per_name_char', self.default_fee_per_name_char)
self._balance_cache = LRUCache(2 ** 15)
self._balance_cache = LRUCacheWithMetrics(2 ** 15)
@classmethod
def get_id(cls):
@@ -231,7 +231,7 @@ class Ledger(metaclass=LedgerRegistry):
async def get_effective_amount_estimators(self, funding_accounts: Iterable[Account]):
estimators = []
for account in funding_accounts:
utxos = await account.get_utxos()
utxos = await account.get_utxos(no_tx=True, no_channel_info=True)
for utxo in utxos:
estimators.append(utxo.get_estimator(self))
return estimators
@@ -538,7 +538,7 @@ class Ledger(metaclass=LedgerRegistry):
"request %i transactions, %i/%i for %s are already synced", len(to_request), len(already_synced),
len(remote_history), address
)
remote_history_txids = set(txid for txid, _ in remote_history)
remote_history_txids = {txid for txid, _ in remote_history}
async for tx in self.request_synced_transactions(to_request, remote_history_txids, address):
pending_synced_history[tx_indexes[tx.id]] = f"{tx.id}:{tx.height}:"
if len(pending_synced_history) % 100 == 0:
@@ -937,6 +937,11 @@ class Ledger(metaclass=LedgerRegistry):
return self.db.get_purchase_count(**constraints)
async def _resolve_for_local_results(self, accounts, txos):
txos = await self._resolve_for_local_claim_results(accounts, txos)
txos = await self._resolve_for_local_support_results(accounts, txos)
return txos
async def _resolve_for_local_claim_results(self, accounts, txos):
results = []
response = await self.resolve(
accounts, [txo.permanent_url for txo in txos if txo.can_decode_claim]
@@ -952,6 +957,23 @@ class Ledger(metaclass=LedgerRegistry):
results.append(txo)
return results
async def _resolve_for_local_support_results(self, accounts, txos):
channel_ids = set()
signed_support_txos = []
for txo in txos:
support = txo.can_decode_support
if support and support.signing_channel_id:
channel_ids.add(support.signing_channel_id)
signed_support_txos.append(txo)
if channel_ids:
channels = {
channel.claim_id: channel for channel in
(await self.claim_search(accounts, claim_ids=list(channel_ids)))[0]
}
for txo in signed_support_txos:
txo.channel = channels.get(txo.support.signing_channel_id)
return txos
async def get_claims(self, resolve=False, **constraints):
claims = await self.db.get_claims(**constraints)
if resolve:
@@ -1000,8 +1022,10 @@ class Ledger(metaclass=LedgerRegistry):
claims.append(None)
return claims
async def get_collections(self, resolve_claims=0, **constraints):
async def get_collections(self, resolve_claims=0, resolve=False, **constraints):
collections = await self.db.get_collections(**constraints)
if resolve:
collections = await self._resolve_for_local_results(constraints.get('accounts', []), collections)
if resolve_claims > 0:
for collection in collections:
collection.claims = await self.resolve_collection(collection, page_size=resolve_claims)
@@ -1036,7 +1060,7 @@ class Ledger(metaclass=LedgerRegistry):
'abandon_info': [],
'purchase_info': []
}
is_my_inputs = all([txi.is_my_input for txi in tx.inputs])
is_my_inputs = all(txi.is_my_input for txi in tx.inputs)
if is_my_inputs:
# fees only matter if we are the ones paying them
item['value'] = dewies_to_lbc(tx.net_account_balance + tx.fee)
@@ -1147,7 +1171,7 @@ class Ledger(metaclass=LedgerRegistry):
balance = self._balance_cache.get(account.id)
if not balance:
balance = self._balance_cache[account.id] = \
await account.get_detailed_balance(confirmations, reserved_subtotals=True)
await account.get_detailed_balance(confirmations)
for key, value in balance.items():
if key == 'reserved_subtotals':
for subkey, subvalue in value.items():
@@ -1156,6 +1180,7 @@ class Ledger(metaclass=LedgerRegistry):
result[key] += value
return result
class TestNetLedger(Ledger):
network_name = 'testnet'
pubkey_address_prefix = bytes((111,))
+189 -177
View File
@@ -1,26 +1,28 @@
import logging
import asyncio
import json
import socket
import random
from time import perf_counter
from operator import itemgetter
from collections import defaultdict
from typing import Dict, Optional, Tuple
import aiohttp
from lbry import __version__
from lbry.utils import resolve_host
from lbry.error import IncompatibleWalletServerError
from lbry.wallet.rpc import RPCSession as BaseClientSession, Connector, RPCError, ProtocolError
from lbry.wallet.stream import StreamController
from lbry.wallet.server.udp import SPVStatusClientProtocol, SPVPong
log = logging.getLogger(__name__)
class ClientSession(BaseClientSession):
def __init__(self, *args, network, server, timeout=30, on_connect_callback=None, **kwargs):
def __init__(self, *args, network: 'Network', server, timeout=30, **kwargs):
self.network = network
self.server = server
super().__init__(*args, **kwargs)
self._on_disconnect_controller = StreamController()
self.on_disconnected = self._on_disconnect_controller.stream
self.framer.max_size = self.max_errors = 1 << 32
self.timeout = timeout
self.max_seconds_idle = timeout * 2
@@ -28,8 +30,6 @@ class ClientSession(BaseClientSession):
self.connection_latency: Optional[float] = None
self._response_samples = 0
self.pending_amount = 0
self._on_connect_cb = on_connect_callback or (lambda: None)
self.trigger_urgent_reconnect = asyncio.Event()
@property
def available(self):
@@ -56,7 +56,7 @@ class ClientSession(BaseClientSession):
async def send_request(self, method, args=()):
self.pending_amount += 1
log.debug("send %s%s to %s:%i", method, tuple(args), *self.server)
log.debug("send %s%s to %s:%i (%i timeout)", method, tuple(args), self.server[0], self.server[1], self.timeout)
try:
if method == 'server.version':
return await self.send_timed_server_version_request(args, self.timeout)
@@ -67,7 +67,7 @@ class ClientSession(BaseClientSession):
log.debug("Time since last packet: %s", perf_counter() - self.last_packet_received)
if (perf_counter() - self.last_packet_received) < self.timeout:
continue
log.info("timeout sending %s to %s:%i", method, *self.server)
log.warning("timeout sending %s to %s:%i", method, *self.server)
raise asyncio.TimeoutError
if done:
try:
@@ -87,44 +87,12 @@ class ClientSession(BaseClientSession):
self.synchronous_close()
raise
except asyncio.CancelledError:
log.info("cancelled sending %s to %s:%i", method, *self.server)
log.warning("cancelled sending %s to %s:%i", method, *self.server)
# self.synchronous_close()
raise
finally:
self.pending_amount -= 1
async def ensure_session(self):
# Handles reconnecting and maintaining a session alive
# TODO: change to 'ping' on newer protocol (above 1.2)
retry_delay = default_delay = 1.0
while True:
try:
if self.is_closing():
await self.create_connection(self.timeout)
await self.ensure_server_version()
self._on_connect_cb()
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:
await self.close()
log.debug("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message)
retry_delay = 60 * 60
except IncompatibleWalletServerError:
await self.close()
retry_delay = 60 * 60
log.debug("Wallet server has an incompatible version, retrying in 1h: %s:%d", *self.server)
except (asyncio.TimeoutError, OSError):
await self.close()
retry_delay = min(60, retry_delay * 2)
log.debug("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
try:
await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay)
except asyncio.TimeoutError:
pass
finally:
self.trigger_urgent_reconnect.clear()
async def ensure_server_version(self, required=None, timeout=3):
required = required or self.network.PROTOCOL_VERSION
response = await asyncio.wait_for(
@@ -134,6 +102,25 @@ class ClientSession(BaseClientSession):
raise IncompatibleWalletServerError(*self.server)
return response
async def keepalive_loop(self, timeout=3, max_idle=60):
try:
while True:
now = perf_counter()
if min(self.last_send, self.last_packet_received) + max_idle < now:
await asyncio.wait_for(
self.send_request('server.ping', []), timeout=timeout
)
else:
await asyncio.sleep(max(0, max_idle - (now - self.last_send)))
except Exception as err:
if isinstance(err, asyncio.CancelledError):
log.warning("closing connection to %s:%i", *self.server)
else:
log.exception("lost connection to spv")
finally:
if not self.is_closing():
self._close()
async def create_connection(self, timeout=6):
connector = Connector(lambda: self, *self.server)
start = perf_counter()
@@ -145,12 +132,14 @@ class ClientSession(BaseClientSession):
controller.add(request.args)
def connection_lost(self, exc):
log.debug("Connection lost: %s:%d", *self.server)
log.warning("Connection lost: %s:%d", *self.server)
super().connection_lost(exc)
self.response_time = None
self.connection_latency = None
self._response_samples = 0
self._on_disconnect_controller.add(True)
# self._on_disconnect_controller.add(True)
if self.network:
self.network.disconnect()
class Network:
@@ -160,10 +149,9 @@ class Network:
def __init__(self, ledger):
self.ledger = ledger
self.session_pool = SessionPool(network=self, timeout=self.config.get('connect_timeout', 6))
self.client: Optional[ClientSession] = None
self.server_features = None
self._switch_task: Optional[asyncio.Task] = None
# self._switch_task: Optional[asyncio.Task] = None
self.running = False
self.remote_height: int = 0
self._concurrency = asyncio.Semaphore(16)
@@ -183,58 +171,176 @@ class Network:
}
self.aiohttp_session: Optional[aiohttp.ClientSession] = None
self._urgent_need_reconnect = asyncio.Event()
self._loop_task: Optional[asyncio.Task] = None
self._keepalive_task: Optional[asyncio.Task] = None
@property
def config(self):
return self.ledger.config
async def switch_forever(self):
while self.running:
if self.is_connected:
await self.client.on_disconnected.first
self.server_features = None
self.client = None
continue
self.client = await self.session_pool.wait_for_fastest_session()
log.info("Switching to SPV wallet server: %s:%d", *self.client.server)
try:
self.server_features = await self.get_server_features()
self._update_remote_height((await self.subscribe_headers(),))
self._on_connected_controller.add(True)
log.info("Subscribed to headers: %s:%d", *self.client.server)
except (asyncio.TimeoutError, ConnectionError):
log.info("Switching to %s:%d timed out, closing and retrying.", *self.client.server)
self.client.synchronous_close()
self.server_features = None
self.client = None
def disconnect(self):
if self._keepalive_task and not self._keepalive_task.done():
self._keepalive_task.cancel()
self._keepalive_task = None
async def start(self):
self.running = True
self.aiohttp_session = aiohttp.ClientSession()
self._switch_task = asyncio.ensure_future(self.switch_forever())
# this may become unnecessary when there are no more bugs found,
# but for now it helps understanding log reports
self._switch_task.add_done_callback(lambda _: log.info("Wallet client switching task stopped."))
self.session_pool.start(self.config['default_servers'])
self.on_header.listen(self._update_remote_height)
if not self.running:
self.running = True
self.aiohttp_session = aiohttp.ClientSession()
self.on_header.listen(self._update_remote_height)
self._loop_task = asyncio.create_task(self.network_loop())
self._urgent_need_reconnect.set()
def loop_task_done_callback(f):
try:
f.result()
except Exception:
if self.running:
log.exception("wallet server connection loop crashed")
self._loop_task.add_done_callback(loop_task_done_callback)
async def resolve_spv_dns(self):
hostname_to_ip = {}
ip_to_hostnames = defaultdict(list)
async def resolve_spv(server, port):
try:
server_addr = await resolve_host(server, port, 'udp')
hostname_to_ip[server] = (server_addr, port)
ip_to_hostnames[(server_addr, port)].append(server)
except socket.error:
log.warning("error looking up dns for spv server %s:%i", server, port)
except Exception:
log.exception("error looking up dns for spv server %s:%i", server, port)
# accumulate the dns results
await asyncio.gather(*(resolve_spv(server, port) for (server, port) in self.config['default_servers']))
return hostname_to_ip, ip_to_hostnames
async def get_n_fastest_spvs(self, timeout=3.0) -> Dict[Tuple[str, int], Optional[SPVPong]]:
loop = asyncio.get_event_loop()
pong_responses = asyncio.Queue()
connection = SPVStatusClientProtocol(pong_responses)
sent_ping_timestamps = {}
_, ip_to_hostnames = await self.resolve_spv_dns()
n = len(ip_to_hostnames)
log.info("%i possible spv servers to try (%i urls in config)", n, len(self.config['default_servers']))
pongs = {}
try:
await loop.create_datagram_endpoint(lambda: connection, ('0.0.0.0', 0))
# could raise OSError if it cant bind
start = perf_counter()
for server in ip_to_hostnames:
connection.ping(server)
sent_ping_timestamps[server] = perf_counter()
while len(pongs) < n:
(remote, ts), pong = await asyncio.wait_for(pong_responses.get(), timeout - (perf_counter() - start))
latency = ts - start
log.info("%s:%i has latency of %sms (available: %s, height: %i)",
'/'.join(ip_to_hostnames[remote]), remote[1], round(latency * 1000, 2),
pong.available, pong.height)
if pong.available:
pongs[(ip_to_hostnames[remote][0], remote[1])] = pong
return pongs
except asyncio.TimeoutError:
if pongs:
log.info("%i/%i probed spv servers are accepting connections", len(pongs), len(ip_to_hostnames))
return pongs
else:
log.warning("%i spv status probes failed, retrying later. servers tried: %s",
len(sent_ping_timestamps),
', '.join('/'.join(hosts) + f' ({ip})' for ip, hosts in ip_to_hostnames.items()))
random_server = random.choice(list(ip_to_hostnames.keys()))
host, port = random_server
log.warning("trying fallback to randomly selected spv: %s:%i", host, port)
return {(host, port): None}
finally:
connection.close()
async def connect_to_fastest(self) -> Optional[ClientSession]:
fastest_spvs = await self.get_n_fastest_spvs()
for (host, port) in fastest_spvs:
client = ClientSession(network=self, server=(host, port))
try:
await client.create_connection()
log.warning("Connected to spv server %s:%i", host, port)
await client.ensure_server_version()
return client
except (asyncio.TimeoutError, ConnectionError, OSError, IncompatibleWalletServerError, RPCError):
log.warning("Connecting to %s:%d failed", host, port)
client._close()
return
async def network_loop(self):
sleep_delay = 30
while self.running:
await asyncio.wait(
[asyncio.sleep(30), self._urgent_need_reconnect.wait()], return_when=asyncio.FIRST_COMPLETED
)
if self._urgent_need_reconnect.is_set():
sleep_delay = 30
self._urgent_need_reconnect.clear()
if not self.is_connected:
client = await self.connect_to_fastest()
if not client:
log.warning("failed to connect to any spv servers, retrying later")
sleep_delay *= 2
sleep_delay = min(sleep_delay, 300)
continue
log.debug("get spv server features %s:%i", *client.server)
features = await client.send_request('server.features', [])
self.client, self.server_features = client, features
log.info("subscribe to headers %s:%i", *client.server)
self._update_remote_height((await self.subscribe_headers(),))
self._on_connected_controller.add(True)
server_str = "%s:%i" % client.server
log.info("maintaining connection to spv server %s", server_str)
self._keepalive_task = asyncio.create_task(self.client.keepalive_loop())
try:
if not self._urgent_need_reconnect.is_set():
await asyncio.wait(
[self._keepalive_task, self._urgent_need_reconnect.wait()],
return_when=asyncio.FIRST_COMPLETED
)
else:
await self._keepalive_task
if self._urgent_need_reconnect.is_set():
log.warning("urgent reconnect needed")
self._urgent_need_reconnect.clear()
if self._keepalive_task and not self._keepalive_task.done():
self._keepalive_task.cancel()
except asyncio.CancelledError:
pass
finally:
self._keepalive_task = None
self.client = None
self.server_features = None
log.warning("connection lost to %s", server_str)
log.info("network loop finished")
async def stop(self):
if self.running:
self.running = False
self.running = False
self.disconnect()
if self._loop_task and not self._loop_task.done():
self._loop_task.cancel()
self._loop_task = None
if self.aiohttp_session:
await self.aiohttp_session.close()
self._switch_task.cancel()
self.session_pool.stop()
self.aiohttp_session = None
@property
def is_connected(self):
return self.client and not self.client.is_closing()
def rpc(self, list_or_method, args, restricted=True, session=None):
session = session or (self.client if restricted else self.session_pool.fastest_session)
if session and not session.is_closing():
def rpc(self, list_or_method, args, restricted=True, session: Optional[ClientSession] = None):
if session or self.is_connected:
session = session or self.client
return session.send_request(list_or_method, args)
else:
self.session_pool.trigger_nodelay_connect()
self._urgent_need_reconnect.set()
raise ConnectionError("Attempting to send rpc request when connection is not available.")
async def retriable_call(self, function, *args, **kwargs):
@@ -242,14 +348,15 @@ class Network:
while self.running:
if not self.is_connected:
log.warning("Wallet server unavailable, waiting for it to come back and retry.")
self._urgent_need_reconnect.set()
await self.on_connected.first
await self.session_pool.wait_for_fastest_session()
try:
return await function(*args, **kwargs)
except asyncio.TimeoutError:
log.warning("Wallet server call timed out, retrying.")
except ConnectionError:
pass
log.warning("connection error")
raise asyncio.CancelledError() # if we got here, we are shutting down
def _update_remote_height(self, header_args):
@@ -312,9 +419,6 @@ class Network:
def get_server_features(self):
return self.rpc('server.features', (), restricted=True)
def get_claims_by_ids(self, claim_ids):
return self.rpc('blockchain.claimtrie.getclaimsbyids', claim_ids)
def resolve(self, urls, session_override=None):
return self.rpc('blockchain.claimtrie.resolve', urls, False, session_override)
@@ -339,95 +443,3 @@ class Network:
async with self.aiohttp_session.post(server, json=message) as r:
result = await r.json()
return result['result']
class SessionPool:
def __init__(self, network: Network, timeout: float):
self.network = network
self.sessions: Dict[ClientSession, Optional[asyncio.Task]] = dict()
self.timeout = timeout
self.new_connection_event = asyncio.Event()
@property
def online(self):
return any(not session.is_closing() for session in self.sessions)
@property
def available_sessions(self):
return (session for session in self.sessions if session.available)
@property
def fastest_session(self):
if not self.online:
return None
return min(
[((session.response_time + session.connection_latency) * (session.pending_amount + 1), session)
for session in self.available_sessions] or [(0, None)],
key=itemgetter(0)
)[1]
def _get_session_connect_callback(self, session: ClientSession):
loop = asyncio.get_event_loop()
def callback():
duplicate_connections = [
s for s in self.sessions
if s is not session and s.server_address_and_port == session.server_address_and_port
]
already_connected = None if not duplicate_connections else duplicate_connections[0]
if already_connected:
self.sessions.pop(session).cancel()
session.synchronous_close()
log.debug("wallet server %s resolves to the same server as %s, rechecking in an hour",
session.server[0], already_connected.server[0])
loop.call_later(3600, self._connect_session, session.server)
return
self.new_connection_event.set()
log.info("connected to %s:%i", *session.server)
return callback
def _connect_session(self, server: Tuple[str, int]):
session = None
for s in self.sessions:
if s.server == server:
session = s
break
if not session:
session = ClientSession(
network=self.network, server=server
)
session._on_connect_cb = self._get_session_connect_callback(session)
task = self.sessions.get(session, None)
if not task or task.done():
task = asyncio.create_task(session.ensure_session())
task.add_done_callback(lambda _: self.ensure_connections())
self.sessions[session] = task
def start(self, default_servers):
for server in default_servers:
self._connect_session(server)
def stop(self):
for session, task in self.sessions.items():
task.cancel()
session.synchronous_close()
self.sessions.clear()
def ensure_connections(self):
for session in self.sessions:
self._connect_session(session.server)
def trigger_nodelay_connect(self):
# used when other parts of the system sees we might have internet back
# bypasses the retry interval
for session in self.sessions:
session.trigger_urgent_reconnect.set()
async def wait_for_fastest_session(self):
while not self.fastest_session:
self.trigger_nodelay_connect()
self.new_connection_event.clear()
await self.new_connection_event.wait()
return self.fastest_session
+8 -1
View File
@@ -11,6 +11,7 @@ import importlib
from binascii import hexlify
from typing import Type, Optional
import urllib.request
from uuid import uuid4
import lbry
from lbry.wallet.server.server import Server
@@ -168,6 +169,7 @@ class SPVNode:
self.server = None
self.hostname = 'localhost'
self.port = 50001 + node_number # avoid conflict with default daemon
self.udp_port = self.port
self.session_timeout = 600
self.rpc_port = '0' # disabled by default
@@ -182,10 +184,13 @@ class SPVNode:
'REORG_LIMIT': '100',
'HOST': self.hostname,
'TCP_PORT': str(self.port),
'UDP_PORT': str(self.udp_port),
'SESSION_TIMEOUT': str(self.session_timeout),
'MAX_QUERY_WORKERS': '0',
'INDIVIDUAL_TAG_INDEXES': '',
'RPC_PORT': self.rpc_port
'RPC_PORT': self.rpc_port,
'ES_INDEX_PREFIX': uuid4().hex,
'ES_MODE': 'writer',
}
if extraconf:
conf.update(extraconf)
@@ -197,6 +202,8 @@ class SPVNode:
async def stop(self, cleanup=True):
try:
await self.server.db.search_index.delete_index()
await self.server.db.search_index.stop()
await self.server.stop()
finally:
cleanup and self.cleanup()
-3
View File
@@ -108,9 +108,6 @@ class Response:
class CodeMessageError(Exception):
def __init__(self, code, message):
super().__init__(code, message)
@property
def code(self):
return self.args[0]
+3
View File
@@ -32,10 +32,13 @@ import inspect
# other_params: None means cannot be called with keyword arguments only
# any means any name is good
from functools import lru_cache
SignatureInfo = namedtuple('SignatureInfo', 'min_args max_args '
'required_names other_names')
@lru_cache(256)
def signature_info(func):
params = inspect.signature(func).parameters
min_args = max_args = 0
+24 -25
View File
@@ -5,12 +5,12 @@ from concurrent.futures.thread import ThreadPoolExecutor
from typing import Optional
from prometheus_client import Gauge, Histogram
import lbry
from lbry.schema.claim import Claim
from lbry.wallet.server.db.writer import SQLDB
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.udp import StatusServer
class Prefetcher:
@@ -185,6 +185,7 @@ class BlockProcessor:
self.search_cache = {}
self.history_cache = {}
self.status_server = StatusServer()
async def run_in_thread_with_lock(self, func, *args):
# Run in a thread to prevent blocking. Shielded so that
@@ -213,6 +214,8 @@ class BlockProcessor:
if hprevs == chain:
start = time.perf_counter()
await self.run_in_thread_with_lock(self.advance_blocks, blocks)
if self.sql:
await self.db.search_index.claim_consumer(self.sql.claim_producer())
for cache in self.search_cache.values():
cache.clear()
self.history_cache.clear()
@@ -221,10 +224,14 @@ class BlockProcessor:
processed_time = time.perf_counter() - start
self.block_count_metric.set(self.height)
self.block_update_time_metric.observe(processed_time)
self.status_server.set_height(self.db.fs_height, self.db.db_tip)
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, processed_time))
if self._caught_up_event.is_set():
if self.sql:
await self.db.search_index.apply_filters(self.sql.blocked_streams, self.sql.blocked_channels,
self.sql.filtered_streams, self.sql.filtered_channels)
await self.notifications.on_block(self.touched, self.height)
self.touched = set()
elif hprevs[0] != chain[0]:
@@ -279,7 +286,6 @@ class BlockProcessor:
await self.run_in_thread_with_lock(flush_backup)
last -= len(raw_blocks)
await self.run_in_thread_with_lock(self.db.sql.delete_claims_above_height, self.height)
await self.prefetcher.reset_height(self.height)
self.reorg_count_metric.inc()
except:
@@ -599,8 +605,7 @@ class BlockProcessor:
# Key: b'h' + compressed_tx_hash + tx_idx + tx_num
# Value: hashX
prefix = b'h' + tx_hash[:4] + idx_packed
candidates = {db_key: hashX for db_key, hashX
in self.db.utxo_db.iterator(prefix=prefix)}
candidates = dict(self.db.utxo_db.iterator(prefix=prefix))
for hdb_key, hashX in candidates.items():
tx_num_packed = hdb_key[-4:]
if len(candidates) > 1:
@@ -648,7 +653,11 @@ class BlockProcessor:
self.reorg_count = 0
else:
blocks = self.prefetcher.get_prefetched_blocks()
await self.check_and_advance_blocks(blocks)
try:
await self.check_and_advance_blocks(blocks)
except Exception:
self.logger.exception("error while processing txs")
raise
async def _first_caught_up(self):
self.logger.info(f'caught up to height {self.height}')
@@ -682,9 +691,11 @@ class BlockProcessor:
disk before exiting, as otherwise a significant amount of work
could be lost.
"""
self._caught_up_event = caught_up_event
try:
await self._first_open_dbs()
self.status_server.set_height(self.db.fs_height, self.db.db_tip)
await asyncio.wait([
self.prefetcher.main_loop(self.height),
self._process_prefetched_blocks()
@@ -695,6 +706,7 @@ class BlockProcessor:
self.logger.exception("Block processing failed!")
raise
finally:
self.status_server.stop()
# Shut down block processing
self.logger.info('flushing to DB for a clean shutdown...')
await self.flush(True)
@@ -714,7 +726,6 @@ class BlockProcessor:
class Timer:
def __init__(self, name):
self.name = name
self.total = 0
@@ -777,15 +788,17 @@ class LBRYBlockProcessor(BlockProcessor):
self.timer = Timer('BlockProcessor')
def advance_blocks(self, blocks):
self.sql.begin()
if self.sql:
self.sql.begin()
try:
self.timer.run(super().advance_blocks, blocks)
except:
self.logger.exception(f'Error while advancing transaction in new block.')
raise
finally:
self.sql.commit()
if self.db.first_sync and self.height == self.daemon.cached_height():
if self.sql:
self.sql.commit()
if self.sql and self.db.first_sync and self.height == self.daemon.cached_height():
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')
@@ -794,22 +807,8 @@ class LBRYBlockProcessor(BlockProcessor):
def advance_txs(self, height, txs, header, block_hash):
timer = self.timer.sub_timers['advance_blocks']
undo = timer.run(super().advance_txs, height, txs, header, block_hash, timer_name='super().advance_txs')
timer.run(self.sql.advance_txs, height, txs, header, self.daemon.cached_height(), forward_timer=True)
if self.sql:
timer.run(self.sql.advance_txs, height, txs, header, self.daemon.cached_height(), forward_timer=True)
if (height % 10000 == 0 or not self.db.first_sync) and self.logger.isEnabledFor(10):
self.timer.show(height=height)
return undo
def _checksig(self, value, address):
try:
claim_dict = Claim.from_bytes(value)
cert_id = claim_dict.signing_channel_hash
if not self.should_validate_signatures:
return cert_id
if cert_id:
cert_claim = self.db.get_claim_info(cert_id)
if cert_claim:
certificate = Claim.from_bytes(cert_claim.value)
claim_dict.validate_signature(address, certificate)
return cert_id
except Exception:
pass
+3 -1
View File
@@ -8,7 +8,7 @@ from lbry.wallet.server.server import Server
def get_argument_parser():
parser = argparse.ArgumentParser(
prog="torba-server"
prog="lbry-hub"
)
parser.add_argument("spvserver", type=str, help="Python class path to SPV server implementation.",
nargs="?", default="lbry.wallet.server.coin.LBC")
@@ -27,6 +27,8 @@ def main():
coin_class = get_coin_class(args.spvserver)
logging.basicConfig(level=logging.INFO)
logging.info('lbry.server starting')
logging.getLogger('aiohttp').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
try:
server = Server(Env(coin_class))
server.run()
+3 -3
View File
@@ -6,7 +6,7 @@ from functools import wraps
import aiohttp
from prometheus_client import Gauge, Histogram
from lbry.utils import LRUCache
from lbry.utils import LRUCacheWithMetrics
from lbry.wallet.rpc.jsonrpc import RPCError
from lbry.wallet.server.util import hex_to_bytes, class_logger
from lbry.wallet.rpc import JSONRPC
@@ -54,8 +54,8 @@ class Daemon:
self._height = None
self.available_rpcs = {}
self.connector = aiohttp.TCPConnector()
self._block_hash_cache = LRUCache(100000)
self._block_cache = LRUCache(2**16, metric_name='block', namespace=NAMESPACE)
self._block_hash_cache = LRUCacheWithMetrics(100000)
self._block_cache = LRUCacheWithMetrics(2 ** 16, metric_name='block', namespace=NAMESPACE)
async def close(self):
if self.connector:
+3 -2
View File
@@ -1,7 +1,8 @@
CLAIM_TYPES = {
'stream': 1,
'channel': 2,
'repost': 3
'repost': 3,
'collection': 4,
}
STREAM_TYPES = {
@@ -10,7 +11,7 @@ STREAM_TYPES = {
'image': 3,
'document': 4,
'binary': 5,
'model': 6
'model': 6,
}
# 9/21/2020
@@ -0,0 +1 @@
from .search import SearchIndex
@@ -0,0 +1,61 @@
INDEX_DEFAULT_SETTINGS = {
"settings":
{"analysis":
{"analyzer": {
"default": {"tokenizer": "whitespace", "filter": ["lowercase", "porter_stem"]}}},
"index":
{"refresh_interval": -1,
"number_of_shards": 1,
"number_of_replicas": 0,
"sort": {
"field": ["trending_mixed", "release_time"],
"order": ["desc", "desc"]
}}
},
"mappings": {
"properties": {
"claim_id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text",
"index_prefixes": {
"min_chars": 1,
"max_chars": 10
}
},
"height": {"type": "integer"},
"claim_type": {"type": "byte"},
"censor_type": {"type": "byte"},
"trending_mixed": {"type": "float"},
"release_time": {"type": "long"},
}
}
}
FIELDS = {'is_controlling', 'last_take_over_height', 'claim_id', 'claim_name', 'normalized', 'tx_position', 'amount',
'timestamp', 'creation_timestamp', 'height', 'creation_height', 'activation_height', 'expiration_height',
'release_time', 'short_url', 'canonical_url', 'title', 'author', 'description', 'claim_type', 'reposted',
'stream_type', 'media_type', 'fee_amount', 'fee_currency', 'duration', 'reposted_claim_hash', 'censor_type',
'claims_in_channel', 'channel_join', 'signature_valid', 'effective_amount', 'support_amount',
'trending_group', 'trending_mixed', 'trending_local', 'trending_global', 'channel_id', 'tx_id', 'tx_nout',
'signature', 'signature_digest', 'public_key_bytes', 'public_key_hash', 'public_key_id', '_id', 'tags',
'reposted_claim_id'}
TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id',
'media_type', 'normalized', 'public_key_bytes', 'public_key_hash', 'short_url', 'signature',
'signature_digest', 'stream_type', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags'}
RANGE_FIELDS = {
'height', 'creation_height', 'activation_height', 'expiration_height',
'timestamp', 'creation_timestamp', 'duration', 'release_time', 'fee_amount',
'tx_position', 'channel_join', 'reposted', 'limit_claims_per_channel',
'amount', 'effective_amount', 'support_amount',
'trending_group', 'trending_mixed', 'censor_type',
'trending_local', 'trending_global',
}
REPLACEMENTS = {
'name': 'normalized',
'txid': 'tx_id',
'claim_hash': '_id'
}
@@ -0,0 +1,573 @@
import asyncio
import struct
from binascii import unhexlify
from collections import Counter
from decimal import Decimal
from operator import itemgetter
from typing import Optional, List, Iterable, Union
from elasticsearch import AsyncElasticsearch, NotFoundError, ConnectionError
from elasticsearch.helpers import async_streaming_bulk
from lbry.crypto.base58 import Base58
from lbry.error import ResolveCensoredError, claim_id as parse_claim_id
from lbry.schema.result import Outputs, Censor
from lbry.schema.tags import clean_tags
from lbry.schema.url import URL, normalize_name
from lbry.utils import LRUCache
from lbry.wallet.server.db.common import CLAIM_TYPES, STREAM_TYPES
from lbry.wallet.server.db.elasticsearch.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, \
RANGE_FIELDS
from lbry.wallet.server.util import class_logger
class ChannelResolution(str):
@classmethod
def lookup_error(cls, url):
return LookupError(f'Could not find channel in "{url}".')
class StreamResolution(str):
@classmethod
def lookup_error(cls, url):
return LookupError(f'Could not find claim at "{url}".')
class SearchIndex:
def __init__(self, index_prefix: str, search_timeout=3.0, elastic_host='localhost', elastic_port=9200):
self.search_timeout = search_timeout
self.sync_timeout = 600 # wont hit that 99% of the time, but can hit on a fresh import
self.search_client: Optional[AsyncElasticsearch] = None
self.sync_client: Optional[AsyncElasticsearch] = None
self.index = index_prefix + 'claims'
self.logger = class_logger(__name__, self.__class__.__name__)
self.claim_cache = LRUCache(2 ** 15)
self.short_id_cache = LRUCache(2 ** 17) # never invalidated, since short ids are forever
self.search_cache = LRUCache(2 ** 17)
self.resolution_cache = LRUCache(2 ** 17)
self._elastic_host = elastic_host
self._elastic_port = elastic_port
async def start(self):
if self.sync_client:
return
hosts = [{'host': self._elastic_host, 'port': self._elastic_port}]
self.sync_client = AsyncElasticsearch(hosts, timeout=self.sync_timeout)
self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout)
while True:
try:
await self.sync_client.cluster.health(wait_for_status='yellow')
break
except ConnectionError:
self.logger.warning("Failed to connect to Elasticsearch. Waiting for it!")
await asyncio.sleep(1)
res = await self.sync_client.indices.create(self.index, INDEX_DEFAULT_SETTINGS, ignore=400)
return res.get('acknowledged', False)
def stop(self):
clients = [self.sync_client, self.search_client]
self.sync_client, self.search_client = None, None
return asyncio.ensure_future(asyncio.gather(*(client.close() for client in clients)))
def delete_index(self):
return self.sync_client.indices.delete(self.index, ignore_unavailable=True)
async def _consume_claim_producer(self, claim_producer):
count = 0
for op, doc in claim_producer:
if op == 'delete':
yield {'_index': self.index, '_op_type': 'delete', '_id': doc}
else:
yield extract_doc(doc, self.index)
count += 1
if count % 100 == 0:
self.logger.info("Indexing in progress, %d claims.", count)
self.logger.info("Indexing done for %d claims.", count)
async def claim_consumer(self, claim_producer):
touched = set()
async for ok, item in async_streaming_bulk(self.sync_client, self._consume_claim_producer(claim_producer),
raise_on_error=False):
if not ok:
self.logger.warning("indexing failed for an item: %s", item)
else:
item = item.popitem()[1]
touched.add(item['_id'])
await self.sync_client.indices.refresh(self.index)
self.logger.info("Indexing done.")
def update_filter_query(self, censor_type, blockdict, channels=False):
blockdict = {key[::-1].hex(): value[::-1].hex() for key, value in blockdict.items()}
if channels:
update = expand_query(channel_id__in=list(blockdict.keys()), censor_type=f"<{censor_type}")
else:
update = expand_query(claim_id__in=list(blockdict.keys()), censor_type=f"<{censor_type}")
key = 'channel_id' if channels else 'claim_id'
update['script'] = {
"source": f"ctx._source.censor_type={censor_type}; ctx._source.censoring_channel_hash=params[ctx._source.{key}]",
"lang": "painless",
"params": blockdict
}
return update
async def apply_filters(self, blocked_streams, blocked_channels, filtered_streams, filtered_channels):
if filtered_streams:
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.SEARCH, filtered_streams), slices=4)
await self.sync_client.indices.refresh(self.index)
if filtered_channels:
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.SEARCH, filtered_channels), slices=4)
await self.sync_client.indices.refresh(self.index)
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.SEARCH, filtered_channels, True), slices=4)
await self.sync_client.indices.refresh(self.index)
if blocked_streams:
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.RESOLVE, blocked_streams), slices=4)
await self.sync_client.indices.refresh(self.index)
if blocked_channels:
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.RESOLVE, blocked_channels), slices=4)
await self.sync_client.indices.refresh(self.index)
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.RESOLVE, blocked_channels, True), slices=4)
await self.sync_client.indices.refresh(self.index)
self.search_cache.clear()
self.claim_cache.clear()
self.resolution_cache.clear()
async def session_query(self, query_name, kwargs):
offset, total = kwargs.get('offset', 0) if isinstance(kwargs, dict) else 0, 0
total_referenced = []
if query_name == 'resolve':
total_referenced, response, censor = await self.resolve(*kwargs)
else:
cache_item = ResultCacheItem.from_cache(str(kwargs), self.search_cache)
if cache_item.result is not None:
return cache_item.result
async with cache_item.lock:
if cache_item.result:
return cache_item.result
censor = Censor(Censor.SEARCH)
if kwargs.get('no_totals'):
response, offset, total = await self.search(**kwargs, censor_type=Censor.NOT_CENSORED)
else:
response, offset, total = await self.search(**kwargs)
censor.apply(response)
total_referenced.extend(response)
if censor.censored:
response, _, _ = await self.search(**kwargs, censor_type=Censor.NOT_CENSORED)
total_referenced.extend(response)
result = Outputs.to_base64(
response, await self._get_referenced_rows(total_referenced), offset, total, censor
)
cache_item.result = result
return result
return Outputs.to_base64(response, await self._get_referenced_rows(total_referenced), offset, total, censor)
async def resolve(self, *urls):
censor = Censor(Censor.RESOLVE)
results = [await self.resolve_url(url) for url in urls]
# just heat the cache
await self.populate_claim_cache(*filter(lambda x: isinstance(x, str), results))
results = [self._get_from_cache_or_error(url, result) for url, result in zip(urls, results)]
censored = [
result if not isinstance(result, dict) or not censor.censor(result)
else ResolveCensoredError(url, result['censoring_channel_hash'])
for url, result in zip(urls, results)
]
return results, censored, censor
def _get_from_cache_or_error(self, url: str, resolution: Union[LookupError, StreamResolution, ChannelResolution]):
cached = self.claim_cache.get(resolution)
return cached or (resolution if isinstance(resolution, LookupError) else resolution.lookup_error(url))
async def get_many(self, *claim_ids):
await self.populate_claim_cache(*claim_ids)
return filter(None, map(self.claim_cache.get, claim_ids))
async def populate_claim_cache(self, *claim_ids):
missing = [claim_id for claim_id in claim_ids if self.claim_cache.get(claim_id) is None]
if missing:
results = await self.search_client.mget(
index=self.index, body={"ids": missing}
)
for result in expand_result(filter(lambda doc: doc['found'], results["docs"])):
self.claim_cache.set(result['claim_id'], result)
async def full_id_from_short_id(self, name, short_id, channel_id=None):
key = (channel_id or '') + name + short_id
if key not in self.short_id_cache:
query = {'name': name, 'claim_id': short_id}
if channel_id:
query['channel_id'] = channel_id
query['order_by'] = ['^channel_join']
query['signature_valid'] = True
else:
query['order_by'] = '^creation_height'
result, _, _ = await self.search(**query, limit=1)
if len(result) == 1:
result = result[0]['claim_id']
self.short_id_cache[key] = result
return self.short_id_cache.get(key, None)
async def search(self, **kwargs):
if 'channel' in kwargs:
kwargs['channel_id'] = await self.resolve_url(kwargs.pop('channel'))
if not kwargs['channel_id'] or not isinstance(kwargs['channel_id'], str):
return [], 0, 0
try:
if 'limit_claims_per_channel' in kwargs:
return await self.search_ahead(**kwargs), 0, 0
else:
result = (await self.search_client.search(
expand_query(**kwargs), index=self.index,
track_total_hits=False if kwargs.get('no_totals') else 10_000
))['hits']
except NotFoundError:
return [], 0, 0
return expand_result(result['hits']), 0, result.get('total', {}).get('value', 0)
async def search_ahead(self, **kwargs):
# 'limit_claims_per_channel' case. Fetch 1000 results, reorder, slice, inflate and return
per_channel_per_page = kwargs.pop('limit_claims_per_channel')
limit = kwargs.pop('limit', 10)
offset = kwargs.pop('offset', 0)
kwargs['limit'] = 1000
query = expand_query(**kwargs)
result = (await self.search_client.search(
query, index=self.index, track_total_hits=False, _source_includes=['_id', 'channel_id']
))['hits']
to_inflate = []
channel_counter = Counter()
delayed = []
while result['hits'] or delayed:
if len(to_inflate) % limit == 0:
channel_counter.clear()
else:
break # means last page was incomplete and we are left with bad replacements
new_delayed = []
for id, chann in delayed:
if channel_counter[chann] < per_channel_per_page:
to_inflate.append((id, chann))
channel_counter[hit_channel_id] += 1
else:
new_delayed.append((id, chann))
delayed = new_delayed
while result['hits']:
hit = result['hits'].pop(0)
hit_id, hit_channel_id = hit['_id'], hit['_source']['channel_id']
if channel_counter[hit_channel_id] < per_channel_per_page:
to_inflate.append((hit_id, hit_channel_id))
channel_counter[hit_channel_id] += 1
if len(to_inflate) % limit == 0:
break
else:
delayed.append((hit_id, hit_channel_id))
return list(await self.get_many(*(claim_id for claim_id, _ in to_inflate[offset:(offset + limit)])))
async def resolve_url(self, raw_url):
if raw_url not in self.resolution_cache:
self.resolution_cache[raw_url] = await self._resolve_url(raw_url)
return self.resolution_cache[raw_url]
async def _resolve_url(self, raw_url):
try:
url = URL.parse(raw_url)
except ValueError as e:
return e
stream = LookupError(f'Could not find claim at "{raw_url}".')
channel_id = await self.resolve_channel_id(url)
if isinstance(channel_id, LookupError):
return channel_id
stream = (await self.resolve_stream(url, channel_id if isinstance(channel_id, str) else None)) or stream
if url.has_stream:
return StreamResolution(stream)
else:
return ChannelResolution(channel_id)
async def resolve_channel_id(self, url: URL):
if not url.has_channel:
return
if url.channel.is_fullid:
return url.channel.claim_id
if url.channel.is_shortid:
channel_id = await self.full_id_from_short_id(url.channel.name, url.channel.claim_id)
if not channel_id:
return LookupError(f'Could not find channel in "{url}".')
return channel_id
query = url.channel.to_dict()
if set(query) == {'name'}:
query['is_controlling'] = True
else:
query['order_by'] = ['^creation_height']
matches, _, _ = await self.search(**query, limit=1)
if matches:
channel_id = matches[0]['claim_id']
else:
return LookupError(f'Could not find channel in "{url}".')
return channel_id
async def resolve_stream(self, url: URL, channel_id: str = None):
if not url.has_stream:
return None
if url.has_channel and channel_id is None:
return None
query = url.stream.to_dict()
if url.stream.claim_id is not None:
if url.stream.is_fullid:
claim_id = url.stream.claim_id
else:
claim_id = await self.full_id_from_short_id(query['name'], query['claim_id'], channel_id)
return claim_id
if channel_id is not None:
if set(query) == {'name'}:
# temporarily emulate is_controlling for claims in channel
query['order_by'] = ['effective_amount', '^height']
else:
query['order_by'] = ['^channel_join']
query['channel_id'] = channel_id
query['signature_valid'] = True
elif set(query) == {'name'}:
query['is_controlling'] = True
matches, _, _ = await self.search(**query, limit=1)
if matches:
return matches[0]['claim_id']
async def _get_referenced_rows(self, txo_rows: List[dict]):
txo_rows = [row for row in txo_rows if isinstance(row, dict)]
referenced_ids = set(filter(None, map(itemgetter('reposted_claim_id'), txo_rows)))
referenced_ids |= set(filter(None, (row['channel_id'] for row in txo_rows)))
referenced_ids |= set(map(parse_claim_id, filter(None, (row['censoring_channel_hash'] for row in txo_rows))))
referenced_txos = []
if referenced_ids:
referenced_txos.extend(await self.get_many(*referenced_ids))
referenced_ids = set(filter(None, (row['channel_id'] for row in referenced_txos)))
if referenced_ids:
referenced_txos.extend(await self.get_many(*referenced_ids))
return referenced_txos
def extract_doc(doc, index):
doc['claim_id'] = doc.pop('claim_hash')[::-1].hex()
if doc['reposted_claim_hash'] is not None:
doc['reposted_claim_id'] = doc.pop('reposted_claim_hash')[::-1].hex()
else:
doc['reposted_claim_id'] = None
channel_hash = doc.pop('channel_hash')
doc['channel_id'] = channel_hash[::-1].hex() if channel_hash else channel_hash
channel_hash = doc.pop('censoring_channel_hash')
doc['censoring_channel_hash'] = channel_hash[::-1].hex() if channel_hash else channel_hash
txo_hash = doc.pop('txo_hash')
doc['tx_id'] = txo_hash[:32][::-1].hex()
doc['tx_nout'] = struct.unpack('<I', txo_hash[32:])[0]
doc['is_controlling'] = bool(doc['is_controlling'])
doc['signature'] = (doc.pop('signature') or b'').hex() or None
doc['signature_digest'] = (doc.pop('signature_digest') or b'').hex() or None
doc['public_key_bytes'] = (doc.pop('public_key_bytes') or b'').hex() or None
doc['public_key_hash'] = (doc.pop('public_key_hash') or b'').hex() or None
doc['signature_valid'] = bool(doc['signature_valid'])
doc['claim_type'] = doc.get('claim_type', 0) or 0
doc['stream_type'] = int(doc.get('stream_type', 0) or 0)
doc['has_source'] = bool(doc['has_source'])
return {'doc': doc, '_id': doc['claim_id'], '_index': index, '_op_type': 'update', 'doc_as_upsert': True}
def expand_query(**kwargs):
if "amount_order" in kwargs:
kwargs["limit"] = 1
kwargs["order_by"] = "effective_amount"
kwargs["offset"] = int(kwargs["amount_order"]) - 1
if 'name' in kwargs:
kwargs['name'] = normalize_name(kwargs.pop('name'))
if kwargs.get('is_controlling') is False:
kwargs.pop('is_controlling')
query = {'must': [], 'must_not': []}
collapse = None
for key, value in kwargs.items():
key = key.replace('claim.', '')
many = key.endswith('__in') or isinstance(value, list)
if many:
key = key.replace('__in', '')
value = list(filter(None, value))
if value is None or isinstance(value, list) and len(value) == 0:
continue
key = REPLACEMENTS.get(key, key)
if key in FIELDS:
partial_id = False
if key == 'claim_type':
if isinstance(value, str):
value = CLAIM_TYPES[value]
else:
value = [CLAIM_TYPES[claim_type] for claim_type in value]
if key == '_id':
if isinstance(value, Iterable):
value = [item[::-1].hex() for item in value]
else:
value = value[::-1].hex()
if not many and key in ('_id', 'claim_id') and len(value) < 20:
partial_id = True
if key == 'public_key_id':
key = 'public_key_hash'
value = Base58.decode(value)[1:21].hex()
if key == 'signature_valid':
continue # handled later
if key in TEXT_FIELDS:
key += '.keyword'
ops = {'<=': 'lte', '>=': 'gte', '<': 'lt', '>': 'gt'}
if partial_id:
query['must'].append({"prefix": {"claim_id": value}})
elif key in RANGE_FIELDS and isinstance(value, str) and value[0] in ops:
operator_length = 2 if value[:2] in ops else 1
operator, value = value[:operator_length], value[operator_length:]
if key == 'fee_amount':
value = str(Decimal(value)*1000)
query['must'].append({"range": {key: {ops[operator]: value}}})
elif many:
query['must'].append({"terms": {key: value}})
else:
if key == 'fee_amount':
value = str(Decimal(value)*1000)
query['must'].append({"term": {key: {"value": value}}})
elif key == 'not_channel_ids':
for channel_id in value:
query['must_not'].append({"term": {'channel_id.keyword': channel_id}})
query['must_not'].append({"term": {'_id': channel_id}})
elif key == 'channel_ids':
query['must'].append({"terms": {'channel_id.keyword': value}})
elif key == 'claim_ids':
query['must'].append({"terms": {'claim_id.keyword': value}})
elif key == 'media_types':
query['must'].append({"terms": {'media_type.keyword': value}})
elif key == 'stream_types':
query['must'].append({"terms": {'stream_type': [STREAM_TYPES[stype] for stype in value]}})
elif key == 'any_languages':
query['must'].append({"terms": {'languages': clean_tags(value)}})
elif key == 'any_languages':
query['must'].append({"terms": {'languages': value}})
elif key == 'all_languages':
query['must'].extend([{"term": {'languages': tag}} for tag in value])
elif key == 'any_tags':
query['must'].append({"terms": {'tags.keyword': clean_tags(value)}})
elif key == 'all_tags':
query['must'].extend([{"term": {'tags.keyword': tag}} for tag in clean_tags(value)])
elif key == 'not_tags':
query['must_not'].extend([{"term": {'tags.keyword': tag}} for tag in clean_tags(value)])
elif key == 'not_claim_id':
query['must_not'].extend([{"term": {'claim_id.keyword': cid}} for cid in value])
elif key == 'limit_claims_per_channel':
collapse = ('channel_id.keyword', value)
if kwargs.get('has_channel_signature'):
query['must'].append({"exists": {"field": "signature_digest"}})
if 'signature_valid' in kwargs:
query['must'].append({"term": {"signature_valid": bool(kwargs["signature_valid"])}})
elif 'signature_valid' in kwargs:
query.setdefault('should', [])
query["minimum_should_match"] = 1
query['should'].append({"bool": {"must_not": {"exists": {"field": "signature_digest"}}}})
query['should'].append({"term": {"signature_valid": bool(kwargs["signature_valid"])}})
if 'has_source' in kwargs:
query.setdefault('should', [])
query["minimum_should_match"] = 1
is_stream_or_repost = {"terms": {"claim_type": [CLAIM_TYPES['stream'], CLAIM_TYPES['repost']]}}
query['should'].append(
{"bool": {"must": [{"match": {"has_source": kwargs['has_source']}}, is_stream_or_repost]}})
query['should'].append({"bool": {"must_not": [is_stream_or_repost]}})
if kwargs.get('text'):
query['must'].append(
{"simple_query_string":
{"query": kwargs["text"], "fields": [
"claim_name^4", "channel_name^8", "title^1", "description^.5", "author^1", "tags^.5"
]}})
query = {
"_source": {"excludes": ["description", "title"]},
'query': {'bool': query},
"sort": [],
}
if "limit" in kwargs:
query["size"] = kwargs["limit"]
if 'offset' in kwargs:
query["from"] = kwargs["offset"]
if 'order_by' in kwargs:
if isinstance(kwargs["order_by"], str):
kwargs["order_by"] = [kwargs["order_by"]]
for value in kwargs['order_by']:
if 'trending_group' in value:
# fixme: trending_mixed is 0 for all records on variable decay, making sort slow.
continue
is_asc = value.startswith('^')
value = value[1:] if is_asc else value
value = REPLACEMENTS.get(value, value)
if value in TEXT_FIELDS:
value += '.keyword'
query['sort'].append({value: "asc" if is_asc else "desc"})
if collapse:
query["collapse"] = {
"field": collapse[0],
"inner_hits": {
"name": collapse[0],
"size": collapse[1],
"sort": query["sort"]
}
}
return query
def expand_result(results):
inner_hits = []
expanded = []
for result in results:
if result.get("inner_hits"):
for _, inner_hit in result["inner_hits"].items():
inner_hits.extend(inner_hit["hits"]["hits"])
continue
result = result['_source']
result['claim_hash'] = unhexlify(result['claim_id'])[::-1]
if result['reposted_claim_id']:
result['reposted_claim_hash'] = unhexlify(result['reposted_claim_id'])[::-1]
else:
result['reposted_claim_hash'] = None
result['channel_hash'] = unhexlify(result['channel_id'])[::-1] if result['channel_id'] else None
result['txo_hash'] = unhexlify(result['tx_id'])[::-1] + struct.pack('<I', result['tx_nout'])
result['tx_hash'] = unhexlify(result['tx_id'])[::-1]
if result['censoring_channel_hash']:
result['censoring_channel_hash'] = unhexlify(result['censoring_channel_hash'])[::-1]
expanded.append(result)
if inner_hits:
return expand_result(inner_hits)
return expanded
class ResultCacheItem:
__slots__ = '_result', 'lock', 'has_result'
def __init__(self):
self.has_result = asyncio.Event()
self.lock = asyncio.Lock()
self._result = None
@property
def result(self) -> str:
return self._result
@result.setter
def result(self, result: str):
self._result = result
if result is not None:
self.has_result.set()
@classmethod
def from_cache(cls, cache_key, cache):
cache_item = cache.get(cache_key)
if cache_item is None:
cache_item = cache[cache_key] = ResultCacheItem()
return cache_item
+114
View File
@@ -0,0 +1,114 @@
import argparse
import asyncio
import logging
import os
from collections import namedtuple
from multiprocessing import Process
import apsw
from elasticsearch import AsyncElasticsearch
from elasticsearch.helpers import async_bulk
from lbry.wallet.server.env import Env
from lbry.wallet.server.coin import LBC
from lbry.wallet.server.db.elasticsearch.search import extract_doc, SearchIndex
INDEX = 'claims'
async def get_all(db, shard_num, shards_total, limit=0):
logging.info("shard %d starting", shard_num)
def exec_factory(cursor, statement, bindings):
tpl = namedtuple('row', (d[0] for d in cursor.getdescription()))
cursor.setrowtrace(lambda cursor, row: tpl(*row))
return True
db.setexectrace(exec_factory)
total = db.execute(f"select count(*) as total from claim where height % {shards_total} = {shard_num};").fetchone()[0]
for num, claim in enumerate(db.execute(f"""
SELECT claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
(select cr.has_source from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_has_source,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash)
WHERE claim.height % {shards_total} = {shard_num}
ORDER BY claim.height desc
""")):
claim = dict(claim._asdict())
claim['has_source'] = bool(claim.pop('reposted_has_source') or claim['has_source'])
claim['censor_type'] = 0
claim['censoring_channel_hash'] = None
claim['tags'] = claim['tags'].split(',,') if claim['tags'] else []
claim['languages'] = claim['languages'].split(' ') if claim['languages'] else []
if num % 10_000 == 0:
logging.info("%d/%d", num, total)
yield extract_doc(claim, INDEX)
if 0 < limit <= num:
break
async def consume(producer):
env = Env(LBC)
logging.info("ES sync host: %s:%i", env.elastic_host, env.elastic_port)
es = AsyncElasticsearch([{'host': env.elastic_host, 'port': env.elastic_port}])
try:
await async_bulk(es, producer, request_timeout=120)
await es.indices.refresh(index=INDEX)
finally:
await es.close()
async def make_es_index():
env = Env(LBC)
index = SearchIndex('', elastic_host=env.elastic_host, elastic_port=env.elastic_port)
try:
return await index.start()
finally:
index.stop()
async def run(args, shard):
def itsbusy(*_):
logging.info("shard %d: db is busy, retry", shard)
return True
db = apsw.Connection(args.db_path, flags=apsw.SQLITE_OPEN_READONLY | apsw.SQLITE_OPEN_URI)
db.setbusyhandler(itsbusy)
db.cursor().execute('pragma journal_mode=wal;')
db.cursor().execute('pragma temp_store=memory;')
producer = get_all(db.cursor(), shard, args.clients, limit=args.blocks)
await asyncio.gather(*(consume(producer) for _ in range(min(8, args.clients))))
def __run(args, shard):
asyncio.run(run(args, shard))
def run_elastic_sync():
logging.basicConfig(level=logging.INFO)
logging.getLogger('aiohttp').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
logging.info('lbry.server starting')
parser = argparse.ArgumentParser(prog="lbry-hub-elastic-sync")
parser.add_argument("db_path", type=str)
parser.add_argument("-c", "--clients", type=int, default=16)
parser.add_argument("-b", "--blocks", type=int, default=0)
parser.add_argument("-f", "--force", default=False, action='store_true')
args = parser.parse_args()
processes = []
if not args.force and not os.path.exists(args.db_path):
logging.info("DB path doesnt exist")
return
if not args.force and not asyncio.run(make_es_index()):
logging.info("ES is already initialized")
return
for i in range(args.clients):
processes.append(Process(target=__run, args=(args, i)))
processes[-1].start()
for process in processes:
process.join()
process.close()
-52
View File
@@ -1,52 +0,0 @@
from lbry.wallet.database import constraints_to_sql
CREATE_FULL_TEXT_SEARCH = """
create virtual table if not exists search using fts5(
claim_name, channel_name, title, description, author, tags,
content=claim, tokenize=porter
);
"""
FTS_ORDER_BY = "bm25(search, 4.0, 8.0, 1.0, 0.5, 1.0, 0.5)"
def fts_action_sql(claims=None, action='insert'):
select = {
'rowid': "claim.rowid",
'claim_name': "claim.normalized",
'channel_name': "channel.normalized",
'title': "claim.title",
'description': "claim.description",
'author': "claim.author",
'tags': "(select group_concat(tag, ' ') from tag where tag.claim_hash=claim.claim_hash)"
}
if action == 'delete':
select['search'] = '"delete"'
where, values = "", {}
if claims:
where, values = constraints_to_sql({'claim.claim_hash__in': claims})
where = 'WHERE '+where
return f"""
INSERT INTO search ({','.join(select.keys())})
SELECT {','.join(select.values())} FROM claim
LEFT JOIN claim as channel ON (claim.channel_hash=channel.claim_hash) {where}
""", values
def update_full_text_search(action, outputs, db, is_first_sync):
if is_first_sync:
return
if not outputs:
return
if action in ("before-delete", "before-update"):
db.execute(*fts_action_sql(outputs, 'delete'))
elif action in ("after-insert", "after-update"):
db.execute(*fts_action_sql(outputs, 'insert'))
else:
raise ValueError(f"Invalid action for updating full text search: '{action}'")
def first_sync_finished(db):
db.execute(*fts_action_sql())
+98 -29
View File
@@ -1,11 +1,12 @@
import os
import apsw
from typing import Union, Tuple, Set, List
from itertools import chain
from decimal import Decimal
from collections import namedtuple
from multiprocessing import Manager
from binascii import unhexlify
from binascii import unhexlify, hexlify
from lbry.wallet.server.leveldb import LevelDB
from lbry.wallet.server.util import class_logger
from lbry.wallet.database import query, constraints_to_sql
@@ -15,11 +16,10 @@ from lbry.schema.mime_types import guess_stream_type
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 TRENDING_ALGORITHMS
from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS, INDEXED_LANGUAGES
from lbry.wallet.server.db.elasticsearch import SearchIndex
ATTRIBUTE_ARRAY_MAX_LENGTH = 100
@@ -55,6 +55,7 @@ class SQLDB:
description text,
claim_type integer,
has_source bool,
reposted integer default 0,
-- streams
@@ -134,6 +135,22 @@ class SQLDB:
create index if not exists claimtrie_claim_hash_idx on claimtrie (claim_hash);
"""
CREATE_CHANGELOG_TRIGGER = """
create table if not exists changelog (
claim_hash bytes primary key
);
create index if not exists claimtrie_claim_hash_idx on claimtrie (claim_hash);
create trigger if not exists claim_changelog after update on claim
begin
insert or ignore into changelog (claim_hash) values (new.claim_hash);
end;
create trigger if not exists claimtrie_changelog after update on claimtrie
begin
insert or ignore into changelog (claim_hash) values (new.claim_hash);
insert or ignore into changelog (claim_hash) values (old.claim_hash);
end;
"""
SEARCH_INDEXES = """
-- used by any tag clouds
create index if not exists tag_tag_idx on tag (tag, claim_hash);
@@ -189,10 +206,10 @@ class SQLDB:
CREATE_TABLES_QUERY = (
CREATE_CLAIM_TABLE +
CREATE_FULL_TEXT_SEARCH +
CREATE_SUPPORT_TABLE +
CREATE_CLAIMTRIE_TABLE +
CREATE_TAG_TABLE +
CREATE_CHANGELOG_TRIGGER +
CREATE_LANGUAGE_TABLE
)
@@ -203,7 +220,6 @@ class SQLDB:
self.db = None
self.logger = class_logger(__name__, self.__class__.__name__)
self.ledger = Ledger if main.coin.NET == 'mainnet' else RegTestLedger
self._fts_synced = False
self.state_manager = None
self.blocked_streams = None
self.blocked_channels = None
@@ -216,6 +232,7 @@ class SQLDB:
unhexlify(channel_id)[::-1] for channel_id in filtering_channels if channel_id
}
self.trending = trending
self.pending_deletes = set()
def open(self):
self.db = apsw.Connection(
@@ -354,6 +371,7 @@ class SQLDB:
'author': None,
'duration': None,
'claim_type': None,
'has_source': False,
'stream_type': None,
'media_type': None,
'release_time': None,
@@ -371,6 +389,7 @@ class SQLDB:
if claim.is_stream:
claim_record['claim_type'] = CLAIM_TYPES['stream']
claim_record['has_source'] = claim.stream.has_source
claim_record['media_type'] = claim.stream.source.media_type
claim_record['stream_type'] = STREAM_TYPES[guess_stream_type(claim_record['media_type'])]
claim_record['title'] = claim.stream.title
@@ -393,6 +412,8 @@ class SQLDB:
claim_record['reposted_claim_hash'] = claim.repost.reference.claim_hash
elif claim.is_channel:
claim_record['claim_type'] = CLAIM_TYPES['channel']
elif claim.is_collection:
claim_record['claim_type'] = CLAIM_TYPES['collection']
languages[(language, claim_hash)] = (language, claim_hash, tx.height)
@@ -417,14 +438,14 @@ class SQLDB:
claims = self._upsertable_claims(txos, header)
if claims:
self.executemany("""
INSERT OR IGNORE INTO claim (
INSERT OR REPLACE INTO claim (
claim_hash, claim_id, claim_name, normalized, txo_hash, tx_position, amount,
claim_type, media_type, stream_type, timestamp, creation_timestamp,
claim_type, media_type, stream_type, timestamp, creation_timestamp, has_source,
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,
:claim_type, :media_type, :stream_type, :timestamp, :timestamp, :has_source,
: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,
@@ -442,7 +463,7 @@ class SQLDB:
UPDATE claim SET
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,
timestamp=:timestamp, fee_amount=:fee_amount, fee_currency=:fee_currency, has_source=:has_source,
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;
@@ -526,6 +547,7 @@ class SQLDB:
WHERE claim_hash = ?
""", targets
)
return {target[0] for target in targets}
def validate_channel_signatures(self, height, new_claims, updated_claims, spent_claims, affected_channels, timer):
if not new_claims and not updated_claims and not spent_claims:
@@ -692,7 +714,7 @@ class SQLDB:
claim_in_channel.channel_hash=claim.claim_hash
)
WHERE claim_hash = ?
""", [(channel_hash,) for channel_hash in all_channel_keys.keys()])
""", [(channel_hash,) for channel_hash in all_channel_keys])
sub_timer.stop()
sub_timer = timer.add_timer('update blocked claims list')
@@ -799,11 +821,56 @@ class SQLDB:
f"SELECT claim_hash, normalized FROM claim WHERE expiration_height = {height}"
)
def enqueue_changes(self):
for claim in self.execute(f"""
SELECT claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
(select cr.has_source from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_has_source,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash)
WHERE claim.claim_hash in (SELECT claim_hash FROM changelog)
"""):
claim = claim._asdict()
id_set = set(filter(None, (claim['claim_hash'], claim['channel_hash'], claim['reposted_claim_hash'])))
claim['censor_type'] = 0
claim['censoring_channel_hash'] = None
claim['has_source'] = bool(claim.pop('reposted_has_source') or claim['has_source'])
for reason_id in id_set:
if reason_id in self.blocked_streams:
claim['censor_type'] = 2
claim['censoring_channel_hash'] = self.blocked_streams.get(reason_id)
elif reason_id in self.blocked_channels:
claim['censor_type'] = 2
claim['censoring_channel_hash'] = self.blocked_channels.get(reason_id)
elif reason_id in self.filtered_streams:
claim['censor_type'] = 1
claim['censoring_channel_hash'] = self.filtered_streams.get(reason_id)
elif reason_id in self.filtered_channels:
claim['censor_type'] = 1
claim['censoring_channel_hash'] = self.filtered_channels.get(reason_id)
claim['tags'] = claim['tags'].split(',,') if claim['tags'] else []
claim['languages'] = claim['languages'].split(' ') if claim['languages'] else []
yield 'update', claim
def clear_changelog(self):
self.execute("delete from changelog;")
def claim_producer(self):
while self.pending_deletes:
claim_hash = self.pending_deletes.pop()
yield 'delete', hexlify(claim_hash[::-1]).decode()
for claim in self.enqueue_changes():
yield claim
self.clear_changelog()
def advance_txs(self, height, all_txs, header, daemon_height, timer):
insert_claims = []
update_claims = []
update_claim_hashes = set()
delete_claim_hashes = set()
delete_claim_hashes = self.pending_deletes
insert_supports = []
delete_support_txo_hashes = set()
recalculate_claim_hashes = set() # added/deleted supports, added/updated claim
@@ -872,28 +939,17 @@ class SQLDB:
expire_timer.stop()
r = timer.run
r(update_full_text_search, 'before-delete',
delete_claim_hashes, self.db.cursor(), self.main.first_sync)
affected_channels = r(self.delete_claims, delete_claim_hashes)
r(self.delete_supports, delete_support_txo_hashes)
r(self.insert_claims, insert_claims, header)
r(self.calculate_reposts, insert_claims)
r(update_full_text_search, 'after-insert',
[txo.claim_hash for txo in insert_claims], self.db.cursor(), self.main.first_sync)
r(update_full_text_search, 'before-update',
[txo.claim_hash for txo in update_claims], self.db.cursor(), self.main.first_sync)
r(self.update_claims, update_claims, header)
r(update_full_text_search, 'after-update',
[txo.claim_hash for txo in update_claims], self.db.cursor(), self.main.first_sync)
r(self.validate_channel_signatures, height, insert_claims,
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)
for algorithm in self.trending:
r(algorithm.run, self.db.cursor(), height, daemon_height, recalculate_claim_hashes)
if not self._fts_synced and self.main.first_sync and height == daemon_height:
r(first_sync_finished, self.db.cursor())
self._fts_synced = True
class LBRYLevelDB(LevelDB):
@@ -905,17 +961,30 @@ class LBRYLevelDB(LevelDB):
for algorithm_name in self.env.trending_algorithms:
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
if self.env.es_mode == 'reader':
self.logger.info('Index mode: reader')
self.sql = None
else:
self.logger.info('Index mode: writer. Using SQLite db to sync ES')
self.sql = SQLDB(
self, path,
self.env.default('BLOCKING_CHANNEL_IDS', '').split(' '),
self.env.default('FILTERING_CHANNEL_IDS', '').split(' '),
trending
)
# Search index
self.search_index = SearchIndex(
self.env.es_index_prefix, self.env.database_query_timeout, self.env.elastic_host, self.env.elastic_port
)
def close(self):
super().close()
self.sql.close()
if self.sql:
self.sql.close()
async def _open_dbs(self, *args, **kwargs):
await self.search_index.start()
await super()._open_dbs(*args, **kwargs)
self.sql.open()
if self.sql:
self.sql.open()
+6 -1
View File
@@ -33,6 +33,8 @@ class Env:
self.allow_root = self.boolean('ALLOW_ROOT', False)
self.host = self.default('HOST', 'localhost')
self.rpc_host = self.default('RPC_HOST', 'localhost')
self.elastic_host = self.default('ELASTIC_HOST', 'localhost')
self.elastic_port = self.integer('ELASTIC_PORT', 9200)
self.loop_policy = self.set_event_loop_policy()
self.obsolete(['UTXO_MB', 'HIST_MB', 'NETWORK'])
self.db_dir = self.required('DB_DIRECTORY')
@@ -53,10 +55,13 @@ class Env:
coin_name = self.required('COIN').strip()
network = self.default('NET', 'mainnet').strip()
self.coin = Coin.lookup_coin_class(coin_name, network)
self.es_index_prefix = self.default('ES_INDEX_PREFIX', '')
self.es_mode = self.default('ES_MODE', 'writer')
self.cache_MB = self.integer('CACHE_MB', 1200)
self.reorg_limit = self.integer('REORG_LIMIT', self.coin.REORG_LIMIT)
# Server stuff
self.tcp_port = self.integer('TCP_PORT', None)
self.udp_port = self.integer('UDP_PORT', self.tcp_port)
self.ssl_port = self.integer('SSL_PORT', None)
if self.ssl_port:
self.ssl_certfile = self.required('SSL_CERTFILE')
@@ -94,7 +99,7 @@ class Env:
self.identities = [identity
for identity in (clearnet_identity, tor_identity)
if identity is not None]
self.database_query_timeout = float(self.integer('QUERY_TIMEOUT_MS', 250)) / 1000.0
self.database_query_timeout = float(self.integer('QUERY_TIMEOUT_MS', 3000)) / 1000.0
@classmethod
def default(cls, envvar, default):
+23 -6
View File
@@ -12,6 +12,7 @@
import asyncio
import array
import ast
import base64
import os
import time
import zlib
@@ -24,7 +25,7 @@ from glob import glob
from struct import pack, unpack
from concurrent.futures.thread import ThreadPoolExecutor
import attr
from lbry.utils import LRUCache
from lbry.utils import LRUCacheWithMetrics
from lbry.wallet.server import util
from lbry.wallet.server.hash import hash_to_hex_str, HASHX_LEN
from lbry.wallet.server.merkle import Merkle, MerkleCache
@@ -82,6 +83,7 @@ class LevelDB:
self.utxo_db = None
self.tx_counts = None
self.headers = None
self.encoded_headers = LRUCacheWithMetrics(1 << 21, metric_name='encoded_headers', namespace='wallet_server')
self.last_flush = time.time()
self.logger.info(f'using {self.env.db_engine} for DB backend')
@@ -93,7 +95,7 @@ class LevelDB:
self.headers_db = None
self.tx_db = None
self._tx_and_merkle_cache = LRUCache(2**17, metric_name='tx_and_merkle', namespace="wallet_server")
self._tx_and_merkle_cache = LRUCacheWithMetrics(2 ** 17, metric_name='tx_and_merkle', namespace="wallet_server")
self.total_transactions = None
async def _read_tx_counts(self):
@@ -135,9 +137,7 @@ class LevelDB:
return
def get_headers():
return [
header for header in self.headers_db.iterator(prefix=HEADER_PREFIX, include_key=False)
]
return list(self.headers_db.iterator(prefix=HEADER_PREFIX, include_key=False))
headers = await asyncio.get_event_loop().run_in_executor(self.executor, get_headers)
assert len(headers) - 1 == self.db_height, f"{len(headers)} vs {self.db_height}"
@@ -440,6 +440,16 @@ class LevelDB:
raise IndexError(f'height {height:,d} out of range')
return header
def encode_headers(self, start_height, count, headers):
key = (start_height, count)
if not self.encoded_headers.get(key):
compressobj = zlib.compressobj(wbits=-15, level=1, memLevel=9)
headers = base64.b64encode(compressobj.compress(headers) + compressobj.flush()).decode()
if start_height % 1000 != 0:
return headers
self.encoded_headers[key] = headers
return self.encoded_headers.get(key)
def read_headers(self, start_height, count) -> typing.Tuple[bytes, int]:
"""Requires start_height >= 0, count >= 0. Reads as many headers as
are available starting at start_height up to count. This
@@ -466,7 +476,14 @@ class LevelDB:
tx_height = bisect_right(self.tx_counts, tx_num)
if tx_height > self.db_height:
return None, tx_height
return self.total_transactions[tx_num], tx_height
try:
return self.total_transactions[tx_num], tx_height
except IndexError:
self.logger.exception(
"Failed to access a cached transaction, known bug #3142 "
"should be fixed in #3205"
)
return None, tx_height
def _fs_transactions(self, txids: Iterable[str]):
unpack_be_uint64 = util.unpack_be_uint64
+12 -3
View File
@@ -210,6 +210,15 @@ class MemPool:
return deferred, {prevout: utxo_map[prevout] for prevout in unspent}
async def _mempool_loop(self, synchronized_event):
try:
return await self._refresh_hashes(synchronized_event)
except asyncio.CancelledError:
raise
except Exception as e:
self.logger.exception("MEMPOOL DIED")
raise e
async def _refresh_hashes(self, synchronized_event):
"""Refresh our view of the daemon's mempool."""
while True:
@@ -315,7 +324,7 @@ class MemPool:
for prevout in tx.prevouts
if prevout[0] not in all_hashes)
utxos = await self.api.lookup_utxos(prevouts)
utxo_map = {prevout: utxo for prevout, utxo in zip(prevouts, utxos)}
utxo_map = dict(zip(prevouts, utxos))
return self._accept_transactions(tx_map, utxo_map, touched)
@@ -326,7 +335,7 @@ class MemPool:
async def keep_synchronized(self, synchronized_event):
"""Keep the mempool synchronized with the daemon."""
await asyncio.wait([
self._refresh_hashes(synchronized_event),
self._mempool_loop(synchronized_event),
# self._refresh_histogram(synchronized_event),
self._logging(synchronized_event)
])
@@ -344,7 +353,7 @@ class MemPool:
value += sum(v for h168, v in tx.out_pairs if h168 == hashX)
return value
async def compact_fee_histogram(self):
def compact_fee_histogram(self):
"""Return a compact fee histogram of the current mempool."""
return self.cached_compact_histogram
+8 -1
View File
@@ -94,6 +94,7 @@ class Server:
self.session_mgr = env.coin.SESSION_MANAGER(
env, db, bp, daemon, mempool, self.shutdown_event
)
self._indexer_task = None
async def start(self):
env = self.env
@@ -110,11 +111,17 @@ class Server:
self.cancellable_tasks.append(asyncio.ensure_future(run(*args, _flag)))
return _flag.wait()
await self.start_prometheus()
if self.env.udp_port:
await self.bp.status_server.start(
0, bytes.fromhex(self.bp.coin.GENESIS_HASH)[::-1],
self.env.host, self.env.udp_port
)
await _start_cancellable(self.bp.fetch_and_process_blocks)
await self.db.populate_header_merkle_cache()
await _start_cancellable(self.mempool.keep_synchronized)
await _start_cancellable(self.session_mgr.serve, self.notifications)
await self.start_prometheus()
async def stop(self):
for task in reversed(self.cancellable_tasks):
+63 -171
View File
@@ -3,7 +3,6 @@ import ssl
import math
import time
import json
import zlib
import base64
import codecs
import typing
@@ -16,16 +15,17 @@ from asyncio import Event, sleep
from collections import defaultdict
from functools import partial
from binascii import hexlify, unhexlify
from binascii import hexlify
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from elasticsearch import ConnectionTimeout
from prometheus_client import Counter, Info, Histogram, Gauge
import lbry
from lbry.utils import LRUCache
from lbry.utils import LRUCacheWithMetrics
from lbry.build_info import BUILD, COMMIT_HASH, DOCKER_TAG
from lbry.wallet.server.block_processor import LBRYBlockProcessor
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.rpc.framing import NewlineFramer
@@ -247,11 +247,12 @@ class SessionManager:
async def _manage_servers(self):
paused = False
max_sessions = self.env.max_sessions
low_watermark = max_sessions * 19 // 20
low_watermark = int(max_sessions * 0.95)
while True:
await self.session_event.wait()
self.session_event.clear()
if not paused and len(self.sessions) >= max_sessions:
self.bp.status_server.set_unavailable()
self.logger.info(f'maximum sessions {max_sessions:,d} '
f'reached, stopping new connections until '
f'count drops to {low_watermark:,d}')
@@ -260,6 +261,7 @@ class SessionManager:
# Start listening for incoming connections if paused and
# session count has fallen
if paused and len(self.sessions) <= low_watermark:
self.bp.status_server.set_available()
self.logger.info('resuming listening for incoming connections')
await self._start_external_servers()
paused = False
@@ -572,6 +574,7 @@ class SessionManager:
await self.start_other()
await self._start_external_servers()
server_listening_event.set()
self.bp.status_server.set_available()
# Peer discovery should start after the external servers
# because we connect to ourself
await asyncio.wait([
@@ -582,6 +585,7 @@ class SessionManager:
])
finally:
await self._close_servers(list(self.servers.keys()))
log.warning("disconnect %i sessions", len(self.sessions))
if self.sessions:
await asyncio.wait([
session.close(force_after=1) for session in self.sessions.values()
@@ -809,9 +813,6 @@ class LBRYSessionManager(SessionManager):
self.running = False
if self.env.websocket_host is not None and self.env.websocket_port is not None:
self.websocket = AdminWebSocket(self)
self.search_cache = self.bp.search_cache
self.search_cache['search'] = LRUCache(2**14, metric_name='search', namespace=NAMESPACE)
self.search_cache['resolve'] = LRUCache(2**16, metric_name='resolve', namespace=NAMESPACE)
async def process_metrics(self):
while self.running:
@@ -825,22 +826,11 @@ class LBRYSessionManager(SessionManager):
async def start_other(self):
self.running = True
path = os.path.join(self.env.db_dir, 'claims.db')
args = dict(
initializer=reader.initializer,
initargs=(
self.logger, path, self.env.coin.NET, self.env.database_query_timeout,
self.env.track_metrics, (
self.db.sql.blocked_streams, self.db.sql.blocked_channels,
self.db.sql.filtered_streams, self.db.sql.filtered_channels
)
)
)
if self.env.max_query_workers is not None and self.env.max_query_workers == 0:
self.query_executor = ThreadPoolExecutor(max_workers=1, **args)
self.query_executor = ThreadPoolExecutor(max_workers=1)
else:
self.query_executor = ProcessPoolExecutor(
max_workers=self.env.max_query_workers or max(os.cpu_count(), 4), **args
max_workers=self.env.max_query_workers or max(os.cpu_count(), 4)
)
if self.websocket is not None:
await self.websocket.start()
@@ -864,6 +854,7 @@ class LBRYElectrumX(SessionBase):
max_errors = math.inf # don't disconnect people for errors! let them happen...
session_mgr: LBRYSessionManager
version = lbry.__version__
cached_server_features = {}
@classmethod
def initialize_request_handlers(cls):
@@ -892,7 +883,6 @@ class LBRYElectrumX(SessionBase):
'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,
@@ -910,13 +900,15 @@ class LBRYElectrumX(SessionBase):
super().__init__(*args, **kwargs)
if not LBRYElectrumX.request_handlers:
LBRYElectrumX.initialize_request_handlers()
if not LBRYElectrumX.cached_server_features:
LBRYElectrumX.set_server_features(self.env)
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.protocol_tuple = self.PROTOCOL_MIN
self.protocol_string = None
self.daemon = self.session_mgr.daemon
self.bp: LBRYBlockProcessor = self.session_mgr.bp
self.db: LBRYLevelDB = self.bp.db
@@ -927,10 +919,10 @@ class LBRYElectrumX(SessionBase):
for ver in (cls.PROTOCOL_MIN, cls.PROTOCOL_MAX)]
@classmethod
def server_features(cls, env):
def set_server_features(cls, env):
"""Return the server features dictionary."""
min_str, max_str = cls.protocol_min_max_strings()
return {
cls.cached_server_features.update({
'hosts': env.hosts_dict(),
'pruning': None,
'server_version': cls.version,
@@ -943,10 +935,10 @@ class LBRYElectrumX(SessionBase):
'daily_fee': env.daily_fee,
'hash_function': 'sha256',
'trending_algorithm': env.trending_algorithms[0]
}
})
async def server_features_async(self):
return self.server_features(self.env)
return self.cached_server_features
@classmethod
def server_version_args(cls):
@@ -995,16 +987,6 @@ class LBRYElectrumX(SessionBase):
)
except asyncio.CancelledError:
raise
except reader.SQLiteInterruptedError as error:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_interrupt(start, error.metrics)
self.session_mgr.interrupt_count_metric.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)
self.session_mgr.db_operational_error_metric.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)
@@ -1021,40 +1003,33 @@ class LBRYElectrumX(SessionBase):
self.session_mgr.pending_query_metric.dec()
self.session_mgr.executor_time_metric.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)
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(
query_name, function, kwargs
)
else:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.cache_response()
return cache_item.result
async def run_and_cache_query(self, query_name, kwargs):
start = time.perf_counter()
if isinstance(kwargs, dict):
kwargs['release_time'] = format_release_time(kwargs.get('release_time'))
try:
self.session_mgr.pending_query_metric.inc()
return await self.db.search_index.session_query(query_name, kwargs)
except ConnectionTimeout:
self.session_mgr.interrupt_count_metric.inc()
raise RPCError(JSONRPC.QUERY_TIMEOUT, 'query timed out')
finally:
self.session_mgr.pending_query_metric.dec()
self.session_mgr.executor_time_metric.observe(time.perf_counter() - start)
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)
return await self.run_and_cache_query('search', kwargs)
async def claimtrie_resolve(self, *urls):
if urls:
count = len(urls)
try:
self.session_mgr.urls_to_resolve_count_metric.inc(count)
return await self.run_and_cache_query('resolve', reader.resolve_to_bytes, urls)
return await self.run_and_cache_query('resolve', urls)
finally:
self.session_mgr.resolved_url_count_metric.inc(count)
@@ -1071,67 +1046,6 @@ class LBRYElectrumX(SessionBase):
return -1
return None
async def claimtrie_getclaimsbyids(self, *claim_ids):
claims = await self.batched_formatted_claims_from_daemon(claim_ids)
return dict(zip(claim_ids, claims))
async def batched_formatted_claims_from_daemon(self, claim_ids):
claims = await self.daemon.getclaimsbyids(claim_ids)
result = []
for claim in claims:
if claim and claim.get('value'):
result.append(self.format_claim_from_daemon(claim))
return result
def format_claim_from_daemon(self, claim, name=None):
"""Changes the returned claim data to the format expected by lbry and adds missing fields."""
if not claim:
return {}
# this ISO-8859 nonsense stems from a nasty form of encoding extended characters in lbrycrd
# it will be fixed after the lbrycrd upstream merge to v17 is done
# it originated as a fear of terminals not supporting unicode. alas, they all do
if 'name' in claim:
name = claim['name'].encode('ISO-8859-1').decode()
info = self.db.sql.get_claims(claim_id=claim['claimId'])
if not info:
# raise RPCError("Lbrycrd has {} but not lbryumx, please submit a bug report.".format(claim_id))
return {}
address = info.address.decode()
# fixme: temporary
#supports = self.format_supports_from_daemon(claim.get('supports', []))
supports = []
amount = get_from_possible_keys(claim, 'amount', 'nAmount')
height = get_from_possible_keys(claim, 'height', 'nHeight')
effective_amount = get_from_possible_keys(claim, 'effective amount', 'nEffectiveAmount')
valid_at_height = get_from_possible_keys(claim, 'valid at height', 'nValidAtHeight')
result = {
"name": name,
"claim_id": claim['claimId'],
"txid": claim['txid'],
"nout": claim['n'],
"amount": amount,
"depth": self.db.db_height - height + 1,
"height": height,
"value": hexlify(claim['value'].encode('ISO-8859-1')).decode(),
"address": address, # from index
"supports": supports,
"effective_amount": effective_amount,
"valid_at_height": valid_at_height
}
if 'claim_sequence' in claim:
# TODO: ensure that lbrycrd #209 fills in this value
result['claim_sequence'] = claim['claim_sequence']
else:
result['claim_sequence'] = -1
if 'normalized_name' in claim:
result['normalized_name'] = claim['normalized_name'].encode('ISO-8859-1').decode()
return result
def assert_tx_hash(self, value):
'''Raise an RPCError if the value is not a valid transaction
hash.'''
@@ -1142,16 +1056,6 @@ class LBRYElectrumX(SessionBase):
pass
raise RPCError(1, f'{value} should be a transaction hash')
def assert_claim_id(self, value):
'''Raise an RPCError if the value is not a valid claim id
hash.'''
try:
if len(util.hex_to_bytes(value)) == 20:
return
except Exception:
pass
raise RPCError(1, f'{value} should be a claim id hash')
async def subscribe_headers_result(self):
"""The result of a header subscription or notification."""
return self.session_mgr.hsub_results[self.subscribe_headers_raw]
@@ -1268,10 +1172,9 @@ class LBRYElectrumX(SessionBase):
address: the address to subscribe to"""
if len(addresses) > 1000:
raise RPCError(BAD_REQUEST, f'too many addresses in subscription request: {len(addresses)}')
hashXes = [
(self.address_to_hashX(address), address) for address in addresses
return [
await self.hashX_subscribe(self.address_to_hashX(address), address) for address in addresses
]
return await asyncio.gather(*(self.hashX_subscribe(*args) for args in hashXes))
async def address_unsubscribe(self, address):
"""Unsubscribe an address.
@@ -1357,8 +1260,7 @@ class LBRYElectrumX(SessionBase):
headers, count = self.db.read_headers(start_height, count)
if b64:
compressobj = zlib.compressobj(wbits=-15, level=1, memLevel=9)
headers = base64.b64encode(compressobj.compress(headers) + compressobj.flush()).decode()
headers = self.db.encode_headers(start_height, count, headers)
else:
headers = headers.hex()
result = {
@@ -1467,7 +1369,8 @@ class LBRYElectrumX(SessionBase):
client_name: a string identifying the client
protocol_version: the protocol version spoken by the client
"""
if self.protocol_string is not None:
return self.version, self.protocol_string
if self.sv_seen and self.protocol_tuple >= (1, 4):
raise RPCError(BAD_REQUEST, f'server.version already sent')
self.sv_seen = True
@@ -1477,8 +1380,7 @@ class LBRYElectrumX(SessionBase):
if self.env.drop_client is not None and \
self.env.drop_client.match(client_name):
self.close_after_send = True
raise RPCError(BAD_REQUEST,
f'unsupported client: {client_name}')
raise RPCError(BAD_REQUEST, f'unsupported client: {client_name}')
if self.client_version != client_name[:17]:
self.session_mgr.session_count_metric.labels(version=self.client_version).dec()
self.client_version = client_name[:17]
@@ -1487,19 +1389,16 @@ class LBRYElectrumX(SessionBase):
# Find the highest common protocol version. Disconnect if
# that protocol version in unsupported.
ptuple, client_min = util.protocol_version(
protocol_version, self.PROTOCOL_MIN, self.PROTOCOL_MAX)
ptuple, client_min = util.protocol_version(protocol_version, self.PROTOCOL_MIN, self.PROTOCOL_MAX)
if ptuple is None:
# FIXME: this fills the logs
# if client_min > self.PROTOCOL_MIN:
# self.logger.info(f'client requested future protocol version '
# f'{util.version_string(client_min)} '
# f'- is your software out of date?')
self.close_after_send = True
raise RPCError(BAD_REQUEST,
f'unsupported protocol version: {protocol_version}')
ptuple, client_min = util.protocol_version(protocol_version, (1, 1, 0), (1, 4, 0))
if ptuple is None:
self.close_after_send = True
raise RPCError(BAD_REQUEST, f'unsupported protocol version: {protocol_version}')
self.protocol_tuple = ptuple
return self.version, self.protocol_version_string()
self.protocol_string = util.version_string(ptuple)
return self.version, self.protocol_string
async def transaction_broadcast(self, raw_tx):
"""Broadcast a raw transaction to the network.
@@ -1549,15 +1448,14 @@ class LBRYElectrumX(SessionBase):
else:
batch_result[tx_hash] = [raw_tx, {'block_height': -1}]
def threaded_get_merkle():
if needed_merkles:
for tx_hash, (raw_tx, block_txs, pos, block_height) in needed_merkles.items():
batch_result[tx_hash] = raw_tx, {
'merkle': self._get_merkle_branch(block_txs, pos),
'pos': pos,
'block_height': block_height
}
if needed_merkles:
await asyncio.get_running_loop().run_in_executor(self.db.executor, threaded_get_merkle)
await asyncio.sleep(0) # heavy call, give other tasks a chance
self.session_mgr.tx_replied_count_metric.inc(len(tx_hashes))
return batch_result
@@ -1612,26 +1510,20 @@ class LocalRPC(SessionBase):
return 'RPC'
class ResultCacheItem:
__slots__ = '_result', 'lock', 'has_result'
def __init__(self):
self.has_result = asyncio.Event()
self.lock = asyncio.Lock()
self._result = None
@property
def result(self) -> str:
return self._result
@result.setter
def result(self, result: str):
self._result = result
if result is not None:
self.has_result.set()
def get_from_possible_keys(dictionary, *keys):
for key in keys:
if key in dictionary:
return dictionary[key]
def format_release_time(release_time):
# round release time to 1000 so it caches better
# also set a default so we dont show claims in the future
def roundup_time(number, factor=360):
return int(1 + int(number / factor)) * factor
if isinstance(release_time, str) and len(release_time) > 0:
time_digits = ''.join(filter(str.isdigit, release_time))
time_prefix = release_time[:-len(time_digits)]
return time_prefix + str(roundup_time(int(time_digits)))
elif isinstance(release_time, int):
return roundup_time(release_time)
+199
View File
@@ -0,0 +1,199 @@
import asyncio
import struct
from time import perf_counter
import logging
from typing import Optional, Tuple, NamedTuple
from lbry.utils import LRUCache
# from prometheus_client import Counter
log = logging.getLogger(__name__)
_MAGIC = 1446058291 # genesis blocktime (which is actually wrong)
# ping_count_metric = Counter("ping_count", "Number of pings received", namespace='wallet_server_status')
_PAD_BYTES = b'\x00' * 64
class SPVPing(NamedTuple):
magic: int
protocol_version: int
pad_bytes: bytes
def encode(self):
return struct.pack(b'!lB64s', *self)
@staticmethod
def make(protocol_version=1) -> bytes:
return SPVPing(_MAGIC, protocol_version, _PAD_BYTES).encode()
@classmethod
def decode(cls, packet: bytes):
decoded = cls(*struct.unpack(b'!lB64s', packet[:69]))
if decoded.magic != _MAGIC:
raise ValueError("invalid magic bytes")
return decoded
class SPVPong(NamedTuple):
protocol_version: int
flags: int
height: int
tip: bytes
source_address_raw: bytes
def encode(self):
return struct.pack(b'!BBl32s4s', *self)
@staticmethod
def make(height: int, tip: bytes, flags: int, protocol_version: int = 1) -> bytes:
# note: drops the last 4 bytes so the result can be cached and have addresses added to it as needed
return SPVPong(protocol_version, flags, height, tip, b'\x00\x00\x00\x00').encode()[:38]
@classmethod
def decode(cls, packet: bytes):
return cls(*struct.unpack(b'!BBl32s4s', packet[:42]))
@property
def available(self) -> bool:
return (self.flags & 0b00000001) > 0
@property
def ip_address(self) -> str:
return ".".join(map(str, self.source_address_raw))
def __repr__(self) -> str:
return f"SPVPong(external_ip={self.ip_address}, version={self.protocol_version}, " \
f"available={'True' if self.flags & 1 > 0 else 'False'}," \
f" height={self.height}, tip={self.tip[::-1].hex()})"
class SPVServerStatusProtocol(asyncio.DatagramProtocol):
PROTOCOL_VERSION = 1
def __init__(self, height: int, tip: bytes, throttle_cache_size: int = 1024, throttle_reqs_per_sec: int = 10):
super().__init__()
self.transport: Optional[asyncio.transports.DatagramTransport] = None
self._height = height
self._tip = tip
self._flags = 0
self._cached_response = None
self.update_cached_response()
self._throttle = LRUCache(throttle_cache_size)
self._should_log = LRUCache(throttle_cache_size)
self._min_delay = 1 / throttle_reqs_per_sec
def update_cached_response(self):
self._cached_response = SPVPong.make(self._height, self._tip, self._flags, self.PROTOCOL_VERSION)
def set_unavailable(self):
self._flags &= 0b11111110
self.update_cached_response()
def set_available(self):
self._flags |= 0b00000001
self.update_cached_response()
def set_height(self, height: int, tip: bytes):
self._height, self._tip = height, tip
self.update_cached_response()
def should_throttle(self, host: str):
now = perf_counter()
last_requested = self._throttle.get(host, default=0)
self._throttle[host] = now
if now - last_requested < self._min_delay:
log_cnt = self._should_log.get(host, default=0) + 1
if log_cnt % 100 == 0:
log.warning("throttle spv status to %s", host)
self._should_log[host] = log_cnt
return True
return False
def make_pong(self, host):
return self._cached_response + bytes(int(b) for b in host.split("."))
def datagram_received(self, data: bytes, addr: Tuple[str, int]):
if self.should_throttle(addr[0]):
return
try:
SPVPing.decode(data)
except (ValueError, struct.error, AttributeError, TypeError):
# log.exception("derp")
return
self.transport.sendto(self.make_pong(addr[0]), addr)
# ping_count_metric.inc()
def connection_made(self, transport) -> None:
self.transport = transport
def connection_lost(self, exc: Optional[Exception]) -> None:
self.transport = None
def close(self):
if self.transport:
self.transport.close()
class StatusServer:
def __init__(self):
self._protocol: Optional[SPVServerStatusProtocol] = None
async def start(self, height: int, tip: bytes, interface: str, port: int):
if self.is_running:
return
loop = asyncio.get_event_loop()
self._protocol = SPVServerStatusProtocol(height, tip)
interface = interface if interface.lower() != 'localhost' else '127.0.0.1'
await loop.create_datagram_endpoint(lambda: self._protocol, (interface, port))
log.info("started udp status server on %s:%i", interface, port)
def stop(self):
if self.is_running:
self._protocol.close()
self._protocol = None
@property
def is_running(self):
return self._protocol is not None
def set_unavailable(self):
if self.is_running:
self._protocol.set_unavailable()
def set_available(self):
if self.is_running:
self._protocol.set_available()
def set_height(self, height: int, tip: bytes):
if self.is_running:
self._protocol.set_height(height, tip)
class SPVStatusClientProtocol(asyncio.DatagramProtocol):
PROTOCOL_VERSION = 1
def __init__(self, responses: asyncio.Queue):
super().__init__()
self.transport: Optional[asyncio.transports.DatagramTransport] = None
self.responses = responses
self._ping_packet = SPVPing.make(self.PROTOCOL_VERSION)
def datagram_received(self, data: bytes, addr: Tuple[str, int]):
try:
self.responses.put_nowait(((addr, perf_counter()), SPVPong.decode(data)))
except (ValueError, struct.error, AttributeError, TypeError, RuntimeError):
return
def connection_made(self, transport) -> None:
self.transport = transport
def connection_lost(self, exc: Optional[Exception]) -> None:
self.transport = None
log.info("closed udp spv server selection client")
def ping(self, server: Tuple[str, int]):
self.transport.sendto(self._ping_packet, server)
def close(self):
# log.info("close udp client")
if self.transport:
self.transport.close()
+13 -6
View File
@@ -539,6 +539,7 @@ class Transaction:
height: int = -2, position: int = -1, julian_day: int = None) -> None:
self._raw = raw
self._raw_sans_segwit = None
self._raw_outputs = None
self.is_segwit_flag = 0
self.witnesses: List[bytes] = []
self.ref = TXRefMutable(self)
@@ -600,6 +601,7 @@ class Transaction:
def _reset(self):
self._raw = None
self._raw_sans_segwit = None
self._raw_outputs = None
self.ref.reset()
@property
@@ -693,9 +695,7 @@ class Transaction:
stream.write_compact_size(len(self._inputs))
for txin in self._inputs:
txin.serialize_to(stream)
stream.write_compact_size(len(self._outputs))
for txout in self._outputs:
txout.serialize_to(stream)
self._serialize_outputs(stream)
stream.write_uint32(self.locktime)
return stream.get_bytes()
@@ -709,13 +709,19 @@ class Transaction:
txin.serialize_to(stream, txin.txo_ref.txo.script.source)
else:
txin.serialize_to(stream, b'')
stream.write_compact_size(len(self._outputs))
for txout in self._outputs:
txout.serialize_to(stream)
self._serialize_outputs(stream)
stream.write_uint32(self.locktime)
stream.write_uint32(self.signature_hash_type(1)) # signature hash type: SIGHASH_ALL
return stream.get_bytes()
def _serialize_outputs(self, stream):
if self._raw_outputs is None:
self._raw_outputs = BCDataStream()
self._raw_outputs.write_compact_size(len(self._outputs))
for txout in self._outputs:
txout.serialize_to(self._raw_outputs)
stream.write(self._raw_outputs.get_bytes())
def _deserialize(self):
if self._raw is not None:
stream = BCDataStream(self._raw)
@@ -844,6 +850,7 @@ class Transaction:
return hash_type
async def sign(self, funding_accounts: Iterable['Account']):
self._reset()
ledger, wallet = self.ensure_all_have_same_ledger_and_wallet(funding_accounts)
for i, txi in enumerate(self._inputs):
assert txi.script is not None
+1 -1
View File
@@ -64,7 +64,7 @@ async def checkcontrolling(daemon: Daemon, db: SQLDB):
if __name__ == '__main__':
if not len(sys.argv) == 3:
if len(sys.argv) != 3:
print("usage: <db_file_path> <lbrycrd_url>")
sys.exit(1)
db_path, lbrycrd_url = sys.argv[1:] # pylint: disable=W0632
-177
View File
@@ -1,177 +0,0 @@
import os
import time
import textwrap
import argparse
import asyncio
import logging
from concurrent.futures.process import ProcessPoolExecutor
from lbry.wallet.server.db.reader import search_to_bytes, initializer, _get_claims, interpolate
from lbry.wallet.ledger import MainNetLedger
log = logging.getLogger(__name__)
log.addHandler(logging.StreamHandler())
log.setLevel(logging.CRITICAL)
DEFAULT_ANY_TAGS = [
'blockchain',
'news',
'learning',
'technology',
'automotive',
'economics',
'food',
'science',
'art',
'nature'
]
COMMON_AND_RARE = [
'gaming',
'ufos'
]
COMMON_AND_RARE2 = [
'city fix',
'gaming'
]
RARE_ANY_TAGS = [
'city fix',
'ufos',
]
CITY_FIX = [
'city fix'
]
MATURE_TAGS = [
'porn',
'nsfw',
'mature',
'xxx'
]
ORDER_BY = [
[
"trending_global",
"trending_mixed",
],
[
"release_time"
],
[
"effective_amount"
]
]
def get_args(limit=20):
args = []
any_tags_combinations = [DEFAULT_ANY_TAGS, COMMON_AND_RARE, RARE_ANY_TAGS, COMMON_AND_RARE2, CITY_FIX, []]
not_tags_combinations = [MATURE_TAGS, []]
for no_fee in [False, True]:
for claim_type in [None, 'stream', 'channel']:
for no_totals in [True]:
for offset in [0, 100]:
for any_tags in any_tags_combinations:
for not_tags in not_tags_combinations:
for order_by in ORDER_BY:
kw = {
'order_by': order_by,
'offset': offset,
'limit': limit,
'no_totals': no_totals
}
if not_tags:
kw['not_tags'] = not_tags
if any_tags:
kw['any_tags'] = any_tags
if claim_type:
kw['claim_type'] = claim_type
if no_fee:
kw['fee_amount'] = 0
args.append(kw)
print(f"-- Trying {len(args)} argument combinations")
return args
def _search(kwargs):
start = time.perf_counter()
error = None
try:
search_to_bytes(kwargs)
except Exception as err:
error = str(err)
return time.perf_counter() - start, kwargs, error
async def search(executor, kwargs):
return await asyncio.get_running_loop().run_in_executor(
executor, _search, kwargs
)
async def main(db_path, max_query_time):
args = dict(initializer=initializer, initargs=(log, db_path, MainNetLedger, 0.25))
workers = max(os.cpu_count(), 4)
log.info(f"using {workers} reader processes")
query_executor = ProcessPoolExecutor(workers, **args)
tasks = [search(query_executor, constraints) for constraints in get_args()]
try:
results = await asyncio.gather(*tasks)
query_times = [
{
'sql': interpolate(*_get_claims("""
claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
claim.claim_hash, claim.txo_hash,
claim.claims_in_channel,
claim.height, claim.creation_height,
claim.activation_height, claim.expiration_height,
claim.effective_amount, claim.support_amount,
claim.trending_group, claim.trending_mixed,
claim.trending_local, claim.trending_global,
claim.short_url, claim.canonical_url,
claim.channel_hash, channel.txo_hash AS channel_txo_hash,
channel.height AS channel_height, claim.signature_valid
""", **constraints)),
'duration': ts,
'error': error
}
for ts, constraints, error in results
]
errored = [query_info for query_info in query_times if query_info['error']]
errors = {str(query_info['error']): [] for query_info in errored}
for error in errored:
errors[str(error['error'])].append(error['sql'])
slow = [
query_info for query_info in query_times
if not query_info['error'] and query_info['duration'] > (max_query_time / 2.0)
]
fast = [
query_info for query_info in query_times
if not query_info['error'] and query_info['duration'] <= (max_query_time / 2.0)
]
print(f"-- {len(fast)} queries were fast")
slow.sort(key=lambda query_info: query_info['duration'], reverse=True)
print(f"-- Failing queries:")
for error in errors:
print(f"-- Failure: \"{error}\"")
for failing_query in errors[error]:
print(f"{textwrap.dedent(failing_query)};\n")
print()
print(f"-- Slow queries:")
for slow_query in slow:
print(f"-- Query took {slow_query['duration']}\n{textwrap.dedent(slow_query['sql'])};\n")
finally:
query_executor.shutdown()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--db_path', dest='db_path', default=os.path.expanduser('~/claims.db'), type=str)
parser.add_argument('--max_time', dest='max_time', default=0.25, type=float)
args = parser.parse_args()
db_path = args.db_path
max_query_time = args.max_time
asyncio.run(main(db_path, max_query_time))
+25
View File
@@ -13,6 +13,7 @@ from lbry.extras.cli import set_kwargs, get_argument_parser
from lbry.extras.daemon.daemon import (
Daemon, jsonrpc_dumps_pretty, encode_pagination_doc
)
from tests.integration.other.test_comment_commands import MockedCommentServer
from lbry.extras.daemon.json_response_encoder import (
encode_tx_doc, encode_txo_doc, encode_account_doc, encode_file_doc,
encode_wallet_doc
@@ -66,6 +67,10 @@ class Examples(CommandTestCase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.daemon.conf.comment_server = 'http://localhost:2903/api'
self.comment_server = MockedCommentServer(2903)
await self.comment_server.start()
self.addCleanup(self.comment_server.stop)
self.recorder = ExampleRecorder(self)
async def play(self):
@@ -360,6 +365,26 @@ class Examples(CommandTestCase):
await self.daemon.jsonrpc_comment_abandon(reply['comment_id'])
# collections
collection = await r(
'Create a collection of one stream',
'collection', 'create',
'--name=tom', '--bid=1.0',
f'--channel_id={channel_id}',
f'--claims={stream_id}'
)
await self.on_transaction_dict(collection)
await self.generate(1)
await self.on_transaction_dict(collection)
await r(
'List collections',
'collection', 'list',
'--resolve', '--resolve_claims=1',
)
# files
file_list_result = (await r(
-62
View File
@@ -1,62 +0,0 @@
import uvloop, asyncio, time, sys, logging
from concurrent.futures import ProcessPoolExecutor
from lbry.wallet.server.db import reader
from lbry.wallet.server.metrics import calculate_avg_percentiles
db_path = '../../../lbryconf/wallet-server/claims.db'
default_query_timout = 0.25
log = logging.getLogger(__name__)
log.addHandler(logging.StreamHandler())
async def run_times(executor, iterations, show=True):
start = time.perf_counter()
timings = await asyncio.gather(*(asyncio.get_running_loop().run_in_executor(
executor, reader.search_to_bytes, {
'no_totals': True,
'offset': 0,
'limit': 20,
'any_tags': [
'ufos', 'city fix'
],
'not_tags': [
'porn', 'mature', 'xxx', 'nsfw'
],
'order_by': [
'release_time'
]
}
) for _ in range(iterations)))
timings = [r[1]['execute_query'][0]['total'] for r in timings]
total = int((time.perf_counter() - start) * 100)
if show:
avg = sum(timings)/len(timings)
print(f"{iterations:4}: {total}ms total concurrent, {len(timings)*avg*1000:.3f}s total sequential (avg*runs)")
print(f" {total/len(timings):.1f}ms/query concurrent (total/runs)")
print(f" {avg:.1f}ms/query actual average (sum(queries)/runs)")
stats = calculate_avg_percentiles(timings)
print(f" min: {stats[1]}, 5%: {stats[2]}, 25%: {stats[3]}, 50%: {stats[4]}, 75%: {stats[5]}, 95%: {stats[6]}, max: {stats[7]}")
sys.stdout.write(' sample:')
for i, t in zip(range(10), timings[::-1]):
sys.stdout.write(f' {t}ms')
print(' ...\n' if len(timings) > 10 else '\n')
async def main():
executor = ProcessPoolExecutor(
4, initializer=reader.initializer, initargs=(log, db_path, 'mainnet', 1.0, True)
)
#await run_times(executor, 4, show=False)
#await run_times(executor, 1)
await run_times(executor, 2**3)
await run_times(executor, 2**5)
await run_times(executor, 2**7)
#await run_times(executor, 2**9)
#await run_times(executor, 2**11)
#await run_times(executor, 2**13)
executor.shutdown(True)
if __name__ == '__main__':
uvloop.install()
asyncio.run(main())
-273
View File
@@ -1,273 +0,0 @@
#!/usr/bin/env python
import asyncio
import json
import logging
import pickle
import signal
import sqlite3
import time
from os import path
from pprint import pprint
from urllib.parse import unquote
from aioupnp import upnp, fault as upnpfault
from aiohttp import web
from lbry.wallet.network import ClientSession
from lbry.schema.result import Outputs
from lbry.wallet.transaction import Transaction
from binascii import hexlify, unhexlify
from lbry.dht import node, peer
log = logging.getLogger("lbry")
log.addHandler(logging.StreamHandler())
log.setLevel(logging.INFO)
async def main():
data_dir = "/home/grin/code/lbry/sdk"
state_dir = data_dir + '/nodestate/'
loop = asyncio.get_event_loop()
try:
loop.add_signal_handler(signal.SIGINT, shutdown)
loop.add_signal_handler(signal.SIGTERM, shutdown)
except NotImplementedError:
pass # Not implemented on Windows
db = sqlite3.connect(data_dir + "/tracker.sqlite3")
db.execute('CREATE TABLE IF NOT EXISTS announce (local_id TEXT, hash TEXT, node_id TEXT, ip TEXT, port INT, timestamp INT)')
db.execute('CREATE UNIQUE INDEX IF NOT EXISTS node_id_hash_idx ON announce (node_id, hash)')
spv_host = 'spv13.lbry.com'
wallet_client = ClientSession(network=None, server=(spv_host, 50001))
await wallet_client.create_connection()
asyncio.create_task(run_web_api(loop, db, wallet_client))
num_nodes = 128
u = await upnp.UPnP.discover()
external_ip = await u.get_external_ip()
try:
nodes = await start_nodes(loop, num_nodes, external_ip, state_dir)
await asyncio.gather(*map(lambda n: n.started_listening.wait(), nodes), loop=loop)
print("joined")
queue = asyncio.Queue(maxsize=100*num_nodes)
for n in nodes:
asyncio.create_task(drain_events(n, queue))
while True:
(n, node_id, ip, method, args) = await queue.get()
local_node_id = bytes.hex(n.protocol.node_id)
if method != b'store':
# print(f"{local_node_id[:8]}: {method} from {bytes.hex(node_id)} ({ip})")
continue
if len(args)< 5:
print(f'malformed args to Store')
pprint(args)
continue
blob_hash, token, port, original_publisher_id, age = args[:5]
print(f"STORE to {local_node_id[:8]} from {bytes.hex(node_id)[:8]} ({ip}) for blob {bytes.hex(blob_hash)[:8]}")
try:
cur = db.cursor()
cur.execute(
'''
INSERT INTO announce (local_id, hash, node_id, ip, port, timestamp) VALUES (?,?,?,?,?,?)
ON CONFLICT (node_id, hash) DO UPDATE SET
local_id=excluded.local_id, ip=excluded.ip, port=excluded.port, timestamp=excluded.timestamp
''',
(local_node_id, bytes.hex(blob_hash), bytes.hex(node_id), ip, port, int(time.time()))
)
db.commit()
cur.close()
except sqlite3.Error as err:
print("failed sqlite insert", err)
finally:
print("shutting down")
for n in nodes:
node_id = bytes.hex(n.protocol.node_id)
n.stop()
# print(f'deleting upnp port mapping {n.protocol.udp_port}')
try:
await u.delete_port_mapping(n.protocol.udp_port, "UDP")
except upnpfault.UPnPError:
pass
state = n.get_state()
# keep existing rt if there is one
if len(state.routing_table_peers) == 0 and path.exists(state_dir + node_id):
with open(state_dir + node_id, 'rb') as f:
existing_state = pickle.load(f)
if len(existing_state.routing_table_peers) > 0:
state.routing_table_peers = existing_state.routing_table_peers
print(f'rt empty on save, but old rt was recovered ({len(state.routing_table_peers)} peers)')
with open(state_dir + node_id, 'wb') as f:
# pprint(state.routing_table_peers)
# pprint(state.datastore)
print(f'{node_id[:8]}: saved {len(state.routing_table_peers)} rt peers, {len(state.datastore)} in store')
pickle.dump(state, f)
await wallet_client.close()
db.close()
class ShutdownErr(BaseException):
pass
def shutdown():
print("got interrupt signal...")
raise ShutdownErr()
def make_node_id(i: int, n: int) -> str:
"""
split dht address space into N chunks and return the first id of the i'th chunk
make_node_id(0,n) returns 000...000 for any n
"""
if not 0 <= i < n:
raise ValueError("i must be between 0 (inclusive) and n (exclusive)")
bytes_in_id = 48
return "{0:0{1}x}".format(i * ((2**8)**bytes_in_id // n), bytes_in_id*2)
async def start_nodes(loop, num_nodes, external_ip, state_dir):
start_port = 4445
known_node_urls = [("lbrynet1.lbry.com", 4444), ("lbrynet2.lbry.com", 4444), ("lbrynet3.lbry.com", 4444)]
peer_manager = peer.PeerManager(loop)
nodes = []
for i in range(num_nodes):
node_id = make_node_id(i, num_nodes)
# pprint(node_id)
port = start_port + i
# await u.get_next_mapping(port, "UDP", "lbry dht tracker") # not necessary, i just opened ports in router
n = node.Node(loop, peer_manager, node_id=bytes.fromhex(node_id), external_ip=external_ip,
udp_port=port, internal_udp_port=port, peer_port=3333)
persisted_peers = []
if path.exists(state_dir + node_id):
with open(state_dir + node_id, 'rb') as f:
state = pickle.load(f)
# pprint(state.routing_table_peers)
# pprint(state.datastore)
print(f'{node_id[:8]}: loaded {len(state.routing_table_peers)} rt peers, {len(state.datastore)} in store')
n.load_state(state)
persisted_peers = state.routing_table_peers
# if len(persisted_peers) == 0 and len(state.datastore) > 0:
# peers_to_import = map(lambda p: (p[0], p[1], p[2], p[3]), n.get_state().datastore)
# persisted_peers.extend(peers_to_import)
# print(f'{node_id[:8]}: rt is empty but we recovered {len(state.datastore)} '
# f'peers from the datastore. {len(peers_to_import)} of those were recent enough to import')
n.start("0.0.0.0", known_node_urls, persisted_peers)
nodes.append(n)
return nodes
async def drain_events(n, q):
# print(f'drain started on {bytes.hex(n.protocol.node_id)[:8]}')
while True:
(node_id, ip, method, args) = await n.protocol.event_queue.get()
try:
q.put_nowait((n, node_id, ip, method, args))
except asyncio.QueueFull:
pass
async def run_web_api(loop, db, wallet_client):
try:
app = web.Application(loop=loop)
app['db'] = db
app['wallet_client'] = wallet_client
app.add_routes([
web.get('/', api_handler),
web.get('/seeds/hash/{hash}', seeds_handler),
web.get('/seeds/url/{url}', url_handler),
])
# server = web.Server(api_handler, loop=loop)
# runner = web.ServerRunner(server)
runner = web.AppRunner(app)
await runner.setup()
site = web.TCPSite(runner, 'localhost', 8080)
await site.start()
except Exception as err:
pprint(err)
await runner.cleanup()
async def seeds_handler(request):
blobhash = request.match_info['hash']
db = request.app['db']
try:
cur = db.cursor()
c = cur.execute("""
select count(distinct(node_id)) from announce where hash = ? and timestamp > strftime('%s','now','-1 day')
""", (blobhash,)).fetchone()[0]
cur.close()
return web.Response(text=json.dumps({'seeds': c})+"\n")
except Exception as err:
return web.Response(text=json.dumps({'error': err})+"\n")
async def url_handler(request):
url = unquote(request.match_info['url'])
log.warning(url)
db = request.app['db']
wallet_client = request.app['wallet_client']
try:
sd_hash = await get_sd_hash(wallet_client, url)
if sd_hash is None:
return web.Response(text=json.dumps({'error': 'Could not get sd hash for url', 'url': url})+"\n")
seeds = get_seeds(db, sd_hash)
return web.Response(text=json.dumps({'url': url, 'sd_hash': sd_hash, 'seeds': seeds})+"\n")
except Exception as err:
return web.Response(text=json.dumps({'error': err})+"\n")
def get_seeds(db, blobhash):
cur = db.cursor()
c = cur.execute(
"select count(distinct(node_id)) from announce where hash = ? and timestamp > strftime('%s','now','-1 day')",
(blobhash,)
).fetchone()[0]
cur.close()
return c
async def get_sd_hash(wallet_client, url):
try:
resolved_txos = Outputs.from_base64(await wallet_client.send_request('blockchain.claimtrie.resolve', [url]))
if not resolved_txos.txos:
return None
raw_txs = await wallet_client.send_request('blockchain.transaction.get_batch', [txid for (txid, height) in resolved_txos.txs])
txo_proto = resolved_txos.txos[0]
txid = txo_proto.tx_hash[::-1].hex()
raw_tx_hex, _ = raw_txs[txid]
txo = Transaction(bytes.fromhex(raw_tx_hex)).outputs[txo_proto.nout]
return txo.claim.stream.source.sd_hash
except Exception as err: # claim is not a stream, stream has no source, protobuf err, etc
if isinstance(err, asyncio.CancelledError):
raise err
log.exception("failed to get sd_hash")
return None
async def api_handler(request):
return web.Response(text="tracker OK")
if __name__ == "__main__":
try:
asyncio.run(main())
except ShutdownErr:
pass
+4 -2
View File
@@ -28,8 +28,9 @@ setup(
entry_points={
'console_scripts': [
'lbrynet=lbry.extras.cli:main',
'torba-server=lbry.wallet.server.cli:main',
'lbry-hub=lbry.wallet.server.cli:main',
'orchstr8=lbry.wallet.orchstr8.cli:main',
'lbry-hub-elastic-sync=lbry.wallet.server.db.elasticsearch.sync:run_elastic_sync'
],
},
install_requires=[
@@ -53,7 +54,8 @@ setup(
'coincurve==11.0.0',
'pbkdf2==1.3',
'attrs==18.2.0',
'pylru==1.1.0'
'pylru==1.1.0',
'elasticsearch==7.10.1'
] + PLYVEL,
classifiers=[
'Framework :: AsyncIO',
@@ -114,15 +114,6 @@ class BlockchainReorganizationTests(CommandTestCase):
client_reorg_block_hash = (await self.ledger.headers.hash(208)).decode()
self.assertEqual(client_reorg_block_hash, reorg_block_hash)
# verify the dropped claim is no longer returned by claim search
txos, _, _, _ = await self.ledger.claim_search([], name='hovercraft')
self.assertListEqual(txos, [])
# verify the claim published a block earlier wasn't also reverted
txos, _, _, _ = await self.ledger.claim_search([], name='still-valid')
self.assertEqual(1, len(txos))
self.assertEqual(207, txos[0].tx_ref.height)
# broadcast the claim in a different block
new_txid = await self.blockchain.sendrawtransaction(hexlify(broadcast_tx.raw).decode())
self.assertEqual(broadcast_tx.id, new_txid)
@@ -3,6 +3,7 @@ import tempfile
import logging
import asyncio
from binascii import unhexlify
from unittest import skip
from urllib.request import urlopen
from lbry.error import InsufficientFundsError
@@ -10,6 +11,7 @@ from lbry.extras.daemon.comment_client import verify
from lbry.extras.daemon.daemon import DEFAULT_PAGE_SIZE
from lbry.testcase import CommandTestCase
from lbry.wallet.orchstr8.node import SPVNode
from lbry.wallet.transaction import Transaction
from lbry.wallet.util import satoshis_to_coins as lbc
@@ -72,9 +74,11 @@ class ClaimSearchCommand(ClaimTestCase):
for claim, result in zip(claims, results):
self.assertEqual(
(claim['txid'], self.get_claim_id(claim)),
(result['txid'], result['claim_id'])
(result['txid'], result['claim_id']),
f"(expected {claim['outputs'][0]['name']}) != (got {result['name']})"
)
@skip("doesnt happen on ES...?")
async def test_disconnect_on_memory_error(self):
claim_ids = [
'0000000000000000000000000000000000000000',
@@ -94,6 +98,18 @@ class ClaimSearchCommand(ClaimTestCase):
with self.assertRaises(ConnectionResetError):
await self.claim_search(claim_ids=claim_ids)
async def test_claim_search_as_reader_server(self):
node2 = SPVNode(self.conductor.spv_module, node_number=2)
current_prefix = self.conductor.spv_node.server.bp.env.es_index_prefix
await node2.start(self.blockchain, extraconf={'ES_MODE': 'reader', 'ES_INDEX_PREFIX': current_prefix})
self.addCleanup(node2.stop)
self.ledger.network.config['default_servers'] = [(node2.hostname, node2.port)]
await self.ledger.stop()
await self.ledger.start()
channel2 = await self.channel_create('@abc', '0.1', allow_duplicate_name=True)
await asyncio.sleep(1) # fixme: find a way to block on the writer
await self.assertFindsClaims([channel2], name='@abc')
async def test_basic_claim_search(self):
await self.create_channel()
channel_txo = self.channel['outputs'][0]
@@ -134,6 +150,7 @@ class ClaimSearchCommand(ClaimTestCase):
claims = [three, two, signed]
await self.assertFindsClaims(claims, channel_ids=[self.channel_id])
await self.assertFindsClaims(claims, channel=f"@abc#{self.channel_id}")
await self.assertFindsClaims([], channel=f"@inexistent")
await self.assertFindsClaims([three, two, signed2, signed], channel_ids=[channel_id2, self.channel_id])
await self.channel_abandon(claim_id=self.channel_id)
await self.assertFindsClaims([], channel=f"@abc#{self.channel_id}", valid_channel_signature=True)
@@ -157,6 +174,20 @@ class ClaimSearchCommand(ClaimTestCase):
# abandoned stream won't show up for streams in channel search
await self.stream_abandon(txid=signed2['txid'], nout=0)
await self.assertFindsClaims([], channel_ids=[channel_id2])
# resolve by claim ids
await self.assertFindsClaims([three, two], claim_ids=[self.get_claim_id(three), self.get_claim_id(two)])
await self.assertFindsClaims([three], claim_id=self.get_claim_id(three))
await self.assertFindsClaims([three], claim_id=self.get_claim_id(three), text='*')
async def test_source_filter(self):
channel = await self.channel_create('@abc')
no_source = await self.stream_create('no-source', data=None)
normal = await self.stream_create('normal', data=b'normal')
normal_repost = await self.stream_repost(self.get_claim_id(normal), 'normal-repost')
no_source_repost = await self.stream_repost(self.get_claim_id(no_source), 'no-source-repost')
await self.assertFindsClaims([no_source_repost, no_source, channel], has_no_source=True)
await self.assertFindsClaims([normal_repost, normal, channel], has_source=True)
await self.assertFindsClaims([no_source_repost, normal_repost, normal, no_source, channel])
async def test_pagination(self):
await self.create_channel()
@@ -352,6 +383,38 @@ class ClaimSearchCommand(ClaimTestCase):
limit_claims_per_channel=3, claim_type='stream'
)
async def test_limit_claims_per_channel_across_sorted_pages(self):
await self.generate(10)
match = self.assertFindsClaims
channel_id = self.get_claim_id(await self.channel_create('@chan0'))
claims = []
first = await self.stream_create('claim0', channel_id=channel_id)
second = await self.stream_create('claim1', channel_id=channel_id)
for i in range(2, 10):
some_chan = self.get_claim_id(await self.channel_create(f'@chan{i}', bid='0.001'))
claims.append(await self.stream_create(f'claim{i}', bid='0.001', channel_id=some_chan))
last = await self.stream_create('claim10', channel_id=channel_id)
await match(
[first, second, claims[0], claims[1]], page_size=4,
limit_claims_per_channel=3, claim_type='stream', order_by=['^height']
)
# second goes out
await match(
[first, claims[0], claims[1], claims[2]], page_size=4,
limit_claims_per_channel=1, claim_type='stream', order_by=['^height']
)
# second appears, from replacement queue
await match(
[second, claims[3], claims[4], claims[5]], page_size=4, page=2,
limit_claims_per_channel=1, claim_type='stream', order_by=['^height']
)
# last is unaffected, as the limit applies per page
await match(
[claims[6], claims[7], last], page_size=4, page=3,
limit_claims_per_channel=1, claim_type='stream', order_by=['^height']
)
async def test_claim_type_and_media_type_search(self):
# create an invalid/unknown claim
address = await self.account.receiving.get_or_create_usable_address()
@@ -365,6 +428,7 @@ class ClaimSearchCommand(ClaimTestCase):
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))
collection = await self.collection_create('a-collection', claims=[self.get_claim_id(video)])
channel = await self.channel_create()
unknown = self.sout(tx)
@@ -372,6 +436,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([image, video, octet, unknown], claim_type='stream')
await self.assertFindsClaims([channel], claim_type='channel')
await self.assertFindsClaims([repost], claim_type='repost')
await self.assertFindsClaims([collection], claim_type='collection')
# stream_type
await self.assertFindsClaims([octet, unknown], stream_types=['binary'])
@@ -422,10 +487,11 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims([claim2], text='autobiography')
await self.assertFindsClaims([claim3], text='history')
await self.assertFindsClaims([claim4], text='conspiracy')
await self.assertFindsClaims([], text='conspiracy AND history')
await self.assertFindsClaims([claim4, claim3], text='conspiracy OR history')
await self.assertFindsClaims([claim1, claim4, claim2, claim3], text='documentary')
await self.assertFindsClaims([claim4, claim1, claim2, claim3], text='satoshi')
await self.assertFindsClaims([], text='conspiracy+history')
await self.assertFindsClaims([claim4, claim3], text='conspiracy|history')
await self.assertFindsClaims([claim1, claim4, claim2, claim3], text='documentary', order_by=[])
# todo: check why claim1 and claim2 order changed. used to be ...claim1, claim2...
await self.assertFindsClaims([claim4, claim2, claim1, claim3], text='satoshi', order_by=[])
claim2 = await self.stream_update(
self.get_claim_id(claim2), clear_tags=True, tags=['cloud'],
@@ -461,6 +527,47 @@ class TransactionCommands(ClaimTestCase):
class TransactionOutputCommands(ClaimTestCase):
async def test_txo_list_resolve_supports(self):
channel = self.get_claim_id(await self.channel_create('@identity'))
stream = self.get_claim_id(await self.stream_create())
support = await self.support_create(stream, channel_id=channel)
r, = await self.txo_list(type='support')
self.assertEqual(r['txid'], support['txid'])
self.assertNotIn('name', r['signing_channel'])
r, = await self.txo_list(type='support', resolve=True)
self.assertIn('name', r['signing_channel'])
self.assertEqual(r['signing_channel']['name'], '@identity')
async def test_txo_list_by_channel_filtering(self):
channel_foo = self.get_claim_id(await self.channel_create('@foo'))
channel_bar = self.get_claim_id(await self.channel_create('@bar'))
stream_a = self.get_claim_id(await self.stream_create('a', channel_id=channel_foo))
stream_b = self.get_claim_id(await self.stream_create('b', channel_id=channel_foo))
stream_c = self.get_claim_id(await self.stream_create('c', channel_id=channel_bar))
stream_d = self.get_claim_id(await self.stream_create('d'))
support_c = await self.support_create(stream_c, '0.3', channel_id=channel_foo)
support_d = await self.support_create(stream_d, '0.3', channel_id=channel_bar)
r = await self.txo_list(type='stream')
self.assertEqual({stream_a, stream_b, stream_c, stream_d}, {c['claim_id'] for c in r})
r = await self.txo_list(type='stream', channel_id=channel_foo)
self.assertEqual({stream_a, stream_b}, {c['claim_id'] for c in r})
r = await self.txo_list(type='support', channel_id=channel_foo)
self.assertEqual({support_c['txid']}, {s['txid'] for s in r})
r = await self.txo_list(type='support', channel_id=channel_bar)
self.assertEqual({support_d['txid']}, {s['txid'] for s in r})
r = await self.txo_list(type='stream', channel_id=[channel_foo, channel_bar])
self.assertEqual({stream_a, stream_b, stream_c}, {c['claim_id'] for c in r})
r = await self.txo_list(type='stream', not_channel_id=channel_foo)
self.assertEqual({stream_c, stream_d}, {c['claim_id'] for c in r})
r = await self.txo_list(type='stream', not_channel_id=[channel_foo, channel_bar])
self.assertEqual({stream_d}, {c['claim_id'] for c in r})
async def test_txo_list_and_sum_filtering(self):
channel_id = self.get_claim_id(await self.channel_create())
self.assertEqual('1.0', lbc(await self.txo_sum(type='channel', is_not_spent=True)))
@@ -1295,6 +1402,11 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(1, blocked['channels'][0]['blocked'])
self.assertTrue(blocked['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(self.daemon.jsonrpc_claim_search(name='bad_content', no_totals=True))
self.assertEqual(result['items'], last_result['items'])
# search inside channel containing filtered content
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel'))
filtered = result['blocked']
@@ -1304,6 +1416,11 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(1, filtered['channels'][0]['blocked'])
self.assertTrue(filtered['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel', no_totals=True))
self.assertEqual(result['items'], last_result['items'])
# 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']))
@@ -1357,6 +1474,13 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(3, filtered['channels'][0]['blocked'])
self.assertTrue(filtered['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(
self.daemon.jsonrpc_claim_search(any_tags=['bad-stuff'], order_by=['height'], no_totals=True)
)
self.assertEqual(result['items'], last_result['items'])
# filtered channel should still resolve
result = await self.resolve('lbry://@bad_channel')
self.assertEqual(bad_channel_id, result['claim_id'])
@@ -1801,9 +1925,6 @@ class StreamCommands(ClaimTestCase):
with self.assertRaisesRegex(Exception, "'bid' is a required argument for new publishes."):
await self.daemon.jsonrpc_publish('foo')
with self.assertRaisesRegex(Exception, "'file_path' is a required argument for new publishes."):
await self.daemon.jsonrpc_publish('foo', bid='1.0')
# successfully create stream
with tempfile.NamedTemporaryFile() as file:
file.write(b'hi')
@@ -1846,6 +1967,41 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(claim['value']['languages'], ['uk-UA'])
self.assertEqual(claim['value']['tags'], ['anime'])
# publish a stream with no source
tx5 = await self.publish(
'future-release', bid='0.1', languages='uk-UA', tags=['Anime', 'anime ']
)
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 2)
claim = await self.resolve('lbry://future-release')
self.assertEqual(claim['txid'], tx5['outputs'][0]['txid'])
self.assertNotIn('signing_channel', claim)
self.assertEqual(claim['value']['languages'], ['uk-UA'])
self.assertEqual(claim['value']['tags'], ['anime'])
self.assertNotIn('source', claim['value'])
# change metadata before the release
await self.publish(
'future-release', bid='0.1', tags=['Anime', 'anime ', 'psy-trance'], title='Psy will be over 9000!!!'
)
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 2)
claim = await self.resolve('lbry://future-release')
self.assertEqual(claim['value']['tags'], ['anime', 'psy-trance'])
self.assertEqual(claim['value']['title'], 'Psy will be over 9000!!!')
self.assertNotIn('source', claim['value'])
# update the stream to have a source
tx6 = await self.publish(
'future-release', sd_hash='beef', file_hash='beef',
file_name='blah.mp3', tags=['something-else']
)
claim = await self.resolve('lbry://future-release')
self.assertEqual(claim['txid'], tx6['outputs'][0]['txid'])
self.assertEqual(claim['value']['tags'], ['something-else'])
self.assertEqual(claim['value']['source']['sd_hash'], 'beef')
self.assertEqual(claim['value']['source']['hash'], 'beef')
self.assertEqual(claim['value']['source']['name'], 'blah.mp3')
self.assertEqual(claim['value']['source']['media_type'], 'audio/mpeg')
class SupportCommands(CommandTestCase):
@@ -1933,10 +2089,14 @@ class SupportCommands(CommandTestCase):
self.assertTrue(txs[1]['support_info'][0]['is_tip'])
self.assertTrue(txs[1]['support_info'][0]['is_spent'])
async def test_signed_supports(self):
async def test_signed_supports_with_no_change_txo_regression(self):
# reproduces a bug where transactions did not get properly signed
# if there was no change and just a single output
# lbrycrd returned 'the transaction was rejected by network rules.'
channel_id = self.get_claim_id(await self.channel_create())
stream_id = self.get_claim_id(await self.stream_create())
tx = await self.support_create(stream_id, '0.3', channel_id=channel_id)
tx = await self.support_create(stream_id, '7.967598', channel_id=channel_id)
self.assertEqual(len(tx['outputs']), 1) # must be one to reproduce bug
self.assertTrue(tx['outputs'][0]['is_channel_signature_valid'])
@@ -1982,6 +2142,10 @@ class CollectionCommands(CommandTestCase):
await self.collection_update(claim_id, clear_claims=True, claims=claim_ids[:2])
collections = await self.out(self.daemon.jsonrpc_collection_list())
self.assertEquals(len(collections['items']), 2)
self.assertNotIn('canonical_url', collections['items'][0])
resolved_collections = await self.out(self.daemon.jsonrpc_collection_list(resolve=True))
self.assertIn('canonical_url', resolved_collections['items'][0])
await self.collection_abandon(claim_id)
self.assertItemCount(await self.daemon.jsonrpc_collection_list(), 1)
+59 -36
View File
@@ -4,8 +4,10 @@ import lbry
from unittest.mock import Mock
from lbry.wallet.network import Network
from lbry.wallet.orchstr8 import Conductor
from lbry.wallet.orchstr8.node import SPVNode
from lbry.wallet.rpc import RPCSession
from lbry.wallet.server.udp import StatusServer
from lbry.testcase import IntegrationTestCase, AsyncioTestCase
@@ -32,18 +34,17 @@ class NetworkTests(IntegrationTestCase):
'server_version': lbry.__version__,
'trending_algorithm': 'zscore',
}, await self.ledger.network.get_server_features())
await self.conductor.spv_node.stop()
# await self.conductor.spv_node.stop()
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.conductor.spv_node.server.env.payment_address = payment_address
self.conductor.spv_node.server.env.donation_address = donation_address
self.conductor.spv_node.server.env.description = 'Fastest server in the west.'
self.conductor.spv_node.server.env.daily_fee = '42'
from lbry.wallet.server.session import LBRYElectrumX
LBRYElectrumX.set_server_features(self.conductor.spv_node.server.env)
# await self.ledger.network.on_connected.first
self.assertDictEqual({
'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
'hash_function': 'sha256',
@@ -65,22 +66,20 @@ class ReconnectTests(IntegrationTestCase):
async def test_multiple_servers(self):
# we have a secondary node that connects later, so
node2 = SPVNode(self.conductor.spv_module, node_number=2)
self.ledger.network.config['default_servers'].append((node2.hostname, node2.port))
await asyncio.wait_for(self.ledger.stop(), timeout=1)
await asyncio.wait_for(self.ledger.start(), timeout=1)
self.ledger.network.session_pool.new_connection_event.clear()
await node2.start(self.blockchain)
# this is only to speed up the test as retrying would take 4+ seconds
for session in self.ledger.network.session_pool.sessions:
session.trigger_urgent_reconnect.set()
await asyncio.wait_for(self.ledger.network.session_pool.new_connection_event.wait(), timeout=1)
self.assertEqual(2, len(list(self.ledger.network.session_pool.available_sessions)))
self.ledger.network.config['default_servers'].append((node2.hostname, node2.port))
self.ledger.network.config['default_servers'].reverse()
self.assertEqual(50002, self.ledger.network.client.server[1])
await self.ledger.stop()
await self.ledger.start()
self.assertTrue(self.ledger.network.is_connected)
switch_event = self.ledger.network.on_connected.first
self.assertEqual(50003, self.ledger.network.client.server[1])
await node2.stop(True)
# secondary down, but primary is ok, do not switch! (switches trigger new on_connected events)
with self.assertRaises(asyncio.TimeoutError):
await asyncio.wait_for(switch_event, timeout=1)
self.assertFalse(self.ledger.network.is_connected)
await self.ledger.resolve([], ['derp'])
self.assertEqual(50002, self.ledger.network.client.server[1])
async def test_direct_sync(self):
await self.ledger.stop()
@@ -98,10 +97,13 @@ class ReconnectTests(IntegrationTestCase):
async def test_connection_drop_still_receives_events_after_reconnected(self):
address1 = await self.account.receiving.get_or_create_usable_address()
# disconnect and send a new tx, should reconnect and get it
self.ledger.network.client.connection_lost(Exception())
self.ledger.network.client.transport.close()
self.assertFalse(self.ledger.network.is_connected)
await self.ledger.resolve([], 'derp')
sendtxid = await self.blockchain.send_to_address(address1, 1.1337)
await asyncio.wait_for(self.on_transaction_id(sendtxid), 1.0) # mempool
# await self.ledger.resolve([], 'derp')
# self.assertTrue(self.ledger.network.is_connected)
await asyncio.wait_for(self.on_transaction_id(sendtxid), 10.0) # mempool
await self.blockchain.generate(1)
await self.on_transaction_id(sendtxid) # confirmed
self.assertLess(self.ledger.network.client.response_time, 1) # response time properly set lower, we are fine
@@ -123,7 +125,7 @@ class ReconnectTests(IntegrationTestCase):
await self.blockchain.generate(1)
# (this is just so the test doesn't hang forever if it doesn't reconnect)
if not self.ledger.network.is_connected:
await asyncio.wait_for(self.ledger.network.on_connected.first, timeout=1.0)
await asyncio.wait_for(self.ledger.network.on_connected.first, timeout=10.0)
# omg, the burned cable still works! torba is fire proof!
await self.ledger.network.get_transaction(sendtxid)
@@ -136,15 +138,34 @@ class ReconnectTests(IntegrationTestCase):
await self.ledger.network.on_connected.first
self.assertTrue(self.ledger.network.is_connected)
async def test_online_but_still_unavailable(self):
# Edge case. See issue #2445 for context
self.assertIsNotNone(self.ledger.network.session_pool.fastest_session)
for session in self.ledger.network.session_pool.sessions:
session.response_time = None
self.assertIsNone(self.ledger.network.session_pool.fastest_session)
# async def test_online_but_still_unavailable(self):
# # Edge case. See issue #2445 for context
# self.assertIsNotNone(self.ledger.network.session_pool.fastest_session)
# for session in self.ledger.network.session_pool.sessions:
# session.response_time = None
# self.assertIsNone(self.ledger.network.session_pool.fastest_session)
class UDPServerFailDiscoveryTest(AsyncioTestCase):
async def test_wallet_connects_despite_lack_of_udp(self):
conductor = Conductor()
conductor.spv_node.udp_port = '0'
await conductor.start_blockchain()
self.addCleanup(conductor.stop_blockchain)
await conductor.start_spv()
self.addCleanup(conductor.stop_spv)
self.assertFalse(conductor.spv_node.server.bp.status_server.is_running)
await asyncio.wait_for(conductor.start_wallet(), timeout=5)
self.addCleanup(conductor.stop_wallet)
self.assertTrue(conductor.wallet_node.ledger.network.is_connected)
class ServerPickingTestCase(AsyncioTestCase):
async def _make_udp_server(self, port):
s = StatusServer()
await s.start(0, b'\x00' * 32, '127.0.0.1', port)
self.addCleanup(s.stop)
async def _make_fake_server(self, latency=1.0, port=1):
# local fake server with artificial latency
@@ -156,6 +177,7 @@ class ServerPickingTestCase(AsyncioTestCase):
return {'height': 1}
server = await self.loop.create_server(lambda: FakeSession(), host='127.0.0.1', port=port)
self.addCleanup(server.close)
await self._make_udp_server(port)
return '127.0.0.1', port
async def _make_bad_server(self, port=42420):
@@ -164,9 +186,10 @@ class ServerPickingTestCase(AsyncioTestCase):
writer.write(await reader.read())
server = await asyncio.start_server(echo, host='127.0.0.1', port=port)
self.addCleanup(server.close)
await self._make_udp_server(port)
return '127.0.0.1', port
async def test_pick_fastest(self):
async def _test_pick_fastest(self):
ledger = Mock(config={
'default_servers': [
# fast but unhealthy, should be discarded
@@ -182,8 +205,8 @@ class ServerPickingTestCase(AsyncioTestCase):
network = Network(ledger)
self.addCleanup(network.stop)
asyncio.ensure_future(network.start())
await asyncio.wait_for(network.on_connected.first, timeout=1)
await network.start()
await asyncio.wait_for(network.on_connected.first, timeout=10)
self.assertTrue(network.is_connected)
self.assertTupleEqual(network.client.server, ('127.0.0.1', 1337))
self.assertTrue(all([not session.is_closing() for session in network.session_pool.available_sessions]))
@@ -11,7 +11,9 @@ class PurchaseCommandTests(CommandTestCase):
await super().asyncSetUp()
self.merchant_address = await self.blockchain.get_raw_change_address()
async def priced_stream(self, name='stream', price: Optional[str] = '2.0', currency='LBC') -> Transaction:
async def priced_stream(
self, name='stream', price: Optional[str] = '0.2', currency='LBC', mine=False
) -> Transaction:
kwargs = {}
if price and currency:
kwargs = {
@@ -19,6 +21,8 @@ class PurchaseCommandTests(CommandTestCase):
'fee_currency': currency,
'fee_address': self.merchant_address
}
if not mine:
kwargs['claim_address'] = self.merchant_address
file_path = self.create_upload_file(data=b'high value content')
tx = await self.daemon.jsonrpc_stream_create(
name, '0.01', file_path=file_path, **kwargs
@@ -117,6 +121,13 @@ class PurchaseCommandTests(CommandTestCase):
abc_stream = await self.priced_stream('abc')
await self.assertStreamPurchased(abc_stream, lambda: self.daemon.jsonrpc_purchase_create(url='lbry://abc'))
# purchase without valid exchange rate fails
erm = self.daemon.component_manager.get_component('exchange_rate_manager')
for feed in erm.market_feeds:
feed.last_check -= 10_000
with self.assertRaisesRegex(Exception, "Unable to convert 50 from USD to LBC"):
await self.daemon.jsonrpc_purchase_create(claim_id, allow_duplicate_purchase=True)
async def test_purchase_and_transaction_list(self):
self.assertItemCount(await self.daemon.jsonrpc_purchase_list(), 0)
self.assertItemCount(await self.daemon.jsonrpc_transaction_list(), 1)
@@ -182,3 +193,12 @@ class PurchaseCommandTests(CommandTestCase):
await self.ledger.wait(spend)
await self.assertBalance(self.account, '0.487695')
self.assertItemCount(await self.daemon.jsonrpc_utxo_list(), 1)
async def test_owner_not_required_purchase_own_content(self):
await self.priced_stream(mine=True)
# check that `get` doesn't purchase own claim
balance = await self.account.get_balance()
response = await self.daemon.jsonrpc_get('lbry://stream')
self.assertIsNone(response.content_fee)
self.assertEqual(await self.account.get_balance(), balance)
self.assertItemCount(await self.daemon.jsonrpc_purchase_list(), 0)
@@ -43,12 +43,14 @@ class WalletCommands(CommandTestCase):
)
async def test_wallet_reconnect(self):
status = await self.daemon.jsonrpc_status()
self.assertEqual(len(status['wallet']['servers']), 1)
self.assertEqual(status['wallet']['servers'][0]['port'], 50002)
await self.conductor.spv_node.stop(True)
self.conductor.spv_node.port = 54320
await self.conductor.spv_node.start(self.conductor.blockchain_node)
status = await self.daemon.jsonrpc_status()
self.assertEqual(len(status['wallet']['servers']), 1)
self.assertEqual(status['wallet']['servers'][0]['port'], 50002)
self.assertEqual(len(status['wallet']['servers']), 0)
self.daemon.jsonrpc_settings_set('lbryum_servers', ['localhost:54320'])
await self.daemon.jsonrpc_wallet_reconnect()
status = await self.daemon.jsonrpc_status()
@@ -74,7 +76,7 @@ class WalletCommands(CommandTestCase):
}
self.assertIsNone(ledger._balance_cache.get(self.account.id))
query_count += 6
query_count += 2
self.assertEqual(await wallet_balance(), expected)
self.assertEqual(self.ledger.db.db.query_count, query_count)
self.assertEqual(dict_values_to_lbc(ledger._balance_cache.get(self.account.id))['total'], '10.0')
@@ -98,7 +100,7 @@ class WalletCommands(CommandTestCase):
# on_transaction event reset balance cache
query_count = self.ledger.db.db.query_count
self.assertEqual(await wallet_balance(), expected)
query_count += 3 # only one of the accounts changed
query_count += 1 # only one of the accounts changed
self.assertEqual(dict_values_to_lbc(ledger._balance_cache.get(self.account.id))['total'], '9.979893')
self.assertEqual(dict_values_to_lbc(ledger._balance_cache.get(account2.id))['total'], '10.0')
self.assertEqual(self.ledger.db.db.query_count, query_count)
@@ -4,6 +4,7 @@ import lbry
import lbry.wallet
from lbry.error import ServerPaymentFeeAboveMaxAllowedError
from lbry.wallet.network import ClientSession
from lbry.wallet.server.session import LBRYElectrumX
from lbry.testcase import IntegrationTestCase, CommandTestCase
from lbry.wallet.orchstr8.node import SPVNode
@@ -46,7 +47,7 @@ class TestSessions(IntegrationTestCase):
class TestUsagePayment(CommandTestCase):
async def test_single_server_payment(self):
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
@@ -68,21 +69,21 @@ class TestUsagePayment(CommandTestCase):
self.addCleanup(node.stop)
self.daemon.jsonrpc_settings_set('lbryum_servers', [f"{node.hostname}:{node.port}"])
await self.daemon.jsonrpc_wallet_reconnect()
LBRYElectrumX.set_server_features(node.server.env)
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=8)
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 asyncio.wait_for(wallet_pay_service.on_payment.first, timeout=30)
node.server.env.daily_fee = "1.0"
node.server.env.payment_address = address
LBRYElectrumX.set_server_features(node.server.env)
# 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=8)
tx = await asyncio.wait_for(wallet_pay_service.on_payment.first, timeout=30)
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)
@@ -9,6 +9,10 @@ from lbry.wallet import Transaction
class FileCommands(CommandTestCase):
def __init__(self, *a, **kw):
super().__init__(*a, **kw)
self.skip_libtorrent = False
async def initialize_torrent(self, tx_to_update=None):
if not hasattr(self, 'seeder_session'):
self.seeder_session = TorrentSession(self.loop, None)
@@ -217,6 +221,20 @@ class FileCommands(CommandTestCase):
file_list = (await self.daemon.jsonrpc_file_list())['items']
self.assertEqual(file_list[0].stream_claim_info.claim.stream.description, claim.stream.description)
async def test_sourceless_content(self):
# claim has no source, then it has one
tx = await self.stream_create('foo', '0.01', data=None)
claim_id = self.get_claim_id(tx)
await self.daemon.jsonrpc_file_delete(claim_name='foo')
response = await self.out(self.daemon.jsonrpc_get('lbry://foo'))
self.assertIn('error', response)
self.assertIn('nothing to download', response['error'])
# source is set (there isn't a way to clear the source field, so we stop here for now)
await self.stream_update(claim_id, data=b'surpriiiiiiiise')
response = await self.out(self.daemon.jsonrpc_get('lbry://foo'))
self.assertNotIn('error', response)
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 1)
async def test_file_list_paginated_output(self):
await self.create_streams_in_range(0, 20)
@@ -354,7 +372,8 @@ class FileCommands(CommandTestCase):
# FAIL: beyond available balance
await self.stream_create(
'expensive', '0.01', data=b'pay me if you can',
fee_currency='LBC', fee_amount='11.0', fee_address=target_address
fee_currency='LBC', fee_amount='11.0',
fee_address=target_address, claim_address=target_address
)
await self.daemon.jsonrpc_file_delete(claim_name='expensive')
response = await self.out(self.daemon.jsonrpc_get('lbry://expensive'))
@@ -364,7 +383,8 @@ class FileCommands(CommandTestCase):
# FAIL: beyond maximum key fee
await self.stream_create(
'maxkey', '0.01', data=b'no pay me, no',
fee_currency='LBC', fee_amount='111.0', fee_address=target_address
fee_currency='LBC', fee_amount='111.0',
fee_address=target_address, claim_address=target_address
)
await self.daemon.jsonrpc_file_delete(claim_name='maxkey')
response = await self.out(self.daemon.jsonrpc_get('lbry://maxkey'))
@@ -376,7 +396,8 @@ class FileCommands(CommandTestCase):
# PASS: purchase is successful
await self.stream_create(
'icanpay', '0.01', data=b'I got the power!',
fee_currency='LBC', fee_amount='1.0', fee_address=target_address
fee_currency='LBC', fee_amount='1.0',
fee_address=target_address, claim_address=target_address
)
await self.daemon.jsonrpc_file_delete(claim_name='icanpay')
await self.assertBalance(self.account, '9.925679')
@@ -427,7 +448,8 @@ class FileCommands(CommandTestCase):
await self.stream_create(
'somename', '0.5', data=b'Yes, please',
fee_currency='LBC', fee_amount='1.0', fee_address=target_address
fee_currency='LBC', fee_amount='1.0',
fee_address=target_address, claim_address=target_address
)
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='somename'))
# Assert the fee and bid are subtracted
+5 -3
View File
@@ -7,7 +7,8 @@ from lbry.extras import cli
from lbry.extras.daemon.components import (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, FILE_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT,
LIBTORRENT_COMPONENT
)
from lbry.extras.daemon.daemon import Daemon
@@ -22,7 +23,8 @@ class CLIIntegrationTest(AsyncioTestCase):
conf.components_to_skip = (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, FILE_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT,
LIBTORRENT_COMPONENT
)
Daemon.component_attributes = {}
self.daemon = Daemon(conf)
@@ -34,4 +36,4 @@ class CLIIntegrationTest(AsyncioTestCase):
with contextlib.redirect_stdout(actual_output):
cli.main(["--api", "localhost:5299", "status"])
actual_output = actual_output.getvalue()
self.assertIn("connection_status", actual_output)
self.assertIn("is_running", actual_output)
@@ -2,6 +2,7 @@ import re
import time
import typing
from math import ceil
import secrets
from aiohttp import web
@@ -50,7 +51,7 @@ class MockedCommentServer:
self.server = None
self.comments = []
self.reacts = {}
self.comment_id = 0
self.index = 0
self.react_id = 0
@classmethod
@@ -66,14 +67,15 @@ class MockedCommentServer:
return schema
def create_comment(self, claim_id=None, parent_id=None, channel_name=None, channel_id=None, **kwargs):
comment_id = self.comment_id
comment_id = secrets.token_hex(64)
channel_url = 'lbry://' + channel_name + '#' + channel_id if channel_id else None
if parent_id:
claim_id = self.comments[self.get_comment_id(parent_id)]['claim_id']
parent_comment = list(filter(lambda c: c['comment_id'] == parent_id, self.comments))[0]
claim_id = parent_comment['claim_id']
comment = self._create_comment(
comment_id=str(comment_id),
comment_id=comment_id,
channel_name=channel_name,
channel_id=channel_id,
channel_url=channel_url,
@@ -83,15 +85,14 @@ class MockedCommentServer:
**kwargs
)
self.comments.append(comment)
self.comment_id += 1
return self.clean(comment)
def abandon_comment(self, comment_id: int, channel_id: str, **kwargs):
def abandon_comment(self, comment_id: str, channel_id: str, **kwargs):
deleted = False
comment_id = self.get_comment_id(comment_id)
index = self.get_index_for_comment_id(comment_id)
try:
if self.comments[comment_id]['channel_id'] == channel_id:
self.comments.pop(comment_id)
if index >= 0:
self.comments.pop(index)
deleted = True
finally:
return {
@@ -100,42 +101,41 @@ class MockedCommentServer:
}
}
def edit_comment(self, comment_id: typing.Union[str, int], comment: str, channel_id: str,
def edit_comment(self, comment_id: str, comment: str, channel_id: str,
channel_name: str, signature: str, signing_ts: str) -> dict:
edited = False
if self.credentials_are_valid(channel_id, channel_name, signature, signing_ts) \
and self.is_valid_body(comment):
comment_id = self.get_comment_id(comment_id)
if self.comments[comment_id]['channel_id'] == channel_id:
self.comments[comment_id].update({
index = self.get_index_for_comment_id(comment_id)
if self.comments[index]['channel_id'] == channel_id:
self.comments[index].update({
'comment': comment,
'signature': signature,
'signing_ts': signing_ts
})
edited = True
return self.comments[comment_id] if edited else None
return self.comments[index] if edited else None
def hide_comment(self, comment_id: typing.Union[int, str], signing_ts: str, signature: str):
comment_id = self.get_comment_id(comment_id)
def hide_comment(self, comment_id: str, signing_ts: str, signature: str):
if self.is_signable(signature, signing_ts):
self.comments[comment_id]['is_hidden'] = True
self.comments[self.get_index_for_comment_id(comment_id)]['is_hidden'] = True
return True
return False
def pin_comment(
self,
comment_id: typing.Union[int, str],
comment_id: str,
channel_name: str, channel_id: str, remove: bool,
signing_ts: str, signature: str
):
comment_id = self.get_comment_id(comment_id)
index = self.get_index_for_comment_id(comment_id)
if self.is_signable(signature, signing_ts):
if remove:
self.comments[comment_id]['is_pinned'] = False
self.comments[index]['is_pinned'] = False
else:
self.comments[comment_id]['is_pinned'] = True
return self.comments[comment_id]
self.comments[index]['is_pinned'] = True
return self.comments[index]
return False
def hide_comments(self, pieces: list):
@@ -164,15 +164,15 @@ class MockedCommentServer:
'has_hidden_comments': bool(list(filter(lambda x: x['is_hidden'], self.comments)))
}
def get_comment_channel_by_id(self, comment_id: int, **kwargs):
comment = self.comments[self.get_comment_id(comment_id)]
def get_comment_channel_by_id(self, comment_id: str, **kwargs):
comment = self.comments[self.get_index_for_comment_id(comment_id)]
return {
'channel_id': comment['channel_id'],
'channel_name': comment['channel_name'],
}
def get_comments_by_id(self, comment_ids: list):
comments = [self.comments[self.get_comment_id(cid)] for cid in comment_ids]
comments = [self.comments[self.get_index_for_comment_id(cid)] for cid in comment_ids]
return {
'page': 1,
'page_size': len(comment_ids),
@@ -331,17 +331,18 @@ class MockedCommentServer:
return 0 < len(comment) <= 2000
def is_valid_comment_id(self, comment_id: typing.Union[int, str]) -> bool:
if isinstance(comment_id, str) and comment_id.isalnum():
comment_id = int(comment_id)
if isinstance(comment_id, int):
return 0 <= comment_id < len(self.comments)
if isinstance(comment_id, str):
return True
return False
def get_comment_id(self, cid: typing.Union[int, str, any]) -> int:
if not self.is_valid_comment_id(cid):
raise ValueError('Comment ID is Invalid')
return cid if isinstance(cid, int) else int(cid)
def get_comment_for_id(self, cid: str) -> dict:
return list(filter(lambda c: c['comment_id'] == cid, self.comments))[0]
def get_index_for_comment_id(self, value: str):
for i, dic in enumerate(self.comments):
if dic['comment_id'] == value:
return i
return -1
@staticmethod
def claim_id_is_valid(claim_id: str) -> bool:
@@ -384,7 +385,6 @@ class MockedCommentServer:
(parent_id is None or self.is_valid_comment_id(parent_id))
class CommentCommands(CommandTestCase):
async def asyncSetUp(self):
@@ -412,7 +412,7 @@ class CommentCommands(CommandTestCase):
self.assertEqual(stream['claim_id'], comments[0]['claim_id'])
channel2 = (await self.channel_create('@BuffettJimmy'))['outputs'][0]
await self.daemon.jsonrpc_comment_create(
comment2 = await self.daemon.jsonrpc_comment_create(
claim_id=stream['claim_id'],
channel_name=channel2['name'],
comment='Let\'s all go to Margaritaville',
@@ -712,7 +712,8 @@ class CommentCommands(CommandTestCase):
claim_id=claim_id,
channel_id=bee['claim_id']
)
all_comments = [second_comment, first_comment]
first_comment_id = first_comment['comment_id']
second_comment_id = second_comment['comment_id']
comment_list = await self.daemon.jsonrpc_comment_list(claim_id)
self.assertEqual(
{'items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages'},
@@ -721,29 +722,29 @@ class CommentCommands(CommandTestCase):
self.assertEqual(comment_list['total_items'], 2)
bee_like_reaction = await self.daemon.jsonrpc_comment_react(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=bee['claim_id'],
channel_name=bee['name'],
react_type='like',
)
moth_like_reaction = await self.daemon.jsonrpc_comment_react(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
react_type='like',
)
reactions = await self.daemon.jsonrpc_comment_react_list(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
)
# {'my_reactions': {'0': {'like': 1}}, 'others_reactions': {'0': {'like': 1}}}
self.assertEqual(reactions['my_reactions']['0']['like'], 1)
self.assertEqual(reactions['others_reactions']['0']['like'], 1)
self.assertEqual(reactions['my_reactions'][first_comment_id]['like'], 1)
self.assertEqual(reactions['others_reactions'][first_comment_id]['like'], 1)
bee_dislike_reaction = await self.daemon.jsonrpc_comment_react(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=bee['claim_id'],
channel_name=bee['name'],
react_type='dislike',
@@ -751,30 +752,30 @@ class CommentCommands(CommandTestCase):
)
reactions_after_bee_dislikes = await self.daemon.jsonrpc_comment_react_list(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
)
# {'my_reactions': {'0': {'like': 1, 'dislike', 0}}, 'others_reactions': {'0': {'like': 0, 'dislike': 1}}}
self.assertEqual(reactions_after_bee_dislikes['my_reactions']['0']['like'], 1)
self.assertEqual(reactions_after_bee_dislikes['my_reactions']['0']['dislike'], 0)
self.assertEqual(reactions_after_bee_dislikes['others_reactions']['0']['dislike'], 1)
self.assertEqual(reactions_after_bee_dislikes['others_reactions']['0']['like'], 0)
self.assertEqual(reactions_after_bee_dislikes['my_reactions'][first_comment_id]['like'], 1)
self.assertEqual(reactions_after_bee_dislikes['my_reactions'][first_comment_id]['dislike'], 0)
self.assertEqual(reactions_after_bee_dislikes['others_reactions'][first_comment_id]['dislike'], 1)
self.assertEqual(reactions_after_bee_dislikes['others_reactions'][first_comment_id]['like'], 0)
only_likes_after_bee_dislikes = await self.daemon.jsonrpc_comment_react_list(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
react_types='like',
)
self.assertEqual(only_likes_after_bee_dislikes['my_reactions']['0']['like'], 1)
self.assertEqual(only_likes_after_bee_dislikes['my_reactions']['0']['dislike'], 0)
self.assertEqual(only_likes_after_bee_dislikes['others_reactions']['0']['dislike'], 0)
self.assertEqual(only_likes_after_bee_dislikes['others_reactions']['0']['like'], 0)
self.assertEqual(only_likes_after_bee_dislikes['my_reactions'][first_comment_id]['like'], 1)
self.assertEqual(only_likes_after_bee_dislikes['my_reactions'][first_comment_id]['dislike'], 0)
self.assertEqual(only_likes_after_bee_dislikes['others_reactions'][first_comment_id]['dislike'], 0)
self.assertEqual(only_likes_after_bee_dislikes['others_reactions'][first_comment_id]['like'], 0)
bee_un_dislike_reaction = await self.daemon.jsonrpc_comment_react(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=bee['claim_id'],
channel_name=bee['name'],
remove=True,
@@ -782,30 +783,30 @@ class CommentCommands(CommandTestCase):
)
reactions_after_bee_absconds = await self.daemon.jsonrpc_comment_react_list(
comment_ids=first_comment['comment_id'],
comment_ids=first_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
)
self.assertEqual(reactions_after_bee_absconds['my_reactions']['0']['like'], 1)
self.assertNotIn('dislike', reactions_after_bee_absconds['my_reactions']['0'])
self.assertEqual(reactions_after_bee_absconds['others_reactions']['0']['like'], 0)
self.assertNotIn('dislike', reactions_after_bee_absconds['others_reactions']['0'])
self.assertEqual(reactions_after_bee_absconds['my_reactions'][first_comment_id]['like'], 1)
self.assertNotIn('dislike', reactions_after_bee_absconds['my_reactions'][first_comment_id])
self.assertEqual(reactions_after_bee_absconds['others_reactions'][first_comment_id]['like'], 0)
self.assertNotIn('dislike', reactions_after_bee_absconds['others_reactions'][first_comment_id])
bee_reacts_to_both_comments = await self.daemon.jsonrpc_comment_react(
comment_ids=first_comment['comment_id'] + ',' + second_comment['comment_id'],
comment_ids=first_comment_id + ',' + second_comment_id,
channel_id=bee['claim_id'],
channel_name=bee['name'],
react_type='frozen_tom',
)
reactions_after_double_frozen_tom = await self.daemon.jsonrpc_comment_react_list(
comment_ids=first_comment['comment_id'] + ',' + second_comment['comment_id'],
comment_ids=first_comment_id + ',' + second_comment_id,
channel_id=moth['claim_id'],
channel_name=moth['name'],
)
self.assertEqual(reactions_after_double_frozen_tom['my_reactions']['0']['like'], 1)
self.assertNotIn('dislike', reactions_after_double_frozen_tom['my_reactions']['0'])
self.assertEqual(reactions_after_double_frozen_tom['others_reactions']['0']['frozen_tom'], 1)
self.assertEqual(reactions_after_double_frozen_tom['others_reactions']['1']['frozen_tom'], 1)
self.assertEqual(reactions_after_double_frozen_tom['my_reactions'][first_comment_id]['like'], 1)
self.assertNotIn('dislike', reactions_after_double_frozen_tom['my_reactions'][first_comment_id])
self.assertEqual(reactions_after_double_frozen_tom['others_reactions'][first_comment_id]['frozen_tom'], 1)
self.assertEqual(reactions_after_double_frozen_tom['others_reactions'][second_comment_id]['frozen_tom'], 1)
@@ -5,8 +5,6 @@ from lbry.extras.daemon.exchange_rate_manager import ExchangeRate, ExchangeRateM
class TestExchangeRateManager(AsyncioTestCase):
async def test_exchange_rate_manager(self):
# TODO: re-enable cryptonator.com
# TODO: this uses real exchange rate feeds... update to use mocks
manager = ExchangeRateManager(FEEDS)
manager.start()
self.addCleanup(manager.stop)
@@ -17,6 +15,10 @@ class TestExchangeRateManager(AsyncioTestCase):
for feed in manager.market_feeds:
self.assertTrue(feed.is_online)
self.assertIsInstance(feed.rate, ExchangeRate)
lbc = manager.convert_currency('USD', 'LBC', Decimal('0.01'))
self.assertGreaterEqual(lbc, 0.01)
# print(f'{feed.name} - {feed.market} - {feed.rate.spot}')
lbc = manager.convert_currency('USD', 'LBC', Decimal('1.0'))
self.assertGreaterEqual(lbc, 2.0)
self.assertLessEqual(lbc, 10.0)
lbc = manager.convert_currency('BTC', 'LBC', Decimal('0.01'))
self.assertGreaterEqual(lbc, 1_000)
self.assertLessEqual(lbc, 4_000)
+1
View File
@@ -11,6 +11,7 @@ from lbry.extras.daemon.storage import SQLiteStorage
class TestNodePingQueueDiscover(AsyncioTestCase):
TIMEOUT = None # not supported as it advances time
async def test_ping_queue_discover(self):
loop = asyncio.get_event_loop()
loop.set_debug(False)
@@ -1,11 +1,19 @@
import unittest
from aiohttp import ClientSession
from aiohttp.test_utils import make_mocked_request as request
from aiohttp.web import HTTPForbidden
from lbry.testcase import AsyncioTestCase
from lbry.conf import Config
from lbry.extras.daemon.security import is_request_allowed as allowed, ensure_request_allowed as ensure
from lbry.extras.daemon.components import (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, FILE_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT,
LIBTORRENT_COMPONENT
)
from lbry.extras.daemon.daemon import Daemon
class TestAllowedOrigin(unittest.TestCase):
@@ -51,3 +59,38 @@ class TestAllowedOrigin(unittest.TestCase):
ensure(request('GET', '/', headers={'Origin': 'hackers.com'}), conf)
self.assertIn("'hackers.com' are not allowed", log.output[0])
self.assertIn("'allowed_origin' limits requests to: 'localhost'", log.output[0])
class TestAccessHeaders(AsyncioTestCase):
async def asyncSetUp(self):
conf = Config(allowed_origin='localhost')
conf.data_dir = '/tmp'
conf.share_usage_data = False
conf.api = 'localhost:5299'
conf.components_to_skip = (
DATABASE_COMPONENT, BLOB_COMPONENT, WALLET_COMPONENT, DHT_COMPONENT,
HASH_ANNOUNCER_COMPONENT, FILE_MANAGER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, WALLET_SERVER_PAYMENTS_COMPONENT,
LIBTORRENT_COMPONENT
)
Daemon.component_attributes = {}
self.daemon = Daemon(conf)
await self.daemon.start()
self.addCleanup(self.daemon.stop)
async def test_headers(self):
async with ClientSession() as session:
# OPTIONS
async with session.options('http://localhost:5299') as resp:
self.assertEqual(resp.headers['Access-Control-Allow-Origin'], 'localhost')
self.assertEqual(resp.headers['Access-Control-Allow-Methods'], 'localhost')
self.assertEqual(resp.headers['Access-Control-Allow-Headers'], 'localhost')
# GET
status = {'method': 'status', 'params': []}
async with session.get('http://localhost:5299/lbryapi', json=status) as resp:
self.assertEqual(resp.headers['Access-Control-Allow-Origin'], 'localhost')
self.assertEqual(resp.headers['Access-Control-Allow-Methods'], 'localhost')
self.assertEqual(resp.headers['Access-Control-Allow-Headers'], 'localhost')
@@ -4,9 +4,9 @@ from time import time
from lbry.schema.claim import Claim
from lbry.extras.daemon.exchange_rate_manager import (
ExchangeRate, ExchangeRateManager, CurrencyConversionError,
LBRYFeed, LBRYBTCFeed,
CryptonatorFeed, CryptonatorBTCFeed,
BittrexFeed,
CryptonatorUSDFeed, CryptonatorBTCFeed,
BittrexUSDFeed, BittrexBTCFeed,
CoinExBTCFeed
)
from lbry.testcase import AsyncioTestCase, FakeExchangeRateManager, get_fake_exchange_rate_manager
from lbry.error import InvalidExchangeRateResponseError
@@ -26,59 +26,21 @@ class ExchangeRateTests(AsyncioTestCase):
fee.address = "bRcHraa8bYJZL7vkh5sNmGwPDERFUjGPP9"
manager = get_fake_exchange_rate_manager()
result = manager.convert_currency(fee.currency, "LBC", fee.amount)
self.assertEqual(60.0, result)
self.assertEqual(20.0, result)
def test_missing_feed(self):
fee = Claim().stream.fee
fee.usd = Decimal(1.0)
fee.address = "bRcHraa8bYJZL7vkh5sNmGwPDERFUjGPP9"
manager = FakeExchangeRateManager([LBRYFeed()], {'BTCLBC': 1.0})
manager = FakeExchangeRateManager([BittrexBTCFeed()], {'BTCLBC': 1.0})
with self.assertRaises(CurrencyConversionError):
manager.convert_currency(fee.currency, "LBC", fee.amount)
def test_lbry_feed_response(self):
feed = LBRYFeed()
out = feed.get_rate_from_response({
'data': {
'fresh': 0, 'lbc_usd': 0.05863062523378918,
'lbc_btc': 5.065289549855739e-05, 'btc_usd': 1157.498
},
'success': True,
'error': None
})
self.assertEqual(1.0 / 5.065289549855739e-05, out)
with self.assertRaises(InvalidExchangeRateResponseError):
feed.get_rate_from_response({})
with self.assertRaises(InvalidExchangeRateResponseError):
feed.get_rate_from_response({
"success": True,
"result": []
})
def test_lbry_btc_feed_response(self):
feed = LBRYBTCFeed()
out = feed.get_rate_from_response({
'data': {
'fresh': 0, 'lbc_usd': 0.05863062523378918,
'lbc_btc': 5.065289549855739e-05, 'btc_usd': 1157.498
},
'success': True,
'error': None
})
self.assertEqual(1.0 / 1157.498, out)
with self.assertRaises(InvalidExchangeRateResponseError):
feed.get_rate_from_response({})
with self.assertRaises(InvalidExchangeRateResponseError):
feed.get_rate_from_response({
"success": True,
"result": {}
})
def test_cryptonator_lbc_feed_response(self):
feed = CryptonatorFeed()
feed = CryptonatorUSDFeed()
out = feed.get_rate_from_response({
'ticker': {
'base': 'BTC', 'target': 'LBC', 'price': 23657.44026496,
'base': 'USD', 'target': 'LBC', 'price': 23657.44026496,
'volume': '', 'change': -5.59806916,
},
'timestamp': 1507470422,
@@ -115,22 +77,14 @@ class ExchangeRateTests(AsyncioTestCase):
})
def test_bittrex_feed_response(self):
feed = BittrexFeed()
feed = BittrexBTCFeed()
out = feed.get_rate_from_response({
"success": True,
"message": "",
"result": [
{
'Id': 6902471, 'TimeStamp': '2017-02-27T23:41:52.213', 'Quantity': 56.12611239,
"Price": 0.00001621, "Total": 0.00090980, "FillType": "PARTIAL_FILL", "OrderType": "SELL"
},
{
"Id": 6902403, "TimeStamp": "2017-02-27t23:31:40.463", "Quantity": 430.99988180,
"Price": 0.00001592, "Total": 0.00686151, "FillType": "PARTIAL_FILL", "OrderType": "SELL"
}
]
"symbol": "LBC-BTC",
"lastTradeRate": "0.00000323",
"bidRate": "0.00000322",
"askRate": "0.00000327"
})
self.assertEqual(1.0 / ((0.00090980+0.00686151) / (56.12611239+430.99988180)), out)
self.assertEqual(1.0 / 0.00000323, out)
with self.assertRaises(InvalidExchangeRateResponseError):
feed.get_rate_from_response({})
with self.assertRaises(InvalidExchangeRateResponseError):
@@ -140,7 +94,7 @@ class ExchangeRateTests(AsyncioTestCase):
})
class BadMarketFeed(LBRYFeed):
class BadMarketFeed(BittrexUSDFeed):
def get_response(self):
raise InvalidExchangeRateResponseError(self.name, 'bad stuff')
@@ -153,3 +107,15 @@ class ExchangeRateManagerTests(AsyncioTestCase):
manager.start()
await asyncio.sleep(1)
self.addCleanup(manager.stop)
async def test_median_rate_used(self):
manager = ExchangeRateManager([BittrexBTCFeed, CryptonatorBTCFeed, CoinExBTCFeed])
for feed in manager.market_feeds:
feed.last_check = time()
bittrex, cryptonator, coinex = manager.market_feeds
bittrex.rate = ExchangeRate(bittrex.market, 1.0, time())
cryptonator.rate = ExchangeRate(cryptonator.market, 2.0, time())
coinex.rate = ExchangeRate(coinex.market, 3.0, time())
self.assertEqual(14.0, manager.convert_currency("BTC", "LBC", Decimal(7.0)))
cryptonator.rate.spot = 4.0
self.assertEqual(21.0, manager.convert_currency("BTC", "LBC", Decimal(7.0)))
@@ -18,8 +18,7 @@ from lbry.schema.tags import clean_tags
from lbry.schema.result import Outputs, Censor
from lbry.wallet import Ledger, RegTestLedger
from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS, INDEXED_LANGUAGES
from .full_text_search import FTS_ORDER_BY
from lbry.wallet.server.db.common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS, INDEXED_LANGUAGES
class SQLiteOperationalError(apsw.Error):
@@ -53,7 +52,7 @@ SEARCH_PARAMS = {
'any_locations', 'all_locations', 'not_locations',
'any_languages', 'all_languages', 'not_languages',
'is_controlling', 'limit', 'offset', 'order_by',
'no_totals',
'no_totals', 'has_source'
} | INTEGER_PARAMS
@@ -94,10 +93,10 @@ class ReaderState:
self.db.setprogresshandler(interruptor, 100)
def get_resolve_censor(self) -> Censor:
return Censor(self.blocked_streams, self.blocked_channels)
return Censor(Censor.RESOLVE)
def get_search_censor(self, limit_claims_per_channel: int) -> Censor:
return Censor(self.filtered_streams, self.filtered_channels, limit_claims_per_channel)
return Censor(Censor.SEARCH)
ctx: ContextVar[Optional[ReaderState]] = ContextVar('ctx')
@@ -342,12 +341,7 @@ def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
_apply_constraints_for_array_attributes(constraints, 'language', lambda _: _, for_count)
_apply_constraints_for_array_attributes(constraints, 'location', lambda _: _, for_count)
if 'text' in constraints:
constraints["search"] = constraints.pop("text")
constraints["order_by"] = FTS_ORDER_BY
select = f"SELECT {cols} FROM search JOIN claim ON (search.rowid=claim.rowid)"
else:
select = f"SELECT {cols} FROM claim"
select = f"SELECT {cols} FROM claim"
if not for_count:
select += " LEFT JOIN claimtrie USING (claim_hash)"
return query(select, **constraints)
@@ -372,7 +366,7 @@ def count_claims(**constraints) -> int:
constraints.pop('offset', None)
constraints.pop('limit', None)
constraints.pop('order_by', None)
count = select_claims(Censor(), 'count(*) as row_count', for_count=True, **constraints)
count = select_claims(Censor(Censor.SEARCH), 'count(*) as row_count', for_count=True, **constraints)
return count[0]['row_count']
+7 -2
View File
@@ -8,12 +8,16 @@ from typing import List, Tuple
from lbry.wallet.constants import COIN, NULL_HASH32
from lbry.schema.claim import Claim
from lbry.schema.result import Censor
from lbry.wallet.server.db import reader, writer
from lbry.wallet.server.db import writer
from lbry.wallet.server.coin import LBCRegTest
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
try:
import reader
except:
from . import reader
def get_output(amount=COIN, pubkey_hash=NULL_HASH32):
@@ -31,7 +35,7 @@ def get_tx():
def search(**constraints) -> List:
return reader.search_claims(Censor(), **constraints)
return reader.search_claims(Censor(Censor.SEARCH), **constraints)
def censored_search(**constraints) -> Tuple[List, Censor]:
@@ -553,6 +557,7 @@ class TestTrending(TestSQLDB):
self.advance(zscore.TRENDING_WINDOW * 2, [self.get_support(problematic, 500000000)])
@unittest.skip("filtering/blocking is applied during ES sync, this needs to be ported to integration test")
class TestContentBlocking(TestSQLDB):
def test_blocking_and_filtering(self):
+1
View File
@@ -6,6 +6,7 @@ extras = test
changedir = {toxinidir}/tests
setenv =
HOME=/tmp
ELASTIC_HOST={env:ELASTIC_HOST:localhost}
commands =
pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \
--global-option=fetch \