Compare commits

...
166 Commits
Author SHA1 Message Date
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
Jack Robison a4db0820bc Merge pull request #3136 from lbryio/fix-reflector-loop
fix reflector loop crashing upon an unexpected error
2021-01-08 12:40:18 -05:00
Jack Robison ee7528413e update tests 2021-01-08 11:54:02 -05:00
Jack Robison 7952fc8324 fix reflector loop propagating cancelled error 2021-01-08 09:53:12 -05:00
Jack Robison 652773d2cf Merge pull request #3129 from lbryio/signing_api
add `channel_sign` api for signing data with a channel identity
2021-01-05 14:13:09 -05:00
Victor Shyba 2a17787242 fix test 2021-01-04 18:04:06 -03:00
Victor Shyba 0a53ad5721 use the comment api signing implementation 2021-01-04 18:04:06 -03:00
Victor Shyba 6da6bdc863 adds jsonrpc_channel_sign signing api 2021-01-04 18:04:06 -03:00
Jack Robison 42ad2bb83f Merge pull request #3135 from lbryio/loop-metrics
add prometheus metrics for asyncio loop
2021-01-02 11:54:21 -05:00
Jack Robison f309a65cb4 fix 2021-01-01 15:25:31 -05:00
Jack Robison 77e19ab1a4 prometheus metrics for asyncio loop responsiveness 2021-01-01 15:25:31 -05:00
Jack Robison 1a996b6ef3 Merge pull request #3134 from lbryio/log_checkpoint
log checkpoint finishing so we can gather information on leftover files bug
2021-01-01 15:24:30 -05:00
Victor Shyba b882f1a010 log checkpoint finishing for gathering information on wal/shm file bug 2020-12-31 16:11:22 -03:00
Jack Robison 82a030e6ff Merge pull request #3130 from lbryio/block-cache-metrics
skip null args in `channel_ids` given to `claim_search`
2020-12-30 20:57:56 -05:00
Jack Robison 0758b85179 skip null args given to channel_ids in claim search 2020-12-29 21:41:07 -05:00
Jack Robison ab3d9bd080 block cache metrics 2020-12-29 21:40:39 -05:00
Thomas Zarebczan 8ff813f689 Take 5!
Why you try to pass version param to other installs?
2020-12-26 12:31:51 -05:00
Thomas Zarebczan 88ae72c0d3 Take 3
Why you fail on uninstall?
2020-12-24 20:28:50 -05:00
Thomas Zarebczan 312aa4be26 Fix Windows build take 2 2020-12-24 04:41:21 -05:00
Thomas Zarebczan cbb06fce9d Fix windows build, Merry christmas! 2020-12-24 04:13:03 -05:00
Thomas Zarebczan f259e497c4 Uninstall old python first 2020-12-24 03:48:17 -05:00
Thomas Zarebczan dd4172ac66 64 bit windows 2020-12-24 03:16:07 -05:00
Jack Robison 66029e60d3 v0.87.0 2020-12-23 21:51:13 -05:00
Jack Robison 364f484f04 Merge pull request #3127 from lbryio/lru-cache-metrics
Add metrics for lru caches
2020-12-23 21:08:01 -05:00
Jack Robison 9dd5159414 increase server cache sizes 2020-12-23 20:47:05 -05:00
Jack Robison 13e38d6fd8 use LRUCache instead of pylru in wallet server 2020-12-23 20:47:05 -05:00
Jack Robison 10dcb64715 lru cache metrics 2020-12-23 20:47:03 -05:00
Jack Robison 7551b51e7d Merge pull request #3128 from lbryio/sync_smaller_batches
Improve memory usage during wallet sync
2020-12-23 20:45:03 -05:00
Victor Shyba adb418aafc group cache hits in a single dict 2020-12-23 21:37:20 -03:00
Victor Shyba 270da80d64 return whole batches 2020-12-23 19:10:19 -03:00
Victor Shyba b2027cfd66 sync in batches of 10, clearing after 2020-12-23 18:30:52 -03:00
Jack Robison 7f1f4eeac6 Merge pull request #3125 from lbryio/fix_order42
fix wallet db integrity / sync bugs
2020-12-22 20:50:46 -05:00
Jack Robison 7a7446c8bd force resync blockchain.db 2020-12-22 20:08:26 -05:00
Jack Robison ddbae294e6 skip doc test on gitlab 2020-12-22 16:55:33 -05:00
Jack Robison 8c71b744f3 fix request_synced_transactions edge cases 2020-12-22 15:19:08 -05:00
Jack Robison 479b5d31a9 fix test 2020-12-22 14:06:53 -05:00
Jack Robison 4cbf4230e8 fix txi.txo_ref 2020-12-22 14:05:37 -05:00
Victor Shyba 6a610187e0 cache bypass 2020-12-22 13:01:30 -03:00
Victor Shyba eb2a4aebba unrestricted and reusing verified cache hits 2020-12-21 16:49:08 -03:00
Victor Shyba 21a2e67755 fix rebase 2020-12-20 21:39:36 -03:00
Victor Shyba 3b9e312615 fix verification 2020-12-20 21:25:26 -03:00
Victor Shyba 26dab04c9e checkpoint 2020-12-20 21:25:26 -03:00
Victor Shyba 00713c0d11 asyncgens 2020-12-20 21:25:26 -03:00
Victor Shyba 751b5f3027 refactor duplicate code 2020-12-20 21:25:26 -03:00
Victor Shyba e8261b000e wip, see jack 2020-12-20 21:23:58 -03:00
Victor Shyba 41ecb70297 join network can only happen after initial header sync returns 2020-12-20 21:15:11 -03:00
Jack Robison 09ee104b8c Merge pull request #3120 from lbryio/fix-reorg-crash
Fix off by one in wallet server reorg
2020-12-16 02:36:11 -05:00
Jack Robison e3a4964787 catch any remaining index errors in fs_tx_hash 2020-12-16 01:28:30 -05:00
Jack Robison 9bf72910a4 fix off by one error in reorg 2020-12-16 01:27:03 -05:00
Jack Robison ee39e20e6d logging 2020-12-16 01:26:19 -05:00
Jack Robison 399d6db6f6 Merge branch 'disable-refresh-histogram' 2020-12-15 20:13:20 -05:00
Jack Robison 0821ce44b5 remove unused heavy call 2020-12-15 19:22:12 -05:00
Jack Robison ea279111c6 Merge pull request #3113 from lbryio/leveldb-performance
Improve performance of fetching transactions and sending address notifications
2020-12-14 16:39:50 -05:00
Jack Robison 674ce02e58 logging 2020-12-14 14:38:36 -05:00
Jack Robison 8dfa2767ec new_touched 2020-12-14 13:52:26 -05:00
Jack Robison 20dad7f07f only notify hashxs touched since last notification 2020-12-14 13:42:20 -05:00
Jack Robison 751cc4c44d don't deserialize mempool in a thread 2020-12-13 13:48:50 -05:00
Jack Robison 2318e6d8e9 faster fs_transactions 2020-12-13 13:48:02 -05:00
Jack Robison 61b4a492c3 v0.86.1 2020-12-08 16:41:46 -05:00
Jack Robison 9db3d01e09 Merge pull request #3105 from lbryio/dont-rerequest-mempool
fix mempool txs being re-requested
2020-12-08 16:00:24 -05:00
Jack Robison 8da73ad3dd improve hash_to_hex_str performance 2020-12-08 15:39:03 -05:00
Jack Robison b8c16d8ac5 fix mempool txs being re-requested with each address notification 2020-12-08 15:39:03 -05:00
Jack Robison 429c0951f3 v0.86.0 2020-12-07 21:19:24 -05:00
Jack Robison 74e103c791 version 2020-12-07 21:15:15 -05:00
Jack Robison f941950ee2 fix comment_create docs 2020-12-07 21:13:43 -05:00
Jack Robison 846df2eef1 v0.86.0 2020-12-07 15:58:05 -05:00
Jack Robison 34ed058c97 Merge pull request #3103 from lbryio/fix-mempool-bloat
fix mempool notification bloat
2020-12-07 15:09:13 -05:00
Jack Robison eae0290978 fix mempool notification bloat 2020-12-07 13:16:37 -05:00
Jack Robison 561368570e Merge pull request #3102 from lbryio/faster-notifications
Improve performance of mempool processing loop
2020-12-03 22:43:11 -05:00
Jack Robison 3467d1fed0 fix tests 2020-12-03 22:16:28 -05:00
Jack Robison d02ff232e5 _single_batch 2020-12-03 20:50:25 -05:00
Jack Robison 2d1c6a5402 fix 2020-12-03 19:15:15 -05:00
Jack Robison eab3b65629 calculate notifications for all subscriptions instead of per session 2020-12-03 19:15:15 -05:00
Jack Robison 20b435732a Merge pull request #3099 from lbryio/increase-tx-cache-size
Increase default `tx_cache_size`
2020-12-03 19:14:34 -05:00
Jack Robison 929617273d resync blockchain.db 2020-12-03 15:56:35 -05:00
Jack Robison 2717bf7d49 increase default tx_cache_size setting 2020-12-03 15:56:35 -05:00
Jack Robison 5cd2ebc960 Merge pull request #3098 from lbryio/cached-txids
store txids in memory, faster address subscription/history
2020-12-02 14:08:07 -05:00
Jack Robison 9b4afe9816 store txids in memory, faster address subscription/history 2020-11-25 16:30:11 -05:00
Jack Robison 23bb5598d5 Merge pull request #3095 from lbryio/fix-transaction-getbatch-order
ensure transactions are returned in the order they're requested
2020-11-24 17:21:12 -05:00
Jack Robison af1d7813e9 ensure transactions are returned in the order they're requested 2020-11-24 11:52:07 -05:00
Jack Robison 16c2e5a585 Merge pull request #3093 from lbryio/fix-merkle
fix off-by-one when getting block txs for tx_merkle
2020-11-23 19:08:11 -05:00
Jack Robison c02750edbd fix tx_merkle 2020-11-23 16:48:24 -05:00
Jack Robison 7204ddafec Merge pull request #3092 from lbryio/faster-transaction-getbatch
faster `blockchain.transaction.get_batch`
2020-11-23 12:29:14 -05:00
Jack Robison faeba9a7e4 faster blockchain.transaction.get_batch 2020-11-23 12:05:47 -05:00
Jack Robison 190d238a1f faster read_headers 2020-11-23 12:03:11 -05:00
Jack Robison 715451b5fb v0.85.0 2020-11-21 00:14:20 -05:00
Jack Robison 87f1895405 Merge pull request #3090 from lbryio/fast-headers
store headers in memory on wallet server
2020-11-20 23:33:18 -05:00
Jack Robison 923d817751 store headers in memory 2020-11-20 22:37:42 -05:00
Jack Robison 0728209b66 Merge pull request #3089 from lbryio/force_checkpoint
Ensure no client .wal files remain on shutdown
2020-11-20 21:12:33 -05:00
Victor Shyba b8b9dcc2ee WAL_CHECKPOINT on close 2020-11-20 20:16:03 -03:00
Jack Robison f35e879852 Merge pull request #3088 from lbryio/batched-inflate-outputs
fix flooding with resolve/claim search
2020-11-20 17:43:56 -05:00
Jack Robison 34f4f12eb9 pylint 2020-11-20 16:15:57 -05:00
Jack Robison fa63bf758d delete single_call_context, use session pool 2020-11-20 15:52:11 -05:00
Jack Robison f6b396ae64 Merge branch 'fix-reorg' 2020-11-20 13:32:59 -05:00
Jack Robison 2c7fd58e34 threaded compress headers 2020-11-20 13:09:54 -05:00
Jack Robison 982f2c9634 fix test 2020-11-20 10:57:28 -05:00
Jack Robison f2fd42b47a use write_batch 2020-11-19 18:37:49 -05:00
Jack Robison 1b4ccad938 allow settings TRENDING_ALGORITHMS to nothing 2020-11-19 18:36:34 -05:00
Jack Robison a9de1ce8e0 fix fs_transactions 2020-11-19 12:40:46 -05:00
Jack Robison ac752d5ec2 Merge pull request #3082 from lbryio/faster-leveldb
store transactions for wallet server in leveldb instead of requesting from lbrycrd
2020-11-17 17:02:11 -05:00
Jack Robison 632d8d02d2 remove dead code 2020-11-17 16:17:24 -05:00
Jack Robison 48aeb26e02 threaded_get_merkle
-remove dead code
2020-11-17 16:05:08 -05:00
Jack Robison 1694af8b5e get transactions from leveldb instead of lbrycrd rpc 2020-11-17 15:30:48 -05:00
Jack Robison 83bcab9cd2 cleanup 2020-11-17 15:30:48 -05:00
Jack Robison bdc7f4b3f5 combine tx_count_db and hashes_db, add tx db 2020-11-17 15:30:48 -05:00
Lex Berezhny 39202a3d79 old sequence resolution test 2020-11-17 11:24:29 -05:00
Lex Berezhny 912065a121 remove url sequence feature from code and tests 2020-11-17 11:24:29 -05:00
Thomas Zarebczan c8466afac2 Remove * from invalid characters
This is already part of other URLs and channels, will be removed from spec as it won't be used for sequencing.
2020-11-16 14:09:04 -05:00
Victor Shyba 2619e162c1 recover invalid state described on #3026 2020-11-09 16:03:38 -05:00
Lex Berezhny e1112e17f8 v0.84.0 2020-11-08 19:42:33 -05:00
Jack Robison 92b2ead74c Merge pull request #3078 from lbryio/null-language
support `none` argument to `any_languages` filter in `claim_search`
2020-11-05 22:09:11 -05:00
Jack Robison bbed9b94c1 null language filtering for claim search 2020-11-05 21:23:49 -05:00
Jack Robison 73d07311db Merge branch 'brendon' 2020-11-05 21:21:24 -05:00
Brendon J. Brewer 1cdff47477 Rewrite of variable_decay.py for speed improvements 2020-11-05 21:15:55 -05:00
Jack Robison 511a5c3f82 Merge pull request #3058 from lbryio/faster-resolve
faster resolve and claim_search
2020-11-05 21:09:07 -05:00
Jack Robison 853885e2ff debug 2020-11-05 19:25:34 -05:00
Jack Robison d83936a66a fix uncaught error 2020-11-04 22:21:35 -05:00
Jack Robison 5517d2bf56 fix new_sdk_server arg for resolve 2020-11-03 16:23:31 -05:00
Jack Robison f21ab49ac5 bump aioupnp requirement 2020-11-03 10:39:38 -05:00
Jack Robison 925a458abe tags 2020-11-03 10:39:08 -05:00
Jack Robison 76946c447f use single_call_context for claim_search and resolve 2020-11-03 10:39:08 -05:00
Jack Robison 2faa29b1c4 fix dht_monitor script 2020-11-03 10:39:08 -05:00
Lex Berezhny 6826cc311d update test to use new url spec 2020-10-30 11:37:54 -04:00
Lex Berezhny 5e17ce0a0b minor fixup 2020-10-30 11:37:54 -04:00
Kevin Raoofi e8d299d3b6 Allow : or # for claim_id
This removes the code for trying multiple patterns and the setup for it

Added a few unit tests to check that the parsed URL is as expected
2020-10-30 11:37:54 -04:00
Kevin Raoofi 7637aa2ab6 Added support for spec compliant URL parsing
Legacy URLs are preserved by attempting to parse the new URL format and,
on failing that, it'll attempt the legacy one.

Tests had to be updated such that the correct things are asserted
against each other.
2020-10-30 11:37:54 -04:00
Jack Robison ab067d1d3a fix unclean closing of blockchain.db 2020-10-26 16:23:28 -04:00
Lex Berezhny e6f84666c7 added glorious data in dictionary doc for support_sum 2020-10-16 12:03:01 -04:00
Lex Berezhny 4c5429af15 fix lint 2020-10-16 12:03:01 -04:00
Alex Grintsvayg 0a0ac3b7c9 pass-through for new support_sum api 2020-10-16 12:03:01 -04:00
67 changed files with 2699 additions and 1566 deletions

No files matched your search

+3 -1
View File
@@ -6,10 +6,12 @@
/.coverage*
/lbry-venv
/venv
/lbry/blockchain
lbry.egg-info
__pycache__
_trial_temp/
trending*.log
/tests/integration/blockchain/files
/tests/.coverage.*
@@ -17,4 +19,4 @@ _trial_temp/
/lbry/wallet/bin
/.vscode
/.gitignore
/.gitignore
+3 -1
View File
@@ -121,9 +121,11 @@ build:windows:
GIT_DEPTH: 5
before_script:
- ./docker/install_choco.ps1
- choco install -y --x86 python3 7zip checksum
- choco install -y --x64 python --version=3.7.9
- choco install -y 7zip checksum
- python --version # | findstr /B "Python 3\.7\." # dont upgrade python on every run. just make sure we're on the right Python
- pip --version # | findstr /E '\(python 3\.7\)'
- python -c "import sys;print(f'{str(64 if sys.maxsize > 2**32 else 32)} bit python\n{sys.platform}')"
- pip install virtualenv pywin32
- virtualenv venv
- venv/Scripts/activate.ps1
+1 -1
View File
@@ -1,4 +1,4 @@
FROM ubuntu:19.10
FROM ubuntu:20.04
ARG user=lbry
ARG db_dir=/database
+241 -129
View File
@@ -54,10 +54,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1602347143,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpi0ftuq_m\",\n \"download_path\": \"/tmp/tmpi0ftuq_m/tmpoqm09_cn\",\n \"file_name\": \"tmpoqm09_cn\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"4c7ff8e062dc8e3101d7a3a17806a66b\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d7296b24c2204dfa9e2488bc13fe89425e83202c5adece9151b63be0b469b1230fcb3a108605f48e7b2c1d5b886d7d6737c93580ed7021901fdf627559f3dc724be3f50c66bc375956cccff2e91f74d9e839c0070a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6719038b2faab800f1bc7a967ff6e23213db9447bea46effe25bdebf302098d581e4a3fbbe34b75dcd29f3dbe7f5a266\",\n \"stream_name\": \"tmpoqm09_cn\",\n \"streaming_url\": \"http://localhost:5280/stream/f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"suggested_file_name\": \"tmpoqm09_cn\",\n \"timestamp\": 1602347164,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#1b430d33d4efa0aac39a9cebf95736ed0517a4c1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1611869247,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpjwnofwu8\",\n \"download_path\": \"/tmp/tmpjwnofwu8/tmpc5ym6vx_\",\n \"file_name\": \"tmpc5ym6vx_\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"c4169cac48bf35c480c6d152bb2a663e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01113f10c2d15ae542f1ffe92608fbf6457284e540b744fbe796c11ebf7ca4f39c1e41df8085d3ebcd8a02f3e164960744c92bf2733bf43c65c31d8b7e3061374177a6875e8220e07e8ebfe75848282ff154301b570a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"f3bd0df688fd55cd363c769b3ec6ba871ee457a79c2353bb9e0c4845583202531c2942d213a84952c07f4c932189950d\",\n \"stream_name\": \"tmpc5ym6vx_\",\n \"streaming_url\": \"http://localhost:5280/stream/ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"suggested_file_name\": \"tmpc5ym6vx_\",\n \"timestamp\": 1611869265,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -250,10 +250,10 @@
"examples": [
{
"title": "Publish a file",
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp1lqawwh6\", \"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/tmp1lqawwh6",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp1lqawwh6\", \"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\": \"0100000001ed4ed8fb84080c7b633d679f92d4286b05790a55f0976e1949197545f6cc610d010000006b483045022100bacc195ecd57d8f4fc5774542cb92ce9fec7c9369b314967338f9f52c10e1d8a0220018c8d97d57eb4faec2eaba60482b8d1066d17d3b6e7e3b7c22b36e3af33a126012103c7659bbbe345116221702d06f9d702355240f1b93efd0dd61d9107b6ec2f1be3ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70316c716177776836180b22186170706c69636174696f6e2f6f637465742d73747265616d32302cb8f1f95805af6f490d11a35248909a25ccf2f0304f8c58a1b76a8edd6e016dba7587da059c1322c481fcfb5859be4e6d7576a91451a7a0658e232c7efaf816224e16447f8e09f33288ace0b46217000000001976a9149ecfc9cd786d152fb1d734584231f10d357433e688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpW1iYzQqMxFqphUGRf5WH5qE4TwbEaLYW\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1602347164,\n \"txid\": \"0d61ccf645751949196e97f0550a79056b28d4929f673d637b0c0884fbd84eed\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnxhqVKhui8nTy4Tnh482mJZkE9buh1Kyc\",\n \"amount\": \"1.0\",\n \"claim_id\": \"039ca47b10c13f9142cd0e9f275d9defa2259345\",\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#039ca47b10c13f9142cd0e9f275d9defa2259345\",\n \"timestamp\": null,\n \"txid\": \"a234311a403bf53c5b59f34256cbf477f9c778b6622980297129a2f2e4ef8090\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp1lqawwh6\",\n \"sd_hash\": \"2cb8f1f95805af6f490d11a35248909a25ccf2f0304f8c58a1b76a8edd6e016dba7587da059c1322c481fcfb5859be4e\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"muzfykGZvSDahDdruKm3Ukeeu3Y4HXpTYv\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"a234311a403bf53c5b59f34256cbf477f9c778b6622980297129a2f2e4ef8090\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"a234311a403bf53c5b59f34256cbf477f9c778b6622980297129a2f2e4ef8090\"\n }\n}"
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp7djhncmf\", \"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/tmp7djhncmf",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp7djhncmf\", \"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\": \"0100000001d4dc123e149eec9ce0847dfbb494077fca33b2dfb003bd9d78e30203c69e51fc010000006b483045022100c24c6c9650be3c5ac0e183f109beb96c3508e4bedf2cf9ddb7d449891b0b36ff022007c904d69f5556c74b5b14e012d90372643e03331e266b4ece4b8fe871657517012103d11b0e230905de433309d7c862d4541c761ec112ea2d5fc14123489b20e3bdc2ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037646a686e636d66180b22186170706c69636174696f6e2f6f637465742d73747265616d3230865e699a1545dbc5ba66037edd5da424ada86be39d9ee60008eba7db764f7fae8981977077087155a1d81f683e0b3cff6d7576a91481e8fcf79ca5ef4691c5d8fcb0eb18be9e2f3d1888ace0b46217000000001976a9145c0f2741b68394b7bbf1bbd4477389202dee4cf288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"moHgNwZY5iwYcVY8Yy3kbnDMCHZ6PUy2aq\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1611869265,\n \"txid\": \"fc519ec60302e3789dbd03b0dfb233ca7f0794b4fb7d84e09cec9e143e12dcd4\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msMra6oTV5z669WhofU1RJTcswwnG2hMPz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"829747f51ecb52d5c58de6608a2db24c5703e22c\",\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#829747f51ecb52d5c58de6608a2db24c5703e22c\",\n \"timestamp\": null,\n \"txid\": \"fee529c6b102999377cf34fdfc1788a47e7e701edd63ec8dcca558560113100e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7djhncmf\",\n \"sd_hash\": \"865e699a1545dbc5ba66037edd5da424ada86be39d9ee60008eba7db764f7fae8981977077087155a1d81f683e0b3cff\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mouicaKryWxtm6rF8H1xZSZTH3jc1Shnsr\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"fee529c6b102999377cf34fdfc1788a47e7e701edd63ec8dcca558560113100e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"fee529c6b102999377cf34fdfc1788a47e7e701edd63ec8dcca558560113100e\"\n }\n}"
}
]
},
@@ -314,10 +314,10 @@
"examples": [
{
"title": "Resolve a claim",
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"], \"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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"], \"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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\": {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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\": 1602347164,\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"short_url\": \"lbry://astream#0\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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\": 1602347163,\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"], \"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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"], \"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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\": {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4/astream#1\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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\": 1611869265,\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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\": 1611869264,\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"short_url\": \"lbry://@channel#4\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
}
]
},
@@ -339,7 +339,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\": \"9fwEs1bvRyFsZut5FXiodUYkMNXx2iVpXCJsVA6Zj458cHt5sjExuA1WjLfV3LbbJc\",\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\": \"4704f19c74b47c2c3b3fd282067ae5c1ee333acda3f914af32bda6883d45a986\",\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.82.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.019847268995363265,\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 \"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\": \"7mEn9npYgwZAZ5aZ6m9cRYvJhZCgnVGeC3UVkwa1eYCsHprqJ5VDTHsSModPobMBTQ\",\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\": \"a574f36fcfc8b69456957f1969c9881277a67c42daa7efba699872073b2faa2d\",\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.88.0\",\n \"trending_algorithm\": \"zscore\"\n },\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"127.0.0.1\",\n \"latency\": 0.0075637230183929205,\n \"port\": 50002\n }\n ]\n },\n \"wallet_server_payments\": {\n \"max_fee\": \"0.0\",\n \"running\": false\n }\n }\n}"
}
]
},
@@ -361,7 +361,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.82.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.82.0\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"XFCE\",\n \"distro\": {\n \"codename\": \"bionic\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"18.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"18\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.88.0\",\n \"os_release\": \"5.4.0-62-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-5.4.0-62-generic-x86_64-with-Ubuntu-18.04-bionic\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.5\",\n \"version\": \"0.88.0\"\n }\n}"
}
]
}
@@ -415,10 +415,10 @@
"examples": [
{
"title": "Add an account from seed",
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\", \"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\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602347132,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdPBSZ4mFsbEgMhMUq3AXDp3x7gErF1xu5UCkjLwnWv1QpbgnVqXg86qizrGspJARPEwT8XbEqzGGKwKMuYHp5KdWyK6YfTx\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WrDESiRrGztnvisQzNMRo7ejQCH9fHmHuxTXMjmNhQdGzhuEvkAA2j6kbUddUGJjwCySMh4mi9kaHY2U3CcYCSy5WnZhAe9\",\n \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"profit dash parent blur problem rain moral cupboard slide ugly become uncover\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\", \"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\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1611869236,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdAdaLnXR3benQnkduTLwoVqpys1KkkKPAgbCmpf8ReivmWUf8s4nqk9gHDjujgy8rcEVPomoHbbgGLDE9KYSf4f1GZod5hJ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WdfNESC1T1JtypGa4nXrNoScGP3dB27n1AqyQDUic9Lnwecu1fC4EZtut8pQEypvbRTxfkPTzQJmFxgsxhaFCbjxR1cm6hH\",\n \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\"\n }\n}"
}
]
},
@@ -456,9 +456,9 @@
},
{
"title": "Get balance for specific account by id",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}).json()",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}).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 +493,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\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602347132,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdPBSZ4mFsbEgMhMUq3AXDp3x7gErF1xu5UCkjLwnWv1QpbgnVqXg86qizrGspJARPEwT8XbEqzGGKwKMuYHp5KdWyK6YfTx\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WrDESiRrGztnvisQzNMRo7ejQCH9fHmHuxTXMjmNhQdGzhuEvkAA2j6kbUddUGJjwCySMh4mi9kaHY2U3CcYCSy5WnZhAe9\",\n \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\"\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\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1611869235,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdAdaLnXR3benQnkduTLwoVqpys1KkkKPAgbCmpf8ReivmWUf8s4nqk9gHDjujgy8rcEVPomoHbbgGLDE9KYSf4f1GZod5hJ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WdfNESC1T1JtypGa4nXrNoScGP3dB27n1AqyQDUic9Lnwecu1fC4EZtut8pQEypvbRTxfkPTzQJmFxgsxhaFCbjxR1cm6hH\",\n \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\"\n }\n}"
}
]
},
@@ -548,24 +548,24 @@
"examples": [
{
"title": "Transfer 2 LBC from default account to specific account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000017737909e752ad61334bdc01fe9db9b0ccfca83be5be5b383804f7e4fb429a8e7000000006a47304402204508041c314b3a961df9acd60c588895e4421734c7346089b35bf0e979542c93022025403336b85b441133a22106fa56b50932630ac1f499e743c429fa10a1703f8001210235b6cd33ef8081bd69e871ac88bdec3e426a30a29989e41d7670ce0fbaa31291ffffffff0200c2eb0b000000001976a914e2606d9ded2da067c7871abfe4c3e87f8d58f13088ac90d7ae2f000000001976a914cbf6689db925dc52503a84cf4ab8e626fb031e5788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhT466YG6Y3x2Q3zBhvfjbuSBffYcSSYCA\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 0,\n \"timestamp\": 1602347162,\n \"txid\": \"e7a829b44f7e4f8083b3e55bbe83cacf0c9bdbe91fc0bd3413d62a759e903777\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n29vXMbPKzTvfhkCEiZK65XAo6qLBF58r1\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mz7QemZsW1NyZtnLt7tuhqyBEyBN4xNnEC\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ba05126e11e5578536f50620190ebd9873be103e3931e51fd7e59899ccc0ad2d010000006b483045022100ff0fa8bb13f313585edd8b8656223d56787df8a55745e01be6afe272ba0e2d9402206aafbf466566a4098519541c5be8fe73e43c9f4af594ce5fed020827f94dbc2a012102126bbfa549860b749cf7ec39afcdf3e9c1c69e757ac6a05641b747ec47ca28bfffffffff0200c2eb0b000000001976a9141b4df769373c0b5107ca0d6af28d8be357e26e7788ac90d7ae2f000000001976a9145fe75806700bdde1218c0450adae59e8117ef66b88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpXyJ4wc2UVPTC1WQMFqUNSvWGERLiGr2n\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 1,\n \"timestamp\": 1611869263,\n \"txid\": \"2dadc0cc9998e5d71fe531393e10be7398bd0e192006f5368557e5116e1205ba\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mi1KwSKLspT54T5DwCWRNYuSZeGYBFbran\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mpG3dL7KrGjH3EhzCrKrfeUYsWvKxAu3Us\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\"\n }\n}"
},
{
"title": "Spread LBC between multiple addresses",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"from_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\" --from_account=\"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"from_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001693ab01abff0f9fc59fee20ad468992358df0ae6c9ec4d633ad769fd10965c7a000000006a47304402203c6df1c6d08140ed389259145826b9ba2c510670c070ecc68d1dedb61d1be7010220415be53ede17d0dcffe2b1c7d6a3305147fc9e9fb5a21c169c88c2180d3e1851012103524c8e2ac559c52214a58b3f7a01c659ab1e05db6ba58443aafcc0797b70fe95ffffffff03c0687804000000001976a914dc1fe1b384738f2e961de8225a9d37df7231e83e88acc0687804000000001976a914dc1fe1b384738f2e961de8225a9d37df7231e83e88ac6cb9fa02000000001976a914de6179465c79c0fa7e14d22b5c7929950a0ae51f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n29vXMbPKzTvfhkCEiZK65XAo6qLBF58r1\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1602347163,\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1as9S2RihLw3XnLBZQsiKvUpYK6pviSZE\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1as9S2RihLw3XnLBZQsiKvUpYK6pviSZE\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1no5EWx5pNZRwtnDhzf46aoFqyELgfBXx\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"from_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\" --from_account=\"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"from_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ff4bd76164fb6eb49dfbcf923b214ecad11652a7544709c0b55fa7476a973dc7000000006a4730440220449ee85661074f1ea185cfd114218de9a6cb8e51e7587a01d18b113f3a2c98df022035051065db09dfb0fac4608e821d510e4cb422f43c8601bca70c9200cbd244b70121024ce22932b275d87036b3696a60821be60e54994407d101a3224d8aff73e0d609ffffffff03c0687804000000001976a91423dc5f90801d4be789c1d5aaa01a091d54c03f2b88acc0687804000000001976a91423dc5f90801d4be789c1d5aaa01a091d54c03f2b88ac6cb9fa02000000001976a91448fc3bc54370d28dd1ecb256746ca665a3d84b8588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mi1KwSKLspT54T5DwCWRNYuSZeGYBFbran\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1611869264,\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"minZwaCsKrVyHSAvnoFLeARkm6SQqqYb7E\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"minZwaCsKrVyHSAvnoFLeARkm6SQqqYb7E\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mnAs7MZ17wPdabiUziQgaS9yA8XNnVHFie\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\"\n }\n}"
},
{
"title": "Transfer all LBC to a specified account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000034d63f30b5f37c1d43ec622508acb51b81933a8e11d54b6e205cbcc42288a52af000000006b483045022100ae0dd5aa00d2150a92280e43052e9bd067de1cd0411fe0ff0f891542f9447ae602200e002b679fc429bffc894189775156cfa7c238d23aecb0aba1a57b87926b7ad2012103e3d7a6abed73fcbcb732c293a92f24fe9e086d23633c7af3cbdb7a628177214bffffffff4d63f30b5f37c1d43ec622508acb51b81933a8e11d54b6e205cbcc42288a52af010000006a47304402207d31a5ce08e74a8ef30ce1234e8f05f7e998017e6977bfa55f95804967196c6202201d0a7557844384129c69ed0a5026970c3b1aac9a4590e020f7585f2d32767a70012103e3d7a6abed73fcbcb732c293a92f24fe9e086d23633c7af3cbdb7a628177214bffffffff4d63f30b5f37c1d43ec622508acb51b81933a8e11d54b6e205cbcc42288a52af020000006b483045022100f656402402d388b5aa19e152463ac93ec2d43c2bbfee418362e1782a9d02c6bd022064495e1a440cc5b2bd0cee521ac14aedef04fb6ee246fbd0ee85871aba96c4250121026064fd1225c75d704dc113fe4362a153e48b14c9bfe1183833b46b2abc474b46ffffffff015027eb0b000000001976a914429178dc65e997aed56709402cebb4f90eaf8b9588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1as9S2RihLw3XnLBZQsiKvUpYK6pviSZE\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1602347163,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1as9S2RihLw3XnLBZQsiKvUpYK6pviSZE\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1602347163,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1no5EWx5pNZRwtnDhzf46aoFqyELgfBXx\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1602347163,\n \"txid\": \"af528a2842cccb05e2b6541de1a83319b851cb8a5022c63ed4c1375f0bf3634d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mmawAJ2k762cNvvrWWUvp8CbL5ecXsnFe4\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"7a4a236462e50c8ae79d2a633afe1833f6a022b80dcf3f0adaafcf61203ce377\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"7a4a236462e50c8ae79d2a633afe1833f6a022b80dcf3f0adaafcf61203ce377\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003c332ae3716e97a0a7ad1cd5af52ec5eba2c9235f1a60288383cecb046f726530000000006b483045022100ca4453a10b64b3ea20eb7b80083da2e82429219f88c445879f339e2c68d6c6020220701bf64abfdf3e52ce81613532d2a147289f6eecf1a4df70ffe6af7f05320c660121034fc66b2ed3f1fd2ee6779ea8fcab34f0dab1a62cfbcbca0273aaa7602933b8dfffffffffc332ae3716e97a0a7ad1cd5af52ec5eba2c9235f1a60288383cecb046f726530010000006b483045022100ef789f7a66b3d25b3ea0adad3a90dc9d6e2c678b36fee3ef976e1cfde986d3e902202fae406940a427a625070561547d77b74eb752599e3ab50010655fe2bf14c4bb0121034fc66b2ed3f1fd2ee6779ea8fcab34f0dab1a62cfbcbca0273aaa7602933b8dfffffffffc332ae3716e97a0a7ad1cd5af52ec5eba2c9235f1a60288383cecb046f726530020000006b483045022100a18c2be528e295f14bc73153da49fc26e7673ce54a244d56bde5e837338a13d602203617ea4bbaf6afba9cef0f2bae643c3a07c1ba7c1a0a6f4e0eb3e51a8558dc7e012102eac9ad662cb072c604035bde6b872f8e6d66a78afdf41fee8081952f71fd134cffffffff015027eb0b000000001976a91482236255af83ff8a98a3c23a09c890165642ef8988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"minZwaCsKrVyHSAvnoFLeARkm6SQqqYb7E\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1611869264,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"minZwaCsKrVyHSAvnoFLeARkm6SQqqYb7E\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1611869264,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mnAs7MZ17wPdabiUziQgaS9yA8XNnVHFie\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1611869264,\n \"txid\": \"3065726f04cbce838328601a5f23c9a2ebc52ef55acdd17a0a7ae91637ae32c3\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msP4XXL5v1gSiU4qdFsAapuWM9Utj3CEgQ\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"64a621b9a05391ee0ca2b0bb06a43893db47b75aea6de6141b9d434356e6d575\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"64a621b9a05391ee0ca2b0bb06a43893db47b75aea6de6141b9d434356e6d575\"\n }\n}"
}
]
},
@@ -623,7 +623,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\": \"n12F5dP42LAjUmzLfsXKL9hWir9Moc4gFa\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #n12F5dP42LAjUmzLfsXKL9hWir9Moc4gFa\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YFAumnSDC9Lnmbvr3CvZcNASuScmPCNxD9YuPEFX21bActkEX4ov5unEHmBNSoFaVwEzQfvsSNVkYCf4Jfesk3wYmkou4XD\",\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\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y8jCeVTvY6N7n6oSCWd1UWMuAXwaPo25yHXdmGTQhf9nUvJzb6Y6BvvjrY3pFX1nKLbpfbckQ8MGuBShhjqJWgE7FTZ5aR6\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -668,10 +668,10 @@
"examples": [
{
"title": "Remove an account",
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}).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\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602347132,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdPBSZ4mFsbEgMhMUq3AXDp3x7gErF1xu5UCkjLwnWv1QpbgnVqXg86qizrGspJARPEwT8XbEqzGGKwKMuYHp5KdWyK6YfTx\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WrDESiRrGztnvisQzNMRo7ejQCH9fHmHuxTXMjmNhQdGzhuEvkAA2j6kbUddUGJjwCySMh4mi9kaHY2U3CcYCSy5WnZhAe9\",\n \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}).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\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1611869235,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdAdaLnXR3benQnkduTLwoVqpys1KkkKPAgbCmpf8ReivmWUf8s4nqk9gHDjujgy8rcEVPomoHbbgGLDE9KYSf4f1GZod5hJ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WdfNESC1T1JtypGa4nXrNoScGP3dB27n1AqyQDUic9Lnwecu1fC4EZtut8pQEypvbRTxfkPTzQJmFxgsxhaFCbjxR1cm6hH\",\n \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\"\n }\n}"
}
]
},
@@ -764,10 +764,10 @@
"examples": [
{
"title": "Modify maximum number of times a change address can be reused",
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\", \"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\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1602347132,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdPBSZ4mFsbEgMhMUq3AXDp3x7gErF1xu5UCkjLwnWv1QpbgnVqXg86qizrGspJARPEwT8XbEqzGGKwKMuYHp5KdWyK6YfTx\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WrDESiRrGztnvisQzNMRo7ejQCH9fHmHuxTXMjmNhQdGzhuEvkAA2j6kbUddUGJjwCySMh4mi9kaHY2U3CcYCSy5WnZhAe9\",\n \"seed\": \"three educate eagle smooth trade cram tobacco decrease cannon situate movie hub\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7 --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\", \"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\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1611869236,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdAdaLnXR3benQnkduTLwoVqpys1KkkKPAgbCmpf8ReivmWUf8s4nqk9gHDjujgy8rcEVPomoHbbgGLDE9KYSf4f1GZod5hJ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WdfNESC1T1JtypGa4nXrNoScGP3dB27n1AqyQDUic9Lnwecu1fC4EZtut8pQEypvbRTxfkPTzQJmFxgsxhaFCbjxR1cm6hH\",\n \"seed\": \"profit dash parent blur problem rain moral cupboard slide ugly become uncover\"\n }\n}"
}
]
}
@@ -803,9 +803,9 @@
"examples": [
{
"title": "Check if address is mine",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"n1WWyHtbpT3W1eB2TD6VU7hX4yJTvQCLaZ\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine n1WWyHtbpT3W1eB2TD6VU7hX4yJTvQCLaZ",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"n1WWyHtbpT3W1eB2TD6VU7hX4yJTvQCLaZ\"}}).json()",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mmUrBHXsVkHXy8TQ64P1ZGAone2uW2QmtP\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mmUrBHXsVkHXy8TQ64P1ZGAone2uW2QmtP",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mmUrBHXsVkHXy8TQ64P1ZGAone2uW2QmtP\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -852,14 +852,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\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mfjNbstnsVa48XhDnSPSapQbY9fvpKyZsK\",\n \"pubkey\": \"tpubDA9GDAntyJu4KoN4BTMNAoj8pX5bCRB5UyJFayZPdnGTJGLqGQBGpZWqKqQNjsazhWxXLQ8kb29PAVw8EZPkTtePEfa42Zoy9HvewqkgRn8\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mgN7AAkBk9PPCWzvRAkjRJMb8cDm7n8xAj\",\n \"pubkey\": \"tpubDA9GDAntyJu4wKnmUnJudm6w1NJFiWtKRo16GZ2FS3L7gJX8Bbyzpr9VWQTG4V7CJ8Y1mwN9pWktzrZyq8WrVLmJeWZLR8k68mhKNjCzhs9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mgU3YrLxEiyVsR28JgMLtXEEb3fZ7WMsqu\",\n \"pubkey\": \"tpubDA9GDAntyJu4m8kzE92TADkZkY4fmwviDsNSB424oz6pNF61dyCrjr1uTTUjRHxNaTE1UNHR3vC9kgSmvFrojyXDceetd29Nh7m7dABx9Ds\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhSMZAqJ8mFEJfG3tuBEAcFet1A3vxm7hY\",\n \"pubkey\": \"tpubDA9GDAntyJu4JT7yq3n8p3VoXHUiE5G6xxJcwhe4sQnqeWiPt58NoWarBVSU3iNueQsUJjWv5m2VJKLttip74HFmg7An9p57MFt7uLJS5DY\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhanDQpEg1EdBqohwe47izzHx3viBdBYE6\",\n \"pubkey\": \"tpubDA9GDAntyJu4JatiSGaXvHmKiJvr2kgWq6XdREhXW2y3UP5d7yABCt1333g1bY7bydNYhZpMXB6CmPEZkUo8TcJCfdczBFmxaDH7ke1RrGt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhhPr1vwRNVxUdKXefg3CknqE8vVAMH7d6\",\n \"pubkey\": \"tpubDA9GDAntyJu4KsY2PQHNWrswXoBCTfVNc91hTev8CzDh8QiYpjL1x3Pfehv6niSDtuVCKapTs16eaU94RQqBE8gujFMzqKEq8CgtsqarGi3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mjVKBbRWvJ7j2RrS6ytmf3b3bS6Xpc4GST\",\n \"pubkey\": \"tpubDA9GDAntyJu4QexZzQzAm2EN52KFRXGELiMqbY8SwthMUreny7zf1ggVFZveA8U6o2sMSa6bof28qqCg7G5As6aXKKBHCzEre3saVkWNhqn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmVwQBy9fRfjCnAAPxjeAepkGsrFtKbu7j\",\n \"pubkey\": \"tpubDA9GDAntyJu4UbDaRcJbyKWUyiADBrrmD2GKV7qyF1vPRCwpShWdF1M5Zf6i5kEbj9LkbQdAJNyCtSnqTq6HmbNjrFvSLDf2xzQMNXKcmQj\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmZae3dpvRLrkbDYGtbUub5VCKwRSD1759\",\n \"pubkey\": \"tpubDA9GDAntyJu4U2NGzZJBKU9NtznxWZKCsrj91kv37E1do2AizKzrrbP3R49BXZ1jKsHFCPs29icvBmVPqZbyMrgzia6ZLFNiCXgssHPTvsg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmsCgEHQheLZAv3R5rrSGaxoGrpkdoAhQ3\",\n \"pubkey\": \"tpubDA9GDAntyJu4FwufEJZGndGSWHx48mxDg5JTH792QDTqdH6KYsgiLbnNit1C5YdNsHAjh35BDSWTiXprF9aZQBQupfdpb3Kj44GynksM8pK\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mn8edzFP13a9qsT3xhBFUz49sZvNYuDCGE\",\n \"pubkey\": \"tpubDA9GDAntyJu4EZQrTFjZMbb3CyJESKnCfpb1y6mA9bGf9Y5ESU4CR9KxYJACejKt459tZH4pWEdHmd4DRzhfSyL1bwgbTeQPu6QCQST6qp7\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mqR9pHCGeD9H1AjD4BagjSRevcdZH2jKce\",\n \"pubkey\": \"tpubDA9GDAntyJu4Y15wW9HaBaYsPhxDXnyUmu5HkKH7vbBwbDkYVjFJEa1iT59eZX1ET4yw47iZXTVitP1rLEyiRX36M7uKzUGVnVqrLiDwjcg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mrFZgVvdJRACFyapQT6U2kYYssxtEBhsJN\",\n \"pubkey\": \"tpubDA9GDAntyJu4g6YSmmC5ASxUGPcqB6Pwr1RPT7LEtfBeEJAtVCH54WSTnMjH3hZCPMfiYKTNgwEvkWiUpampD95omcQyph26DC2eaeC2UtH\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mraWt7Xiyf6pvfhAjRLHXyJHz38JwWcg9e\",\n \"pubkey\": \"tpubDA9GDAntyJu4jvZbhhLgmjyHwiFFWRhdC5BECWWDbfRbRAWgm3C1yc3mKkRQYqTYGnHTeRnqqAX7C6sfjYfpendk2S6V1TZpAYFN6CNoV3X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mtqUMLDLuPELeJutd4Y4uxYD9PKBGuXRbh\",\n \"pubkey\": \"tpubDA9GDAntyJu4qY3XmFuJ1BQVVvZ7XWKYcnbnk96isfswPHPJ4DHguYbLtg8HzCU2KQ9DgxdQHfDaJXmsWNYcm5C6wHqFw9B9EToaBbsdXLs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mutNYuAqUSmrrQkgFvQe7WD9jTZ2QVwyqu\",\n \"pubkey\": \"tpubDA9GDAntyJu4ctpMETHCrwzt6f6K4q2MSvXMzRprvAfW1AoRvaYWUKBD91KPdCVKLmhfpfdRnSmMLnzC52vL9B8EF1QUkxM5ogs4idd544Y\",\n \"Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mgdGseinwQCiDSJKceS6vmvjdigCHugqAK\",\n \"pubkey\": \"tpubDA9GDAntyJu4H6EacLkPSd54jmNdv8NkcrFu6eGZS4KF1kPcp9UMBWzLdoJWgdX3pouNNwYb3vMDMFcnBKZZauWBsHEoDB1n7iDq9yqRmwb\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mhauHJiP2XmK5mjJdhFuBKUakztZ95JBtX\",\n \"pubkey\": \"tpubDA9GDAntyJu4p78LzCFttyQ4yDyy8J3fGfeBsY8hjDc4BMzD53b83LLXgP5WEgCYjNPpCkxFw2WrBrqpR4cCxsgRoyZvRuwjcj3FsQS7dyV\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"pubkey\": \"tpubDA9GDAntyJu4jXL61pc7bdfAhy1LjRBqKfvXWPEk1TH2aq8JUzJm2h8CDTCUTJ7shvGkX8tKsybUgNm13VU2a3ypMaG8JamSUchZ6y11Yq1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mj6mgRxeCrBqjEPxat4FGCjKV1qVp4Rz4w\",\n \"pubkey\": \"tpubDA9GDAntyJu4cs2MyEinAoduEQWtdwmnxebeK92BWyrZ4z7C9z2FR6MooEcQeF5XGYfy76rJia578rR2TSAc7U5Rd6N6Ae1eLmAndBLUnKz\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mm4DDPyWJs9V5SfaXg94nkjtQKx6yw72gx\",\n \"pubkey\": \"tpubDA9GDAntyJu4nmncAA1KRJeWfuRMoWr4EeTM8YVZcVEJYGB8C98rYwM6eGD4oCGKYpTGQ1KuHCWG3U9yzbKoqoMrtUom9DFD7eYcXKshQvs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mmUrBHXsVkHXy8TQ64P1ZGAone2uW2QmtP\",\n \"pubkey\": \"tpubDA9GDAntyJu4MwhUoMuXdeYxnhc52mguRd1mK6Ag8wXs8cZriS1cEp348mCafzgkU7haPdTgASprqSQTLykiAsR8YDR5B2w6UeCGywbJeTq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mmrL4RfDN3eTD7cmnPdm2sWtbqeyjaPaom\",\n \"pubkey\": \"tpubDA9GDAntyJu4QMsYxEctH4XCmGwosAznBUZTedgXEGusSSnrD3Xx8ZmcNicZRHqZbL99qtSgJKfLgHDaAeHJrzcuJs5MzYvGitd9DLexSZG\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mnEXKY3N4Kn8pBdQEZrLS4KWbUhBg9mwTW\",\n \"pubkey\": \"tpubDA9GDAntyJu4TGSb9D5pdLefW8vawgYw3qbiudnj8aLjL8kgWEwAGtzegXPFjgySteL7i3jNuvATz9BzaWbbr7S7v1KkxCq7HMA34YtxSQf\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mncXU2ny9iASjfpmmXHB5tsRFRqbUL6UAo\",\n \"pubkey\": \"tpubDA9GDAntyJu4GrhdwCKAQnBojDhZb9VAxpy9Qwao3xGBjuesFvvGFXbtyauwd28uAMS3hBEXhoPUxCxoKuRAdwhe6tFsWfYRjNb5GrTY83L\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mnqCR72yJW5VkzmS4Xhet5LCyizPNiqknP\",\n \"pubkey\": \"tpubDA9GDAntyJu4baFJhJoEwNbie4a2E2Ud35ow8fzJMAJRJtR9ivDKkZKj44hoWPpXoZUfzJpgzHoBZZhPdoS4YtPKY8x61mDC2JatMqauNNb\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"moLNxch2F95NrHq4UjPjQWmrgCuzhUPDFw\",\n \"pubkey\": \"tpubDA9GDAntyJu58WHkm7XussHGKf21o4nqDYyypo8uon3mRhsJUCYbBS23By2xj96tRSpaY7qwKHxuY7h7bgrebXZYUx3fWSiU8pztQNuyZ7G\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mp6rug4eFHFGgiWoHWdsSUD4zgZbMfJDjt\",\n \"pubkey\": \"tpubDA9GDAntyJu4wHQUavPWftJrLS2nCVChAY6kK7RiaBQAbrah5FSHkNLFxxz8FEiLEDa3hLeuh58wjfnR2bKpxEG9D5yqSZSdn3s6bv4EoPt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mpG3dL7KrGjH3EhzCrKrfeUYsWvKxAu3Us\",\n \"pubkey\": \"tpubDA9GDAntyJu4E1spcTeugejAo5kPnWrygPCd8WJkXPto54AdpcxSErxQ3d63SSm4VJfHGVNEp7u3V8Co56HkQQdK6YRdwevXpQPGwfJ1gbv\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mpQHSuaFpsuRQyfPFkmRWC9HnbyvDCp6un\",\n \"pubkey\": \"tpubDA9GDAntyJu4N5zCW6ELfmrd4DYPP8uTkT2w1cMPb95Bo1eS5aLqZdiLWE7snsMjJnXeLTLPXJoU31jZtQs5v3rhSS7kJtq9UoWTP6dgGJY\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mpXyJ4wc2UVPTC1WQMFqUNSvWGERLiGr2n\",\n \"pubkey\": \"tpubDA9GDAntyJu4F5TaNDgnkRswJVsKoR8EHaEWx1WuoZxaa5WvCktxJKmyaEwQh3soFXaQTnxoNcCkyUFhqM2YmYMSoePpSme4ZR3JTY1p65h\",\n \"used_times\": 1\n },\n {\n \"account\": \"mgKCkaxcF54rqJZ3QvuSSTpCQnqvgEorcA\",\n \"address\": \"mrZFJKVxsJYTPg14tmgdBDkJ973s1Qzpxa\",\n \"pubkey\": \"tpubDA9GDAntyJu53ea7vqupqsvfWsvUncjJAMRn2PKfsn1rxfQqKqPRbGgBu82i875URskLQWRm2CUgMthJoMb6TN3aYwbL9zyfTnw9zrAEnzb\",\n \"Line truncated
},
{
"title": "List addresses in specified account",
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mfjNbstnsVa48XhDnSPSapQbY9fvpKyZsK\",\n \"pubkey\": \"tpubDA9GDAntyJu4KoN4BTMNAoj8pX5bCRB5UyJFayZPdnGTJGLqGQBGpZWqKqQNjsazhWxXLQ8kb29PAVw8EZPkTtePEfa42Zoy9HvewqkgRn8\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mgN7AAkBk9PPCWzvRAkjRJMb8cDm7n8xAj\",\n \"pubkey\": \"tpubDA9GDAntyJu4wKnmUnJudm6w1NJFiWtKRo16GZ2FS3L7gJX8Bbyzpr9VWQTG4V7CJ8Y1mwN9pWktzrZyq8WrVLmJeWZLR8k68mhKNjCzhs9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mgU3YrLxEiyVsR28JgMLtXEEb3fZ7WMsqu\",\n \"pubkey\": \"tpubDA9GDAntyJu4m8kzE92TADkZkY4fmwviDsNSB424oz6pNF61dyCrjr1uTTUjRHxNaTE1UNHR3vC9kgSmvFrojyXDceetd29Nh7m7dABx9Ds\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhSMZAqJ8mFEJfG3tuBEAcFet1A3vxm7hY\",\n \"pubkey\": \"tpubDA9GDAntyJu4JT7yq3n8p3VoXHUiE5G6xxJcwhe4sQnqeWiPt58NoWarBVSU3iNueQsUJjWv5m2VJKLttip74HFmg7An9p57MFt7uLJS5DY\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhanDQpEg1EdBqohwe47izzHx3viBdBYE6\",\n \"pubkey\": \"tpubDA9GDAntyJu4JatiSGaXvHmKiJvr2kgWq6XdREhXW2y3UP5d7yABCt1333g1bY7bydNYhZpMXB6CmPEZkUo8TcJCfdczBFmxaDH7ke1RrGt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mhhPr1vwRNVxUdKXefg3CknqE8vVAMH7d6\",\n \"pubkey\": \"tpubDA9GDAntyJu4KsY2PQHNWrswXoBCTfVNc91hTev8CzDh8QiYpjL1x3Pfehv6niSDtuVCKapTs16eaU94RQqBE8gujFMzqKEq8CgtsqarGi3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mjVKBbRWvJ7j2RrS6ytmf3b3bS6Xpc4GST\",\n \"pubkey\": \"tpubDA9GDAntyJu4QexZzQzAm2EN52KFRXGELiMqbY8SwthMUreny7zf1ggVFZveA8U6o2sMSa6bof28qqCg7G5As6aXKKBHCzEre3saVkWNhqn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmVwQBy9fRfjCnAAPxjeAepkGsrFtKbu7j\",\n \"pubkey\": \"tpubDA9GDAntyJu4UbDaRcJbyKWUyiADBrrmD2GKV7qyF1vPRCwpShWdF1M5Zf6i5kEbj9LkbQdAJNyCtSnqTq6HmbNjrFvSLDf2xzQMNXKcmQj\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmZae3dpvRLrkbDYGtbUub5VCKwRSD1759\",\n \"pubkey\": \"tpubDA9GDAntyJu4U2NGzZJBKU9NtznxWZKCsrj91kv37E1do2AizKzrrbP3R49BXZ1jKsHFCPs29icvBmVPqZbyMrgzia6ZLFNiCXgssHPTvsg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mmsCgEHQheLZAv3R5rrSGaxoGrpkdoAhQ3\",\n \"pubkey\": \"tpubDA9GDAntyJu4FwufEJZGndGSWHx48mxDg5JTH792QDTqdH6KYsgiLbnNit1C5YdNsHAjh35BDSWTiXprF9aZQBQupfdpb3Kj44GynksM8pK\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mn8edzFP13a9qsT3xhBFUz49sZvNYuDCGE\",\n \"pubkey\": \"tpubDA9GDAntyJu4EZQrTFjZMbb3CyJESKnCfpb1y6mA9bGf9Y5ESU4CR9KxYJACejKt459tZH4pWEdHmd4DRzhfSyL1bwgbTeQPu6QCQST6qp7\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mqR9pHCGeD9H1AjD4BagjSRevcdZH2jKce\",\n \"pubkey\": \"tpubDA9GDAntyJu4Y15wW9HaBaYsPhxDXnyUmu5HkKH7vbBwbDkYVjFJEa1iT59eZX1ET4yw47iZXTVitP1rLEyiRX36M7uKzUGVnVqrLiDwjcg\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mrFZgVvdJRACFyapQT6U2kYYssxtEBhsJN\",\n \"pubkey\": \"tpubDA9GDAntyJu4g6YSmmC5ASxUGPcqB6Pwr1RPT7LEtfBeEJAtVCH54WSTnMjH3hZCPMfiYKTNgwEvkWiUpampD95omcQyph26DC2eaeC2UtH\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mraWt7Xiyf6pvfhAjRLHXyJHz38JwWcg9e\",\n \"pubkey\": \"tpubDA9GDAntyJu4jvZbhhLgmjyHwiFFWRhdC5BECWWDbfRbRAWgm3C1yc3mKkRQYqTYGnHTeRnqqAX7C6sfjYfpendk2S6V1TZpAYFN6CNoV3X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mtqUMLDLuPELeJutd4Y4uxYD9PKBGuXRbh\",\n \"pubkey\": \"tpubDA9GDAntyJu4qY3XmFuJ1BQVVvZ7XWKYcnbnk96isfswPHPJ4DHguYbLtg8HzCU2KQ9DgxdQHfDaJXmsWNYcm5C6wHqFw9B9EToaBbsdXLs\",\n \"used_times\": 0\n },\n {\n \"account\": \"mrZC8uh7yPXsNLp7cnKijCLfSf9zZiYiER\",\n \"address\": \"mutNYuAqUSmrrQkgFvQe7WD9jTZ2QVwyqu\",\n \"pubkey\": \"tpubDA9GDAntyJu4ctpMETHCrwzt6f6K4q2MSvXMzRprvAfW1AoRvaYWUKBD91KPdCVKLmhfpfdRnSmMLnzC52vL9B8EF1QUkxM5ogs4idd544Y\",\n \"Line truncated
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mgSUtMkJx1jyxRzQsMjxxcJdwqsBkQmfoy\",\n \"pubkey\": \"tpubDA9GDAntyJu4KzmQTQ8pPjGLNYbM5mG5kThbd9xN24bWAHEpAzXvYP7k74wXQ59HZxeoMETPEzjp4YTFhqRwuZjP3uDwVh4Xi6hQBf3SBYf\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mhABfjzTrh4gfwLfgavrhdAs99wXeVSJa9\",\n \"pubkey\": \"tpubDA9GDAntyJu4SuhLVrBmfzkkHxkQpnzyjFJzyWHECwCw1r4KVXFCpfwjRxS2MDXKDRNYAN8G7TovB9SMQUnV4XUZJNgsaMnPvNe38pAaZo2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mhWkVXsaG1uvo95ZKRWpg9nKzeHXx9Ds3t\",\n \"pubkey\": \"tpubDA9GDAntyJu4TeTsPnMRBWizQoGoxJFtVnMhLBG8HaTUgZbgPUovtz7HHJK9QzH9zXr4a54qShUyDPm9FEdTPePsAp5ij91JixgwZdVABSF\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mhxFYxuYZmGLKWkMbCsBMHBt8VLxzL4fTT\",\n \"pubkey\": \"tpubDA9GDAntyJu4mJi8D3f9B7ywbx3f1kbbfy2r7uffe2GeFNFGJdQg4HH9iCya94ZmuTBV4XBzCrcWo5bUZSCcJoLRAKjhpwqaV9CvEiDaWvU\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mi1KwSKLspT54T5DwCWRNYuSZeGYBFbran\",\n \"pubkey\": \"tpubDA9GDAntyJu4M1Vc9chTufQF1KxaWddRd2sPPJgYHBbCNaLeUNgQzPTdrkNaDwWypyqvu2LVNsdibVa9YMHhMs419u3xJi4bjnMZMxg5Ge2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mjkoZpfqjje8vobqKHAbZpwsgzKKSdi7By\",\n \"pubkey\": \"tpubDA9GDAntyJu4jfB1KeiTMrp2BzM9ojnfCcJpDkNZ4XpAFQS35rJaWnk5RNAdmNdkYnPXVdAs5rBbMpT9ogSct67yBdFpxanNWDzJNKP2Dyr\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mmNNzK7FUNW4LpcGhQLU4SBb7pFS23wvyJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4Wa67YwEm4pYv5GUFz7B8jNhPt2p3XRAMHLvoL3KDvmebZ45obLdfTdGeAD7VMmDgHcPwg6ioztg5th7PgtQvhEWkTK4iqd3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mmWrCZM2hKKsmXhJhsBwnhe8QJvfGb3mFj\",\n \"pubkey\": \"tpubDA9GDAntyJu4Y3WMvMnxHPMy5cQ1x83yavwXdKCya4iGde61oksiacdgZYhAa59aiZEMkegR4aDvPwnN7vz6kVeBvcJUxjzJ7jLsUGkECQa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mmc95QN2beZGjfRdSbST52fvGbEoe4WN9d\",\n \"pubkey\": \"tpubDA9GDAntyJu4osHdZ23vVKn4zLndcGQay4i9gZiSPgiqHqevDzurpUpxM9R1WLRGsHGE9MQHtAFSEGXQchxLAS4SHi2WJxsr2nnNqF7mEgt\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mmnUa4RkXRiWzrRRDA8MsccUwzEpQsSNG8\",\n \"pubkey\": \"tpubDA9GDAntyJu4S3tEVtju4Vd942fS8ZTDwZf3vkMBXu4uxv6K7SHKCR7xcUNHeZnYkoMnUD8tASsyTSKtKPhvP47hE4m1HscwQnHBB9ZwYRD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mmngfPUDHwde3qEpCfUR5zwJpjqfgz6ua2\",\n \"pubkey\": \"tpubDA9GDAntyJu4FGKYazkYyF4eZTicEtFE2YyJWn3JSgh4p96mH71rkREHAXC2S9zaGenDPR77vmdR24Tpx9M6sUhTNBC4tZvNdHiBeRay3nf\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mnCJymbUXGt1y5iSi9RMbQoi8EmddkN2UB\",\n \"pubkey\": \"tpubDA9GDAntyJu4foDog9Uq6FwfSiwtNYSUCFKUKeaiMGEnviwmE24sQje3tknEkZkDBuaKZw2mg8C8HdZhK3Fx4QVahyC39Zs45YfPYZ787Ur\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mq96HtssEwc3rok7tEWPKG3LQ3yrXAvMYn\",\n \"pubkey\": \"tpubDA9GDAntyJu4Hi5GW4G9MV85RPYvbCZe4Ddif2QSfzy7frrPsmdQmzJMMhgXwjaoq3cxXWUbh9MMJLKnJ4LVEJuTgUef8wmRBJ3FNDA32qi\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mqUh3YNyQ5JwvNbY1tf2pTXq1QUr8FUgDy\",\n \"pubkey\": \"tpubDA9GDAntyJu4san1KN6r689TABX1JmuaTDDuNYswEnRsPnW5Cnpw7DcqZCNVrYpWWiHyVNyD86GATSUKF4HyGV1kjJvb853E3L62tfsj7T3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mqrhHUxtGWYLXD7bKFR9w7EfuEhpJok92C\",\n \"pubkey\": \"tpubDA9GDAntyJu4NjN6dTfR6soM1zF8XxWDRzt2A1hsoYdBZ2XDNApJfe19uf43LvNVA7J84yXBTorQWmrfATQ7dXLun7sSktfUZfDrnyGTmFJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mvuCYFHAzLTEtPJnoDaNzs3KVmPeRfyTX7\",\n \"address\": \"mqwGzi1bK1euZxj6EK4bPokkE3w5BvRUrP\",\n \"pubkey\": \"tpubDA9GDAntyJu4PqCcGiUeVgNNh9hNEmTYWxZExqihjJiwTWuhN2QfgDxvNDGiQk8ws5ESyHjTT3z5TRgmLuTVuNj7c1euAHGzecBfAFY5Xgn\",\n \"Line truncated
}
]
},
@@ -887,7 +887,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\": \"n1WWyHtbpT3W1eB2TD6VU7hX4yJTvQCLaZ\"\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mmUrBHXsVkHXy8TQ64P1ZGAone2uW2QmtP\"\n}"
}
]
}
@@ -937,10 +937,10 @@
"examples": [
{
"title": "Delete a blob",
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"b029ae2f6897987809ce2fa84bb87588c958cb70f64a51e0b65557d93010383ef066c2fe4fd94a8e46589e3e2fb14652\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete b029ae2f6897987809ce2fa84bb87588c958cb70f64a51e0b65557d93010383ef066c2fe4fd94a8e46589e3e2fb14652",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"b029ae2f6897987809ce2fa84bb87588c958cb70f64a51e0b65557d93010383ef066c2fe4fd94a8e46589e3e2fb14652\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted b029ae2f6897987809ce2fa84bb87588c958cb70f64a51e0b65557d93010383ef066c2fe4fd94a8e46589e3e2fb14652\"\n}"
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"e1bb5963dcf11782f3b3b4b5bce734a6de24c840256cd19ed4cc798461defd25356ab2807f49a066dcd48c829450cfce\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete e1bb5963dcf11782f3b3b4b5bce734a6de24c840256cd19ed4cc798461defd25356ab2807f49a066dcd48c829450cfce",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"e1bb5963dcf11782f3b3b4b5bce734a6de24c840256cd19ed4cc798461defd25356ab2807f49a066dcd48c829450cfce\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted e1bb5963dcf11782f3b3b4b5bce734a6de24c840256cd19ed4cc798461defd25356ab2807f49a066dcd48c829450cfce\"\n}"
}
]
},
@@ -1018,7 +1018,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 \"b029ae2f6897987809ce2fa84bb87588c958cb70f64a51e0b65557d93010383ef066c2fe4fd94a8e46589e3e2fb14652\",\n \"70bc4ff167487bf172fbde83889c210f43578eb4b24a93fc708157dbee3e8a4ef8dcc8800d964803d8e21ad03ac32fd7\",\n \"8bd6e7458594581fe20ab834247bb23c87943d28b219d350ce32532cdfed237193ae9ed2c867ccdfa53371936d84647d\",\n \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\"\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 \"e1bb5963dcf11782f3b3b4b5bce734a6de24c840256cd19ed4cc798461defd25356ab2807f49a066dcd48c829450cfce\",\n \"a72855d3b976a81d575805d305da8180a78a18d777a19d3c8b78c6173f1f51ea71881ce9fa7e61dcbc4e11888b14450b\",\n \"9d8531f7cb149b56422d5464298e745ef499190f37e80ce6a58d4bb3358ecdb3a61f24c3c03a0e13de6e9cb712d60c97\",\n \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1099,10 +1099,10 @@
"examples": [
{
"title": "Abandon a channel claim",
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 2c20835e4289fe13bc88249efa4d20c2246b29d7",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000017c42eb25578d7a14ced50f985f3684fc27c5e32d0c4de0e42fbd19275e2352db000000006a47304402201acf6486377578fe8da483ba54e756817561552fb01b455c0e295e6456a14ee502204997778cd1eac21430d169f755e780950479e350ccf595b3c24a62bd3eb7b9530121033cfe10e3cabcaf74ab8b6eda6389d1afcb44150bcd90bbc30c81a58e3df32d32ffffffff0134b7f505000000001976a91495673ef5014050b5b1a45e2ccbb7740eba05497788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mu8vfHjyRsqBkbt4aiR7MvoJ4ZH2i8zshW\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"2ac3fc94044dc9ac75dda5debf7c2ca4789321a335c8ffbc968bd9699e571041\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"2ac3fc94044dc9ac75dda5debf7c2ca4789321a335c8ffbc968bd9699e571041\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 40e5847245f6fb0826e9fff142e55ad1c2103f11",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001cf7cf2d93deb1c9716607f02e189ed9911e7622e8dfc3847dd41691e4f099cdb000000006a47304402200b440efb3ad7a72da1c502133cbae844f34473d07bd66bfc84994f79cfc079ef02205c6bda751a8c7896f02a5bcbdd0fc3767f8b30ed3b40aafd077233cfd9bc3aee012103e9f7d41d30dce29b3d1a4bbd0ae004967be9c61d9854c266f1b137be198622adffffffff0134b7f505000000001976a9142b65ddd223e1532f4bb662a2d66ccfa735e633d988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjURP7MZxZcL8CBj5NLPYSG7W1xR73FAic\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"8e2e97c0df18f119cd2d344b2d17192f06f4a85f4ba7aba3aa390ae06d861f0a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"8e2e97c0df18f119cd2d344b2d17192f06f4a85f4ba7aba3aa390ae06d861f0a\"\n }\n}"
}
]
},
@@ -1232,14 +1232,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\": \"0100000001693ab01abff0f9fc59fee20ad468992358df0ae6c9ec4d633ad769fd10965c7a010000006a4730440220073395385b372aea05c4b46b3b71e0205d8f8d7fd160684d93e1f38a302ee8fe0220780cc361e97e8637818f341cefe889835568c15ce05b204f6441e62c34f841f70121022426df37c4781c5bfb8c92e42c70d4804ccbf02590105090de2ca5b9e68ff254ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a886d7576a91490861a8c41b20bab8f4952e3506a3ffb75fc8eec88acc462a029000000001976a91400f398243e768c619ed545eee796075f45c47b8188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mz7QemZsW1NyZtnLt7tuhqyBEyBN4xNnEC\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1602347163,\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": null,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mfbz7HMyrLu4N8Buv2M9Jie2rjRTdYo8mD\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ff4bd76164fb6eb49dfbcf923b214ecad11652a7544709c0b55fa7476a973dc7010000006a4730440220166cbca054062bac457ebe71fc04370c5be574953dc758b3568e08628fd5465002207cfd22872fa8e2616a0fd51aaefde27c3ee6f098972c3c623a406f562e957e3a012102344733a4b8ff92b050c1438c880cb5d85fb67de2370e63d0a7a7acbb31ab65c0ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa6d7576a914d59b0409a7ea3002353f05fa868b78822a86559588acc462a029000000001976a9144dd6a6a21a5461d2092ec15de5a585891b0d567688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpG3dL7KrGjH3EhzCrKrfeUYsWvKxAu3Us\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1611869264,\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": null,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mncXU2ny9iASjfpmmXHB5tsRFRqbUL6UAo\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\"\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\": \"01000000017c42eb25578d7a14ced50f985f3684fc27c5e32d0c4de0e42fbd19275e2352db010000006b483045022100d10af77218922d00c58198c6e2b6ed03ca24299c8f02deb757dfe311c83461bc0220747c562cdb0d8ffdf582d5569c1751f610f3c02902f65c1073ec41b1d4977421012102df0403cd16ed2f2c589e2a453875de7836ff4ccd410bad3a75261a41ca9f6d5dffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a0342000436051718e2ab52f58c4534244423acb0fd21647b16f710ffd93b8b245df40d8a863ff0cef51ef4e806a1e3555ed242317ebed197743d7c0cccf270eeae4b0eb5121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9144b862a192c3868172c6e64a02ce61a51e1ea75e288ace221d305000000001976a914cc89c6ea9a2cd8ea630fd745113fc30656c2efaa88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpSQEXUiXBWzW1dSag9RDd3horvLTVcXwt\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnQHhMHFsPD3FAr2yLQ7jd3fy48vBqrUm7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"eeb35c20382ffe506c2de8915f23341d62bcd431\",\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#eeb35c20382ffe506c2de8915f23341d62bcd431\",\n \"timestamp\": null,\n \"txid\": \"8882be2adceebafcc1de60e100fe5a5604c587f6d1890ad5d6c491178ff1619d\",\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\": \"3056301006072a8648ce3d020106052b8104000a0342000436051718e2ab52f58c4534244423acb0fd21647b16f710ffd93b8b245df40d8a863ff0cef51ef4e806a1e3555ed242317ebed197743d7c0cccf270eeae4b0eb5\",\n \"public_key_id\": \"miZpSVeZ1797y6T6DkytvVSAvAz5mN4VWy\",\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\": \"mzATC6tkxXtP6xGUhJXoUporBcJNru6Lty\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"8882be2adceebafcc1de60e100fe5a5604c587f6d1890ad5d6c491178ff1619d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"8882be2adceebafcc1de60e100fe5a5604c587f6d1890ad5d6c491178ff1619d\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001cf7cf2d93deb1c9716607f02e189ed9911e7622e8dfc3847dd41691e4f099cdb010000006b483045022100e64da2b7f528b49c79c4505794688f288fc5316a8a90600b8ff840de9116b3de02203e150c5ef68562980581dbeb22fca77a3aa5bed01fc19bdf83124db82b6b3a6a012102667bb4e5fb7452c96bc3303b7114ff6b0f6a052639653a6fee1a3bd541db2dcdffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a0342000418ecd168d91c3d11b37d909ad3c5f26dc3d4277c3fecc68e3984f8959bec4b51961a98021688e4cc8bcb9ea7c14796405ccafdec1922a14114e5b501121b61ce121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914503c27e84c262847c82354e64fca16616c80e83a88ace221d305000000001976a914d9991753a54a18cf34d09acdf9350af3ed7e103288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2gXLVkWoPdarGoShHSrrn8KMJByYfN84K\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnqCR72yJW5VkzmS4Xhet5LCyizPNiqknP\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a5767825c85badc219b5c8e7ecdadbeced51dd02\",\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#a5767825c85badc219b5c8e7ecdadbeced51dd02\",\n \"timestamp\": null,\n \"txid\": \"92ade6df5b40f0c43c278c96b42bc5d67e62155aa36b7176f5866fc8b5a2f656\",\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\": \"3056301006072a8648ce3d020106052b8104000a0342000418ecd168d91c3d11b37d909ad3c5f26dc3d4277c3fecc68e3984f8959bec4b51961a98021688e4cc8bcb9ea7c14796405ccafdec1922a14114e5b501121b61ce\",\n \"public_key_id\": \"mrXPJ3MJpKV22ep7iUZjAhfPnX7jLdTDZq\",\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\": \"n1MWKdzvKyD3Dgzwda2MLuKSn9R1rYXYsV\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"92ade6df5b40f0c43c278c96b42bc5d67e62155aa36b7176f5866fc8b5a2f656\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"92ade6df5b40f0c43c278c96b42bc5d67e62155aa36b7176f5866fc8b5a2f656\"\n }\n}"
}
]
},
@@ -1361,17 +1361,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\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\"\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\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\"\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\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\"\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\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\"\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 +1563,10 @@
"examples": [
{
"title": "Update a channel claim",
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"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 2c20835e4289fe13bc88249efa4d20c2246b29d7 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"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\": \"010000000273f93fbc4438325de740281851a00f35d656f7b334fa64b6394b165c65a55718000000006a47304402207b45689eb02dcf7be3682a5b30da3202dd2ac1fa06a926645cc67348bebdc696022021551191db9cf3f5a500e40a4ee5dc3369c21da775438380f2bda4c318a83eac0121033cfe10e3cabcaf74ab8b6eda6389d1afcb44150bcd90bbc30c81a58e3df32d32ffffffff77e33c2061cfafda0a3fcf0db822a0f63318fe3a632a9de78a0ce56264234a7a000000006b483045022100ea904889ff44167c2cfdf924efcf9597cfae19f500e911473c531fef07a6b9c002206be927bb8efd01da8c6f3a960e0cfb1bcf4cca0b58128db6b85dabbf277284ec012103d938c3838a7afab5347ef5e70894515ccc7b3016f401b4a1bfaf6f663b6687dbffffffff0200e1f50500000000a6b708406368616e6e656c14d7296b24c2204dfa9e2488bc13fe89425e83202c4c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88420b4e6577204368616e6e656c6d6d76a91490861a8c41b20bab8f4952e3506a3ffb75fc8eec88ac6ebeea0b000000001976a91461dcb486a8807446605420d149654f03a82b347a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mmawAJ2k762cNvvrWWUvp8CbL5ecXsnFe4\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1602347163,\n \"txid\": \"7a4a236462e50c8ae79d2a633afe1833f6a022b80dcf3f0adaafcf61203ce377\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": null,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mpSQEXUiXBWzW1dSag9RDd3horvLTVcXwt\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"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 40e5847245f6fb0826e9fff142e55ad1c2103f11 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"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\": \"01000000025d14d8ee65741f52c41a1aee29eb3a6f64f081406bfb7e298bc7c99725984f1b000000006b483045022100ada1cccea4b3ed15c85cb3ea51d32415f7912ce7b7adb2eb892e4278713a8b4802202e001d324a5f3d31bf7a66cf2caf84a6fab9ab997223b46040849a2acfbb2e1e012103e9f7d41d30dce29b3d1a4bbd0ae004967be9c61d9854c266f1b137be198622adffffffff75d5e65643439d1b14e66dea5ab747db9338a406bbb0a20cee9153a0b921a664000000006a473044022035517b47d323c1a32bc38ac2577022eafff7df6ea53fd12243ed9cea7b20bdd502205f6774848dc9194b6ef3ed0083e344b437bcce8679cd9c3ab9fee3d7b6f79cca0121025b3aa957522f62be56fc67a02528018bab66138e705fd691f39fe87f8d61e465ffffffff0200e1f50500000000a6b708406368616e6e656c14113f10c2d15ae542f1ffe92608fbf6457284e5404c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa420b4e6577204368616e6e656c6d6d76a914d59b0409a7ea3002353f05fa868b78822a86559588ac6ebeea0b000000001976a914e829f79fc11c0e823cd5cd53b692f932725df49888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"msP4XXL5v1gSiU4qdFsAapuWM9Utj3CEgQ\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1611869264,\n \"txid\": \"64a621b9a05391ee0ca2b0bb06a43893db47b75aea6de6141b9d434356e6d575\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": null,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n2gXLVkWoPdarGoShHSrrn8KMJByYfN84K\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\"\n }\n}"
}
]
}
@@ -1627,14 +1665,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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\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\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\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\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\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}"
}
]
},
@@ -1974,14 +2012,14 @@
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"include_purchase_receipt\": false, \"include_is_my_output\": 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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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\": 1602347164,\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"short_url\": \"lbry://astream#0\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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\": 1602347163,\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4/astream#1\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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\": 1611869265,\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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\": 1611869264,\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"short_url\": \"lbry://@channel#4\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\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/",
"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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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\": 1602347164,\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"short_url\": \"lbry://astream#0\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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\": 1602347163,\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4/astream#1\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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\": 1611869265,\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#4\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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\": 1611869264,\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"short_url\": \"lbry://@channel#4\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\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}"
}
]
}
@@ -2386,10 +2424,10 @@
"examples": [
{
"title": "Abandon a comment",
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\"}}).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 2c20835e4289fe13bc88249efa4d20c2246b29d7\"\n },\n \"id\": 1,\n \"jsonrpc\": \"2.0\"\n }\n}"
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\": {\n \"abandoned\": true\n }\n }\n}"
}
]
},
@@ -2444,17 +2482,17 @@
"examples": [
{
"title": "Posting a comment as your channel",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"b212c0b9e8f9206748709bae222d1e0225f1fde1b9064d7bf4ba20eb0b99f9d9ead10b7d31dcf13c9ffa133694a89696d6cd3afc16cb96689029a794674d486e\",\n \"signing_ts\": \"1602347141\",\n \"timestamp\": 1602347142\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=1b430d33d4efa0aac39a9cebf95736ed0517a4c1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"3576658331e9d868415b7bdaab9f3708eed0d873196261ae240d9e29f9790ec87667d8882a3c22553d705f5a216fa8c60e1a4e0664915637b6e0c2935189c015\",\n \"signing_ts\": \"1611869246\",\n \"timestamp\": \"1611869246\"\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\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\", \"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=8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"parent_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"claim_id\": \"\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"5725edae858dabe4e0bb536e84ed76a8d70c0ddf74032bc0473834c164240efd\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\",\n \"signature\": \"bc2099c617979cb5ef148fe6393bca549d1146c4f6c83f637cd05c670d60295bcd2414897cea3088f774422c73343430219a0be2aca22e5b7e7f949c8007e460\",\n \"signing_ts\": \"1602347141\",\n \"timestamp\": 1602347142\n }\n}"
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\", \"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=b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43 --claim_id=1b430d33d4efa0aac39a9cebf95736ed0517a4c1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"92b869e21ffd5886eea527c688dc5af3e82878d3f2a68ad6fd90b88326184a858c3c69e3537536a2d2ad5030bdd6c3d4a6bf685e656c9e8f14496638c7da3ab5\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"signature\": \"516d798c7d73bf6bbd8a3757406fdf6f570237b7ce20b968b89955f6ad50c667202a18afa87a1d1ace30a4b1c20d81628967638a80889258221ca2c97b6f20e7\",\n \"signing_ts\": \"1611869247\",\n \"timestamp\": \"1611869247\"\n }\n}"
}
]
},
@@ -2541,17 +2579,17 @@
"examples": [
{
"title": "List all comments on a claim",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list 03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"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\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"b212c0b9e8f9206748709bae222d1e0225f1fde1b9064d7bf4ba20eb0b99f9d9ead10b7d31dcf13c9ffa133694a89696d6cd3afc16cb96689029a794674d486e\",\n \"signing_ts\": \"1602347141\",\n \"timestamp\": 1602347142\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\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list 1b430d33d4efa0aac39a9cebf95736ed0517a4c1 --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"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\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"92b869e21ffd5886eea527c688dc5af3e82878d3f2a68ad6fd90b88326184a858c3c69e3537536a2d2ad5030bdd6c3d4a6bf685e656c9e8f14496638c7da3ab5\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"signature\": \"516d798c7d73bf6bbd8a3757406fdf6f570237b7ce20b968b89955f6ad50c667202a18afa87a1d1ace30a4b1c20d81628967638a80889258221ca2c97b6f20e7\",\n \"signing_ts\": \"1611869247\",\n \"timestamp\": \"1611869247\"\n },\n {\n \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"3576658331e9d868415b7bdaab9f3708eed0d873196261ae240d9e29f9790ec87667d8882a3c22553d705f5a216fa8c60e1a4e0664915637b6e0c2935189c015\",\n \"signing_ts\": \"1611869246\",\n \"timestamp\": \"1611869246\"\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\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"parent_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list 03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b --parent_id=8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"parent_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\", \"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\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list 1b430d33d4efa0aac39a9cebf95736ed0517a4c1 --parent_id=b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\", \"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\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"92b869e21ffd5886eea527c688dc5af3e82878d3f2a68ad6fd90b88326184a858c3c69e3537536a2d2ad5030bdd6c3d4a6bf685e656c9e8f14496638c7da3ab5\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"signature\": \"516d798c7d73bf6bbd8a3757406fdf6f570237b7ce20b968b89955f6ad50c667202a18afa87a1d1ace30a4b1c20d81628967638a80889258221ca2c97b6f20e7\",\n \"signing_ts\": \"1611869247\",\n \"timestamp\": \"1611869247\"\n },\n {\n \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"3576658331e9d868415b7bdaab9f3708eed0d873196261ae240d9e29f9790ec87667d8882a3c22553d705f5a216fa8c60e1a4e0664915637b6e0c2935189c015\",\n \"signing_ts\": \"1611869246\",\n \"timestamp\": \"1611869246\"\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -2720,10 +2758,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\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"8273c3d6ed1cbed8301a19937c3b2d2c0707ce95deeb17f8727c01cf8b05bb75\"}}).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 2c20835e4289fe13bc88249efa4d20c2246b29d7\"\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\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"comment\": \"Where there was once sasquatch, there is not\",\n \"comment_id\": \"b83776179745d928f3c23ca157a7063f3bc67b8c5a415a3351147f9955f6f934bf778dc3c09481789d1a9f23580c5ccc673a445f94a33c87ecc19255784dbc43\",\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": null,\n \"signature\": \"77b4aa21d44ae3cbf8adb9003ba79abed52ea7f80033d4e764c1e38b84a93c11f0f69863c733d44b09ee2300e43e72aba44cc3e6b6dee0f82c33bd867a3999e8\",\n \"signing_ts\": \"1611869247\",\n \"timestamp\": \"1611869246\"\n }\n}"
}
]
}
@@ -2813,9 +2851,9 @@
"examples": [
{
"title": "Delete a file",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"}}).json()",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -2976,14 +3014,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\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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\": \"4c7ff8e062dc8e3101d7a3a17806a66b\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d7296b24c2204dfa9e2488bc13fe89425e83202c5adece9151b63be0b469b1230fcb3a108605f48e7b2c1d5b886d7d6737c93580ed7021901fdf627559f3dc724be3f50c66bc375956cccff2e91f74d9e839c0070a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6719038b2faab800f1bc7a967ff6e23213db9447bea46effe25bdebf302098d581e4a3fbbe34b75dcd29f3dbe7f5a266\",\n \"stream_name\": \"tmpoqm09_cn\",\n \"streaming_url\": \"http://localhost:5280/stream/f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"suggested_file_name\": \"tmpoqm09_cn\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\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\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"b9baaf557ab346664e6bc3c01a2162c0d18c0d8a\",\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\": \"b1f6169d22eb6b4642b38d51c7883e26\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n1W7YBTYAiwHiUrbirbrqMFM7QSu98mKft\",\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\": \"1602347139\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpsddz9nb5.png\",\n \"sd_hash\": \"70bc4ff167487bf172fbde83889c210f43578eb4b24a93fc708157dbee3e8a4ef8dcc8800d964803d8e21ad03ac32fd7\",\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\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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\": \"c4169cac48bf35c480c6d152bb2a663e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01113f10c2d15ae542f1ffe92608fbf6457284e540b744fbe796c11ebf7ca4f39c1e41df8085d3ebcd8a02f3e164960744c92bf2733bf43c65c31d8b7e3061374177a6875e8220e07e8ebfe75848282ff154301b570a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"f3bd0df688fd55cd363c769b3ec6ba871ee457a79c2353bb9e0c4845583202531c2942d213a84952c07f4c932189950d\",\n \"stream_name\": \"tmpc5ym6vx_\",\n \"streaming_url\": \"http://localhost:5280/stream/ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"suggested_file_name\": \"tmpc5ym6vx_\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\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\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"660d41f1b5dd5655a6ccfc17e56c890ce0f9ecf3\",\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\": \"39869ae1c7ca480dcfd69e59c7b696ca\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mmrL4RfDN3eTD7cmnPdm2sWtbqeyjaPaom\",\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\": \"1611869245\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpktl2l846.png\",\n \"sd_hash\": \"9d8531f7cb149b56422d5464298e745ef499190f37e80ce6a58d4bb3358ecdb3a61f24c3c03a0e13de6e9cb712d60c97\",\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\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"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\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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\": \"4c7ff8e062dc8e3101d7a3a17806a66b\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d7296b24c2204dfa9e2488bc13fe89425e83202c5adece9151b63be0b469b1230fcb3a108605f48e7b2c1d5b886d7d6737c93580ed7021901fdf627559f3dc724be3f50c66bc375956cccff2e91f74d9e839c0070a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6719038b2faab800f1bc7a967ff6e23213db9447bea46effe25bdebf302098d581e4a3fbbe34b75dcd29f3dbe7f5a266\",\n \"stream_name\": \"tmpoqm09_cn\",\n \"streaming_url\": \"http://localhost:5280/stream/f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"suggested_file_name\": \"tmpoqm09_cn\",\n \"timestamp\": 1602347164,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\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\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"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\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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\": \"c4169cac48bf35c480c6d152bb2a663e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01113f10c2d15ae542f1ffe92608fbf6457284e540b744fbe796c11ebf7ca4f39c1e41df8085d3ebcd8a02f3e164960744c92bf2733bf43c65c31d8b7e3061374177a6875e8220e07e8ebfe75848282ff154301b570a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"f3bd0df688fd55cd363c769b3ec6ba871ee457a79c2353bb9e0c4845583202531c2942d213a84952c07f4c932189950d\",\n \"stream_name\": \"tmpc5ym6vx_\",\n \"streaming_url\": \"http://localhost:5280/stream/ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"suggested_file_name\": \"tmpc5ym6vx_\",\n \"timestamp\": 1611869265,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\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 +3138,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1602347143,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpi0ftuq_m\",\n \"download_path\": \"/tmp/tmpi0ftuq_m/tmpoqm09_cn_1\",\n \"file_name\": \"tmpoqm09_cn_1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"4c7ff8e062dc8e3101d7a3a17806a66b\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d7296b24c2204dfa9e2488bc13fe89425e83202c5adece9151b63be0b469b1230fcb3a108605f48e7b2c1d5b886d7d6737c93580ed7021901fdf627559f3dc724be3f50c66bc375956cccff2e91f74d9e839c0070a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6719038b2faab800f1bc7a967ff6e23213db9447bea46effe25bdebf302098d581e4a3fbbe34b75dcd29f3dbe7f5a266\",\n \"stream_name\": \"tmpoqm09_cn\",\n \"streaming_url\": \"http://localhost:5280/stream/f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"suggested_file_name\": \"tmpoqm09_cn\",\n \"timestamp\": 1602347164,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1611869247,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpjwnofwu8\",\n \"download_path\": \"/tmp/tmpjwnofwu8/tmpc5ym6vx__1\",\n \"file_name\": \"tmpc5ym6vx__1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"c4169cac48bf35c480c6d152bb2a663e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01113f10c2d15ae542f1ffe92608fbf6457284e540b744fbe796c11ebf7ca4f39c1e41df8085d3ebcd8a02f3e164960744c92bf2733bf43c65c31d8b7e3061374177a6875e8220e07e8ebfe75848282ff154301b570a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"f3bd0df688fd55cd363c769b3ec6ba871ee457a79c2353bb9e0c4845583202531c2942d213a84952c07f4c932189950d\",\n \"stream_name\": \"tmpc5ym6vx_\",\n \"streaming_url\": \"http://localhost:5280/stream/ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"suggested_file_name\": \"tmpc5ym6vx_\",\n \"timestamp\": 1611869265,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -3384,7 +3422,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/tmpi0ftuq_m\",\n \"download_dir\": \"/tmp/tmpi0ftuq_m\",\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/tmpi0ftuq_m\",\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/jessop/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpjwnofwu8\",\n \"download_dir\": \"/tmp/tmpjwnofwu8\",\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/tmpjwnofwu8\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
}
]
},
@@ -3459,10 +3497,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon 03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000015e8e9e1416976edb490079febac9f08378fc511242e7b0d78da819981cb65a45000000006a473044022053838c1a9edce2acb9fe68ab4b8a6ab1643117b4e07f94c7395335a36061bcf20220391adbe7a4ae0964292939d065ab486d7625091e7a894f7a47ba806804f304650121020c1c56c75a2dbc80abf41c4eba747255560e9171b6a26a4d5e448e5112710a59ffffffff0134b7f505000000001976a91404425e71483eb9da4ee71bd4bbe79204334a81aa88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mfuUWDPjuiitg51T2RW9Gv8BwLnRTQ31KA\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"063a5ca0d6642fa037d2afbd8594504f554db6cee6446bec200d5edce3caf39a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"063a5ca0d6642fa037d2afbd8594504f554db6cee6446bec200d5edce3caf39a\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon 1b430d33d4efa0aac39a9cebf95736ed0517a4c1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b8c1615df39bcfd787aa8a9ac37fe25834e84925086b0307ceed03b43965c924000000006a47304402201900920e615261e3a8c34f7d7725961dcb3e2c54412b949ad67a818aa874b018022070d7359b65dd4a161fb8e8492b32103e0a0033ca0a3d4ab337ef3bbbb2f9fd130121023e7db47dfef3c13f0bce4c2ac55b19b1fe1fe0cccd9339b77b9a45a8130c511fffffffff0134b7f505000000001976a91460c8715797575fc3c35d7de2eaa0c11efdd872ee88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpLhHUYPyHRPBt9Se1hdu4bHfGNQsbHSen\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"891537422fd108d157c4653c35bb21d2071711ef8e9a48980ad88cca8342c9b8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"891537422fd108d157c4653c35bb21d2071711ef8e9a48980ad88cca8342c9b8\"\n }\n}"
}
]
},
@@ -3675,17 +3713,17 @@
"examples": [
{
"title": "Create a stream claim without metadata",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoqm09_cn\", \"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/tmpoqm09_cn",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoqm09_cn\", \"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\": \"010000000173f93fbc4438325de740281851a00f35d656f7b334fa64b6394b165c65a55718010000006a4730440220610f73970a99c0e060854776dfd490350f65eaab71203769d3a82bb24ebf316002206abe7267a8e4fb6fac656db10f90b1cbb0f770831a2e8a62c6fadf1a83ffacd5012103c1de52bed1341a0dca16dff47a1f1f494852c67ded2f9ef83548f8243b6741e1ffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b6d7576a9149c9c8a38fa0a5c7c78dca0c7262a9b4cd02e5e2a88ac38fb9423000000001976a9148c98273fcd66dcc29f52e998b63c729839b8d3bb88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mfbz7HMyrLu4N8Buv2M9Jie2rjRTdYo8mD\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1602347163,\n \"txid\": \"1857a5655c164b39b664fa34b3f756d6350fa051182840e75d323844bc3ff973\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"timestamp\": null,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtLMAi2JnL341S1bK4wskCparLrH5Fu4t8\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpc5ym6vx_\", \"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/tmpc5ym6vx_",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpc5ym6vx_\", \"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\": \"01000000015d14d8ee65741f52c41a1aee29eb3a6f64f081406bfb7e298bc7c99725984f1b010000006b483045022100effcf91d911bc4599facb799c5207ec20ce0d4f39278a31c68ef096808b0914f02206c6ddec97694e47f3e29c2c57defa52ddbe0764d1cc0f9f93803305cad3fcb880121025ca79c60d9256ea9edec1ac527587b3e0c1922131a58385d9c170c6426d2b6e6ffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa56d7576a914222be234ed511463ee136350e1d969682566bbe088ac38fb9423000000001976a914c4dd4c6072bc2034e75b40eb17575e13baf37b5a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mncXU2ny9iASjfpmmXHB5tsRFRqbUL6UAo\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1611869264,\n \"txid\": \"1b4f982597c9c78b297efb6b4081f0646f3aeb29ee1a1ac4521f7465eed8145d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"timestamp\": null,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"myTsqjNvY4RkE24zsi85BdFf1zYYwLCVfh\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\"\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/tmpsddz9nb5.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\": 1602347139, \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpsddz9nb5.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=1602347139 --channel_id=\"2c20835e4289fe13bc88249efa4d20c2246b29d7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpsddz9nb5.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\": 1602347139, \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000014412ccab712ad458ed2c450ae796a1fd67014cc88b2e6436dbf96de15436bcb2010000006a47304402203fe700069ccb5f7621fb2f2f24320c37519883c75458aafe11075d9cbed547be022071b43a6060bf43017c04d589e357f17756936c94fbd9c9035180d484ca2efd30012102227817a8ad7a33c1e24d0ada38ee942e8a38cbea980d02df01d3652b1f28f9afffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101d7296b24c2204dfa9e2488bc13fe89425e83202c459e12774a78db26e30fbd9a152fb094189b65a06364f85a17bf76eff0cb41a6a6900fb2d45a3ddcb34ca9174ee4926624d171b909490c87b28127cb5e5ab4f70ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d707364647a396e62352e706e6718632209696d6167652f706e67323070bc4ff167487bf172fbde83889c210f43578eb4b24a93fc708157dbee3e8a4ef8dcc8800d964803d8e21ad03ac32fd7120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f72672883c187fc053222080112196fdb39d0dc114c42dca3418a636953e50c8cb2cd1ce4209b27188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914db39d0dc114c42dca3418a636953e50c8cb2cd1c88acac5e7d1d000000001976a914628b92ad36fb3f24af2a062b433e7927b0a9867688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtLMAi2JnL341S1bK4wskCparLrH5Fu4t8\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1602347164,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1W7YBTYAiwHiUrbirbrqMFM7QSu98mKft\",\n \"amount\": \"1.0\",\n \"claim_id\": \"b9baaf557ab346664e6bc3c01a2162c0d18c0d8a\",\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#b9baaf557ab346664e6bc3c01a2162c0d18c0d8a\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"0d61ccf645751949196e97f0550a79056b28d4929f673d637b0c0884fbd84eed\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n1W7YBTYAiwHiUrbirbrqMFM7QSu98mKft\",\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\": \"1602347139\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpsddz9nb5.png\",\n \"sd_hash\": \"70bc4ff167487bf172fbde83889c210f43578eb4b24a93fc708157dbee3e8a4ef8dcc8800d964803d8e21ad03ac32fd7\",\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/tmpktl2l846.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\": 1611869245, \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpktl2l846.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=1611869245 --channel_id=\"40e5847245f6fb0826e9fff142e55ad1c2103f11\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpktl2l846.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\": 1611869245, \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001628540dd68fb2884eb566df6fb4261664a1f2fb73ef3c26dca7efe8ad76f249d010000006a47304402204178a4ff4d94741fcf4cc09db2fe842e64fc567f9f77f0e84ee9ae29b0067df202207405bf82d20bf0ac2f9addba5345167e6a1a57befa4ee538838f573b399d5a0b0121026912ae6039902f830c970c966ce82bf0e3cb528132f609933da1cadab001779effffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101113f10c2d15ae542f1ffe92608fbf6457284e540a6ec29900fc13634ec5b190d20ed602f42eb2b507b7445dd9d1c346524fe392c47ed3efad8313a8c184c458188f08a8ac7795639e4a257d7f8f213c9249de2180ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d706b746c326c3834362e706e6718632209696d6167652f706e6732309d8531f7cb149b56422d5464298e745ef499190f37e80ce6a58d4bb3358ecdb3a61f24c3c03a0e13de6e9cb712d60c97120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728bdd8cc80063222080112196f457ad3964601bd031638e3d1ef2dd8c6d49b93ffa424b17c188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914457ad3964601bd031638e3d1ef2dd8c6d49b93ff88acac5e7d1d000000001976a914553e501f9c763eb28a7c7ba9376053f674e88d4c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myTsqjNvY4RkE24zsi85BdFf1zYYwLCVfh\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1611869265,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mmrL4RfDN3eTD7cmnPdm2sWtbqeyjaPaom\",\n \"amount\": \"1.0\",\n \"claim_id\": \"660d41f1b5dd5655a6ccfc17e56c890ce0f9ecf3\",\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#660d41f1b5dd5655a6ccfc17e56c890ce0f9ecf3\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"fc519ec60302e3789dbd03b0dfb233ca7f0794b4fb7d84e09cec9e143e12dcd4\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mmrL4RfDN3eTD7cmnPdm2sWtbqeyjaPaom\",\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\": \"1611869245\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpktl2l846.png\",\n \"sd_hash\": \"9d8531f7cb149b56422d5464298e745ef499190f37e80ce6a58d4bb3358ecdb3a61f24c3c03a0e13de6e9cb712d60c97\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbLine truncated
}
]
},
@@ -3755,14 +3793,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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"timestamp\": 1602347164,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\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\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"timestamp\": 1611869265,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\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\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1602347164,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"timestamp\": 1602347164,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\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\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1611869265,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"timestamp\": 1611869265,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\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}"
}
]
},
@@ -4095,10 +4133,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update 03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b --channel_id=\"2c20835e4289fe13bc88249efa4d20c2246b29d7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\", \"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\": \"01000000024412ccab712ad458ed2c450ae796a1fd67014cc88b2e6436dbf96de15436bcb2000000006a47304402203ea72a540317c922102a0a4d6542b0cc62fe9eb7cca583c1c8d59271bac9a17902201a80461bf002aa6df1fea59610b888f805c5267aa364e3b143360f15685059e80121020c1c56c75a2dbc80abf41c4eba747255560e9171b6a26a4d5e448e5112710a59ffffffff9d61f18f1791c4d6d50a89d1f687c504565afe00e160dec1fcbaeedc2abe8288010000006b483045022100a5229fc465e0d475796026dee75822408d47c640aa7b508cf4fe9d51f6438a00022072f7f649fc2f30254ebc4012fd9fa68998be354609115e738c994779beb9ba6c0121020c25ef96399f35f81c54b40b934d82391c8a9fa5950e7503a25328872cf9f89bffffffff0200e1f50500000000fd2301b7076173747265616d141b6f13b3d61bb43b2bff75c6fac4098c2f00d4034ce801d7296b24c2204dfa9e2488bc13fe89425e83202c5adece9151b63be0b469b1230fcb3a108605f48e7b2c1d5b886d7d6737c93580ed7021901fdf627559f3dc724be3f50c66bc375956cccff2e91f74d9e839c0070a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f716d30395f636e180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b6d6d76a9149c9c8a38fa0a5c7c78dca0c7262a9b4cd02e5e2a88ac32a0d205000000001976a914f3821a0f3daa8d88ee979459735490111b72c90188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"timestamp\": 1602347164,\n \"txid\": \"b2bc3654e16df9db36642e8bc84c0167fda196e70a452ced58d42a71abcc1244\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoqm09_cn\",\n \"sd_hash\": \"f5dd1bd0df88ccbc2f016abaad0b3ffde5e87508dc7af1d964d51736fa260c5f25f2af741573d6bbd59ff458c554972b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzATC6tkxXtP6xGUhJXoUporBcJNru6Lty\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1602347163,\n \"txid\": \"8882be2adceebafcc1de60e100fe5a5604c587f6d1890ad5d6c491178ff1619d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"muo3EZhx8VQtZsscvKLVCS2nk8tPeGSUKC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\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#03d4002f8c09c4fac675ff2b3bb41bd6b3136f1b\",\n \"signing_channel\": {\n \"address\": \"mth8FNCBtmx5M92AtxUpWigDPaB1g2xNpZ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2c20835e4289fe13bc88249efa4d20c2246b29d7\",\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#2c20835e4289fe13bc88249efa4d20c2246b29d7\",\n \"timestamp\": 1602347163,\n \"txid\": \"db52235e2719bd2fe4e04d0c2de3c527fc84365f980fd5ce147a8d5725eb427c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004bb438060971d65dfccc532c2c72357b802057d458a9143c2f863461ba8f5f79a512b770a19b80717467e0d0366e8097d3cf803a91609a2827d0701d6562e5a88\",\n \"public_key_id\": \"msagyzG92X562roXPRfSYQkmoNWzMYtZd8\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"455ab61c9819a88dd7b0e7421251fc7883f0c9bafe790049db6e9716149e8e5e\",\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\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update 1b430d33d4efa0aac39a9cebf95736ed0517a4c1 --channel_id=\"40e5847245f6fb0826e9fff142e55ad1c2103f11\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\", \"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\": \"0100000002628540dd68fb2884eb566df6fb4261664a1f2fb73ef3c26dca7efe8ad76f249d000000006b4830450221008ef72aeb8f185fa190d6fca9a6abf374cdfc7f2c215fabbbbdacfc114d54a9e902206716689c471e51df710ca790c5e98d382b75d17ac7d1ea07d2b486f10a59831a0121023e7db47dfef3c13f0bce4c2ac55b19b1fe1fe0cccd9339b77b9a45a8130c511fffffffff56f6a2b5c86f86f576716ba35a15627ed6c52bb4968c273cc4f0405bdfe6ad92010000006b483045022100e66763c6a3790c5a9f90c744fc9058b639b9ad68856e2696aeedecf5a775ef3a02203624a9f36377d2334d74725f1b42e08be0386834d828c86c6aecd59b684c432b0121036db504484afe77cb6af56d5b5b1ace594cac85103aa74844fd10055fc32a701effffffff0200e1f50500000000fd2301b7076173747265616d14c1a41705ed3657f9eb9c9ac3aaa0efd4330d431b4ce801113f10c2d15ae542f1ffe92608fbf6457284e540b744fbe796c11ebf7ca4f39c1e41df8085d3ebcd8a02f3e164960744c92bf2733bf43c65c31d8b7e3061374177a6875e8220e07e8ebfe75848282ff154301b570a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706335796d3676785f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa56d6d76a914222be234ed511463ee136350e1d969682566bbe088ac32a0d205000000001976a9144274565b05d3410efed90e7dd2f62e1c6a817fb388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"timestamp\": 1611869265,\n \"txid\": \"9d246fd78afe7eca6dc2f33eb72f1f4a666142fbf66d56eb8428fb68dd408562\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpc5ym6vx_\",\n \"sd_hash\": \"ff6562454cdefc42732e97c8cf5f81c1278aff3cac9f2ea30b5de8bffcd83b9a37d9e307f564c642aae5bf8eaca7efa5\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1MWKdzvKyD3Dgzwda2MLuKSn9R1rYXYsV\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1611869264,\n \"txid\": \"92ade6df5b40f0c43c278c96b42bc5d67e62155aa36b7176f5866fc8b5a2f656\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"middqfSidoJ4Bv17qheAFaPvnikcnnGuXQ\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\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#1b430d33d4efa0aac39a9cebf95736ed0517a4c1\",\n \"signing_channel\": {\n \"address\": \"mzzPvbftpTErnMzQmbsRK5gKuqVPdX8SEU\",\n \"amount\": \"1.0\",\n \"claim_id\": \"40e5847245f6fb0826e9fff142e55ad1c2103f11\",\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#40e5847245f6fb0826e9fff142e55ad1c2103f11\",\n \"timestamp\": 1611869264,\n \"txid\": \"db9c094f1e6941dd4738fc8d2e62e71199ed89e1027f6016971ceb3dd9f27ccf\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3428de368e9414410cdc9cde9de03e6a0786f096b033cbc5d7fa581bde7f123515f5d6292ad595fc285caf1755128f15c54834d7aa7101ed5a1e07893d496fa\",\n \"public_key_id\": \"mnrdQ1NyMZTQWHiPjcpdAytckwXN43NuF2\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"24c96539b403edce07036b082549e83458e27fc39a8aaa87d7cf9bf35d61c1b8\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n Line truncated
}
]
}
@@ -4310,6 +4348,44 @@
],
"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": []
},
{
"name": "support_sum",
"description": "List total staked supports for a claim, grouped by the channel that signed the support.\n+\n+ If claim_id is a channel claim, you can use --include_channel_content to also include supports for\n+ content claims in the channel.\n\n !!!! NOTE: PAGINATION DOES NOT DO ANYTHING AT THE MOMENT !!!!!",
"arguments": [
{
"name": "claim_id",
"type": "str",
"description": "claim id",
"is_required": false
},
{
"name": "new_sdk_server",
"type": "str",
"description": "URL of the new SDK server (EXPERIMENTAL)",
"is_required": false
},
{
"name": "include_channel_content",
"type": "bool",
"description": "if claim_id is for a channel, include supports for claims in that channel",
"is_required": false
},
{
"name": "page",
"type": "int",
"description": "page to return during paginating",
"is_required": false
},
{
"name": "page_size",
"type": "int",
"description": "number of items on page during pagination",
"is_required": false
}
],
"returns": " {\n \"page\": \"Page number of the current items.\",\n \"page_size\": \"Number of items to show on a page.\",\n \"total_pages\": \"Total number of pages.\",\n \"total_items\": \"Total number of items.\",\n \"items\": [\n \"glorious data in dictionary\"\n ]\n }",
"examples": []
}
]
},
@@ -4436,7 +4512,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-10 12:26\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1602347163,\n \"txid\": \"7a5c9610fd69d73a634decc9e60adf58239968d40ae2fe59fcf9f0bf1ab03a69\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2020-10-10 12:26\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1602347162,\n \"txid\": \"e7a829b44f7e4f8083b3e55bbe83cacf0c9bdbe91fc0bd3413d62a759e903777\",\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-01-28 16:27\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1611869264,\n \"txid\": \"c73d976a47a75fb5c0094754a75216d1ca4e213b92cffb9db46efb6461d74bff\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2021-01-28 16:27\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1611869263,\n \"txid\": \"2dadc0cc9998e5d71fe531393e10be7398bd0e192006f5368557e5116e1205ba\",\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}"
}
]
},
@@ -4487,6 +4563,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",
@@ -4621,6 +4703,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",
@@ -4737,6 +4831,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",
@@ -4829,6 +4929,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.83.0"
__version__ = "0.89.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)
+1 -1
View File
@@ -638,7 +638,7 @@ class Config(CLIConfig):
"Strategy to use when selecting UTXOs for a transaction",
STRATEGIES, "standard")
transaction_cache_size = Integer("Transaction cache size", 100_000)
transaction_cache_size = Integer("Transaction cache size", 2 ** 17)
save_resolved_claims = Toggle(
"Save content claims to the database when they are resolved to keep file_list up to date, "
"only disable this if file_x commands are not needed", True
+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:
+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)
+25 -22
View File
@@ -26,42 +26,45 @@ def is_comment_signed_by_channel(comment: dict, channel: Output, sign_comment_id
if isinstance(channel, Output):
try:
signing_field = comment['comment_id'] if sign_comment_id else comment['comment']
pieces = [
comment['signing_ts'].encode(),
cid2hash(comment['channel_id']),
signing_field.encode()
]
return Output.is_signature_valid(
get_encoded_signature(comment['signature']),
sha256(b''.join(pieces)),
channel.claim.channel.public_key_bytes
)
return verify(channel, signing_field.encode(), comment, cid2hash(comment['channel_id']))
except KeyError:
pass
return False
def verify(channel, data, signature, channel_hash=None):
pieces = [
signature['signing_ts'].encode(),
channel_hash or channel.claim_hash,
data
]
return Output.is_signature_valid(
get_encoded_signature(signature['signature']),
sha256(b''.join(pieces)),
channel.claim.channel.public_key_bytes
)
def sign_comment(comment: dict, channel: Output, sign_comment_id=False):
timestamp = str(int(time.time()))
signing_field = comment['comment_id'] if sign_comment_id else comment['comment']
pieces = [timestamp.encode(), channel.claim_hash, signing_field.encode()]
comment.update(sign(channel, signing_field.encode()))
def sign(channel, data):
timestamp = str(int(time.time()))
pieces = [timestamp.encode(), channel.claim_hash, data]
digest = sha256(b''.join(pieces))
signature = channel.private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256)
comment.update({
return {
'signature': binascii.hexlify(signature).decode(),
'signing_ts': timestamp
})
}
def sign_reaction(reaction: dict, channel: Output):
timestamp = str(int(time.time()))
signing_field = reaction['channel_name']
pieces = [timestamp.encode(), channel.claim_hash, signing_field.encode()]
digest = sha256(b''.join(pieces))
signature = channel.private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256)
reaction.update({
'signature': binascii.hexlify(signature).decode(),
'signing_ts': timestamp
})
reaction.update(sign(channel, signing_field.encode()))
async def jsonrpc_post(url: str, method: str, params: dict = None, **kwargs) -> any:
params = params or {}
+20 -16
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,7 +534,7 @@ 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()
@@ -545,9 +549,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(
+122 -22
View File
@@ -21,6 +21,7 @@ import base58
from aiohttp import web
from prometheus_client import generate_latest as prom_generate_latest, Gauge, Histogram, Counter
from google.protobuf.message import DecodeError
from lbry.wallet import (
Wallet, ENCRYPT_ON_DISK, SingleKey, HierarchicalDeterministic,
Transaction, Output, Input, Account, database
@@ -557,6 +558,14 @@ class Daemon(metaclass=JSONRPCServerType):
await self.component_manager.stop()
else:
self.component_startup_task.cancel()
# the wallet component might have not started
try:
wallet_component = self.component_manager.get_actual_component('wallet')
except NameError:
pass
else:
await wallet_component.stop()
await self.component_manager.stop()
log.info("stopped api components")
await self.rpc_runner.cleanup()
await self.streaming_runner.cleanup()
@@ -2295,6 +2304,41 @@ class Daemon(metaclass=JSONRPCServerType):
kwargs['is_not_spent'] = True
return self.jsonrpc_txo_list(**kwargs)
async def jsonrpc_support_sum(self, claim_id, new_sdk_server, include_channel_content=False, **kwargs):
"""
List total staked supports for a claim, grouped by the channel that signed the support.
+
+ If claim_id is a channel claim, you can use --include_channel_content to also include supports for
+ content claims in the channel.
!!!! NOTE: PAGINATION DOES NOT DO ANYTHING AT THE MOMENT !!!!!
Usage:
support_sum <claim_id> <new_sdk_server>
[--include_channel_content]
[--page=<page>] [--page_size=<page_size>]
Options:
--claim_id=<claim_id> : (str) claim id
--new_sdk_server=<new_sdk_server> : (str) URL of the new SDK server (EXPERIMENTAL)
--include_channel_content : (bool) if claim_id is for a channel, include supports for claims in
that channel
--page=<page> : (int) page to return during paginating
--page_size=<page_size> : (int) number of items on page during pagination
Returns: {Paginated[Dict]}
"""
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})
support_sums = await self.ledger.sum_supports(
new_sdk_server, claim_id=claim_id, include_channel_content=include_channel_content, **kwargs
)
return {
"items": support_sums,
"page": page_num,
"page_size": page_size
}
@requires(WALLET_COMPONENT)
async def jsonrpc_claim_search(self, **kwargs):
"""
@@ -2573,6 +2617,7 @@ class Daemon(metaclass=JSONRPCServerType):
)
txo = tx.outputs[0]
await txo.generate_channel_private_key()
tx._reset()
await tx.sign(funding_accounts)
@@ -2729,6 +2774,7 @@ class Daemon(metaclass=JSONRPCServerType):
new_txo.private_key = old_txo.private_key
new_txo.script.generate()
tx._reset()
await tx.sign(funding_accounts)
@@ -2745,6 +2791,39 @@ class Daemon(metaclass=JSONRPCServerType):
return tx
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_sign(
self, channel_name=None, channel_id=None, hexdata=None, channel_account_id=None, wallet_id=None):
"""
Signs data using the specified channel signing key.
Usage:
channel_sign [<channel_name> | --channel_name=<channel_name>]
[<channel_id> | --channel_id=<channel_id>] [<hexdata> | --hexdata=<hexdata>]
[--channel_account_id=<channel_account_id>...] [--wallet_id=<wallet_id>]
Options:
--channel_name=<channel_name> : (str) name of channel used to sign (or use channel id)
--channel_id=<channel_id> : (str) claim id of channel used to sign (or use channel name)
--hexdata=<hexdata> : (str) data to sign, encoded as hexadecimal
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
for channel certificates, defaults to all accounts.
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
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."
signing_channel = await self.get_channel_or_error(
wallet, channel_account_id, channel_id, channel_name, for_signing=True
)
return comment_client.sign(signing_channel, unhexlify(hexdata))
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_abandon(
self, claim_id=None, txid=None, nout=None, account_id=None, wallet_id=None,
@@ -3219,11 +3298,11 @@ class Daemon(metaclass=JSONRPCServerType):
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--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
@@ -3266,6 +3345,7 @@ class Daemon(metaclass=JSONRPCServerType):
file_stream = await self.file_manager.create_stream(file_path)
claim.stream.source.sd_hash = file_stream.sd_hash
new_txo.script.generate()
tx._reset()
if channel:
new_txo.sign(channel)
@@ -3485,6 +3565,7 @@ class Daemon(metaclass=JSONRPCServerType):
file_stream = await self.file_manager.create_stream(file_path)
new_txo.claim.stream.source.sd_hash = file_stream.sd_hash
new_txo.script.generate()
tx._reset()
stream_hash = file_stream.stream_hash
elif old_stream:
stream_hash = old_stream.stream_hash
@@ -3631,14 +3712,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
@@ -3689,6 +3772,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
@@ -3752,7 +3839,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]
@@ -3810,7 +3897,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
@@ -3875,6 +3961,7 @@ class Daemon(metaclass=JSONRPCServerType):
new_txo = tx.outputs[0]
new_txo.script.generate()
tx._reset()
if channel:
new_txo.sign(channel)
@@ -4270,7 +4357,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,
@@ -4293,6 +4381,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)
@@ -4307,9 +4396,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]]
]
@@ -4323,6 +4412,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
@@ -4376,15 +4466,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]
@@ -4394,6 +4484,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
@@ -4414,7 +4505,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:
@@ -4438,6 +4532,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 |
@@ -4451,6 +4546,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,
@@ -4485,6 +4582,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]]
]
@@ -4499,6 +4597,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,
@@ -5091,7 +5191,7 @@ class Daemon(metaclass=JSONRPCServerType):
Usage:
comment_create (<comment> | --comment=<comment>)
(<claim_id> | --claim_id=<claim_id> | --parent_id=<parent_id>)
(<claim_id> | --claim_id=<claim_id>) [--parent_id=<parent_id>]
(--channel_id=<channel_id> | --channel_name=<channel_name>)
[--channel_account_id=<channel_account_id>...] [--wallet_id=<wallet_id>]
+3 -12
View File
@@ -107,22 +107,13 @@ class MarketFeed:
class BittrexFeed(MarketFeed):
name = "Bittrex"
market = "BTCLBC"
url = "https://bittrex.com/api/v1.1/public/getmarkethistory"
params = {'market': 'BTC-LBC', 'count': 50}
url = "https://api.bittrex.com/v3/markets/LBC-BTC/ticker"
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):
+13 -3
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)
@@ -170,7 +173,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
)
+37 -1
View File
@@ -1,14 +1,44 @@
import time
import logging
import asyncio
import asyncio.tasks
from aiohttp import web
from prometheus_client import generate_latest as prom_generate_latest
from prometheus_client import Counter, Histogram, Gauge
PROBES_IN_FLIGHT = Counter("probes_in_flight", "Number of loop probes in flight", namespace='asyncio')
PROBES_FINISHED = Counter("probes_finished", "Number of finished loop probes", namespace='asyncio')
PROBE_TIMES = Histogram("probe_times", "Loop probe times", namespace='asyncio')
TASK_COUNT = Gauge("running_tasks", "Number of running tasks", namespace='asyncio')
def get_loop_metrics(delay=1):
loop = asyncio.get_event_loop()
def callback(started):
PROBE_TIMES.observe(time.perf_counter() - started - delay)
PROBES_FINISHED.inc()
async def monitor_loop_responsiveness():
while True:
now = time.perf_counter()
loop.call_later(delay, callback, now)
PROBES_IN_FLIGHT.inc()
TASK_COUNT.set(len(asyncio.tasks._all_tasks))
await asyncio.sleep(delay)
return loop.create_task(monitor_loop_responsiveness())
class PrometheusServer:
def __init__(self, logger=None):
self.runner = None
self.logger = logger or logging.getLogger(__name__)
self._monitor_loop_task = None
async def start(self, interface: str, port: int):
self.logger.info("start prometheus metrics")
prom_app = web.Application()
prom_app.router.add_get('/metrics', self.handle_metrics_get_request)
self.runner = web.AppRunner(prom_app)
@@ -16,7 +46,10 @@ class PrometheusServer:
metrics_site = web.TCPSite(self.runner, interface, port, shutdown_timeout=.5)
await metrics_site.start()
self.logger.info('metrics server listening on %s:%i', *metrics_site._server.sockets[0].getsockname()[:2])
self.logger.info(
'prometheus metrics server listening on %s:%i', *metrics_site._server.sockets[0].getsockname()[:2]
)
self._monitor_loop_task = get_loop_metrics()
async def handle_metrics_get_request(self, request: web.Request):
try:
@@ -29,4 +62,7 @@ class PrometheusServer:
raise
async def stop(self):
if self._monitor_loop_task and not self._monitor_loop_task.done():
self._monitor_loop_task.cancel()
self._monitor_loop_task = None
await self.runner.cleanup()
+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'),
+2 -9
View File
@@ -22,8 +22,7 @@ def _create_url_regex():
return _group(
_named(name+"_name", prefix + invalid_names_regex) +
_oneof(
_group('#' + _named(name+"_claim_id", "[0-9a-f]{1,40}")),
_group(':' + _named(name+"_sequence", '[1-9][0-9]*')),
_group('[:#]' + _named(name+"_claim_id", "[0-9a-f]{1,40}")),
_group(r'\$' + _named(name+"_amount_order", '[1-9][0-9]*'))
) + '?'
)
@@ -50,7 +49,6 @@ def normalize_name(name):
class PathSegment(NamedTuple):
name: str
claim_id: str = None
sequence: int = None
amount_order: int = None
@property
@@ -61,17 +59,13 @@ class PathSegment(NamedTuple):
q = {'name': self.name}
if self.claim_id is not None:
q['claim_id'] = self.claim_id
if self.sequence is not None:
q['sequence'] = self.sequence
if self.amount_order is not None:
q['amount_order'] = self.amount_order
return q
def __str__(self):
if self.claim_id is not None:
return f"{self.name}#{self.claim_id}"
elif self.sequence is not None:
return f"{self.name}:{self.sequence}"
return f"{self.name}:{self.claim_id}"
elif self.amount_order is not None:
return f"{self.name}${self.amount_order}"
return self.name
@@ -118,7 +112,6 @@ class URL(NamedTuple):
segments[segment] = PathSegment(
parts[f'{segment}_name'],
parts[f'{segment}_claim_id'],
parts[f'{segment}_sequence'],
parts[f'{segment}_amount_order']
)
+1 -1
View File
@@ -40,7 +40,7 @@ class StreamDownloader:
async def cached_read_blob(blob_info: 'BlobInfo') -> bytes:
return await self.read_blob(blob_info, 2)
if self.blob_manager.decrypted_blob_lru_cache:
if self.blob_manager.decrypted_blob_lru_cache is not None:
cached_read_blob = lru_cache_concurrent(override_lru_cache=self.blob_manager.decrypted_blob_lru_cache)(
cached_read_blob
)
+3 -4
View File
@@ -354,20 +354,19 @@ class ManagedStream(ManagedDownloadSource):
self.reflector_progress = int((i + 1) / len(we_have) * 100)
except (asyncio.TimeoutError, ValueError):
return sent
except ConnectionRefusedError:
except ConnectionError:
return sent
except (OSError, Exception) as err:
if isinstance(err, asyncio.CancelledError):
log.warning("stopped uploading %s#%s to reflector", self.claim_name, self.claim_id)
raise err
if isinstance(err, OSError):
elif isinstance(err, OSError):
log.warning(
"stopped uploading %s#%s to reflector because blobs were deleted or moved", self.claim_name,
self.claim_id
)
else:
log.exception("unexpected error reflecting %s#%s", self.claim_name, self.claim_id)
raise asyncio.CancelledError()
return sent
finally:
if protocol.transport:
protocol.transport.close()
+2 -2
View File
@@ -160,13 +160,13 @@ class StreamManager(SourceManager):
async def reflect_streams(self):
try:
return await self._reflact_streams()
return await self._reflect_streams()
except asyncio.CancelledError:
raise
except Exception:
log.exception("reflector task encountered an unexpected error!")
async def _reflact_streams(self):
async def _reflect_streams(self):
# todo: those debug statements are temporary for #2987 - remove them if its closed
while True:
if self.config.reflect_streams and self.config.reflector_servers:
+8 -2
View File
@@ -23,8 +23,9 @@ 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 (
@@ -320,6 +321,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()
@@ -340,6 +342,7 @@ class CommandTestCase(IntegrationTestCase):
server_tmp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, server_tmp_dir)
self.server_config = Config()
self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, ':memory:')
await self.server_storage.open()
@@ -389,10 +392,13 @@ class CommandTestCase(IntegrationTestCase):
conf.fixed_peers = [('127.0.0.1', 5567)]
conf.known_dht_nodes = []
conf.blob_lru_cache_size = self.blob_lru_cache_size
conf.transaction_cache_size = 10000
conf.components_to_skip = [
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):
+185 -10
View File
@@ -20,8 +20,11 @@ import pkg_resources
import certifi
import aiohttp
from prometheus_client import Counter
from prometheus_client.registry import REGISTRY
from lbry.schema.claim import Claim
log = logging.getLogger(__name__)
@@ -189,6 +192,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
@@ -203,18 +208,44 @@ async def resolve_host(url: str, port: int, proto: str) -> str:
))[0][4][0]
class LRUCache:
class LRUCacheWithMetrics:
__slots__ = [
'capacity',
'cache'
'cache',
'_track_metrics',
'hits',
'misses'
]
def __init__(self, capacity):
def __init__(self, capacity: int, metric_name: typing.Optional[str] = None, namespace: str = "daemon_cache"):
self.capacity = capacity
self.cache = collections.OrderedDict()
if metric_name is None:
self._track_metrics = False
self.hits = self.misses = None
else:
self._track_metrics = True
try:
self.hits = Counter(
f"{metric_name}_cache_hit_count", "Number of cache hits", namespace=namespace
)
self.misses = Counter(
f"{metric_name}_cache_miss_count", "Number of cache misses", namespace=namespace
)
except ValueError as 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
def get(self, key):
value = self.cache.pop(key)
def get(self, key, default=None):
try:
value = self.cache.pop(key)
if self._track_metrics:
self.hits.inc()
except KeyError:
if self._track_metrics:
self.misses.inc()
return default
self.cache[key] = value
return value
@@ -226,16 +257,94 @@ class LRUCache:
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()
if self._track_metrics: # needed for tests
try:
REGISTRY.unregister(self.hits)
REGISTRY.unregister(self.misses)
except AttributeError:
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 or LRUCache(cache_size)
lru_cache = override_lru_cache if override_lru_cache is not None else LRUCacheWithMetrics(cache_size)
def wrapper(async_fn):
@@ -270,14 +379,80 @@ async def aiohttp_request(method, url, **kwargs) -> typing.AsyncContextManager[a
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():
+141
View File
@@ -740,4 +740,145 @@ HASHES = {
738000: 'aebdf15b23eb7a37600f67d45bf6586b1d5bff3d5f3459adc2f6211ab3dd0bcb',
739000: '3f5a894ac42f95f7d54ce25c42ea0baf1a05b2da0e9406978de0dc53484d8b04',
740000: '55debc22f995d844eafa0a90296c9f4f433e2b7f38456fff45dd3c66cef04e37',
741000: '927b47fc909b4b55c067bbd75d8638af1400fac076cb642e9500a747d849e458',
742000: '97fa3d83eb94114496e418c118f549ebfb8f6d123d0b40a12ecb093239557646',
743000: '482b66d8d5084703079c28e3ae69e5dee735f762d6fcf9743e75f04e139fd181',
744000: 'f406890d5c70808a58fb14429bad812a3185bdb9dace1aa57de76663f92b5013',
745000: '2bd0802cbb8aa4441a159104d39515a4ff6fc8dfe616bc83e88197847c78bcff',
746000: '24d090a7b6359db3d5d714a69ddc9a6f2e8ff8f044b723220a8ba32df785fd54',
747000: '07c4ce9ce5310ee472cf753ddb03c39c5fee6c910d491daffd38615205411633',
748000: 'ea913798c0f09d0a27eae7c852954c2c88b8c3b7f23f8fba26b68a3952d0ffde',
749000: '23f256adebfe35d49ba84ad49f3f71fc67f7745091c91f22e65f1cc2e23b8f2c',
750000: '96db12ee3a295f3d5c56d244e6e7493f58c08d3427e379940e5d4f891a41ec26',
751000: 'cedaf12415dac1314942e58ced80830b92fbfabc41f42a0b0f054f0672ef9822',
752000: '293606bcd9fbbee5584724301b2cf86bb69204820023e1fb46c238ddfbc660ab',
753000: 'f4d43cbb38b7d97919dedc0f5a6dc8007896c4f443b76f3e5693e25bc46760cf',
754000: 'fcaad22fd815311280fe451086516375d1d9d92b2990c7c351407df5aa19011e',
755000: 'b9276f10d1844cb5b0308766c8db960490ac34a73c4653d0a91202789a6ccb9b',
756000: '2fe5581f1110c1c8dcea46cad647551bd6bd640cb37738d863e189bd8f368347',
757000: 'b9d915f366f0b010429a52245b0fb02774157eb9fd8f66bce32dcd3acc71c2a1',
758000: '62d1854fc15db56b5d0e05ceeb54c1297966bf9dc7f7a0a14b42c059fc485d1b',
759000: 'f4ca9f69d16d092f4a0ea5102e6343b21204c4ea9cd9b22cddd77dbb5d68ade3',
760000: 'df3bb86641330d8cc7f55a2fd0da28251219e95babe960a308b18e08a7d88fc8',
761000: 'a93029475de4bc7569b6ae802d658cd91c84cc253772712a279f140a6c3b91b1',
762000: '307e289dc6ec8bcd62ca8831e4159d5edd780f2fae55ba55dd446225450f46f8',
763000: '293f73514abca24f374473bd0394179812952a04ea13dc60ef5ada5331fa274f',
764000: 'dd8b082db9281e3d9bacf15d6b352fda186d2d2923c7731844d0d4764dd71db8',
765000: '201239e562d2571bf47347b3522fff89632aecea3b2d8cef05151f88b2b0bcdb',
766000: '4a55a538b51b5650979e64521998cd5c5ad055ba9f3ac0e3e2a28febc6cc2798',
767000: '3916666f2adbb05ea98ec1961f9546b9afa0f6910ec95e42ce37267f2ae4f79c',
768000: 'dc0ad881eedcb5fd4954238f462080d6e7636b058d481698ed1c077e0ce2207e',
769000: 'eaf10a1e1ec6e129289b8479a05df03e0808f1f0946f1995de6524e9ebe7a461',
770000: '7200c64f22e32de7f999583361c933680fc9a2ffcb9a5ab73d3076fd49ec7537',
771000: 'd883111a2eeacff80ce31df35ab6c943805b9e48877b413fccf371e5dbfa7fb2',
772000: '3977d3c60edb9c80c97bb2b759b1659cbb650ad2d3a6f61d2caec83f1b2ae84c',
773000: '9c7175fb8646a1a82383b4c534fd01bcf92d65c43d87ae854d51a784b04dc77e',
774000: 'e0e92485f86e5fffa87b3497424e43b02a37710517d9d3f272392e8cdc56e5e9',
775000: '6395229113d3aa2105afbaeb8b59621a536fc61fe272314b2fc3bdda98dd66cc',
776000: 'b4b00207328b5f032bd4f0b634f91323ff520ada8c8bfec241b23c8e4bfd5a4e',
777000: '14cdc6f5f7b4bd5bad745dfe6fcd114e9194026412a2e1b3f345be2eef433d16',
778000: 'd3cd7b68be504c32117b670d38d59d44b02dcf3d65811efc2ca5531d902623cc',
779000: 'afcd220e4040cb5f92d4b38fc204e59822df2218f767f2c4b33597b238a35f77',
780000: '78252a9cfc289a70192ed8dd3dddeb1b9a4f9b8eff9a5d0ac259b3254472cf68',
781000: '02ebc3f17d947481a311b4771c254f1e002b6a9198d4a5258ce6c13165aadddc',
782000: '8dd9f1f372ee6d688a0bcdc3b342c77804ba5a646a218be4bc2aa02d846206c0',
783000: 'e46b0d02ec2ef488fae455665e107520e1bd2b4f35ca52af7ad8addd2f72fa73',
784000: '9ee8a8de94231e3ae3a610b82fdbca48dc14d9b80791d20af6c365a31822df6f',
785000: '21e1cc12def8173a50158b2833bd91a62140c61646f5e08aecaee3e6da20735e',
786000: 'b3e659f84d73de42888cc0f2b69bae71dd5fa6756a437a4b21958b182faa316e',
787000: 'a9be7ba00ea6a9ea6bd03d8412ec014ca7e8cda6bdc33382f165e702811b8836',
788000: 'a4c14729f8a68c03f5a0ccd890ac6a92b39c143f1f752fe81ad051eb52d8dce0',
789000: '5cf66d224e5645097efc9c3c0392b51c8ca8ea1295151921a7912a2f04ee1274',
790000: '676769ade71c33bc102bce416e66eb2c6794b03d7b8f5a590c87c380da463775',
791000: '0228e074451797bf6bfbc941bcafcbadc972d32e4e1e0c5da015513f65714217',
792000: '0fa3d00a1f19c5ac060e10a410cf7cea18eac5f89018d79ce51ac3fc66bbb365',
793000: '5f68d0868b424e32f5ce3d8e7d9f18979da7b831b8ef4e3974d62fb20ff53a97',
794000: '34508c56423739c00a837801b654b07decb274d02b383eff396d23c4d64bc0e9',
795000: '7f70910c855d1fd88cd7f9be8a3b94314ee408a31a2da6301404bf8deb07c12c',
796000: 'b74ab8813b1d2a0967fea0e66597572e5f0b5a285e21f5150fcc9d5f757de130',
797000: 'bba27b1491d907ab1baa456cb651dc5b071231b1b6ad27b62d351ca12c25dbfd',
798000: 'e75dcb15b2fc91f02e75e600dde9f6f46c09672533bc82a5d6916c4a2cd8613a',
799000: 'adf62c826a3e0b33af439a7881918ae4ce19c5fb2ca37d21243415f7d716aa65',
800000: 'd8f0ca13a8c8a19c254a3a6ba15150a34711dca96f2d877162cc44aa2acfb268',
801000: '2a8c7104c4040a2bc31913ae25e9361df5bac9477368c708f86c1ca640480887',
802000: '1f3b09d3561c4a8a056b263289bd492dc6c0d604c3fa195935e735d1c0ddc40e',
803000: '037769628c40a701fdb4b16d79084b8fbb319fde79770a7ac842f3cdc813099e',
804000: 'a0c6a089e5fa1e3589ca282085fe7201a5705776d81b257ffd252b2947fa6428',
805000: 'b2ac99bfc4a488e7b7624b31ee061991a6dd0881bb005cd13f3dd2e66a08fe19',
806000: 'ffe63cb999a278280b80a667d2dcb60c40e43a53f733914d8bec808b694ebf83',
807000: 'eddb09fc6c4869a59b520d0befb1fb6ac952333f3cc5de086539c85ea8558778',
808000: '0f4fb3f9172e52897ea992d9f3a2024126c4d2e63e9888739f11fb1f5e4c1f46',
809000: '9641dd720d23ced2f1cb6e5cf46ac4e547afb9f56263c4cf58e3b19d407cf401',
810000: 'de6dc953acd7e5ef213b3aaf1c4a9ee1d5b756bfce5525ee105214647e243a85',
811000: 'c52c83712ca12b24b2db1b4a575e7f352b1d560cbf702e121a03bdca9e8be23d',
812000: '83143734bb965318a53a38a7e403dcdb3e3fadedb01ab12c370417fc2a0655c0',
813000: 'e480deff10c5a84fc957e3aed936690e24b74dd08fa8858a8a953c2f7383b914',
814000: '810d33afcee07b9abe16c6cdc3a041038daa131c476b0daf48a080007f08b490',
815000: 'b4aeb9e16fddd27844b2d56bc2b221134039bb5642c9e9ba88372afbdeac3972',
816000: '86e73b67aae3d248011b8f66ed414cb8a9ba4b2a3cf7e32773cfbff055d719b7',
817000: '3ebb8b83752b48242016cb682f0f6bd14e15371bf1163a5933193eaa0edeb351',
818000: '4d925e17f642f220bbf317d3d5355d2f41fbce325f190f8c3b32dc0b337d24d6',
819000: 'b9cc126d620f6b99d90a00d35957b0e428aaaa7c986bc9e816a60e4334572961',
820000: '9c2f8c142bed1f94dca29276f7c83958be8cfe11773bb9b56c808fbcf7d3b1f8',
821000: 'e5509eb98895cfa12a8da5d54c1df3f52472ffcbdf707adbf84a4a9c5d356203',
822000: '764aada4802ebfe4ef935ab50af06a4f83aa556c49fdde3d9e12e1abd230c16b',
823000: '1dbd745c2e96a365d865f990d109137d32d42977f503af55d8c00b109d31d3c3',
824000: '954304a0b0c8f549c3bffd5ff46b5b8f05b0f0fde2a36f24fd5af9d774fb3079',
825000: '17808b14f2056c1a5d46cb7617e9de9be6a1a6084edbc1bdb778586467a72297',
826000: '3ca1167d4cac8b187829b23001b438617c43704b42462c4eb001b0d434cb9651',
827000: '246d1607245e4a202f420393ac2e30e9cbf5eb5570dc997073b897f6d8643023',
828000: '1764730a8dc3e89d02d168ff6bb54e8c903820b74711af6ff27bd0c8545577e7',
829000: 'd9f3ab0cd823c6305bd8b95a96188bb4f2ca90b4d66c5d12293e8b6192bac0f2',
830000: 'd4ff51f0092b04aedf8d39937680d8e8309b1be21d36e7833ed36f8e30aad6ea',
831000: '3e92e76721b962396dce52993fa7606552f0907b38f7b2bd7b21ada98c145f47',
832000: 'df12fcdb4cbe53ba627ace6de898298de175f8671d3d90170732d110fcdc34b8',
833000: '25167ff38ae4a5964b618cabe0a12d4de62ac7a4c47448cdb4499e09e108d5b9',
834000: 'd31f5309ea179a1e386e835fc372e47dcda6871a3a239abfba50c4f368994f13',
835000: 'aff7e8dd3e55ea807fcbe284014075f420b3a23f1b0eb47bacdc1c91d2899813',
836000: '3b5ac6d64c470739bb17d1544a285affb40f2d33e92687e5ba7c5ac602e0d72a',
837000: 'd5619cbfe4f27c55f2bf9351b4891636cf64fef88212a5eeeae7bd3de47fe0bd',
838000: '1f9102a49c6ac470cb5d0050e5300b1443840d6d65719b835e3bea484aafb2ec',
839000: '3f63e391f0fbc5787fbe4ace3bada3816261294ea1c6ee435001801023682f90',
840000: '777894fd12bd0d6dee7bcde2995c68e55e7094e3122da38571e4b6c4304b75e0',
841000: 'ceb0c598c788e25e43e25aa4beff5c7377035824844cf1675eaea537074df028',
842000: '8661cf2065dc713d2ba043f0b81f0effcc940eeb3e91906a21ff22c210561dcd',
843000: '0dc2766f90415009d0c86bedffee6ebcf58042eb08262c0c67c4e9ed86b2aec8',
844000: '26d072da864cab268a12794977b04ec44fb69ef3978e2342e82225974dac54dd',
845000: '95e93bb60be8d5f07a1f4d26290c914957a82fc9d26ae8a3f20082eda27406ff',
846000: 'f1bdc39af7705e58ab8b6c31dc70dce1e115db1cfd8cc9b037949dfbec82a59a',
847000: 'f5f10f06396ecf2765d8a081141d489737c1d8d57c281f28f57c4cb2f90db883',
848000: '331b8ef08605bae8d749893af9ed54f0df4f07a5a002108a2a0aea82d0360979',
849000: '75b5f6233ab9a1bbc3c8b2893e5b22a0aa98e7ea635261255dc3c281f67d2260',
850000: '5d7e6fe83e0ea1910a54a00090704737671d6f44df4228e21440ad1fc15e595f',
851000: '7822db25d3ff0f6695ee38bad91edf317b5c6611673d28f1d22053110bb558be',
852000: '2f0effad83a3561fc1a2806a562786a641d9ddb18d16bb9308006e7d324a21e9',
853000: 'f603b2eaff11d5296377d990651317d40a1b2599ad2c5250eab131090f4b9458',
854000: '34d59b26a50f18a9f250736d0f2e69d28b7e196fbef9b8a26c6b0b75c16aa194',
855000: '76dd1ffff3946c0878969886fcf177ce5ab5560df19ddf006f9bcb02ae3e4e4f',
856000: '74ff0b6f64e9dd5802fec2aac1d3ae194d28b9264114adaf0a882b46c8c918fe',
857000: '7b5badfa2e4f40aa597a504d7ebe83c3705a2c6169a8c168ce293db223bc2d32',
858000: '2bb0767a0f72b20d45ecfc3e34517dbda16d85758e040cf0e147f4cbd0cc57ac',
859000: '3d741b9c365a91ed76f85824b94d19ec19b608d232660840ba59c7aa4b2cb67f',
860000: 'd481a5a117878c0e3acd1f5844e150fb30e617577947d9846b1d214d703b71b0',
861000: '54033424e488a3f1ad6946d4a6d9acb48465d6b1dbe8e1c2504a54cc84d7cad4',
862000: '464bc3820a8cc8844dc9e26c388009e9982c656d46ef4b4fd0a2cb0e4eea0aaa',
863000: 'd1aa94be2174f66780c4f226b9da3f6712b0f37af8dec33360bea83ca261b342',
864000: '8c16008f11de5bc395d88cd802514ff647450f1bc136724b9aaf2ccce10a494f',
865000: '3dae86012e97a201e2e1a47c899001ac00f78dc108026ed7c4194858c6c6dd5a',
866000: 'afe5b0ccab995e1a1fa25fbc24c1d4b1a92c43042d03395f8743dcd806e72fd8',
867000: 'c83716ac171aa9ab0d414833db340fa30e82bfda6cc616d3038529caab9b5600',
868000: '8c409fe03cd35ef2d8e366818788b40eaeb4c8f6ae91450d75f4a66ca5f69cad',
869000: '1d47909ceba790b8e1ce2e9902ee2775ea99e58efdb95668f9803a8ccf95f286',
870000: '9adf5da1476388f053aa42de636da169d1cf1c9652cdf7cd9ad4fb18a0eb3388',
871000: '8ad57fb1e74bcba0b5614fbac003be2bb32275dd85b38f2d28a0585005a99cfc',
872000: '84a32e92012a356106e9657da8dab1a5491ea588fc29d411c69b20680c666420',
873000: 'adf5921bbbfaa43929f67e6a070975313b77b456e262c700a27be611fceb17ae',
874000: '09eaa7c4b18c79a46a2895190333f72336826223d5c986849a06f5153f49f2a5',
875000: '235d7e4f31966507312149ea4c5e294aa84c695cf840117f0ef5963be7a0bda1',
876000: '9aa9cb806ccbec0475ac330b496c5b2edeba38ba3f1e13ddd54a01457634a288',
877000: 'c1e7f9b2b20bb1c4c0deadbc786d31fdf36f262325342aa23d1a66e2846b22bc',
878000: 'ee0d2b20ac28ce23ab38698a57c6beff14f12b7af9d027c05cc92f652695f46b',
879000: '0eb0810f4b81d1845b0a88f05449408df2e45715c9210a656f45278c5fdf7956',
880000: 'e7d613027e3b4ca38d09bbef07998b57db237c6d67f1e8ea50024d2e0d9a1a72',
881000: '21af4d355d8756b8bf0369b2d79b5c824148ae069026ba5c14f9dd6b7555e1db',
}
+68 -33
View File
@@ -121,7 +121,13 @@ class AIOSQLite:
if self._closing:
return
self._closing = True
await asyncio.get_event_loop().run_in_executor(self.writer_executor, self.writer_connection.close)
def __checkpoint_and_close(conn: sqlite3.Connection):
conn.execute("PRAGMA WAL_CHECKPOINT(FULL);")
log.info("DB checkpoint finished.")
conn.close()
await asyncio.get_event_loop().run_in_executor(
self.writer_executor, __checkpoint_and_close, self.writer_connection)
self.writer_executor.shutdown(wait=True)
self.reader_executor.shutdown(wait=True)
self.read_ready.clear()
@@ -145,7 +151,7 @@ class AIOSQLite:
self.waiting_reads_metric.inc()
self.read_count_metric.inc()
try:
while self.writers: # more writes can come in while we are waiting for the first
while self.writers and not self._closing: # more writes can come in while we are waiting for the first
if not urgent_read and still_waiting and self.urgent_read_done.is_set():
# throttle the writes if they pile up
self.urgent_read_done.clear()
@@ -153,6 +159,8 @@ class AIOSQLite:
# wait until the running writes have finished
await self.read_ready.wait()
still_waiting = True
if self._closing:
raise asyncio.CancelledError()
return await asyncio.get_event_loop().run_in_executor(
self.reader_executor, read_only_fn, sql, parameters
)
@@ -195,6 +203,8 @@ class AIOSQLite:
self.read_ready.clear()
try:
async with self.write_lock:
if self._closing:
raise asyncio.CancelledError()
return await asyncio.get_event_loop().run_in_executor(
self.writer_executor, lambda: self.__run_transaction(fun, *args, **kwargs)
)
@@ -230,6 +240,8 @@ class AIOSQLite:
self.read_ready.clear()
try:
async with self.write_lock:
if self._closing:
raise asyncio.CancelledError()
return await asyncio.get_event_loop().run_in_executor(
self.writer_executor, self.__run_transaction_with_foreign_keys_disabled, fun, args, kwargs
)
@@ -375,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
@@ -419,7 +448,7 @@ class SQLiteMixin:
return
await self.db.executescript('\n'.join(
f"DROP TABLE {table};" for table in tables
))
) + '\n' + 'PRAGMA WAL_CHECKPOINT(FULL);' + '\n' + 'VACUUM;')
await self.db.execute(self.CREATE_VERSION_TABLE)
await self.db.execute("INSERT INTO version VALUES (?)", (self.SCHEMA_VERSION,))
await self.db.executescript(self.CREATE_TABLES_QUERY)
@@ -563,7 +592,7 @@ def get_and_reserve_spendable_utxos(transaction: sqlite3.Connection, accounts: L
class Database(SQLiteMixin):
SCHEMA_VERSION = "1.3"
SCHEMA_VERSION = "1.5"
PRAGMAS = """
pragma journal_mode=WAL;
@@ -675,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
@@ -933,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 = ""
@@ -1020,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
+146 -207
View File
@@ -10,11 +10,11 @@ from collections import defaultdict
from binascii import hexlify, unhexlify
from typing import Dict, Tuple, Type, Iterable, List, Optional, DefaultDict, NamedTuple
import pylru
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 LRUCacheWithMetrics
from .tasks import TaskGroup
from .database import Database
@@ -29,7 +29,6 @@ from .constants import TXO_TYPES, CLAIM_TYPES, COIN, NULL_HASH32
from .bip32 import PubKey, PrivateKey
from .coinselection import CoinSelector
log = logging.getLogger(__name__)
LedgerType = Type['BaseLedger']
@@ -124,7 +123,6 @@ class Ledger(metaclass=LedgerRegistry):
self.network: Network = self.config.get('network') or Network(self)
self.network.on_header.listen(self.receive_header)
self.network.on_status.listen(self.process_status_update)
self.network.on_connected.listen(self.join_network)
self.accounts = []
self.fee_per_byte: int = self.config.get('fee_per_byte', self.default_fee_per_byte)
@@ -157,7 +155,7 @@ class Ledger(metaclass=LedgerRegistry):
self._on_ready_controller = StreamController()
self.on_ready = self._on_ready_controller.stream
self._tx_cache = pylru.lrucache(self.config.get("tx_cache_size", 100_000))
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()
@@ -169,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 = pylru.lrucache(100000)
self._balance_cache = LRUCacheWithMetrics(2 ** 15)
@classmethod
def get_id(cls):
@@ -233,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
@@ -330,6 +328,8 @@ class Ledger(metaclass=LedgerRegistry):
await self.network.on_connected.first
async with self._header_processing_lock:
await self._update_tasks.add(self.initial_headers_sync())
self.network.on_connected.listen(self.join_network)
asyncio.ensure_future(self.join_network())
await fully_synced
await self.db.release_all_outputs()
await asyncio.gather(*(a.maybe_migrate_certificates() for a in self.accounts))
@@ -415,6 +415,7 @@ class Ledger(metaclass=LedgerRegistry):
"Blockchain Reorganization: attempting rewind to height %s from starting height %s",
height, height+rewound
)
self._tx_cache.clear()
else:
raise IndexError(f"headers.connect() returned negative number ({added})")
@@ -479,12 +480,14 @@ class Ledger(metaclass=LedgerRegistry):
for address, remote_status in zip(batch, results):
self._update_tasks.add(self.update_history(address, remote_status, address_manager))
addresses_remaining = addresses_remaining[batch_size:]
log.info("subscribed to %i/%i addresses on %s:%i", len(addresses) - len(addresses_remaining),
len(addresses), *self.network.client.server_address_and_port)
log.info(
"finished subscribing to %i addresses on %s:%i", len(addresses),
*self.network.client.server_address_and_port
)
if self.network.client and self.network.client.server_address_and_port:
log.info("subscribed to %i/%i addresses on %s:%i", len(addresses) - len(addresses_remaining),
len(addresses), *self.network.client.server_address_and_port)
if self.network.client and self.network.client.server_address_and_port:
log.info(
"finished subscribing to %i addresses on %s:%i", len(addresses),
*self.network.client.server_address_and_port
)
def process_status_update(self, update):
address, remote_status = update
@@ -511,11 +514,8 @@ class Ledger(metaclass=LedgerRegistry):
)
return True
acquire_lock_tasks = []
synced_txs = []
to_request = {}
pending_synced_history = {}
updated_cached_items = {}
already_synced = set()
already_synced_offset = 0
@@ -525,17 +525,6 @@ class Ledger(metaclass=LedgerRegistry):
already_synced.add((txid, remote_height))
already_synced_offset += 1
continue
cache_item = self._tx_cache.get(txid)
if cache_item is None:
cache_item = TransactionCacheItem()
self._tx_cache[txid] = cache_item
for txid, remote_height in remote_history[already_synced_offset:]:
cache_item = self._tx_cache[txid]
acquire_lock_tasks.append(asyncio.create_task(cache_item.lock.acquire()))
if acquire_lock_tasks:
await asyncio.wait(acquire_lock_tasks)
tx_indexes = {}
@@ -543,29 +532,18 @@ class Ledger(metaclass=LedgerRegistry):
tx_indexes[txid] = i
if (txid, remote_height) in already_synced:
continue
cache_item = self._tx_cache.get(txid)
cache_item.pending_verifications += 1
updated_cached_items[txid] = cache_item
assert cache_item is not None, 'cache item is none'
assert cache_item.lock.locked(), 'cache lock is not held?'
# tx = cache_item.tx
# if cache_item.tx is not None and \
# cache_item.tx.height >= remote_height and \
# (cache_item.tx.is_verified or remote_height < 1):
# synced_txs.append(cache_item.tx) # cached tx is already up-to-date
# pending_synced_history[i] = f'{tx.id}:{tx.height}:'
# continue
to_request[i] = (txid, remote_height)
log.debug(
"request %i transactions, %i/%i for %s are already synced", len(to_request), len(synced_txs),
"request %i transactions, %i/%i for %s are already synced", len(to_request), len(already_synced),
len(remote_history), address
)
requested_txes = await self._request_transaction_batch(to_request, len(remote_history), address)
for tx in requested_txes:
remote_history_txids = set(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}:"
synced_txs.append(tx)
if len(pending_synced_history) % 100 == 0:
log.info("Syncing address %s: %d/%d", address, len(pending_synced_history), len(to_request))
log.info("Sync finished for address %s: %d/%d", address, len(pending_synced_history), len(to_request))
assert len(pending_synced_history) == len(remote_history), \
f"{len(pending_synced_history)} vs {len(remote_history)}"
@@ -576,21 +554,7 @@ class Ledger(metaclass=LedgerRegistry):
if f"{txid}:{height}:" != pending_synced_history[i]:
log.warning("history mismatch: %s vs %s", remote_history[remote_i], pending_synced_history[i])
synced_history += pending_synced_history[i]
cache_size = self.config.get("tx_cache_size", 100_000)
for txid, cache_item in updated_cached_items.items():
cache_item.pending_verifications -= 1
if cache_item.pending_verifications < 0:
log.warning("config value tx cache size %i needs to be increased", cache_size)
cache_item.pending_verifications = 0
try:
cache_item.lock.release()
except RuntimeError:
log.warning("lock was already released?")
await self.db.save_transaction_io_batch(
[], address, self.address_to_hash160(address), synced_history
)
await self.db.set_address_history(address, synced_history)
if address_manager is None:
address_manager = await self.get_address_manager_for_address(address)
@@ -598,13 +562,6 @@ class Ledger(metaclass=LedgerRegistry):
if address_manager is not None:
await address_manager.ensure_address_gap()
for txid, cache_item in updated_cached_items.items():
if self._tx_cache.get(txid) is not cache_item:
log.warning("tx cache corrupted while syncing %s, reattempt sync=%s", address, reattempt_update)
if reattempt_update:
return await self.update_history(address, remote_status, address_manager, False)
return False
local_status, local_history = \
await self.get_local_status_and_history(address, synced_history)
@@ -636,150 +593,105 @@ class Ledger(metaclass=LedgerRegistry):
log.debug("finished syncing transaction history for %s, %i known txs", address, len(local_history))
return True
async def cache_transaction(self, txid, remote_height, check_local=True):
cache_item = self._tx_cache.get(txid)
if cache_item is None:
cache_item = self._tx_cache[txid] = TransactionCacheItem()
elif cache_item.tx is not None and \
cache_item.tx.height >= remote_height and \
(cache_item.tx.is_verified or remote_height < 1):
return cache_item.tx # cached tx is already up-to-date
cache_item.pending_verifications += 1
try:
async with cache_item.lock:
tx = cache_item.tx
if tx is None and check_local:
# check local db
tx = cache_item.tx = await self.db.get_transaction(txid=txid)
merkle = None
if tx is None:
# fetch from network
_raw, merkle = await self.network.retriable_call(
self.network.get_transaction_and_merkle, txid, remote_height
)
tx = Transaction(unhexlify(_raw), height=merkle['block_height'])
cache_item.tx = tx # make sure it's saved before caching it
tx.height = remote_height
if merkle and 0 < remote_height < len(self.headers):
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
header = await self.headers.get(remote_height)
tx.position = merkle['pos']
tx.is_verified = merkle_root == header['merkle_root']
return tx
finally:
cache_item.pending_verifications -= 1
async def maybe_verify_transaction(self, tx, remote_height, merkle=None):
tx.height = remote_height
cached = self._tx_cache.get(tx.id)
if not cached:
# cache txs looked up by transaction_show too
cached = TransactionCacheItem()
self._tx_cache[tx.id] = cached
cached.tx = tx
if 0 < remote_height < len(self.headers) and cached.pending_verifications <= 1:
if 0 < remote_height < len(self.headers):
# can't be tx.pending_verifications == 1 because we have to handle the transaction_show case
if not merkle:
merkle = await self.network.retriable_call(self.network.get_merkle, tx.id, remote_height)
if 'merkle' not in merkle:
return
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
header = await self.headers.get(remote_height)
tx.position = merkle['pos']
tx.is_verified = merkle_root == header['merkle_root']
return tx
async def _request_transaction_batch(self, to_request, remote_history_size, address):
header_cache = {}
async def request_transactions(self, to_request: Tuple[Tuple[str, int], ...], cached=False):
batches = [[]]
remote_heights = {}
synced_txs = []
heights_in_batch = 0
last_height = 0
for idx in sorted(to_request):
txid = to_request[idx][0]
height = to_request[idx][1]
cache_hits = set()
for txid, height in sorted(to_request, key=lambda x: x[1]):
if cached:
cached_tx = self._tx_cache.get(txid)
if cached_tx is not None:
if cached_tx.tx is not None and cached_tx.tx.is_verified:
cache_hits.add(txid)
continue
else:
self._tx_cache[txid] = TransactionCacheItem()
remote_heights[txid] = height
if height != last_height:
heights_in_batch += 1
last_height = height
if len(batches[-1]) == 100 or heights_in_batch == 20:
if len(batches[-1]) == 100:
batches.append([])
heights_in_batch = 1
batches[-1].append(txid)
if not batches[-1]:
batches.pop()
if cached and cache_hits:
yield {txid: self._tx_cache[txid].tx for txid in cache_hits}
last_showed_synced_count = 0
async def _single_batch(batch):
this_batch_synced = []
batch_result = await self.network.retriable_call(self.network.get_transaction_batch, batch)
for txid, (raw, merkle) in batch_result.items():
remote_height = remote_heights[txid]
merkle_height = merkle['block_height']
cache_item = self._tx_cache.get(txid)
if cache_item is None:
cache_item = TransactionCacheItem()
self._tx_cache[txid] = cache_item
tx = cache_item.tx or Transaction(unhexlify(raw), height=remote_height)
tx.height = remote_height
cache_item.tx = tx
if 'merkle' in merkle and remote_heights[txid] > 0:
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
try:
header = header_cache.get(remote_heights[txid]) or (await self.headers.get(merkle_height))
except IndexError:
log.warning("failed to verify %s at height %i", tx.id, merkle_height)
else:
header_cache[remote_heights[txid]] = header
tx.position = merkle['pos']
tx.is_verified = merkle_root == header['merkle_root']
check_db_for_txos = []
for txi in tx.inputs:
if txi.txo_ref.txo is not None:
continue
cache_item = self._tx_cache.get(txi.txo_ref.tx_ref.id)
if cache_item is not None:
if cache_item.tx is not None:
txi.txo_ref = cache_item.tx.outputs[txi.txo_ref.position].ref
else:
check_db_for_txos.append(txi.txo_ref.id)
referenced_txos = {} if not check_db_for_txos else {
txo.id: txo for txo in await self.db.get_txos(
txoid__in=check_db_for_txos, order_by='txo.txoid', no_tx=True
)
}
for txi in tx.inputs:
if txi.txo_ref.txo is not None:
continue
referenced_txo = referenced_txos.get(txi.txo_ref.id)
if referenced_txo is not None:
txi.txo_ref = referenced_txo.ref
continue
cache_item = self._tx_cache.get(txi.txo_ref.id)
if cache_item is None:
cache_item = self._tx_cache[txi.txo_ref.id] = TransactionCacheItem()
if cache_item.tx is not None:
txi.txo_ref = cache_item.tx.ref
synced_txs.append(tx)
this_batch_synced.append(tx)
await self.db.save_transaction_io_batch(
this_batch_synced, address, self.address_to_hash160(address), ""
)
await asyncio.wait([
self._on_transaction_controller.add(TransactionEvent(address, tx))
for tx in this_batch_synced
])
nonlocal last_showed_synced_count
if last_showed_synced_count + 100 < len(synced_txs):
log.info("synced %i/%i transactions for %s", len(synced_txs), remote_history_size, address)
last_showed_synced_count = len(synced_txs)
for batch in batches:
await _single_batch(batch)
return synced_txs
txs = await self._single_batch(batch, remote_heights)
if cached:
for txid, tx in txs.items():
self._tx_cache[txid].tx = tx
yield txs
async def request_synced_transactions(self, to_request, remote_history, address):
async for txs in self.request_transactions(((txid, height) for txid, height in to_request.values())):
for tx in txs.values():
yield tx
await self._sync_and_save_batch(address, remote_history, txs)
async def _single_batch(self, batch, remote_heights):
heights = {remote_heights[txid] for txid in batch}
unrestriced = 0 < min(heights) < max(heights) < max(self.headers.checkpoints or [0])
batch_result = await self.network.retriable_call(self.network.get_transaction_batch, batch, not unrestriced)
txs = {}
for txid, (raw, merkle) in batch_result.items():
remote_height = remote_heights[txid]
tx = Transaction(unhexlify(raw), height=remote_height)
txs[tx.id] = tx
await self.maybe_verify_transaction(tx, remote_height, merkle)
return txs
async def _sync_and_save_batch(self, address, remote_history, pending_txs):
await asyncio.gather(*(self._sync(tx, remote_history, pending_txs) for tx in pending_txs.values()))
await self.db.save_transaction_io_batch(
pending_txs.values(), address, self.address_to_hash160(address), ""
)
while pending_txs:
self._on_transaction_controller.add(TransactionEvent(address, pending_txs.popitem()[1]))
async def _sync(self, tx, remote_history, pending_txs):
check_db_for_txos = {}
for txi in tx.inputs:
if txi.txo_ref.txo is not None:
continue
wanted_txid = txi.txo_ref.tx_ref.id
if wanted_txid not in remote_history:
continue
if wanted_txid in pending_txs:
txi.txo_ref = pending_txs[wanted_txid].outputs[txi.txo_ref.position].ref
else:
check_db_for_txos[txi] = txi.txo_ref.id
referenced_txos = {} if not check_db_for_txos else {
txo.id: txo for txo in await self.db.get_txos(
txoid__in=list(check_db_for_txos.values()), order_by='txo.txoid', no_tx=True
)
}
for txi in check_db_for_txos:
if txi.txo_ref.id in referenced_txos:
txi.txo_ref = referenced_txos[txi.txo_ref.id].ref
else:
tx_from_db = await self.db.get_transaction(txid=txi.txo_ref.tx_ref.id)
if tx_from_db is None:
log.warning("%s not on db, not on cache, but on remote history!", txi.txo_ref.id)
else:
txi.txo_ref = tx_from_db.outputs[txi.txo_ref.position].ref
return tx
async def get_address_manager_for_address(self, address) -> Optional[AddressManager]:
details = await self.db.get_address(address=address)
@@ -847,11 +759,10 @@ class Ledger(metaclass=LedgerRegistry):
include_received_tips=False) -> Tuple[List[Output], dict, int, int]:
encoded_outputs = await query
outputs = Outputs.from_base64(encoded_outputs or b'') # TODO: why is the server returning None?
txs = []
txs: List[Transaction] = []
if len(outputs.txs) > 0:
txs: List[Transaction] = await asyncio.gather(*(
self.cache_transaction(*tx) for tx in outputs.txs
))
async for tx in self.request_transactions(tuple(outputs.txs), cached=True):
txs.extend(tx.values())
_txos, blocked = outputs.inflate(txs)
@@ -924,15 +835,20 @@ class Ledger(metaclass=LedgerRegistry):
return txos, blocked, outputs.offset, outputs.total
async def resolve(self, accounts, urls, new_sdk_server=None, **kwargs):
txos = []
urls_copy = list(urls)
if new_sdk_server:
resolve = partial(self.network.new_resolve, new_sdk_server)
else:
resolve = partial(self.network.retriable_call, self.network.resolve)
urls_copy = list(urls)
txos = []
while urls_copy:
batch, urls_copy = urls_copy[:500], urls_copy[500:]
txos.extend((await self._inflate_outputs(resolve(batch), accounts, **kwargs))[0])
batch, urls_copy = urls_copy[:100], urls_copy[100:]
txos.extend(
(await self._inflate_outputs(
resolve(batch), accounts, **kwargs
))[0]
)
assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received."
result = {}
for url, txo in zip(urls, txos):
@@ -945,6 +861,9 @@ class Ledger(metaclass=LedgerRegistry):
result[url] = txo
return result
async def sum_supports(self, new_sdk_server, **kwargs) -> List[Dict]:
return await self.network.sum_supports(new_sdk_server, **kwargs)
async def claim_search(
self, accounts, include_purchase_receipt=False, include_is_my_output=False,
new_sdk_server=None, **kwargs) -> Tuple[List[Output], dict, int, int]:
@@ -955,7 +874,7 @@ class Ledger(metaclass=LedgerRegistry):
return await self._inflate_outputs(
claim_search(**kwargs), accounts,
include_purchase_receipt=include_purchase_receipt,
include_is_my_output=include_is_my_output
include_is_my_output=include_is_my_output,
)
async def get_claim_by_claim_id(self, accounts, claim_id, **kwargs) -> Output:
@@ -1018,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]
@@ -1033,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:
@@ -1061,7 +1002,7 @@ class Ledger(metaclass=LedgerRegistry):
return self.db.get_channel_count(**constraints)
async def resolve_collection(self, collection, offset=0, page_size=1):
claim_ids = collection.claim.collection.claims.ids[offset:page_size+offset]
claim_ids = collection.claim.collection.claims.ids[offset:page_size + offset]
try:
resolve_results, _, _, _ = await self.claim_search([], claim_ids=claim_ids)
except Exception as err:
@@ -1110,7 +1051,7 @@ class Ledger(metaclass=LedgerRegistry):
'txid': tx.id,
'timestamp': ts,
'date': datetime.fromtimestamp(ts).isoformat(' ')[:-3] if tx.height > 0 else None,
'confirmations': (headers.height+1) - tx.height if tx.height > 0 else 0,
'confirmations': (headers.height + 1) - tx.height if tx.height > 0 else 0,
'claim_info': [],
'update_info': [],
'support_info': [],
@@ -1120,7 +1061,7 @@ class Ledger(metaclass=LedgerRegistry):
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)
item['value'] = dewies_to_lbc(tx.net_account_balance + tx.fee)
item['fee'] = dewies_to_lbc(-tx.fee)
else:
# someone else paid the fees
@@ -1143,13 +1084,13 @@ class Ledger(metaclass=LedgerRegistry):
if txi.txo_ref.txo is not None:
other_txo = txi.txo_ref.txo
if (other_txo.is_claim or other_txo.script.is_support_claim) \
and other_txo.claim_id == txo.claim_id:
and other_txo.claim_id == txo.claim_id:
previous = other_txo
break
if previous is not None:
item['update_info'].append({
'address': txo.get_address(self),
'balance_delta': dewies_to_lbc(previous.amount-txo.amount),
'balance_delta': dewies_to_lbc(previous.amount - txo.amount),
'amount': dewies_to_lbc(txo.amount),
'claim_id': txo.claim_id,
'claim_name': txo.claim_name,
@@ -1227,7 +1168,7 @@ class Ledger(metaclass=LedgerRegistry):
for account in accounts:
balance = self._balance_cache.get(account.id)
if not balance:
balance = self._balance_cache[account.id] =\
balance = self._balance_cache[account.id] = \
await account.get_detailed_balance(confirmations, reserved_subtotals=True)
for key, value in balance.items():
if key == 'reserved_subtotals':
@@ -1237,7 +1178,6 @@ class Ledger(metaclass=LedgerRegistry):
result[key] += value
return result
class TestNetLedger(Ledger):
network_name = 'testnet'
pubkey_address_prefix = bytes((111,))
@@ -1246,7 +1186,6 @@ class TestNetLedger(Ledger):
extended_private_key_prefix = unhexlify('04358394')
checkpoints = {}
class RegTestLedger(Ledger):
network_name = 'regtest'
headers_class = UnvalidatedHeaders
+193 -180
View File
@@ -1,27 +1,27 @@
import logging
import asyncio
import json
import socket
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
@@ -29,8 +29,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):
@@ -57,7 +55,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)
@@ -68,7 +66,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:
@@ -88,44 +86,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(
@@ -135,6 +101,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()
@@ -146,12 +131,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:
@@ -161,10 +148,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)
@@ -184,58 +170,170 @@ 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, n=5, timeout=3.0) -> Dict[Tuple[str, int], 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()
log.info("%i possible spv servers to try (%i urls in config)", len(ip_to_hostnames),
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[remote] = pong
return pongs
except asyncio.TimeoutError:
if pongs:
log.info("%i/%i probed spv servers are accepting connections", len(pongs), len(ip_to_hostnames))
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()))
return pongs
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:
await asyncio.wait(
[self._keepalive_task, self._urgent_need_reconnect.wait()],
return_when=asyncio.FIRST_COMPLETED
)
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 = 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):
@@ -243,14 +341,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):
@@ -261,9 +360,9 @@ class Network:
restricted = known_height in (None, -1, 0) or 0 > known_height > self.remote_height - 10
return self.rpc('blockchain.transaction.get', [tx_hash], restricted)
def get_transaction_batch(self, txids):
def get_transaction_batch(self, txids, restricted=True):
# use any server if its old, otherwise restrict to who gave us the history
return self.rpc('blockchain.transaction.get_batch', txids, True)
return self.rpc('blockchain.transaction.get_batch', txids, restricted)
def get_transaction_and_merkle(self, tx_hash, known_height=None):
# use any server if its old, otherwise restrict to who gave us the history
@@ -316,11 +415,11 @@ class Network:
def get_claims_by_ids(self, claim_ids):
return self.rpc('blockchain.claimtrie.getclaimsbyids', claim_ids)
def resolve(self, urls):
return self.rpc('blockchain.claimtrie.resolve', urls)
def resolve(self, urls, session_override=None):
return self.rpc('blockchain.claimtrie.resolve', urls, False, session_override)
def claim_search(self, **kwargs):
return self.rpc('blockchain.claimtrie.search', kwargs)
def claim_search(self, session_override=None, **kwargs):
return self.rpc('blockchain.claimtrie.search', kwargs, False, session_override)
async def new_resolve(self, server, urls):
message = {"method": "resolve", "params": {"urls": urls, "protobuf": True}}
@@ -335,94 +434,8 @@ class Network:
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
async def sum_supports(self, server, **kwargs):
message = {"method": "support_sum", "params": kwargs}
async with self.aiohttp_session.post(server, json=message) as r:
result = await r.json()
return result['result']
+77 -51
View File
@@ -11,6 +11,7 @@ from lbry.wallet.server.daemon import DaemonError
from lbry.wallet.server.hash import hash_to_hex_str, HASHX_LEN
from lbry.wallet.server.util import chunks, class_logger
from lbry.wallet.server.leveldb import FlushData
from lbry.wallet.server.udp import StatusServer
class Prefetcher:
@@ -171,7 +172,8 @@ class BlockProcessor:
# Caches of unflushed items.
self.headers = []
self.tx_hashes = []
self.block_hashes = []
self.block_txs = []
self.undo_infos = []
# UTXO cache
@@ -184,6 +186,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
@@ -215,10 +218,12 @@ class BlockProcessor:
for cache in self.search_cache.values():
cache.clear()
self.history_cache.clear()
self.notifications.notified_mempool_txs.clear()
await self._maybe_flush()
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))
@@ -246,7 +251,7 @@ class BlockProcessor:
self.logger.info('chain reorg detected')
else:
self.logger.info(f'faking a reorg of {count:,d} blocks')
await self.flush(True)
async def get_raw_blocks(last_height, hex_hashes):
heights = range(last_height, last_height - len(hex_hashes), -1)
@@ -263,17 +268,28 @@ class BlockProcessor:
self.touched.discard(None)
self.db.flush_backup(self.flush_data(), self.touched)
start, last, hashes = await self.reorg_hashes(count)
# Reverse and convert to hex strings.
hashes = [hash_to_hex_str(hash) for hash in reversed(hashes)]
for hex_hashes in chunks(hashes, 50):
raw_blocks = await get_raw_blocks(last, hex_hashes)
await self.run_in_thread_with_lock(self.backup_blocks, raw_blocks)
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()
try:
await self.flush(True)
start, last, hashes = await self.reorg_hashes(count)
# Reverse and convert to hex strings.
hashes = [hash_to_hex_str(hash) for hash in reversed(hashes)]
self.logger.info("reorg %i block hashes", len(hashes))
for hex_hashes in chunks(hashes, 50):
raw_blocks = await get_raw_blocks(last, hex_hashes)
self.logger.info("got %i raw blocks", len(raw_blocks))
await self.run_in_thread_with_lock(self.backup_blocks, raw_blocks)
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:
self.logger.exception("boom")
raise
finally:
self.logger.info("done with reorg")
async def reorg_hashes(self, count):
"""Return a pair (start, last, hashes) of blocks to back up during a
@@ -336,8 +352,8 @@ class BlockProcessor:
def flush_data(self):
"""The data for a flush. The lock must be taken."""
assert self.state_lock.locked()
return FlushData(self.height, self.tx_count, self.headers,
self.tx_hashes, self.undo_infos, self.utxo_cache,
return FlushData(self.height, self.tx_count, self.headers, self.block_hashes,
self.block_txs, self.undo_infos, self.utxo_cache,
self.db_deletes, self.tip)
async def flush(self, flush_utxos):
@@ -392,7 +408,8 @@ class BlockProcessor:
for block in blocks:
height += 1
undo_info = self.advance_txs(
height, block.transactions, self.coin.electrum_header(block.header, height)
height, block.transactions, self.coin.electrum_header(block.header, height),
self.coin.header_hash(block.header)
)
if height >= min_height:
self.undo_infos.append((undo_info, height))
@@ -403,25 +420,26 @@ class BlockProcessor:
self.headers.extend(headers)
self.tip = self.coin.header_hash(headers[-1])
def advance_txs(self, height, txs, header):
self.tx_hashes.append(b''.join(tx_hash for tx, tx_hash in txs))
def advance_txs(self, height, txs, header, block_hash):
self.block_hashes.append(block_hash)
self.block_txs.append((b''.join(tx_hash for tx, tx_hash in txs), [tx.raw for tx, _ in txs]))
# Use local vars for speed in the loops
undo_info = []
tx_num = self.tx_count
script_hashX = self.coin.hashX_from_script
s_pack = pack
hashXs_by_tx = []
# Use local vars for speed in the loops
put_utxo = self.utxo_cache.__setitem__
spend_utxo = self.spend_utxo
undo_info_append = undo_info.append
update_touched = self.touched.update
hashXs_by_tx = []
append_hashXs = hashXs_by_tx.append
append_hashX_by_tx = hashXs_by_tx.append
hashX_from_script = self.coin.hashX_from_script
for tx, tx_hash in txs:
hashXs = []
append_hashX = hashXs.append
tx_numb = s_pack('<I', tx_num)
tx_numb = pack('<I', tx_num)
# Spend the inputs
for txin in tx.inputs:
@@ -434,18 +452,17 @@ class BlockProcessor:
# Add the new UTXOs
for idx, txout in enumerate(tx.outputs):
# Get the hashX. Ignore unspendable outputs
hashX = script_hashX(txout.pk_script)
hashX = hashX_from_script(txout.pk_script)
if hashX:
append_hashX(hashX)
put_utxo(tx_hash + s_pack('<H', idx),
hashX + tx_numb + s_pack('<Q', txout.value))
put_utxo(tx_hash + pack('<H', idx), hashX + tx_numb + pack('<Q', txout.value))
append_hashXs(hashXs)
append_hashX_by_tx(hashXs)
update_touched(hashXs)
self.db.total_transactions.append(tx_hash)
tx_num += 1
self.db.history.add_unflushed(hashXs_by_tx, self.tx_count)
self.tx_count = tx_num
self.db.tx_counts.append(tx_num)
@@ -462,6 +479,7 @@ class BlockProcessor:
coin = self.coin
for raw_block in raw_blocks:
self.logger.info("backup block %i", self.height)
# Check and update self.tip
block = coin.block(raw_block, self.height)
header_hash = coin.header_hash(block.header)
@@ -487,20 +505,16 @@ class BlockProcessor:
# Use local vars for speed in the loops
s_pack = pack
put_utxo = self.utxo_cache.__setitem__
spend_utxo = self.spend_utxo
script_hashX = self.coin.hashX_from_script
touched = self.touched
undo_entry_len = 12 + HASHX_LEN
for tx, tx_hash in reversed(txs):
for idx, txout in enumerate(tx.outputs):
# Spend the TX outputs. Be careful with unspendable
# outputs - we didn't save those in the first place.
hashX = script_hashX(txout.pk_script)
hashX = self.coin.hashX_from_script(txout.pk_script)
if hashX:
cache_value = spend_utxo(tx_hash, idx)
touched.add(cache_value[:-12])
cache_value = self.spend_utxo(tx_hash, idx)
self.touched.add(cache_value[:-12])
# Restore the inputs
for txin in reversed(tx.inputs):
@@ -508,9 +522,10 @@ class BlockProcessor:
continue
n -= undo_entry_len
undo_item = undo_info[n:n + undo_entry_len]
put_utxo(txin.prev_hash + s_pack('<H', txin.prev_idx),
undo_item)
touched.add(undo_item[:-12])
self.utxo_cache[txin.prev_hash + s_pack('<H', txin.prev_idx)] = undo_item
self.touched.add(undo_item[:-12])
self.db.total_transactions.pop()
assert n == 0
self.tx_count -= len(txs)
@@ -589,13 +604,17 @@ class BlockProcessor:
prefix = b'h' + tx_hash[:4] + idx_packed
candidates = {db_key: hashX for db_key, hashX
in self.db.utxo_db.iterator(prefix=prefix)}
for hdb_key, hashX in candidates.items():
tx_num_packed = hdb_key[-4:]
if len(candidates) > 1:
tx_num, = unpack('<I', tx_num_packed)
hash, height = self.db.fs_tx_hash(tx_num)
try:
hash, height = self.db.fs_tx_hash(tx_num)
except IndexError:
self.logger.error("data integrity error for hashx history: %s missing tx #%s (%s:%s)",
hashX.hex(), tx_num, hash_to_hex_str(tx_hash), tx_idx)
continue
if hash != tx_hash:
assert hash is not None # Should always be found
continue
@@ -604,12 +623,17 @@ class BlockProcessor:
# Value: the UTXO value as a 64-bit unsigned integer
udb_key = b'u' + hashX + hdb_key[-6:]
utxo_value_packed = self.db.utxo_db.get(udb_key)
if utxo_value_packed:
# Remove both entries for this UTXO
self.db_deletes.append(hdb_key)
self.db_deletes.append(udb_key)
return hashX + tx_num_packed + utxo_value_packed
if utxo_value_packed is None:
self.logger.warning(
"%s:%s is not found in UTXO db for %s", hash_to_hex_str(tx_hash), tx_idx, hash_to_hex_str(hashX)
)
raise ChainError(f"{hash_to_hex_str(tx_hash)}:{tx_idx} is not found in UTXO db for {hash_to_hex_str(hashX)}")
# Remove both entries for this UTXO
self.db_deletes.append(hdb_key)
self.db_deletes.append(udb_key)
return hashX + tx_num_packed + utxo_value_packed
self.logger.error('UTXO {hash_to_hex_str(tx_hash)} / {tx_idx} not found in "h" table')
raise ChainError('UTXO {} / {:,d} not found in "h" table'
.format(hash_to_hex_str(tx_hash), tx_idx))
@@ -622,7 +646,7 @@ class BlockProcessor:
self._caught_up_event.set()
await self.blocks_event.wait()
self.blocks_event.clear()
if self.reorg_count:
if self.reorg_count: # this could only happen by calling the reorg rpc
await self.reorg_chain(self.reorg_count)
self.reorg_count = 0
else:
@@ -661,9 +685,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()
@@ -674,6 +700,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)
@@ -693,7 +720,6 @@ class BlockProcessor:
class Timer:
def __init__(self, name):
self.name = name
self.total = 0
@@ -770,9 +796,9 @@ class LBRYBlockProcessor(BlockProcessor):
self.timer.run(self.sql.execute, self.sql.TAG_INDEXES, timer_name='executing TAG_INDEXES')
self.timer.run(self.sql.execute, self.sql.LANGUAGE_INDEXES, timer_name='executing LANGUAGE_INDEXES')
def advance_txs(self, height, txs, header):
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, timer_name='super().advance_txs')
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 (height % 10000 == 0 or not self.db.first_sync) and self.logger.isEnabledFor(10):
self.timer.show(height=height)
+7 -6
View File
@@ -3,11 +3,10 @@ import itertools
import json
import time
from functools import wraps
from pylru import lrucache
import aiohttp
from prometheus_client import Gauge, Histogram
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
@@ -55,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(10000)
self._block_hash_cache = LRUCacheWithMetrics(100000)
self._block_cache = LRUCacheWithMetrics(2 ** 16, metric_name='block', namespace=NAMESPACE)
async def close(self):
if self.connector:
@@ -250,8 +249,10 @@ class Daemon:
async def deserialised_block(self, hex_hash):
"""Return the deserialised block with the given hex hash."""
if not self._block_cache.get(hex_hash):
self._block_cache[hex_hash] = await self._send_single('getblock', (hex_hash, True))
if hex_hash not in self._block_cache:
block = await self._send_single('getblock', (hex_hash, True))
self._block_cache[hex_hash] = block
return block
return self._block_cache[hex_hash]
async def raw_blocks(self, hex_hashes):
+108 -7
View File
@@ -51,8 +51,8 @@ MOST_USED_TAGS = {
"tutorial",
"video game",
"weapons",
"pc",
"playthrough",
"pc",
"anime",
"how to",
"btc",
@@ -80,9 +80,9 @@ MOST_USED_TAGS = {
"español",
"money",
"music video",
"nintendo",
"movie",
"coronavirus",
"nintendo",
"donald trump",
"steam",
"trailer",
@@ -90,10 +90,10 @@ MOST_USED_TAGS = {
"podcast",
"xbox one",
"survival",
"audio",
"linux",
"travel",
"funny moments",
"audio",
"litecoin",
"animation",
"gamer",
@@ -101,20 +101,120 @@ MOST_USED_TAGS = {
"playstation",
"bitcoin news",
"history",
"fox news",
"xxx",
"god",
"fox news",
"dance",
"god",
"adventure",
"liberal",
"2020",
"horror",
"government",
"freedom",
"2020",
"reaction",
"meme",
"photography",
"truth"
"truth",
"health",
"lbry",
"family",
"online",
"eth",
"crypto news",
"diy",
"trading",
"gold",
"memes",
"world",
"space",
"lol",
"covid-19",
"rpg",
"humor",
"democrat",
"film",
"call of duty",
"tech",
"religion",
"conspiracy",
"rap",
"cnn",
"hangoutsonair",
"unboxing",
"fiction",
"conservative",
"cars",
"hoa",
"epic",
"programming",
"progressive",
"cryptocurrency news",
"classical",
"jesus",
"movies",
"book",
"ps3",
"republican",
"fitness",
"books",
"multiplayer",
"animals",
"pokemon",
"bitcoin price",
"facebook",
"sharefactory",
"criptomonedas",
"cod",
"bible",
"business",
"stream",
"comics",
"how",
"fail",
"nsfw",
"new music",
"satire",
"pets & animals",
"computer",
"classical music",
"indie",
"musica",
"msnbc",
"fps",
"mod",
"sport",
"sony",
"ripple",
"auto",
"rock",
"marvel",
"complete",
"mining",
"political",
"mobile",
"pubg",
"hip hop",
"flat earth",
"xbox 360",
"reviews",
"vlogging",
"latest news",
"hack",
"tarot",
"iphone",
"media",
"cute",
"christian",
"free speech",
"trap",
"war",
"remix",
"ios",
"xrp",
"spirituality",
"song",
"league of legends",
"cat"
}
MATURE_TAGS = [
@@ -131,6 +231,7 @@ COMMON_TAGS = {
}
INDEXED_LANGUAGES = [
'none',
'en',
'aa',
'ab',
+1 -1
View File
@@ -283,7 +283,7 @@ def claims_query(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
channel_ids = constraints.pop('channel_ids')
if channel_ids:
constraints['claim.channel_hash__in'] = {
unhexlify(cid)[::-1] for cid in channel_ids
unhexlify(cid)[::-1] for cid in channel_ids if cid
}
if 'not_channel_ids' in constraints:
not_channel_ids = constraints.pop('not_channel_ids')
+323 -269
View File
@@ -1,18 +1,17 @@
"""
Delayed AR with variable decay rate.
The spike height function is also simpler.
AR-like trending with a delayed effect and a faster
decay rate for high valued claims.
"""
import copy
import math
import time
import apsw
# Half life in blocks *for lower LBC claims* (it's shorter for whale claims)
HALF_LIFE = 200
# Whale threshold (higher -> less DB writing)
WHALE_THRESHOLD = 3.0
# Whale threshold, in LBC (higher -> less DB writing)
WHALE_THRESHOLD = 10000.0
# Decay coefficient per block
DECAY = 0.5**(1.0/HALF_LIFE)
@@ -38,6 +37,7 @@ def install(connection):
Install the trending algorithm.
"""
check_trending_values(connection)
trending_data.initialise(connection.cursor())
if TRENDING_LOG:
f = open("trending_variable_decay.log", "a")
@@ -46,7 +46,6 @@ def install(connection):
# Stub
CREATE_TREND_TABLE = ""
def check_trending_values(connection):
"""
If the trending values appear to be based on the zscore algorithm,
@@ -60,19 +59,304 @@ def check_trending_values(connection):
break
if needs_reset:
print("Resetting some columns. This might take a while...", flush=True, end="")
print("Resetting some columns. This might take a while...", flush=True,
end="")
c.execute(""" BEGIN;
UPDATE claim SET trending_group = 0;
UPDATE claim SET trending_mixed = 0;
UPDATE claim SET trending_global = 0;
UPDATE claim SET trending_local = 0;
COMMIT;""")
print("done.")
def spike_height(x, x_old):
def trending_log(s):
"""
Compute the size of a trending spike (normed - constant units).
Log a string to the log file
"""
if TRENDING_LOG:
fout = open("trending_variable_decay.log", "a")
fout.write(s)
fout.flush()
fout.close()
def trending_unit(height):
"""
Return the trending score unit at a given height.
"""
# Round to the beginning of a SAVE_INTERVAL batch of blocks.
_height = height - (height % SAVE_INTERVAL)
return 1.0/DECAY**(height % RENORM_INTERVAL)
class TrendingDB:
"""
An in-memory database of trending scores
"""
def __init__(self):
self.conn = apsw.Connection(":memory:")
self.cursor = self.conn.cursor()
self.initialised = False
self.write_needed = set()
def execute(self, query, *args, **kwargs):
return self.cursor.execute(query, *args, **kwargs)
def executemany(self, query, *args, **kwargs):
return self.cursor.executemany(query, *args, **kwargs)
def begin(self):
self.execute("BEGIN;")
def commit(self):
self.execute("COMMIT;")
def initialise(self, db):
"""
Pass in claims.db
"""
if self.initialised:
return
trending_log("Initialising trending database...")
# The need for speed
self.execute("PRAGMA JOURNAL_MODE=OFF;")
self.execute("PRAGMA SYNCHRONOUS=0;")
self.begin()
# Create the tables
self.execute("""
CREATE TABLE IF NOT EXISTS claims
(claim_hash BYTES PRIMARY KEY,
lbc REAL NOT NULL DEFAULT 0.0,
trending_score REAL NOT NULL DEFAULT 0.0)
WITHOUT ROWID;""")
self.execute("""
CREATE TABLE IF NOT EXISTS spikes
(id INTEGER PRIMARY KEY,
claim_hash BYTES NOT NULL,
height INTEGER NOT NULL,
mass REAL NOT NULL,
FOREIGN KEY (claim_hash)
REFERENCES claims (claim_hash));""")
# Clear out any existing data
self.execute("DELETE FROM claims;")
self.execute("DELETE FROM spikes;")
# Create indexes
self.execute("CREATE INDEX idx1 ON spikes (claim_hash, height, mass);")
self.execute("CREATE INDEX idx2 ON spikes (claim_hash, height, mass DESC);")
self.execute("CREATE INDEX idx3 on claims (lbc DESC, claim_hash, trending_score);")
# Import data from claims.db
for row in db.execute("""
SELECT claim_hash,
1E-8*(amount + support_amount) AS lbc,
trending_mixed
FROM claim;
"""):
self.execute("INSERT INTO claims VALUES (?, ?, ?);", row)
self.commit()
self.initialised = True
trending_log("done.\n")
def apply_spikes(self, height):
"""
Apply spikes that are due. This occurs inside a transaction.
"""
spikes = []
unit = trending_unit(height)
for row in self.execute("""
SELECT SUM(mass), claim_hash FROM spikes
WHERE height = ?
GROUP BY claim_hash;
""", (height, )):
spikes.append((row[0]*unit, row[1]))
self.write_needed.add(row[1])
self.executemany("""
UPDATE claims
SET trending_score = (trending_score + ?)
WHERE claim_hash = ?;
""", spikes)
self.execute("DELETE FROM spikes WHERE height = ?;", (height, ))
def decay_whales(self, height):
"""
Occurs inside transaction.
"""
if height % SAVE_INTERVAL != 0:
return
whales = self.execute("""
SELECT trending_score, lbc, claim_hash
FROM claims
WHERE lbc >= ?;
""", (WHALE_THRESHOLD, )).fetchall()
whales2 = []
for whale in whales:
trending, lbc, claim_hash = whale
# Overall multiplication factor for decay rate
# At WHALE_THRESHOLD, this is 1
# At 10*WHALE_THRESHOLD, it is 3
decay_rate_factor = 1.0 + 2.0*math.log10(lbc/WHALE_THRESHOLD)
# The -1 is because this is just the *extra* part being applied
factor = (DECAY**SAVE_INTERVAL)**(decay_rate_factor - 1.0)
# Decay
trending *= factor
whales2.append((trending, claim_hash))
self.write_needed.add(claim_hash)
self.executemany("UPDATE claims SET trending_score=? WHERE claim_hash=?;",
whales2)
def renorm(self, height):
"""
Renormalise trending scores. Occurs inside a transaction.
"""
if height % RENORM_INTERVAL == 0:
threshold = 1.0E-3/DECAY_PER_RENORM
for row in self.execute("""SELECT claim_hash FROM claims
WHERE ABS(trending_score) >= ?;""",
(threshold, )):
self.write_needed.add(row[0])
self.execute("""UPDATE claims SET trending_score = ?*trending_score
WHERE ABS(trending_score) >= ?;""",
(DECAY_PER_RENORM, threshold))
def write_to_claims_db(self, db, height):
"""
Write changed trending scores to claims.db.
"""
if height % SAVE_INTERVAL != 0:
return
rows = self.execute(f"""
SELECT trending_score, claim_hash
FROM claims
WHERE claim_hash IN
({','.join('?' for _ in self.write_needed)});
""", self.write_needed).fetchall()
db.executemany("""UPDATE claim SET trending_mixed = ?
WHERE claim_hash = ?;""", rows)
# Clear list of claims needing to be written to claims.db
self.write_needed = set()
def update(self, db, height, recalculate_claim_hashes):
"""
Update trending scores.
Input is a cursor to claims.db, the block height, and the list of
claims that changed.
"""
assert self.initialised
self.begin()
self.renorm(height)
# Fetch changed/new claims from claims.db
for row in db.execute(f"""
SELECT claim_hash,
1E-8*(amount + support_amount) AS lbc
FROM claim
WHERE claim_hash IN
({','.join('?' for _ in recalculate_claim_hashes)});
""", recalculate_claim_hashes):
claim_hash, lbc = row
# Insert into trending db if it does not exist
self.execute("""
INSERT INTO claims (claim_hash)
VALUES (?)
ON CONFLICT (claim_hash) DO NOTHING;""",
(claim_hash, ))
# See if it was an LBC change
old = self.execute("SELECT * FROM claims WHERE claim_hash=?;",
(claim_hash, )).fetchone()
lbc_old = old[1]
# Save new LBC value into trending db
self.execute("UPDATE claims SET lbc = ? WHERE claim_hash = ?;",
(lbc, claim_hash))
if lbc > lbc_old:
# Schedule a future spike
delay = min(int((lbc + 1E-8)**0.4), HALF_LIFE)
spike = (claim_hash, height + delay, spike_mass(lbc, lbc_old))
self.execute("""INSERT INTO spikes
(claim_hash, height, mass)
VALUES (?, ?, ?);""", spike)
elif lbc < lbc_old:
# Subtract from future spikes
penalty = spike_mass(lbc_old, lbc)
spikes = self.execute("""
SELECT * FROM spikes
WHERE claim_hash = ?
ORDER BY height ASC, mass DESC;
""", (claim_hash, )).fetchall()
for spike in spikes:
spike_id, mass = spike[0], spike[3]
if mass > penalty:
# The entire penalty merely reduces this spike
self.execute("UPDATE spikes SET mass=? WHERE id=?;",
(mass - penalty, spike_id))
penalty = 0.0
else:
# Removing this spike entirely accounts for some (or
# all) of the penalty, then move on to other spikes
self.execute("DELETE FROM spikes WHERE id=?;",
(spike_id, ))
penalty -= mass
# If penalty remains, that's a negative spike to be applied
# immediately.
if penalty > 0.0:
self.execute("""
INSERT INTO spikes (claim_hash, height, mass)
VALUES (?, ?, ?);""",
(claim_hash, height, -penalty))
self.apply_spikes(height)
self.decay_whales(height)
self.commit()
self.write_to_claims_db(db, height)
# The "global" instance to work with
# pylint: disable=C0103
trending_data = TrendingDB()
def spike_mass(x, x_old):
"""
Compute the mass of a trending spike (normed - constant units).
x_old = old LBC value
x = new LBC value
"""
# Sign of trending spike
@@ -89,155 +373,16 @@ def spike_height(x, x_old):
return sign*mag
def run(db, height, final_height, recalculate_claim_hashes):
if height < final_height - 5*HALF_LIFE:
trending_log(f"Skipping trending calculations at block {height}.\n")
return
def get_time_boost(height):
"""
Return the time boost at a given height.
"""
return 1.0/DECAY**(height % RENORM_INTERVAL)
def trending_log(s):
"""
Log a string.
"""
if TRENDING_LOG:
fout = open("trending_variable_decay.log", "a")
fout.write(s)
fout.flush()
fout.close()
class TrendingData:
"""
An object of this class holds trending data
"""
def __init__(self):
# Dict from claim id to some trending info.
# Units are TIME VARIABLE in here
self.claims = {}
# Claims with >= WHALE_THRESHOLD LBC total amount
self.whales = set([])
# Have all claims been read from db yet?
self.initialised = False
# List of pending spikes.
# Units are CONSTANT in here
self.pending_spikes = []
def insert_claim_from_load(self, height, claim_hash, trending_score, total_amount):
assert not self.initialised
self.claims[claim_hash] = {"trending_score": trending_score,
"total_amount": total_amount,
"changed": False}
if trending_score >= WHALE_THRESHOLD*get_time_boost(height):
self.add_whale(claim_hash)
def add_whale(self, claim_hash):
self.whales.add(claim_hash)
def apply_spikes(self, height):
"""
Apply all pending spikes that are due at this height.
Apply with time boost ON.
"""
time_boost = get_time_boost(height)
for spike in self.pending_spikes:
if spike["height"] > height:
# Ignore
pass
if spike["height"] == height:
# Apply
self.claims[spike["claim_hash"]]["trending_score"] += time_boost*spike["size"]
self.claims[spike["claim_hash"]]["changed"] = True
if self.claims[spike["claim_hash"]]["trending_score"] >= WHALE_THRESHOLD*time_boost:
self.add_whale(spike["claim_hash"])
if spike["claim_hash"] in self.whales and \
self.claims[spike["claim_hash"]]["trending_score"] < WHALE_THRESHOLD*time_boost:
self.whales.remove(spike["claim_hash"])
# Keep only future spikes
self.pending_spikes = [s for s in self.pending_spikes \
if s["height"] > height]
def update_claim(self, height, claim_hash, total_amount):
"""
Update trending data for a claim, given its new total amount.
"""
assert self.initialised
# Extract existing total amount and trending score
# or use starting values if the claim is new
if claim_hash in self.claims:
old_state = copy.deepcopy(self.claims[claim_hash])
else:
old_state = {"trending_score": 0.0,
"total_amount": 0.0,
"changed": False}
# Calculate LBC change
change = total_amount - old_state["total_amount"]
# Modify data if there was an LBC change
if change != 0.0:
spike = spike_height(total_amount,
old_state["total_amount"])
delay = min(int((total_amount + 1E-8)**0.4), HALF_LIFE)
if change < 0.0:
# How big would the spike be for the inverse movement?
reverse_spike = spike_height(old_state["total_amount"], total_amount)
# Remove that much spike from future pending ones
for future_spike in self.pending_spikes:
if future_spike["claim_hash"] == claim_hash:
if reverse_spike >= future_spike["size"]:
reverse_spike -= future_spike["size"]
future_spike["size"] = 0.0
elif reverse_spike > 0.0:
future_spike["size"] -= reverse_spike
reverse_spike = 0.0
delay = 0
spike = -reverse_spike
self.pending_spikes.append({"height": height + delay,
"claim_hash": claim_hash,
"size": spike})
self.claims[claim_hash] = {"total_amount": total_amount,
"trending_score": old_state["trending_score"],
"changed": False}
def process_whales(self, height):
"""
Whale claims decay faster.
"""
if height % SAVE_INTERVAL != 0:
return
for claim_hash in self.whales:
trending_normed = self.claims[claim_hash]["trending_score"]/get_time_boost(height)
# Overall multiplication factor for decay rate
decay_rate_factor = trending_normed/WHALE_THRESHOLD
# The -1 is because this is just the *extra* part being applied
factor = (DECAY**SAVE_INTERVAL)**(decay_rate_factor - 1.0)
# print(claim_hash, trending_normed, decay_rate_factor)
self.claims[claim_hash]["trending_score"] *= factor
self.claims[claim_hash]["changed"] = True
start = time.time()
trending_log(f"Calculating variable_decay trending at block {height}.\n")
trending_data.update(db, height, recalculate_claim_hashes)
end = time.time()
trending_log(f"Trending operations took {end - start} seconds.\n\n")
def test_trending():
"""
@@ -260,12 +405,12 @@ def test_trending():
COMMIT;
""")
# Initialise trending data before anything happens with the claims
trending_data.initialise(db)
# Insert initial states of claims
everything = {"huge_whale": 0.01,
"huge_whale_botted": 0.01,
"medium_whale": 0.01,
"small_whale": 0.01,
"minnow": 0.01}
everything = {"huge_whale": 0.01, "medium_whale": 0.01, "small_whale": 0.01,
"huge_whale_botted": 0.01, "minnow": 0.01}
def to_list_of_tuples(stuff):
l = []
@@ -277,13 +422,17 @@ def test_trending():
INSERT INTO claim (claim_hash, amount) VALUES (?, 1E8*?);
""", to_list_of_tuples(everything))
# Process block zero
height = 0
run(db, height, height, everything.keys())
# Save trajectories for plotting
trajectories = {}
for key in trending_data.claims:
trajectories[key] = [trending_data.claims[key]["trending_score"]]
for row in trending_data.execute("""
SELECT claim_hash, trending_score
FROM claims;
"""):
trajectories[row[0]] = [row[1]/trending_unit(height)]
# Main loop
for height in range(1, 1000):
@@ -312,119 +461,24 @@ def test_trending():
# Call run()
run(db, height, height, everything.keys())
for key in trending_data.claims:
trajectories[key].append(trending_data.claims[key]["trending_score"]\
/get_time_boost(height))
# Append current trending scores to trajectories
for row in db.execute("""
SELECT claim_hash, trending_mixed
FROM claim;
"""):
trajectories[row[0]].append(row[1]/trending_unit(height))
dbc.close()
# pylint: disable=C0415
import matplotlib.pyplot as plt
for key in trending_data.claims:
for key in trajectories:
plt.plot(trajectories[key], label=key)
plt.legend()
plt.show()
# One global instance
# pylint: disable=C0103
trending_data = TrendingData()
def run(db, height, final_height, recalculate_claim_hashes):
if height < final_height - 5*HALF_LIFE:
trending_log("Skipping variable_decay trending at block {h}.\n".format(h=height))
return
start = time.time()
trending_log("Calculating variable_decay trending at block {h}.\n".format(h=height))
trending_log(" Length of trending data = {l}.\n"\
.format(l=len(trending_data.claims)))
# Renormalise trending scores and mark all as having changed
if height % RENORM_INTERVAL == 0:
trending_log(" Renormalising trending scores...")
keys = trending_data.claims.keys()
trending_data.whales = set([])
for key in keys:
if trending_data.claims[key]["trending_score"] != 0.0:
trending_data.claims[key]["trending_score"] *= DECAY_PER_RENORM
trending_data.claims[key]["changed"] = True
# Tiny becomes zero
if abs(trending_data.claims[key]["trending_score"]) < 1E-3:
trending_data.claims[key]["trending_score"] = 0.0
# Re-mark whales
if trending_data.claims[key]["trending_score"] >= WHALE_THRESHOLD*get_time_boost(height):
trending_data.add_whale(key)
trending_log("done.\n")
# Regular message.
trending_log(" Reading total_amounts from db and updating"\
+ " trending scores in RAM...")
# Update claims from db
if not trending_data.initialised:
trending_log("initial load...")
# On fresh launch
for row in db.execute("""
SELECT claim_hash, trending_mixed,
(amount + support_amount)
AS total_amount
FROM claim;
"""):
trending_data.insert_claim_from_load(height, row[0], row[1], 1E-8*row[2])
trending_data.initialised = True
else:
for row in db.execute(f"""
SELECT claim_hash,
(amount + support_amount)
AS total_amount
FROM claim
WHERE claim_hash IN
({','.join('?' for _ in recalculate_claim_hashes)});
""", recalculate_claim_hashes):
trending_data.update_claim(height, row[0], 1E-8*row[1])
# Apply pending spikes
trending_data.apply_spikes(height)
trending_log("done.\n")
# Write trending scores to DB
if height % SAVE_INTERVAL == 0:
trending_log(" Finding and processing whales...")
trending_log(str(len(trending_data.whales)) + " whales found...")
trending_data.process_whales(height)
trending_log("done.\n")
trending_log(" Writing trending scores to db...")
the_list = []
keys = trending_data.claims.keys()
for key in keys:
if trending_data.claims[key]["changed"]:
the_list.append((trending_data.claims[key]["trending_score"], key))
trending_data.claims[key]["changed"] = False
trending_log("{n} scores to write...".format(n=len(the_list)))
db.executemany("UPDATE claim SET trending_mixed=? WHERE claim_hash=?;",
the_list)
trending_log("done.\n")
trending_log("Trending operations took {time} seconds.\n\n"\
.format(time=time.time() - start))
if __name__ == "__main__":
+2 -3
View File
@@ -330,7 +330,7 @@ class SQLDB:
#self.logger.exception(f"Could not decode claim name for {tx.id}:{txo.position}.")
continue
language = None
language = 'none'
try:
if txo.claim.is_stream and txo.claim.stream.languages:
language = txo.claim.stream.languages[0].language
@@ -394,8 +394,7 @@ class SQLDB:
elif claim.is_channel:
claim_record['claim_type'] = CLAIM_TYPES['channel']
if language:
languages[(language, claim_hash)] = (language, claim_hash, tx.height)
languages[(language, claim_hash)] = (language, claim_hash, tx.height)
for tag in clean_tags(claim.message.tags):
tags[(tag, claim_hash)] = (tag, claim_hash, tx.height)
+3 -1
View File
@@ -37,7 +37,9 @@ class Env:
self.obsolete(['UTXO_MB', 'HIST_MB', 'NETWORK'])
self.db_dir = self.required('DB_DIRECTORY')
self.db_engine = self.default('DB_ENGINE', 'leveldb')
self.trending_algorithms = list(set(self.default('TRENDING_ALGORITHMS', 'zscore').split(' ')))
self.trending_algorithms = [
trending for trending in set(self.default('TRENDING_ALGORITHMS', 'zscore').split(' ')) if trending
]
self.max_query_workers = self.integer('MAX_QUERY_WORKERS', None)
self.individual_tag_indexes = self.boolean('INDIVIDUAL_TAG_INDEXES', True)
self.track_metrics = self.boolean('TRACK_METRICS', False)
+4 -4
View File
@@ -67,17 +67,17 @@ def hash160(x):
return ripemd160(sha256(x))
def hash_to_hex_str(x):
def hash_to_hex_str(x: bytes) -> str:
"""Convert a big-endian binary hash to displayed hex string.
Display form of a binary hash is reversed and converted to hex.
"""
return bytes(reversed(x)).hex()
return x[::-1].hex()
def hex_str_to_hash(x):
def hex_str_to_hash(x: str) -> bytes:
"""Convert a displayed hex string to a binary hash."""
return bytes(reversed(hex_to_bytes(x)))
return hex_to_bytes(x)[::-1]
class Base58Error(Exception):
+14 -14
View File
@@ -173,20 +173,20 @@ class History:
self.logger.info(f'backing up removed {nremoves:,d} history entries')
def get_txnums(self, hashX, limit=1000):
"""Generator that returns an unpruned, sorted list of tx_nums in the
history of a hashX. Includes both spending and receiving
transactions. By default yields at most 1000 entries. Set
limit to None to get them all. """
limit = util.resolve_limit(limit)
for key, hist in self.db.iterator(prefix=hashX):
a = array.array('I')
a.frombytes(hist)
for tx_num in a:
if limit == 0:
return
yield tx_num
limit -= 1
# def get_txnums(self, hashX, limit=1000):
# """Generator that returns an unpruned, sorted list of tx_nums in the
# history of a hashX. Includes both spending and receiving
# transactions. By default yields at most 1000 entries. Set
# limit to None to get them all. """
# limit = util.resolve_limit(limit)
# for key, hist in self.db.iterator(prefix=hashX):
# a = array.array('I')
# a.frombytes(hist)
# for tx_num in a:
# if limit == 0:
# return
# yield tx_num
# limit -= 1
#
# History compaction
+171 -89
View File
@@ -14,15 +14,17 @@ import array
import ast
import os
import time
import zlib
import typing
from typing import Optional, List, Tuple, Iterable
from asyncio import sleep
from bisect import bisect_right
from collections import namedtuple
from functools import partial
from glob import glob
from struct import pack, unpack
from concurrent.futures.thread import ThreadPoolExecutor
import attr
from lbry.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
@@ -35,6 +37,10 @@ UTXO = namedtuple("UTXO", "tx_num tx_pos tx_hash height value")
HEADER_PREFIX = b'H'
TX_COUNT_PREFIX = b'T'
TX_HASH_PREFIX = b'X'
TX_PREFIX = b'B'
TX_NUM_PREFIX = b'N'
BLOCK_HASH_PREFIX = b'C'
@attr.s(slots=True)
@@ -42,7 +48,8 @@ class FlushData:
height = attr.ib()
tx_count = attr.ib()
headers = attr.ib()
block_tx_hashes = attr.ib()
block_hashes = attr.ib()
block_txs = attr.ib()
# The following are flushed to the UTXO DB if undo_infos is not None
undo_infos = attr.ib()
adds = attr.ib()
@@ -74,6 +81,7 @@ class LevelDB:
self.history = History()
self.utxo_db = None
self.tx_counts = None
self.headers = None
self.last_flush = time.time()
self.logger.info(f'using {self.env.db_engine} for DB backend')
@@ -82,9 +90,11 @@ class LevelDB:
self.merkle = Merkle()
self.header_mc = MerkleCache(self.merkle, self.fs_block_hashes)
self.hashes_db = None
self.headers_db = None
self.tx_count_db = None
self.tx_db = None
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):
if self.tx_counts is not None:
@@ -95,7 +105,7 @@ class LevelDB:
def get_counts():
return tuple(
util.unpack_be_uint64(tx_count)
for tx_count in self.tx_count_db.iterator(prefix=TX_COUNT_PREFIX, include_key=False)
for tx_count in self.tx_db.iterator(prefix=TX_COUNT_PREFIX, include_key=False)
)
tx_counts = await asyncio.get_event_loop().run_in_executor(self.executor, get_counts)
@@ -108,9 +118,34 @@ class LevelDB:
else:
assert self.db_tx_count == 0
async def _read_txids(self):
def get_txids():
return list(self.tx_db.iterator(prefix=TX_HASH_PREFIX, include_key=False))
start = time.perf_counter()
self.logger.info("loading txids")
txids = await asyncio.get_event_loop().run_in_executor(self.executor, get_txids)
assert len(txids) == len(self.tx_counts) == 0 or len(txids) == self.tx_counts[-1]
self.total_transactions = txids
ts = time.perf_counter() - start
self.logger.info("loaded %i txids in %ss", len(self.total_transactions), round(ts, 4))
async def _read_headers(self):
if self.headers is not None:
return
def get_headers():
return [
header for header in 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}"
self.headers = headers
async def _open_dbs(self, for_sync, compacting):
if self.executor is None:
self.executor = ThreadPoolExecutor(max(1, os.cpu_count() - 1))
self.executor = ThreadPoolExecutor(1)
coin_path = os.path.join(self.env.db_dir, 'COIN')
if not os.path.isfile(coin_path):
with util.open_file(coin_path, create=True) as f:
@@ -123,17 +158,11 @@ class LevelDB:
self.logger.info('created new headers db')
self.logger.info(f'opened headers DB (for sync: {for_sync})')
assert self.tx_count_db is None
self.tx_count_db = self.db_class('tx_count', for_sync)
if self.tx_count_db.is_new:
self.logger.info('created new tx count db')
self.logger.info(f'opened tx count DB (for sync: {for_sync})')
assert self.hashes_db is None
self.hashes_db = self.db_class('hashes', for_sync)
if self.hashes_db.is_new:
self.logger.info('created new tx hashes db')
self.logger.info(f'opened tx hashes DB (for sync: {for_sync})')
assert self.tx_db is None
self.tx_db = self.db_class('tx', for_sync)
if self.tx_db.is_new:
self.logger.info('created new tx db')
self.logger.info(f'opened tx DB (for sync: {for_sync})')
assert self.utxo_db is None
# First UTXO DB
@@ -151,13 +180,15 @@ class LevelDB:
# Read TX counts (requires meta directory)
await self._read_tx_counts()
if self.total_transactions is None:
await self._read_txids()
await self._read_headers()
def close(self):
self.utxo_db.close()
self.history.close_db()
self.headers_db.close()
self.tx_count_db.close()
self.hashes_db.close()
self.tx_db.close()
self.executor.shutdown(wait=True)
self.executor = None
@@ -187,12 +218,9 @@ class LevelDB:
if self.headers_db:
self.headers_db.close()
self.headers_db = None
if self.tx_count_db:
self.tx_count_db.close()
self.tx_count_db = None
if self.hashes_db:
self.hashes_db.close()
self.hashes_db = None
if self.tx_db:
self.tx_db.close()
self.tx_db = None
await self._open_dbs(False, False)
self.logger.info("opened for serving")
@@ -217,7 +245,7 @@ class LevelDB:
assert flush_data.height == self.fs_height == self.db_height
assert flush_data.tip == self.db_tip
assert not flush_data.headers
assert not flush_data.block_tx_hashes
assert not flush_data.block_txs
assert not flush_data.adds
assert not flush_data.deletes
assert not flush_data.undo_infos
@@ -275,33 +303,48 @@ class LevelDB:
"""
prior_tx_count = (self.tx_counts[self.fs_height]
if self.fs_height >= 0 else 0)
assert len(flush_data.block_tx_hashes) == len(flush_data.headers)
assert len(flush_data.block_txs) == len(flush_data.headers)
assert flush_data.height == self.fs_height + len(flush_data.headers)
assert flush_data.tx_count == (self.tx_counts[-1] if self.tx_counts
else 0)
assert len(self.tx_counts) == flush_data.height + 1
assert len(b''.join(flush_data.block_tx_hashes)) // 32 == flush_data.tx_count - prior_tx_count
assert len(
b''.join(hashes for hashes, _ in flush_data.block_txs)
) // 32 == flush_data.tx_count - prior_tx_count
# Write the headers, tx counts, and tx hashes
# Write the headers
start_time = time.perf_counter()
with self.headers_db.write_batch() as batch:
batch_put = batch.put
for i, header in enumerate(flush_data.headers):
batch_put(HEADER_PREFIX + util.pack_be_uint64(self.fs_height + i + 1), header)
self.headers.append(header)
flush_data.headers.clear()
height_start = self.fs_height + 1
tx_num = prior_tx_count
for header, tx_hashes in zip(flush_data.headers, flush_data.block_tx_hashes):
tx_count = self.tx_counts[height_start]
self.headers_db.put(HEADER_PREFIX + util.pack_be_uint64(height_start), header)
self.tx_count_db.put(TX_COUNT_PREFIX + util.pack_be_uint64(height_start), util.pack_be_uint64(tx_count))
height_start += 1
offset = 0
while offset < len(tx_hashes):
self.hashes_db.put(TX_HASH_PREFIX + util.pack_be_uint64(tx_num), tx_hashes[offset:offset+32])
tx_num += 1
offset += 32
with self.tx_db.write_batch() as batch:
batch_put = batch.put
for block_hash, (tx_hashes, txs) in zip(flush_data.block_hashes, flush_data.block_txs):
tx_count = self.tx_counts[height_start]
batch_put(BLOCK_HASH_PREFIX + util.pack_be_uint64(height_start), block_hash[::-1])
batch_put(TX_COUNT_PREFIX + util.pack_be_uint64(height_start), util.pack_be_uint64(tx_count))
height_start += 1
offset = 0
while offset < len(tx_hashes):
batch_put(TX_HASH_PREFIX + util.pack_be_uint64(tx_num), tx_hashes[offset:offset+32])
batch_put(TX_NUM_PREFIX + tx_hashes[offset:offset+32], util.pack_be_uint64(tx_num))
batch_put(TX_PREFIX + tx_hashes[offset:offset+32], txs[offset // 32])
tx_num += 1
offset += 32
flush_data.block_txs.clear()
flush_data.block_hashes.clear()
flush_data.block_tx_hashes.clear()
self.fs_height = flush_data.height
self.fs_tx_count = flush_data.tx_count
flush_data.headers.clear()
elapsed = time.perf_counter() - start_time
self.logger.info(f'flushed filesystem data in {elapsed:.2f}s')
@@ -362,7 +405,7 @@ class LevelDB:
def flush_backup(self, flush_data, touched):
"""Like flush_dbs() but when backing up. All UTXOs are flushed."""
assert not flush_data.headers
assert not flush_data.block_tx_hashes
assert not flush_data.block_txs
assert flush_data.height < self.db_height
self.history.assert_flushed()
@@ -383,19 +426,21 @@ class LevelDB:
def backup_fs(self, height, tx_count):
"""Back up during a reorg. This just updates our pointers."""
self.fs_height = height
while self.fs_height > height:
self.fs_height -= 1
self.headers.pop()
self.fs_tx_count = tx_count
# Truncate header_mc: header count is 1 more than the height.
self.header_mc.truncate(height + 1)
async def raw_header(self, height):
def raw_header(self, height):
"""Return the binary header at the given height."""
header, n = await self.read_headers(height, 1)
header, n = self.read_headers(height, 1)
if n != 1:
raise IndexError(f'height {height:,d} out of range')
return header
async def read_headers(self, start_height, count):
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
would be zero if start_height is beyond self.db_height, for
@@ -404,24 +449,15 @@ class LevelDB:
Returns a (binary, n) pair where binary is the concatenated
binary headers, and n is the count of headers returned.
"""
if start_height < 0 or count < 0:
raise self.DBError(f'{count:,d} headers starting at '
f'{start_height:,d} not on disk')
def read_headers():
# Read some from disk
disk_count = max(0, min(count, self.db_height + 1 - start_height))
if disk_count:
return b''.join(
self.headers_db.iterator(
start=HEADER_PREFIX + util.pack_be_uint64(start_height),
stop=HEADER_PREFIX + util.pack_be_uint64(start_height + disk_count),
include_key=False
)
), disk_count
return b'', 0
return await asyncio.get_event_loop().run_in_executor(self.executor, read_headers)
disk_count = max(0, min(count, self.db_height + 1 - start_height))
if disk_count:
return b''.join(self.headers[start_height:start_height + disk_count]), disk_count
return b'', 0
def fs_tx_hash(self, tx_num):
"""Return a par (tx_hash, tx_height) for the given tx number.
@@ -429,22 +465,60 @@ class LevelDB:
If the tx_height is not on disk, returns (None, tx_height)."""
tx_height = bisect_right(self.tx_counts, tx_num)
if tx_height > self.db_height:
tx_hash = None
else:
tx_hash = self.hashes_db.get(TX_HASH_PREFIX + util.pack_be_uint64(tx_num))
return tx_hash, tx_height
return None, tx_height
return self.total_transactions[tx_num], tx_height
def _fs_transactions(self, txids: Iterable[str]):
unpack_be_uint64 = util.unpack_be_uint64
tx_counts = self.tx_counts
tx_db_get = self.tx_db.get
tx_cache = self._tx_and_merkle_cache
tx_infos = {}
for tx_hash in txids:
cached_tx = tx_cache.get(tx_hash)
if cached_tx:
tx, merkle = cached_tx
else:
tx_hash_bytes = bytes.fromhex(tx_hash)[::-1]
tx_num = tx_db_get(TX_NUM_PREFIX + tx_hash_bytes)
tx = None
tx_height = -1
if tx_num is not None:
tx_num = unpack_be_uint64(tx_num)
tx_height = bisect_right(tx_counts, tx_num)
if tx_height < self.db_height:
tx = tx_db_get(TX_PREFIX + tx_hash_bytes)
if tx_height == -1:
merkle = {
'block_height': -1
}
else:
tx_pos = tx_num - tx_counts[tx_height - 1]
branch, root = self.merkle.branch_and_root(
self.total_transactions[tx_counts[tx_height - 1]:tx_counts[tx_height]], tx_pos
)
merkle = {
'block_height': tx_height,
'merkle': [
hash_to_hex_str(hash)
for hash in branch
],
'pos': tx_pos
}
if tx_height + 10 < self.db_height:
tx_cache[tx_hash] = tx, merkle
tx_infos[tx_hash] = (None if not tx else tx.hex(), merkle)
return tx_infos
async def fs_transactions(self, txids):
return await asyncio.get_event_loop().run_in_executor(self.executor, self._fs_transactions, txids)
async def fs_block_hashes(self, height, count):
headers_concat, headers_count = await self.read_headers(height, count)
if headers_count != count:
raise self.DBError(f'only got {headers_count:,d} headers starting at {height:,d}, not {count:,d}')
offset = 0
headers = []
for n in range(count):
headers.append(headers_concat[offset:offset + self.coin.BASIC_HEADER_SIZE])
offset += self.coin.BASIC_HEADER_SIZE
return [self.coin.header_hash(header) for header in headers]
if height + count > len(self.headers):
raise self.DBError(f'only got {len(self.headers) - height:,d} headers starting at {height:,d}, not {count:,d}')
return [self.coin.header_hash(header) for header in self.headers[height:height + count]]
async def limited_history(self, hashX, *, limit=1000):
"""Return an unpruned, sorted list of (tx_hash, height) tuples of
@@ -453,26 +527,33 @@ class LevelDB:
transactions. By default returns at most 1000 entries. Set
limit to None to get them all.
"""
def read_history():
hashx_history = []
for key, hist in self.history.db.iterator(prefix=hashX):
db_height = self.db_height
tx_counts = self.tx_counts
cnt = 0
txs = []
for hist in self.history.db.iterator(prefix=hashX, include_key=False):
a = array.array('I')
a.frombytes(hist)
for tx_num in a:
tx_height = bisect_right(self.tx_counts, tx_num)
if tx_height > self.db_height:
tx_hash = None
else:
tx_hash = self.hashes_db.get(TX_HASH_PREFIX + util.pack_be_uint64(tx_num))
hashx_history.append((tx_hash, tx_height))
if limit and len(hashx_history) >= limit:
return hashx_history
return hashx_history
tx_height = bisect_right(tx_counts, tx_num)
if tx_height > db_height:
return
txs.append((tx_num, tx_height))
cnt += 1
if limit and cnt >= limit:
break
if limit and cnt >= limit:
break
return txs
while True:
history = await asyncio.get_event_loop().run_in_executor(self.executor, read_history)
if all(hash is not None for hash, height in history):
return history
if history is not None:
return [(self.total_transactions[tx_num], tx_height) for (tx_num, tx_height) in history]
self.logger.warning(f'limited_history: tx hash '
f'not found (reorg?), retrying...')
await sleep(0.25)
@@ -629,13 +710,14 @@ class LevelDB:
utxos = []
utxos_append = utxos.append
s_unpack = unpack
fs_tx_hash = self.fs_tx_hash
# Key: b'u' + address_hashX + tx_idx + tx_num
# Value: the UTXO value as a 64-bit unsigned integer
prefix = b'u' + hashX
for db_key, db_value in self.utxo_db.iterator(prefix=prefix):
tx_pos, tx_num = s_unpack('<HI', db_key[-6:])
value, = unpack('<Q', db_value)
tx_hash, height = self.fs_tx_hash(tx_num)
tx_hash, height = fs_tx_hash(tx_num)
utxos_append(UTXO(tx_num, tx_pos, tx_hash, height, value))
return utxos
+38 -43
View File
@@ -6,13 +6,11 @@
# and warranty status of this software.
"""Mempool handling."""
import os
import asyncio
import itertools
import time
from abc import ABC, abstractmethod
from collections import defaultdict
from concurrent.futures.thread import ThreadPoolExecutor
from prometheus_client import Histogram
import attr
@@ -74,7 +72,7 @@ class MemPoolAPI(ABC):
"""
@abstractmethod
async def on_mempool(self, touched, height):
async def on_mempool(self, touched, new_touched, height):
"""Called each time the mempool is synchronized. touched is a set of
hashXs touched since the previous call. height is the
daemon's height at the time the mempool was obtained."""
@@ -117,8 +115,8 @@ class MemPool:
# Prevents mempool refreshes during fee histogram calculation
self.lock = asyncio.Lock()
self.wakeup = asyncio.Event()
self.executor = ThreadPoolExecutor(max(os.cpu_count() - 1, 1))
self.mempool_process_time_metric = mempool_process_time_metric
self.notified_mempool_txs = set()
async def _logging(self, synchronized_event):
"""Print regular logs of mempool stats."""
@@ -135,15 +133,11 @@ class MemPool:
await synchronized_event.wait()
async def _refresh_histogram(self, synchronized_event):
try:
while True:
await synchronized_event.wait()
async with self.lock:
# Threaded as can be expensive
await asyncio.get_event_loop().run_in_executor(self.executor, self._update_histogram, 100_000)
await asyncio.sleep(self.coin.MEMPOOL_HISTOGRAM_REFRESH_SECS)
finally:
self.executor.shutdown(wait=True)
while True:
await synchronized_event.wait()
async with self.lock:
self._update_histogram(100_000)
await asyncio.sleep(self.coin.MEMPOOL_HISTOGRAM_REFRESH_SECS)
def _update_histogram(self, bin_size):
# Build a histogram by fee rate
@@ -226,10 +220,15 @@ class MemPool:
continue
hashes = {hex_str_to_hash(hh) for hh in hex_hashes}
async with self.lock:
new_hashes = hashes.difference(self.notified_mempool_txs)
touched = await self._process_mempool(hashes)
self.notified_mempool_txs.update(new_hashes)
new_touched = {
touched_hashx for touched_hashx, txs in self.hashXs.items() if txs.intersection(new_hashes)
}
synchronized_event.set()
synchronized_event.clear()
await self.api.on_mempool(touched, height)
await self.api.on_mempool(touched, new_touched, height)
duration = time.perf_counter() - start
self.mempool_process_time_metric.observe(duration)
try:
@@ -243,7 +242,8 @@ class MemPool:
async def _process_mempool(self, all_hashes):
# Re-sync with the new set of hashes
txs = self.txs
hashXs = self.hashXs
hashXs = self.hashXs # hashX: [tx_hash, ...]
touched = set()
# First handle txs that have disappeared
@@ -274,8 +274,8 @@ class MemPool:
# FIXME: this is not particularly efficient
while tx_map and len(tx_map) != prior_count:
prior_count = len(tx_map)
tx_map, utxo_map = self._accept_transactions(tx_map, utxo_map,
touched)
tx_map, utxo_map = self._accept_transactions(tx_map, utxo_map, touched)
if tx_map:
self.logger.info(f'{len(tx_map)} txs dropped')
@@ -286,30 +286,25 @@ class MemPool:
hex_hashes_iter = (hash_to_hex_str(hash) for hash in hashes)
raw_txs = await self.api.raw_transactions(hex_hashes_iter)
def deserialize_txs(): # This function is pure
to_hashX = self.coin.hashX_from_script
deserializer = self.coin.DESERIALIZER
to_hashX = self.coin.hashX_from_script
deserializer = self.coin.DESERIALIZER
txs = {}
for hash, raw_tx in zip(hashes, raw_txs):
# The daemon may have evicted the tx from its
# mempool or it may have gotten in a block
if not raw_tx:
continue
tx, tx_size = deserializer(raw_tx).read_tx_and_vsize()
# Convert the inputs and outputs into (hashX, value) pairs
# Drop generation-like inputs from MemPoolTx.prevouts
txin_pairs = tuple((txin.prev_hash, txin.prev_idx)
for txin in tx.inputs
if not txin.is_generation())
txout_pairs = tuple((to_hashX(txout.pk_script), txout.value)
for txout in tx.outputs)
txs[hash] = MemPoolTx(txin_pairs, None, txout_pairs,
0, tx_size)
return txs
# Thread this potentially slow operation so as not to block
tx_map = await asyncio.get_event_loop().run_in_executor(self.executor, deserialize_txs)
tx_map = {}
for hash, raw_tx in zip(hashes, raw_txs):
# The daemon may have evicted the tx from its
# mempool or it may have gotten in a block
if not raw_tx:
continue
tx, tx_size = deserializer(raw_tx).read_tx_and_vsize()
# Convert the inputs and outputs into (hashX, value) pairs
# Drop generation-like inputs from MemPoolTx.prevouts
txin_pairs = tuple((txin.prev_hash, txin.prev_idx)
for txin in tx.inputs
if not txin.is_generation())
txout_pairs = tuple((to_hashX(txout.pk_script), txout.value)
for txout in tx.outputs)
tx_map[hash] = MemPoolTx(txin_pairs, None, txout_pairs,
0, tx_size)
# Determine all prevouts not in the mempool, and fetch the
# UTXO information from the database. Failed prevout lookups
@@ -332,7 +327,7 @@ class MemPool:
"""Keep the mempool synchronized with the daemon."""
await asyncio.wait([
self._refresh_hashes(synchronized_event),
self._refresh_histogram(synchronized_event),
# self._refresh_histogram(synchronized_event),
self._logging(synchronized_event)
])
@@ -349,7 +344,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
@@ -366,7 +361,7 @@ class MemPool:
result.update(tx.prevouts)
return result
async def transaction_summaries(self, hashX):
def transaction_summaries(self, hashX):
"""Return a list of MemPoolTxSummary objects for the hashX."""
result = []
for tx_hash in self.hashXs.get(hashX, ()):
+1 -1
View File
@@ -63,7 +63,7 @@ class Merkle:
raise TypeError('index must be an integer')
# This also asserts hashes is not empty
if not 0 <= index < len(hashes):
raise ValueError('index out of range')
raise ValueError(f"index '{index}/{len(hashes)}' out of range")
natural_length = self.branch_length(len(hashes))
if length is None:
length = natural_length
+1 -1
View File
@@ -319,7 +319,7 @@ class PeerManager:
# Check prior header too in case of hard fork.
check_height = min(our_height, their_height)
raw_header = await self.db.raw_header(check_height)
raw_header = self.db.raw_header(check_height)
if ptuple >= (1, 4):
ours = raw_header.hex()
message = 'blockchain.block.header'
+15 -8
View File
@@ -25,9 +25,10 @@ class Notifications:
def __init__(self):
self._touched_mp = {}
self._touched_bp = {}
self.notified_mempool_txs = set()
self._highest_block = -1
async def _maybe_notify(self):
async def _maybe_notify(self, new_touched):
tmp, tbp = self._touched_mp, self._touched_bp
common = set(tmp).intersection(tbp)
if common:
@@ -44,24 +45,24 @@ class Notifications:
del tmp[old]
for old in [h for h in tbp if h <= height]:
touched.update(tbp.pop(old))
await self.notify(height, touched)
await self.notify(height, touched, new_touched)
async def notify(self, height, touched):
async def notify(self, height, touched, new_touched):
pass
async def start(self, height, notify_func):
self._highest_block = height
self.notify = notify_func
await self.notify(height, set())
await self.notify(height, set(), set())
async def on_mempool(self, touched, height):
async def on_mempool(self, touched, new_touched, height):
self._touched_mp[height] = touched
await self._maybe_notify()
await self._maybe_notify(new_touched)
async def on_block(self, touched, height):
self._touched_bp[height] = touched
self._highest_block = height
await self._maybe_notify()
await self._maybe_notify(set())
class Server:
@@ -84,9 +85,12 @@ class Server:
notifications.mempool_hashes = daemon.mempool_hashes
notifications.raw_transactions = daemon.getrawtransactions
notifications.lookup_utxos = db.lookup_utxos
MemPoolAPI.register(Notifications)
self.mempool = mempool = MemPool(env.coin, notifications)
notifications.notified_mempool_txs = self.mempool.notified_mempool_txs
self.session_mgr = env.coin.SESSION_MANAGER(
env, db, bp, daemon, mempool, self.shutdown_event
)
@@ -106,11 +110,14 @@ class Server:
self.cancellable_tasks.append(asyncio.ensure_future(run(*args, _flag)))
return _flag.wait()
await self.start_prometheus()
await self.bp.status_server.start(0, bytes.fromhex(self.bp.coin.GENESIS_HASH)[::-1]
, self.env.host, self.env.tcp_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):
+150 -181
View File
@@ -4,7 +4,6 @@ import math
import time
import json
import zlib
import pylru
import base64
import codecs
import typing
@@ -17,12 +16,12 @@ from asyncio import Event, sleep
from collections import defaultdict
from functools import partial
from binascii import hexlify
from pylru import lrucache
from binascii import hexlify, unhexlify
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from prometheus_client import Counter, Info, Histogram, Gauge
import lbry
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
@@ -141,7 +140,11 @@ class SessionManager:
session_count_metric = Gauge("session_count", "Number of connected client sessions", namespace=NAMESPACE,
labelnames=("version",))
request_count_metric = Counter("requests_count", "Number of requests received", namespace=NAMESPACE,
labelnames=("method", "version"))
labelnames=("method", "version"))
tx_request_count_metric = Counter("requested_transaction", "Number of transactions requested", namespace=NAMESPACE)
tx_replied_count_metric = Counter("replied_transaction", "Number of transactions responded", namespace=NAMESPACE)
urls_to_resolve_count_metric = Counter("urls_to_resolve", "Number of urls to resolve", namespace=NAMESPACE)
resolved_url_count_metric = Counter("resolved_url", "Number of resolved urls", namespace=NAMESPACE)
interrupt_count_metric = Counter("interrupt", "Number of interrupted queries", namespace=NAMESPACE)
db_operational_error_metric = Counter(
@@ -186,7 +189,9 @@ class SessionManager:
self.shutdown_event = shutdown_event
self.logger = util.class_logger(__name__, self.__class__.__name__)
self.servers: typing.Dict[str, asyncio.AbstractServer] = {}
self.sessions: typing.Set['SessionBase'] = set()
self.sessions: typing.Dict[int, 'SessionBase'] = {}
self.hashx_subscriptions_by_session: typing.DefaultDict[str, typing.Set[int]] = defaultdict(set)
self.mempool_statuses = {}
self.cur_group = SessionGroup(0)
self.txs_sent = 0
self.start_time = time.time()
@@ -242,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}')
@@ -255,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
@@ -272,12 +279,12 @@ class SessionManager:
def _group_map(self):
group_map = defaultdict(list)
for session in self.sessions:
for session in self.sessions.values():
group_map[session.group].append(session)
return group_map
def _sub_count(self) -> int:
return sum(s.sub_count() for s in self.sessions)
return sum(s.sub_count() for s in self.sessions.values())
def _lookup_session(self, session_id):
try:
@@ -285,7 +292,7 @@ class SessionManager:
except Exception:
pass
else:
for session in self.sessions:
for session in self.sessions.values():
if session.session_id == session_id:
return session
return None
@@ -309,7 +316,7 @@ class SessionManager:
while True:
await sleep(session_timeout // 10)
stale_cutoff = time.perf_counter() - session_timeout
stale_sessions = [session for session in self.sessions
stale_sessions = [session for session in self.sessions.values()
if session.last_recv < stale_cutoff]
if stale_sessions:
text = ', '.join(str(session.session_id)
@@ -341,7 +348,7 @@ class SessionManager:
pending_requests = 0
closing = 0
for s in self.sessions:
for s in self.sessions.values():
error_count += s.errors
if s.log_me:
logged += 1
@@ -375,7 +382,7 @@ class SessionManager:
def _session_data(self, for_log):
"""Returned to the RPC 'sessions' call."""
now = time.time()
sessions = sorted(self.sessions, key=lambda s: s.start_time)
sessions = sorted(self.sessions.values(), key=lambda s: s.start_time)
return [(session.session_id,
session.flags(),
session.peer_address_str(for_log=for_log),
@@ -567,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([
@@ -577,9 +585,10 @@ 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
session.close(force_after=1) for session in self.sessions.values()
])
await self.stop_other()
@@ -603,7 +612,7 @@ class SessionManager:
async def raw_header(self, height):
"""Return the binary header at the given height."""
try:
return await self.db.raw_header(height)
return self.db.raw_header(height)
except IndexError:
raise RPCError(BAD_REQUEST, f'height {height:,d} '
'out of range') from None
@@ -629,18 +638,42 @@ class SessionManager:
self.history_cache[hashX] = await self.db.limited_history(hashX, limit=limit)
return self.history_cache[hashX]
async def _notify_sessions(self, height, touched):
async def _notify_sessions(self, height, touched, new_touched):
"""Notify sessions about height changes and touched addresses."""
height_changed = height != self.notified_height
if height_changed:
await self._refresh_hsub_results(height)
if self.sessions:
await asyncio.wait([
session.notify(touched, height_changed) for session in self.sessions
])
if not self.sessions:
return
if height_changed:
header_tasks = [
session.send_notification('blockchain.headers.subscribe', (self.hsub_results[session.subscribe_headers_raw], ))
for session in self.sessions.values() if session.subscribe_headers
]
if header_tasks:
self.logger.info(f'notify {len(header_tasks)} sessions of new header')
asyncio.create_task(asyncio.wait(header_tasks))
for hashX in touched.intersection(self.mempool_statuses.keys()):
self.mempool_statuses.pop(hashX, None)
touched.intersection_update(self.hashx_subscriptions_by_session.keys())
if touched or (height_changed and self.mempool_statuses):
notified_hashxs = 0
notified_sessions = 0
to_notify = touched if height_changed else new_touched
for hashX in to_notify:
for session_id in self.hashx_subscriptions_by_session[hashX]:
asyncio.create_task(self.sessions[session_id].send_history_notification(hashX))
notified_sessions += 1
notified_hashxs += 1
if notified_sessions:
self.logger.info(f'notified {notified_sessions} sessions/{notified_hashxs:,d} touched addresses')
def add_session(self, session):
self.sessions.add(session)
self.sessions[id(session)] = session
self.session_event.set()
gid = int(session.start_time - self.start_time) // 900
if self.cur_group.gid != gid:
@@ -649,7 +682,13 @@ class SessionManager:
def remove_session(self, session):
"""Remove a session from our sessions list if there."""
self.sessions.remove(session)
session_id = id(session)
for hashX in session.hashX_subs:
sessions = self.hashx_subscriptions_by_session[hashX]
sessions.remove(session_id)
if not sessions:
self.hashx_subscriptions_by_session.pop(hashX)
self.sessions.pop(session_id)
self.session_event.set()
@@ -684,8 +723,6 @@ class SessionBase(RPCSession):
self._receive_message_orig = self.connection.receive_message
self.connection.receive_message = self.receive_message
async def notify(self, touched, height_changed):
pass
def default_framer(self):
return NewlineFramer(self.env.max_receive)
@@ -777,8 +814,8 @@ class LBRYSessionManager(SessionManager):
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(10000)
self.search_cache['resolve'] = lrucache(10000)
self.search_cache['search'] = LRUCacheWithMetrics(2 ** 14, metric_name='search', namespace=NAMESPACE)
self.search_cache['resolve'] = LRUCacheWithMetrics(2 ** 16, metric_name='resolve', namespace=NAMESPACE)
async def process_metrics(self):
while self.running:
@@ -831,6 +868,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):
@@ -877,14 +915,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.mempool_statuses = {}
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
@@ -895,10 +934,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,
@@ -911,10 +950,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):
@@ -927,48 +966,22 @@ class LBRYElectrumX(SessionBase):
def sub_count(self):
return len(self.hashX_subs)
async def notify(self, touched, height_changed):
"""Notify the client about changes to touched addresses (from mempool
updates or new blocks) and height.
"""
if height_changed and self.subscribe_headers:
args = (await self.subscribe_headers_result(), )
if not (await self.send_notification('blockchain.headers.subscribe', args)):
return
async def send_history_notification(alias, hashX):
async def send_history_notification(self, hashX):
start = time.perf_counter()
alias = self.hashX_subs[hashX]
if len(alias) == 64:
method = 'blockchain.scripthash.subscribe'
else:
method = 'blockchain.address.subscribe'
try:
self.session_mgr.notifications_in_flight_metric.inc()
status = await self.address_status(hashX)
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
start = time.perf_counter()
if len(alias) == 64:
method = 'blockchain.scripthash.subscribe'
else:
method = 'blockchain.address.subscribe'
try:
self.session_mgr.notifications_in_flight_metric.inc()
status = await self.address_status(hashX)
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
start = time.perf_counter()
await self.send_notification(method, (alias, status))
self.session_mgr.notifications_sent_metric.observe(time.perf_counter() - start)
finally:
self.session_mgr.notifications_in_flight_metric.dec()
touched = touched.intersection(self.hashX_subs)
if touched or (height_changed and self.mempool_statuses):
notified = set()
mempool_addrs = tuple(self.mempool_statuses.keys())
for hashX in touched:
alias = self.hashX_subs[hashX]
asyncio.create_task(send_history_notification(alias, hashX))
notified.add(hashX)
for hashX in mempool_addrs:
if hashX not in notified:
alias = self.hashX_subs[hashX]
asyncio.create_task(send_history_notification(alias, hashX))
notified.add(hashX)
if touched:
es = '' if len(touched) == 1 else 'es'
self.logger.info(f'notified {len(notified)} mempool/{len(touched):,d} touched address{es}')
await self.send_notification(method, (alias, status))
self.session_mgr.notifications_sent_metric.observe(time.perf_counter() - start)
finally:
self.session_mgr.notifications_in_flight_metric.dec()
def get_metrics_or_placeholder_for_api(self, query_name):
""" Do not hold on to a reference to the metrics
@@ -1045,7 +1058,12 @@ class LBRYElectrumX(SessionBase):
async def claimtrie_resolve(self, *urls):
if urls:
return await self.run_and_cache_query('resolve', reader.resolve_to_bytes, 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)
finally:
self.session_mgr.resolved_url_count_metric.inc(count)
async def get_server_height(self):
return self.bp.height
@@ -1180,7 +1198,7 @@ class LBRYElectrumX(SessionBase):
# For mempool, height is -1 if it has unconfirmed inputs, otherwise 0
db_history = await self.session_mgr.limited_history(hashX)
mempool = await self.mempool.transaction_summaries(hashX)
mempool = self.mempool.transaction_summaries(hashX)
status = ''.join(f'{hash_to_hex_str(tx_hash)}:'
f'{height:d}:'
@@ -1194,9 +1212,9 @@ class LBRYElectrumX(SessionBase):
status = None
if mempool:
self.mempool_statuses[hashX] = status
self.session_mgr.mempool_statuses[hashX] = status
else:
self.mempool_statuses.pop(hashX, None)
self.session_mgr.mempool_statuses.pop(hashX, None)
return status
async def hashX_listunspent(self, hashX):
@@ -1215,13 +1233,14 @@ class LBRYElectrumX(SessionBase):
async def hashX_subscribe(self, hashX, alias):
self.hashX_subs[hashX] = alias
self.session_mgr.hashx_subscriptions_by_session[hashX].add(id(self))
return await self.address_status(hashX)
async def hashX_unsubscribe(self, hashX, alias):
try:
del self.hashX_subs[hashX]
except ValueError:
pass
sessions = self.session_mgr.hashx_subscriptions_by_session[hashX]
sessions.remove(id(self))
if not sessions:
self.hashX_subs.pop(hashX, None)
def address_to_hashX(self, address):
try:
@@ -1243,7 +1262,7 @@ class LBRYElectrumX(SessionBase):
async def address_get_mempool(self, address):
"""Return the mempool transactions touching an address."""
hashX = self.address_to_hashX(address)
return await self.unconfirmed_history(hashX)
return self.unconfirmed_history(hashX)
async def address_listunspent(self, address):
"""Return the list of UTXOs of an address."""
@@ -1259,7 +1278,7 @@ class LBRYElectrumX(SessionBase):
hashXes = [
(self.address_to_hashX(address), address) for address in addresses
]
return await asyncio.gather(*(self.hashX_subscribe(*args) for args in hashXes))
return [await self.hashX_subscribe(*args) for args in hashXes]
async def address_unsubscribe(self, address):
"""Unsubscribe an address.
@@ -1279,20 +1298,20 @@ class LBRYElectrumX(SessionBase):
hashX = scripthash_to_hashX(scripthash)
return await self.get_balance(hashX)
async def unconfirmed_history(self, hashX):
def unconfirmed_history(self, hashX):
# Note unconfirmed history is unordered in electrum-server
# height is -1 if it has unconfirmed inputs, otherwise 0
return [{'tx_hash': hash_to_hex_str(tx.hash),
'height': -tx.has_unconfirmed_inputs,
'fee': tx.fee}
for tx in await self.mempool.transaction_summaries(hashX)]
for tx in self.mempool.transaction_summaries(hashX)]
async def confirmed_and_unconfirmed_history(self, hashX):
# Note history is ordered but unconfirmed is unordered in e-s
history = await self.session_mgr.limited_history(hashX)
conf = [{'tx_hash': hash_to_hex_str(tx_hash), 'height': height}
for tx_hash, height in history]
return conf + await self.unconfirmed_history(hashX)
return conf + self.unconfirmed_history(hashX)
async def scripthash_get_history(self, scripthash):
"""Return the confirmed and unconfirmed history of a scripthash."""
@@ -1302,7 +1321,7 @@ class LBRYElectrumX(SessionBase):
async def scripthash_get_mempool(self, scripthash):
"""Return the mempool transactions touching a scripthash."""
hashX = scripthash_to_hashX(scripthash)
return await self.unconfirmed_history(hashX)
return self.unconfirmed_history(hashX)
async def scripthash_listunspent(self, scripthash):
"""Return the list of UTXOs of a scripthash."""
@@ -1323,31 +1342,12 @@ class LBRYElectrumX(SessionBase):
f'require header height {height:,d} <= '
f'cp_height {cp_height:,d} <= '
f'chain height {max_height:,d}')
branch, root = await self.db.header_branch_and_root(cp_height + 1,
height)
branch, root = await self.db.header_branch_and_root(cp_height + 1, height)
return {
'branch': [hash_to_hex_str(elt) for elt in branch],
'root': hash_to_hex_str(root),
}
async def block_header(self, height, cp_height=0):
"""Return a raw block header as a hexadecimal string, or as a
dictionary with a merkle proof."""
height = non_negative_integer(height)
cp_height = non_negative_integer(cp_height)
raw_header_hex = (await self.session_mgr.raw_header(height)).hex()
if cp_height == 0:
return raw_header_hex
result = {'header': raw_header_hex}
result.update(await self._merkle_proof(cp_height, height))
return result
async def block_header_13(self, height):
"""Return a raw block header as a hexadecimal string.
height: the header's height"""
return await self.block_header(height)
async def block_headers(self, start_height, count, cp_height=0, b64=False):
"""Return count concatenated block headers as hex for the main chain;
starting at start_height.
@@ -1361,9 +1361,13 @@ class LBRYElectrumX(SessionBase):
max_size = self.MAX_CHUNK_SIZE
count = min(count, max_size)
headers, count = await self.db.read_headers(start_height, count)
compressobj = zlib.compressobj(wbits=-15, level=1, memLevel=9)
headers = base64.b64encode(compressobj.compress(headers) + compressobj.flush()).decode() if b64 else headers.hex()
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()
else:
headers = headers.hex()
result = {
'base64' if b64 else 'hex': headers,
'count': count,
@@ -1381,7 +1385,7 @@ class LBRYElectrumX(SessionBase):
index = non_negative_integer(index)
size = self.coin.CHUNK_SIZE
start_height = index * size
headers, _ = await self.db.read_headers(start_height, size)
headers, _ = self.db.read_headers(start_height, size)
return headers.hex()
async def block_get_header(self, height):
@@ -1470,7 +1474,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
@@ -1480,8 +1485,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]
@@ -1490,19 +1494,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.
@@ -1523,27 +1524,23 @@ class LBRYElectrumX(SessionBase):
f'network rules.\n\n{message}\n[{raw_tx}]')
async def transaction_info(self, tx_hash: str):
assert_tx_hash(tx_hash)
tx_info = await self.daemon_request('getrawtransaction', tx_hash, True)
raw_tx = tx_info['hex']
block_hash = tx_info.get('blockhash')
if not block_hash:
return raw_tx, {'block_height': -1}
merkle_height = (await self.daemon.deserialised_block(block_hash))['height']
merkle = await self.transaction_merkle(tx_hash, merkle_height)
return raw_tx, merkle
return (await self.transaction_get_batch(tx_hash))[tx_hash]
async def transaction_get_batch(self, *tx_hashes):
self.session_mgr.tx_request_count_metric.inc(len(tx_hashes))
if len(tx_hashes) > 100:
raise RPCError(BAD_REQUEST, f'too many tx hashes in request: {len(tx_hashes)}')
for tx_hash in tx_hashes:
assert_tx_hash(tx_hash)
batch_result = {}
batch_result = await self.db.fs_transactions(tx_hashes)
needed_merkles = {}
for tx_hash in tx_hashes:
if tx_hash in batch_result and batch_result[tx_hash][0]:
continue
tx_info = await self.daemon_request('getrawtransaction', tx_hash, True)
raw_tx = tx_info['hex']
block_hash = tx_info.get('blockhash')
merkle = {}
if block_hash:
block = await self.daemon.deserialised_block(block_hash)
height = block['height']
@@ -1552,12 +1549,21 @@ class LBRYElectrumX(SessionBase):
except ValueError:
raise RPCError(BAD_REQUEST, f'tx hash {tx_hash} not in '
f'block {block_hash} at height {height:,d}')
merkle["merkle"] = self._get_merkle_branch(block['tx'], pos)
merkle["pos"] = pos
needed_merkles[tx_hash] = raw_tx, block['tx'], pos, height
else:
height = -1
merkle['block_height'] = height
batch_result[tx_hash] = [raw_tx, merkle]
batch_result[tx_hash] = [raw_tx, {'block_height': -1}]
def threaded_get_merkle():
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)
self.session_mgr.tx_replied_count_metric.inc(len(tx_hashes))
return batch_result
async def transaction_get(self, tx_hash, verbose=False):
@@ -1572,19 +1578,6 @@ class LBRYElectrumX(SessionBase):
return await self.daemon_request('getrawtransaction', tx_hash, verbose)
async def _block_hash_and_tx_hashes(self, height):
"""Returns a pair (block_hash, tx_hashes) for the main chain block at
the given height.
block_hash is a hexadecimal string, and tx_hashes is an
ordered list of hexadecimal strings.
"""
height = non_negative_integer(height)
hex_hashes = await self.daemon_request('block_hex_hashes', height, 1)
block_hash = hex_hashes[0]
block = await self.daemon.deserialised_block(block_hash)
return block_hash, block['tx']
def _get_merkle_branch(self, tx_hashes, tx_pos):
"""Return a merkle branch to a transaction.
@@ -1604,35 +1597,11 @@ class LBRYElectrumX(SessionBase):
height: the height of the block it is in
"""
assert_tx_hash(tx_hash)
block_hash, tx_hashes = await self._block_hash_and_tx_hashes(height)
try:
pos = tx_hashes.index(tx_hash)
except ValueError:
result = await self.transaction_get_batch(tx_hash)
if tx_hash not in result or result[tx_hash][1]['block_height'] <= 0:
raise RPCError(BAD_REQUEST, f'tx hash {tx_hash} not in '
f'block {block_hash} at height {height:,d}')
branch = self._get_merkle_branch(tx_hashes, pos)
return {"block_height": height, "merkle": branch, "pos": pos}
async def transaction_id_from_pos(self, height, tx_pos, merkle=False):
"""Return the txid and optionally a merkle proof, given
a block height and position in the block.
"""
tx_pos = non_negative_integer(tx_pos)
if merkle not in (True, False):
raise RPCError(BAD_REQUEST, f'"merkle" must be a boolean')
block_hash, tx_hashes = await self._block_hash_and_tx_hashes(height)
try:
tx_hash = tx_hashes[tx_pos]
except IndexError:
raise RPCError(BAD_REQUEST, f'no tx at position {tx_pos:,d} in '
f'block {block_hash} at height {height:,d}')
if merkle:
branch = self._get_merkle_branch(tx_hashes, tx_pos)
return {"tx_hash": tx_hash, "merkle": branch}
else:
return tx_hash
f'block at height {height:,d}')
return result[tx_hash][1]
class LocalRPC(SessionBase):
+4 -6
View File
@@ -77,18 +77,16 @@ class LevelDB(Storage):
import plyvel
cls.module = plyvel
def open(self, name, create):
mof = 512 if self.for_sync else 128
def open(self, name, create, lru_cache_size=None):
mof = 10000
path = os.path.join(self.db_dir, name)
# Use snappy compression (the default)
self.db = self.module.DB(path, create_if_missing=create,
max_open_files=mof)
self.db = self.module.DB(path, create_if_missing=create, max_open_files=mof)
self.close = self.db.close
self.get = self.db.get
self.put = self.db.put
self.iterator = self.db.iterator
self.write_batch = partial(self.db.write_batch, transaction=True,
sync=True)
self.write_batch = partial(self.db.write_batch, transaction=True, sync=True)
class RocksDB(Storage):
+192
View File
@@ -0,0 +1,192 @@
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._protocol:
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._protocol:
self._protocol.close()
self._protocol = None
def set_unavailable(self):
self._protocol.set_unavailable()
def set_available(self):
self._protocol.set_available()
def set_height(self, height: int, tip: bytes):
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()
+12 -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)
+8 -3
View File
@@ -145,14 +145,15 @@ class Wallet:
elif not self.is_locked:
log.warning(
"Disk encryption requested but no password available for encryption. "
"Saving wallet in an unencrypted state."
"Resetting encryption preferences and saving wallet in an unencrypted state."
)
self.preferences[ENCRYPT_ON_DISK] = False
return self.storage.write(self.to_dict())
@property
def hash(self) -> bytes:
h = sha256()
if self.preferences.get(ENCRYPT_ON_DISK, False):
if self.is_encrypted:
assert self.encryption_password is not None, \
"Encryption is enabled but no password is available, cannot generate hash."
h.update(self.encryption_password.encode())
@@ -219,7 +220,11 @@ class Wallet:
@property
def is_encrypted(self) -> bool:
return self.is_locked or self.preferences.get(ENCRYPT_ON_DISK, False)
# either its locked or it was unlocked using a password.
# if its set to encrypt on preferences but isnt encrypted and no password was given so far,
# then its not encrypted
return self.is_locked or (
self.preferences.get(ENCRYPT_ON_DISK, False) and self.encryption_password is not None)
def decrypt(self):
assert not self.is_locked, "Cannot decrypt a locked wallet, unlock first."
+1
View File
@@ -1,6 +1,7 @@
import curses
import time
import asyncio
import lbry.wallet
from lbry.conf import Config
from lbry.extras.daemon.client import daemon_rpc
+9 -2
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
@@ -25,7 +26,8 @@ RETURN_DOCS = {
'File': encode_file_doc(),
'Transaction': encode_tx_doc(),
'Output': encode_txo_doc(),
'Address': 'an address in base58'
'Address': 'an address in base58',
'Dict': 'glorious data in dictionary',
}
@@ -65,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):
@@ -336,7 +342,8 @@ class Examples(CommandTestCase):
'Use the parent_id param to make replies',
'comment', 'create',
'--comment="I have photographic evidence confirming Sasquatch exists"',
f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}'
f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}',
f'--claim_id={stream_id}'
)
await r(
+1 -1
View File
@@ -34,7 +34,7 @@ setup(
},
install_requires=[
'aiohttp==3.5.4',
'aioupnp==0.0.17',
'aioupnp==0.0.18',
'appdirs==1.4.3',
'certifi>=2018.11.29',
'colorama==0.3.7',
@@ -9,17 +9,32 @@ class BlockchainReorganizationTests(CommandTestCase):
VERBOSITY = logging.WARN
async def assertBlockHash(self, height):
self.assertEqual(
(await self.ledger.headers.hash(height)).decode(),
await self.blockchain.get_block_hash(height)
)
bp = self.conductor.spv_node.server.bp
def get_txids():
return [
bp.db.fs_tx_hash(tx_num)[0][::-1].hex()
for tx_num in range(bp.db.tx_counts[height - 1], bp.db.tx_counts[height])
]
block_hash = await self.blockchain.get_block_hash(height)
self.assertEqual(block_hash, (await self.ledger.headers.hash(height)).decode())
self.assertEqual(block_hash, (await bp.db.fs_block_hashes(height, 1))[0][::-1].hex())
txids = await asyncio.get_event_loop().run_in_executor(bp.db.executor, get_txids)
txs = await bp.db.fs_transactions(txids)
block_txs = (await bp.daemon.deserialised_block(block_hash))['tx']
self.assertSetEqual(set(block_txs), set(txs.keys()), msg='leveldb/lbrycrd is missing transactions')
self.assertListEqual(block_txs, list(txs.keys()), msg='leveldb/lbrycrd transactions are of order')
async def test_reorg(self):
bp = self.conductor.spv_node.server.bp
bp.reorg_count_metric.set(0)
# invalidate current block, move forward 2
self.assertEqual(self.ledger.headers.height, 206)
await self.assertBlockHash(206)
height = 206
self.assertEqual(self.ledger.headers.height, height)
await self.assertBlockHash(height)
await self.blockchain.invalidate_block((await self.ledger.headers.hash(206)).decode())
await self.blockchain.generate(2)
await self.ledger.on_header.where(lambda e: e.height == 207)
@@ -37,6 +52,11 @@ class BlockchainReorganizationTests(CommandTestCase):
await self.assertBlockHash(207)
await self.assertBlockHash(208)
self.assertEqual(2, bp.reorg_count_metric._samples()[0][2])
await self.blockchain.generate(3)
await self.ledger.on_header.where(lambda e: e.height == 211)
await self.assertBlockHash(209)
await self.assertBlockHash(210)
await self.assertBlockHash(211)
async def test_reorg_change_claim_height(self):
# sanity check
@@ -51,6 +71,8 @@ class BlockchainReorganizationTests(CommandTestCase):
# create a claim and verify it's returned by claim_search
self.assertEqual(self.ledger.headers.height, 207)
await self.assertBlockHash(207)
broadcast_tx = await self.daemon.jsonrpc_stream_create(
'hovercraft', '1.0', file_path=self.create_upload_file(data=b'hi!')
)
@@ -58,6 +80,8 @@ class BlockchainReorganizationTests(CommandTestCase):
await self.generate(1)
await self.ledger.wait(broadcast_tx, self.blockchain.block_expected)
self.assertEqual(self.ledger.headers.height, 208)
await self.assertBlockHash(208)
txos, _, _, _ = await self.ledger.claim_search([], name='hovercraft')
self.assertEqual(1, len(txos))
txo = txos[0]
@@ -75,17 +99,18 @@ class BlockchainReorganizationTests(CommandTestCase):
await self.blockchain.clear_mempool()
await self.blockchain.generate(2)
# wait for the client to catch up and verify the reorg
await asyncio.wait_for(self.on_header(209), 3.0)
await self.assertBlockHash(207)
await self.assertBlockHash(208)
await self.assertBlockHash(209)
# verify the claim was dropped from block 208 as returned by lbrycrdd
reorg_block_hash = await self.blockchain.get_block_hash(208)
self.assertNotEqual(invalidated_block_hash, reorg_block_hash)
block_207 = await self.blockchain.get_block(reorg_block_hash)
self.assertNotIn(txo.tx_ref.id, block_207['tx'])
# wait for the client to catch up and verify the reorg
await asyncio.wait_for(self.on_header(209), 3.0)
await self.assertBlockHash(207)
await self.assertBlockHash(208)
await self.assertBlockHash(209)
client_reorg_block_hash = (await self.ledger.headers.hash(208)).decode()
self.assertEqual(client_reorg_block_hash, reorg_block_hash)
@@ -6,6 +6,7 @@ from binascii import unhexlify
from urllib.request import urlopen
from lbry.error import InsufficientFundsError
from lbry.extras.daemon.comment_client import verify
from lbry.extras.daemon.daemon import DEFAULT_PAGE_SIZE
from lbry.testcase import CommandTestCase
@@ -89,7 +90,7 @@ class ClaimSearchCommand(ClaimTestCase):
# 23829 claim ids makes the request just large enough
claim_ids = [
'0000000000000000000000000000000000000000',
] * 23829
] * 33829
with self.assertRaises(ConnectionResetError):
await self.claim_search(claim_ids=claim_ids)
@@ -271,6 +272,8 @@ class ClaimSearchCommand(ClaimTestCase):
claim5 = await self.stream_create('claim5', fee_amount='1.0', fee_currency='usd', languages='es')
await self.assertFindsClaims([claim4, claim3], any_languages=['en'])
await self.assertFindsClaims([claim2, claim1], any_languages=['none'])
await self.assertFindsClaims([claim4, claim3, claim2, claim1], any_languages=['none', 'en'])
await self.assertFindsClaims([claim5], any_languages=['es'])
await self.assertFindsClaims([claim5, claim4, claim3], any_languages=['en', 'es'])
await self.assertFindsClaims([], fee_currency='foo')
@@ -458,6 +461,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)))
@@ -1002,6 +1046,18 @@ class ChannelCommands(CommandTestCase):
self.assertItemCount(await self.daemon.jsonrpc_channel_list(account_id=self.account.id), 2)
self.assertItemCount(await self.daemon.jsonrpc_channel_list(account_id=account2_id), 1)
async def test_sign_hex_encoded_data(self):
data_to_sign = "CAFEBABE"
# claim new name
await self.channel_create('@someotherchan')
channel_tx = await self.daemon.jsonrpc_channel_create('@signer', '0.1')
await self.confirm_tx(channel_tx.id)
channel = channel_tx.outputs[0]
signature1 = await self.out(self.daemon.jsonrpc_channel_sign(channel_name='@signer', hexdata=data_to_sign))
signature2 = await self.out(self.daemon.jsonrpc_channel_sign(channel_id=channel.claim_id, hexdata=data_to_sign))
self.assertTrue(verify(channel, unhexlify(data_to_sign), signature1))
self.assertTrue(verify(channel, unhexlify(data_to_sign), signature2))
async def test_channel_export_import_before_sending_channel(self):
# export
tx = await self.channel_create('@foo', '1.0')
+44 -36
View File
@@ -6,6 +6,7 @@ from unittest.mock import Mock
from lbry.wallet.network import Network
from lbry.wallet.orchstr8.node import SPVNode
from lbry.wallet.rpc import RPCSession
from lbry.wallet.server.udp import StatusServer
from lbry.testcase import IntegrationTestCase, AsyncioTestCase
@@ -32,18 +33,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 +65,21 @@ 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)
self.assertFalse(self.ledger.network.is_connected)
await self.ledger.resolve([], ['derp'])
self.assertEqual(50002, 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)
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,19 @@ 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 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 +162,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 +171,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 +190,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] = '2.0', 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
@@ -182,3 +186,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)
@@ -117,11 +117,6 @@ class ResolveCommand(BaseResolveTestCase):
await self.stream_create('foo', '0.9', allow_duplicate_name=True))
# plain winning claim
await self.assertResolvesToClaimId('foo', claim_id3)
# sequence resolution
await self.assertResolvesToClaimId('foo:1', claim_id1)
await self.assertResolvesToClaimId('foo:2', claim_id2)
await self.assertResolvesToClaimId('foo:3', claim_id3)
await self.assertResolvesToClaimId('foo:4', None)
# amount order resolution
await self.assertResolvesToClaimId('foo$1', claim_id3)
await self.assertResolvesToClaimId('foo$2', claim_id2)
@@ -138,8 +138,8 @@ class BasicTransactionTests(IntegrationTestCase):
# evil trick: mempool is unsorted on real life, but same order between python instances. reproduce it
original_summary = self.conductor.spv_node.server.mempool.transaction_summaries
async def random_summary(*args, **kwargs):
summary = await original_summary(*args, **kwargs)
def random_summary(*args, **kwargs):
summary = original_summary(*args, **kwargs)
if summary and len(summary) > 2:
ordered = summary.copy()
while summary == ordered:
@@ -10,7 +10,7 @@ from lbry.wallet.dewies import dict_values_to_lbc
class WalletCommands(CommandTestCase):
async def test_wallet_create_and_add_subscribe(self):
session = next(iter(self.conductor.spv_node.server.session_mgr.sessions))
session = next(iter(self.conductor.spv_node.server.session_mgr.sessions.values()))
self.assertEqual(len(session.hashX_subs), 27)
wallet = await self.daemon.jsonrpc_wallet_create('foo', create_account=True, single_key=True)
self.assertEqual(len(session.hashX_subs), 28)
@@ -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()
@@ -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)
@@ -354,7 +358,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 +369,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 +382,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 +434,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
+4 -2
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)
@@ -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)
@@ -4,7 +4,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
manager = ExchangeRateManager(FEEDS)
@@ -18,5 +17,5 @@ class TestExchangeRateManager(AsyncioTestCase):
self.assertTrue(feed.is_online)
self.assertIsInstance(feed.rate, ExchangeRate)
lbc = manager.convert_currency('USD', 'LBC', Decimal('0.01'))
self.assertGreaterEqual(lbc, 0.1)
self.assertGreaterEqual(lbc, 0.01)
self.assertLessEqual(lbc, 10.0)
@@ -36,12 +36,14 @@ class BlobExchangeTestBase(AsyncioTestCase):
self.addCleanup(shutil.rmtree, self.server_dir)
self.server_config = Config(data_dir=self.server_dir, download_dir=self.server_dir, wallet=self.server_dir,
fixed_peers=[])
self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, os.path.join(self.server_dir, "lbrynet.sqlite"))
self.server_blob_manager = BlobManager(self.loop, self.server_dir, self.server_storage, self.server_config)
self.server = BlobServer(self.loop, self.server_blob_manager, 'bQEaw42GXsgCAGio1nxFncJSyRmnztSCjP')
self.client_config = Config(data_dir=self.client_dir, download_dir=self.client_dir,
wallet=self.client_wallet_dir, fixed_peers=[])
self.client_config.transaction_cache_size = 10000
self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite"))
self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config)
self.client_peer_manager = PeerManager(self.loop)
@@ -117,20 +117,12 @@ class ExchangeRateTests(AsyncioTestCase):
def test_bittrex_feed_response(self):
feed = BittrexFeed()
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):
+16 -15
View File
@@ -9,14 +9,15 @@ claim_id = "63f2da17b0d90042c559cc73b6b17f853945c43e"
class TestURLParsing(unittest.TestCase):
segments = 'stream', 'channel'
fields = 'name', 'claim_id', 'sequence', 'amount_order'
fields = 'name', 'claim_id', 'amount_order'
def _assert_url(self, url_string, **kwargs):
def _assert_url(self, url_string, strictly=True, **kwargs):
url = URL.parse(url_string)
if url_string.startswith('lbry://'):
self.assertEqual(url_string, str(url))
else:
self.assertEqual(f'lbry://{url_string}', str(url))
if strictly:
if url_string.startswith('lbry://'):
self.assertEqual(url_string, str(url))
else:
self.assertEqual(f'lbry://{url_string}', str(url))
present = {}
for key in kwargs:
for segment_name in self.segments:
@@ -42,19 +43,22 @@ class TestURLParsing(unittest.TestCase):
url = self._assert_url
# stream
url('test', stream_name='test')
url('test:1', stream_name='test', stream_sequence='1')
url('test*1', stream_name='test*1')
url('test$1', stream_name='test', stream_amount_order='1')
url(f'test#{claim_id}', stream_name='test', stream_claim_id=claim_id)
url(f'test#{claim_id}', stream_name='test', stream_claim_id=claim_id, strictly=False)
url(f'test:{claim_id}', stream_name='test', stream_claim_id=claim_id)
# channel
url('@test', channel_name='@test')
url('@test:1', channel_name='@test', channel_sequence='1')
url('@test$1', channel_name='@test', channel_amount_order='1')
url(f'@test#{claim_id}', channel_name='@test', channel_claim_id=claim_id)
url(f'@test#{claim_id}', channel_name='@test', channel_claim_id=claim_id, strictly=False)
url(f'@test:{claim_id}', channel_name='@test', channel_claim_id=claim_id)
# channel/stream
url('lbry://@test/stuff', channel_name='@test', stream_name='stuff')
url('lbry://@test:1/stuff', channel_name='@test', channel_sequence='1', stream_name='stuff')
url('lbry://@test$1/stuff', channel_name='@test', channel_amount_order='1', stream_name='stuff')
url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff')
url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff', strictly=False)
url(f'lbry://@test:{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff')
# combined legacy and new
url('@test:1/stuff#2', channel_claim_id='1', stream_claim_id='2', channel_name='@test', stream_name='stuff', strictly=False)
# unicode regex edges
_url = lambda name: url(name, stream_name=name)
_url('\uD799')
@@ -104,10 +108,8 @@ class TestURLParsing(unittest.TestCase):
fail("lbry://test@")
fail("lbry://tes@t")
fail(f"lbry://test:1#{claim_id}")
fail("lbry://test:0")
fail("lbry://test$0")
fail("lbry://test/path")
fail("lbry://@test1:1ab/fakepath")
fail("lbry://test:1:1:1")
fail("whatever/lbry://test")
fail("lbry://lbry://test")
@@ -115,5 +117,4 @@ class TestURLParsing(unittest.TestCase):
fail("lbry://abc:0x123")
fail("lbry://abc:0x123/page")
fail("lbry://@test1#ABCDEF/fakepath")
fail("test:0001")
fail("lbry://@test1$1/fakepath?arg1&arg2&arg3")
+8 -11
View File
@@ -93,8 +93,7 @@ class TestReflector(AsyncioTestCase):
await incoming.wait()
stop.set()
# this used to raise (and then propagate) a CancelledError
with self.assertRaises(asyncio.CancelledError):
await reflect_task
self.assertListEqual(await reflect_task, [])
self.assertFalse(self.stream.is_fully_reflected)
self.assertFalse(self.server_blob_manager.get_blob(self.stream.sd_hash).get_is_verified())
@@ -114,8 +113,8 @@ class TestReflector(AsyncioTestCase):
await incoming.wait()
await not_incoming.wait()
stop.set()
with self.assertRaises(asyncio.CancelledError):
await reflect_task
sent = await reflect_task
self.assertListEqual([self.stream.sd_hash], sent)
self.assertTrue(self.server_blob_manager.get_blob(self.stream.sd_hash).get_is_verified())
self.assertFalse(self.stream.is_fully_reflected)
@@ -137,8 +136,8 @@ class TestReflector(AsyncioTestCase):
await incoming.wait()
await not_incoming.wait()
stop.set()
with self.assertRaises(asyncio.CancelledError):
await reflect_task
sent = await reflect_task
self.assertListEqual([self.stream.sd_hash, self.stream.descriptor.blobs[0].blob_hash], sent)
self.assertTrue(self.server_blob_manager.get_blob(self.stream.sd_hash).get_is_verified())
self.assertTrue(self.server_blob_manager.get_blob(self.stream.descriptor.blobs[0].blob_hash).get_is_verified())
self.assertFalse(self.stream.is_fully_reflected)
@@ -160,9 +159,7 @@ class TestReflector(AsyncioTestCase):
await not_incoming.wait()
await incoming.wait()
stop.set()
with self.assertRaises(asyncio.CancelledError):
await reflect_task
# self.assertListEqual(await reflect_task, [self.stream.sd_hash])
self.assertListEqual(await reflect_task, [self.stream.sd_hash])
self.assertTrue(self.server_blob_manager.get_blob(self.stream.sd_hash).get_is_verified())
self.assertFalse(
self.server_blob_manager.get_blob(self.stream.descriptor.blobs[0].blob_hash).get_is_verified()
@@ -187,8 +184,8 @@ class TestReflector(AsyncioTestCase):
await incoming.wait()
await self.stream_manager.delete(self.stream, delete_file=True)
# this used to raise OSError when it can't read the deleted blob for the upload
with self.assertRaises(asyncio.CancelledError):
await reflect_task
sent = await reflect_task
self.assertListEqual([self.stream.sd_hash], sent)
self.assertTrue(self.server_blob_manager.get_blob(self.stream.sd_hash).get_is_verified())
self.assertFalse(
self.server_blob_manager.get_blob(self.stream.descriptor.blobs[0].blob_hash).get_is_verified()
+3 -1
View File
@@ -98,12 +98,14 @@ async def get_mock_wallet(sd_hash, storage, wallet_dir, balance=10.0, fee=None):
wallet = Wallet()
ledger = Ledger({
'db': Database(os.path.join(wallet_dir, 'blockchain.db')),
'headers': FakeHeaders(514082)
'headers': FakeHeaders(514082),
'tx_cache_size': 10000
})
await ledger.db.open()
wallet.generate_account(ledger)
manager = WalletManager()
manager.config = Config()
manager.config.transaction_cache_size = 10000
manager.wallets.append(wallet)
manager.ledgers[Ledger] = ledger
manager.ledger.network.client = ClientSession(
+2 -4
View File
@@ -40,7 +40,7 @@ class MockNetwork:
merkle = await self.get_merkle(tx_hash, known_height)
return tx, merkle
async def get_transaction_batch(self, txids):
async def get_transaction_batch(self, txids, restricted):
return {
txid: await self.get_transaction_and_merkle(txid)
for txid in txids
@@ -126,9 +126,7 @@ class TestSynchronization(LedgerTestCase):
self.ledger.network.get_history_called = []
self.ledger.network.get_transaction_called = []
self.assertFalse(self.ledger._tx_cache[txid1].tx.is_verified)
self.assertFalse(self.ledger._tx_cache[txid2].tx.is_verified)
self.assertFalse(self.ledger._tx_cache[txid3].tx.is_verified)
self.assertEqual(0, len(self.ledger._tx_cache))
await self.ledger.update_history(address, '')
self.assertListEqual(self.ledger.network.get_history_called, [address])
self.assertListEqual(self.ledger.network.get_transaction_called, [])
+42
View File
@@ -74,6 +74,48 @@ class TestWalletCreation(AsyncioTestCase):
decrypted = Wallet.unpack('password', encrypted)
self.assertEqual(decrypted['accounts'][0]['name'], 'An Account')
def test_no_password_but_encryption_preferred(self):
wallet_dict = {
'version': 1,
'name': 'Main Wallet',
'preferences': {
"encrypt-on-disk": {
"ts": 1571762543.351794,
"value": True
},
},
'accounts': [
{
'certificates': {},
'name': 'An Account',
'ledger': 'lbc_mainnet',
'modified_on': 123,
'seed':
"carbon smart garage balance margin twelve chest sword toast envelope bottom stomac"
"h absent",
'encrypted': False,
'private_key':
'xprv9s21ZrQH143K42ovpZygnjfHdAqSd9jo7zceDfPRogM7bkkoNVv7'
'DRNLEoB8HoirMgH969NrgL8jNzLEegqFzPRWM37GXd4uE8uuRkx4LAe',
'public_key':
'xpub661MyMwAqRbcGWtPvbWh9sc2BCfw2cTeVDYF23o3N1t6UZ5wv3EMm'
'Dgp66FxHuDtWdft3B5eL5xQtyzAtkdmhhC95gjRjLzSTdkho95asu9',
'address_generator': {
'name': 'deterministic-chain',
'receiving': {'gap': 17, 'maximum_uses_per_address': 3},
'change': {'gap': 10, 'maximum_uses_per_address': 3}
}
}
]
}
storage = WalletStorage(default=wallet_dict)
wallet = Wallet.from_storage(storage, self.manager)
self.assertEqual(
hexlify(wallet.hash), b'8cc6341885e6ad46f72a17364c65f8441f09e79996c55202196b399c75f8d751'
)
self.assertFalse(wallet.is_encrypted)
def test_read_write(self):
manager = WalletManager()
config = {'data_path': '/tmp/wallet'}