Compare commits

...
336 Commits
Author SHA1 Message Date
Victor Shyba d14eb24141 always add itself
ci / lint (push) Waiting to run
ci / tests / unit (macos-latest) (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / unit (windows-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (blockchain_legacy_search) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-09-29 23:09:13 -03:00
Victor Shyba 820015872b fix standalone blob server and make it fetch from upstream 2021-09-29 23:04:58 -03:00
Victor Shyba f57b1b3c3d dht: use bytes hex/fromhex instead of binascii 2021-09-29 21:27:53 -03:00
Victor Shyba a85ceb3cca add grin to dht known list 2021-09-29 11:49:53 -03:00
Victor Shyba 254ae66ed3 add madiator to known dht nodes 2021-09-29 00:24:51 -03:00
Victor Shyba 3206fe873e add option to set bootstrap_node 2021-09-28 18:52:23 -03:00
Victor Shyba 63046fce58 add dockerfile for dht node 2021-09-28 18:43:35 -03:00
Victor Shyba b76863d055 configure where to save peers 2021-09-28 18:43:35 -03:00
Victor Shyba d7ed74ab94 define arg types 2021-09-28 18:43:35 -03:00
Victor Shyba 7388f5f1cd add dht seed node script 2021-09-28 18:43:35 -03:00
Lex Berezhny c211338218 Merge pull request #3434 from belikor/fix-documentation
fix typo in `file list` arguments list
2021-09-27 11:08:10 -04:00
belikor 8ac89af8bd api.json: correct the error in the generated documentation
From `"name": "blobs_in_stream<blobs_in_stream>"`
to `"name": "blobs_in_stream"`.
2021-09-23 21:01:17 -05:00
belikor bbbaf59591 daemon: fix documentation in the file_list docstring
This is necessary to produce the `docs/api.json`
(through `scripts/generate_json_api.py`)
with correct information, and to be able to parse this file later on
by other tools.
2021-09-23 21:00:31 -05:00
Lex Berezhny 169419896f v0.104.0
ci / lint (push) Waiting to run
ci / tests / unit (macos-latest) (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / unit (windows-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (blockchain_legacy_search) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-09-22 18:39:01 -04:00
Lex Berezhny 0543dca502 re-enable coveralls 2021-09-22 18:15:13 -04:00
Lex Berezhny cc6011d57a ubuntu 16.04 is deprecated on github actions, upgrading to 18.04 2021-09-22 18:14:15 -04:00
Lex Berezhny fc4407ef7e revert release 2021-09-22 18:11:41 -04:00
Lex Berezhny 03735a125f v0.104.0 2021-09-22 14:02:52 -04:00
Lex Berezhny 5baeda9ff1 Merge pull request #3417 from lbryio/preserve_own_blobs
use database to track blob disk space use and preserve own blobs
2021-09-20 11:32:59 -04:00
Lex Berezhny 9b9794b5e0 default is_mine to true during migration 2021-09-20 09:23:42 -04:00
Lex Berezhny 0697d60a48 coveralls still down, will have to merged with coveralls off 2021-09-20 09:01:35 -04:00
Lex Berezhny cfe6c82a31 tests 2021-09-19 21:38:09 -04:00
Lex Berezhny 3e30228d95 lint 2021-09-15 10:49:03 -04:00
Lex Berezhny 7264b53e5f during disk clean your own sd blob is now kept and file status of deleted files is set to stopped 2021-09-15 10:37:08 -04:00
Lex Berezhny 60836d8523 db migration and other fixes 2021-09-15 09:10:06 -04:00
Lex Berezhny ef89c2e47a use databse to track blob disk space use and preserve own blobs 2021-09-15 09:10:06 -04:00
Lex Berezhny 2d9e3e1847 v0.103.0
ci / lint (push) Waiting to run
ci / tests / unit (macos-latest) (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / unit (windows-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (blockchain_legacy_search) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-09-14 23:25:32 -04:00
Lex Berezhny 30136a9697 omit just node.py 2021-09-14 23:06:00 -04:00
Lex Berezhny db7ccd66d3 coverage omit fix 2021-09-14 22:38:39 -04:00
Lex Berezhny cfe6483102 omit coverage inside tox 2021-09-14 22:20:09 -04:00
Alex Grin 561566e723 Merge pull request #3421 from lbryio/vault_temp
avoid [''] on peers list
2021-09-13 16:14:43 -04:00
Victor Shyba c2dcc4c898 avoid [''] on peers list 2021-09-13 15:57:21 -03:00
Lex Berezhny d09bfdc4ff omit orchstr8 stuff since it doesnt always run the same way on every test run 2021-09-12 11:45:52 -04:00
Victor Shyba 358ef4536f add ConflictingInputValueError for claim_id+claim_ids 2021-09-10 18:57:20 -03:00
Victor Shyba 5061a35e66 remove ignored output from hub node 2021-09-10 18:57:20 -03:00
Victor Shyba cd9a1e8c9e default to legacy search for this release 2021-09-10 18:57:20 -03:00
Victor Shyba 646902e75e only duplicate blockchain CI step 2021-09-10 18:57:20 -03:00
Victor Shyba 40d26cb868 fix error msg to match Go msg 2021-09-10 18:57:20 -03:00
Victor Shyba b64aa51c0c fix stream_types being an integer 2021-09-10 18:57:20 -03:00
Victor Shyba 8206441834 run CI for old and new setups 2021-09-10 18:57:20 -03:00
Victor Shyba d713783736 ignore default values 2021-09-10 18:57:20 -03:00
Victor Shyba 57dffaa2ce update hub to beta release 2021-09-10 18:57:20 -03:00
Victor Shyba 9e81dd2360 refactor arguments fixup 2021-09-10 18:57:20 -03:00
Victor Shyba e2798969d7 claim_id is an invertible field, not a repeated 2021-09-10 18:57:20 -03:00
Victor Shyba 1c31ec66f2 simplify operator handling 2021-09-10 18:57:20 -03:00
Victor Shyba 241f9fc7b0 not_claim_id/not_claim_ids is not a search parameter 2021-09-10 18:57:20 -03:00
Victor Shyba 270192486a translate grpc errors to RPCError 2021-09-10 18:57:20 -03:00
Victor Shyba a799503c97 update fields from hub 2021-09-10 18:57:20 -03:00
Victor Shyba 9685928087 there is no first_search 2021-09-10 18:57:20 -03:00
Victor Shyba 0e4b2fad99 specify index name 2021-09-10 18:57:20 -03:00
Victor Shyba 3c4571a4e0 remove fallback 2021-09-10 18:57:20 -03:00
Jeffrey Picard 046147eb1d updates for fields 2021-09-10 18:57:20 -03:00
Jeffrey Picard 7834520e54 update code to be consistent with field renames 2021-09-10 18:57:20 -03:00
Jeffrey Picard 8e5b4d4b6f hardcode port 2021-09-10 18:57:20 -03:00
Jeffrey Picard 4544a074d9 Move the go hub settings from network to ledger config and hook reset
correctly.
2021-09-10 18:57:20 -03:00
Jeffrey Picard 9b78501392 Set default server to the networks default and use go hub by default 2021-09-10 18:57:20 -03:00
Jeffrey Picard f59ddcc88d Forgot to remove duplicate tests 2021-09-10 18:57:20 -03:00
Jeffrey Picard a4955a2b79 remove uneeded prints 2021-09-10 18:57:20 -03:00
Jeffrey Picard 92ae1a565b updates protobuf 2021-09-10 18:57:20 -03:00
Jeffrey Picard 15a56ca25e tons of small changes squashed together 2021-09-10 18:57:20 -03:00
Jeffrey Picard 9dcaa829ea update protobufs 2021-09-10 18:57:20 -03:00
Jeffrey Picard 9f65799a3d uncomment tests, add remove_duplicates param
Cleanup prints and commented out code

remove print

don't do list claims

cleanup
2021-09-10 18:57:20 -03:00
Jeffrey Picard 886587848b protobuf changes
more protobuf changes (fix imports)
2021-09-10 18:57:20 -03:00
Jeffrey Picard a97fc6dba8 cleanup and reorgnazing some stuff
Fixing tests

relabel failing tests properly

run all the tests for the hub

cleanup HubNode
2021-09-10 18:57:20 -03:00
Jeffrey Picard c124e88d12 grpc client for python 2021-09-10 18:57:20 -03:00
Jeffrey Picard 17f3870296 Add tests for hub
Have the basic starting /stopping / querying. Still don't have the hub
jsonrpc stuff working right and from the looks of it I need to clearify
some of the logic in the claim search function itself because it's not
returning the correct number of claims anyways.

get the integration working with grpcurl

Got tests working, still need to port the rest of them

ported all of the claim search tests

still a few failing due to not having inflation working, and there's something weird
with limit_claims_per_channel that needs to be fixed.
2021-09-10 18:57:20 -03:00
Lex Berezhny 4626d42d08 Merge pull request #3414 from cristi-zz/remove_comment_api
removed `comment` API endoints
2021-09-09 13:07:12 -04:00
Cristian Vicas e1e760055c Drop comment_* apis.
Refresh documentation.
2021-09-02 11:38:29 +03:00
Cristian Vicas 45bf6c3bf3 Drop comment_* apis.
Refactored dangling functions.
Added unit test.
2021-09-02 11:38:29 +03:00
Cristian Vicas fef0cc764d Drop comment_* apis
Removed the comment API
Removed tests for the comment API
Removed the documentation section
Removed the comment server configuration
2021-09-02 08:51:00 +03:00
Lex Berezhny 72049afcf6 Merge pull request #3410 from belikor/fix-docstring
jsonrpc_support_sum: remove the + signs from the docstring
2021-09-01 10:05:17 -04:00
belikor d26c06dbf3 jsonrpc_support_sum: remove the + signs from the docstring
These symbols came from 0a0ac3b7c9 and were probably added
accidentally to the beginning of the line by copying and pasting
some diffs.
2021-08-25 13:28:02 -05:00
Lex Berezhny 268decd655 update readme 2021-08-21 20:01:49 -04:00
Lex Berezhny 7ae246c839 always run on push, otherwise master branch does not get coverage 2021-08-21 17:10:53 -04:00
Lex Berezhny c7c454e4fb Merge pull request #3406 from lbryio/coveralls
submit code coverage reports to coveralls
2021-08-21 17:07:22 -04:00
Lex Berezhny 8e27297a81 coveralls flag name fix 2021-08-21 16:47:17 -04:00
Lex Berezhny 2cdec72985 coveralls fix 2021-08-21 16:22:01 -04:00
Lex Berezhny 0085ac534d coverage fix 2021-08-21 15:41:06 -04:00
Lex Berezhny 7828a79a96 coverage combine corrected 2021-08-21 15:31:50 -04:00
Lex Berezhny 5576c21e67 coverage for integration tests 2021-08-21 15:26:14 -04:00
Lex Berezhny e49cfb1d2b another attempt 2021-08-21 14:44:59 -04:00
Lex Berezhny 1e541d0225 explicit coverralls service 2021-08-21 13:52:33 -04:00
Lex Berezhny 0974afd26d guess coverralls service 2021-08-21 12:06:45 -04:00
Lex Berezhny 8d93594771 coverage on win and mac 2021-08-21 10:51:37 -04:00
Lex Berezhny 1136ac70e8 fix makefile 2021-08-21 10:26:55 -04:00
Lex Berezhny dc8d5a39ea fix spaces 2021-08-21 09:42:18 -04:00
Lex Berezhny 8329e649b0 try python coveralls package insead of github action 2021-08-21 09:41:16 -04:00
Lex Berezhny 66da8b164f try AndreMiras/coveralls-python-action action 2021-08-21 09:28:20 -04:00
Lex Berezhny ea48577864 github workflow syntax fix 2021-08-21 09:15:20 -04:00
Lex Berezhny 597146b136 submit coverage to coveralls 2021-08-21 09:04:44 -04:00
Lex Berezhny 30dd0c1e11 Merge pull request #3405 from lbryio/upgrade_pylint
upgrade pylint and fix lint errors
2021-08-20 23:06:44 -04:00
Lex Berezhny 88772c4266 update setup.py 2021-08-20 22:42:12 -04:00
Lex Berezhny dc1d9e1c84 upgrade pylint and fix lint errors 2021-08-20 22:36:35 -04:00
Lex Berezhny 69ea65835d Merge pull request #3402 from lbryio/save_files_default_false
changed default setting `save_files` to be false
2021-08-19 10:57:51 -04:00
Lex Berezhny d5bae3a8c6 manually set save_files=True in unit tests 2021-08-19 09:31:17 -04:00
Lex Berezhny f14010bd5b explicitly set save_files = True in tests 2021-08-17 16:36:48 -04:00
Lex Berezhny 87094fc83f changed default setting save_files to be false 2021-08-17 15:47:18 -04:00
Lex Berezhny 7c179cfeab missing closing squiggly bracket 2021-08-17 14:48:13 -04:00
Lex Berezhny 7582c221d1 v0.102.0
ci / lint (push) Waiting to run
ci / tests / unit (macos-latest) (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / unit (windows-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-08-17 14:16:17 -04:00
Lex Berezhny c109895848 Merge pull request #3399 from lbryio/better-error-logging
Less verbose error logs, only log tracebacks for errors not defined in `lbry.error`
2021-08-17 14:14:27 -04:00
Jack Robison eccedada40 add TODOs for errors raised that aren't defined in lbry.error 2021-08-17 12:31:03 -04:00
Jack Robison 25d54accf8 return api errors from wallet_add and wallet_create 2021-08-17 12:30:17 -04:00
Jack Robison d07685f0e9 only log tracebacks for api errors not defined in lbry.error 2021-08-17 11:30:58 -04:00
Jack Robison 2445c00c7e raise WalletNotLoadedError in get_wallet_or_error instead of ValueError 2021-08-17 11:30:58 -04:00
Lex Berezhny 4c1d3ef514 Merge pull request #3398 from lbryio/clean_blobs_after_delay
clean blobs after waiting interval instead of immediately on startup
2021-08-17 10:44:34 -04:00
Lex Berezhny 4614c7d4c2 clean blobs after waiting interval instead of immediately on startup 2021-08-17 09:52:44 -04:00
Lex Berezhny bbf1ef0dc3 Merge pull request #3378 from lbryio/disk_management
ability to limit disk spaced used for blobs via `blob_storage_limit` setting (oldest blobs are deleted when disk space limit is reached)
2021-08-16 17:41:05 -04:00
Lex Berezhny 3433c9e708 return number of files deleted 2021-08-16 17:03:40 -04:00
Lex Berezhny 2cd5d75a2e return true/false if clean was performed 2021-08-16 17:02:13 -04:00
Lex Berezhny 2535b8adef fix disk space unit test 2021-08-16 14:54:17 -04:00
Lex Berezhny 4edab7bb7f fix sorting by DirEntry error 2021-08-16 14:41:16 -04:00
Lex Berezhny fd8658e317 test component unit test 2021-08-16 14:35:32 -04:00
Lex Berezhny 51d21d8c86 working disk cleanup 2021-08-16 14:15:12 -04:00
Lex Berezhny b4c3307cdf fixed tests 2021-08-13 10:32:46 -04:00
Lex Berezhny 4e8d10cb44 disk space manager and status API 2021-08-13 10:32:46 -04:00
Lex Berezhny e96875a425 workflow syntax 2021-08-13 10:32:46 -04:00
Lex Berezhny 5ab0035348 run tests on windows and mac 2021-08-13 10:32:46 -04:00
Lex Berezhny 4ddff96b1e Merge pull request #3395 from lbryio/libtorrent_optional
make libtorrent optional and skip test which depends on it
2021-08-13 10:31:06 -04:00
Lex Berezhny a08d84c1df make libtorrent optional and skip test which depends on it 2021-08-13 10:07:06 -04:00
Victor Shyba 21c71bfac1 update sync utility 2021-08-09 18:33:47 -03:00
Victor Shyba 6baaed3581 refactor query with new fields 2021-08-09 18:33:47 -03:00
Victor Shyba 152dbfd5d1 reflect fee_currency, fee_amount and duration on repost searches 2021-08-09 18:33:47 -03:00
Victor Shyba a56d14086b reflect media_type on repost searches 2021-08-09 18:33:47 -03:00
Victor Shyba aee87693f8 reflect stream_type on repost searches 2021-08-09 18:33:47 -03:00
Alex Grin 976b4affd9 Merge pull request #3383 from lbryio/dht_log 2021-08-09 17:10:01 -04:00
Victor Shyba e222b6ad9c log that a invalid query happened 2021-08-09 15:07:44 -03:00
Victor Shyba 19b17374e8 throttle instead of disconnecting 2021-08-09 15:07:44 -03:00
Victor Shyba 43989122bb add error type and message to error readme and update code 2021-08-09 15:07:44 -03:00
Victor Shyba 72712d6047 raise and disconnect if too many parameters are used on search 2021-08-09 15:07:44 -03:00
Victor Shyba 0b52d2cc15 log invalid port as a warning instead of an exception 2021-08-03 15:29:52 -03:00
Lex Berezhny 8304102136 move <!channel> out of markdown converter 2021-07-27 11:54:08 -04:00
Lex Berezhny 3381aefcfa notify channel of slack message 2021-07-27 11:39:35 -04:00
Lex Berezhny 279a365cb1 v0.101.1
ci / lint (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-07-27 11:12:06 -04:00
Lex Berezhny 2c9e00da56 revert version 2021-07-27 11:10:16 -04:00
Lex Berezhny f7cae69704 switch to using a custom GITHUB_TOKEN for doing releases 2021-07-27 11:07:25 -04:00
Lex Berezhny b7d58bcdbc v0.101.1 2021-07-26 17:01:25 -04:00
Lex Berezhny 13a856b843 revert version 2021-07-26 17:00:32 -04:00
Lex Berezhny 8da38985c3 debugging for release 2021-07-26 16:58:11 -04:00
Lex Berezhny 60cf6c6b97 v0.101.1 2021-07-26 16:02:28 -04:00
Lex Berezhny 35c2b34564 Merge pull request #3372 from lbryio/release_process_fixup
github release process fixes
2021-07-26 15:58:10 -04:00
Lex Berezhny ef2e048efc fixes for release process 2021-07-26 15:57:45 -04:00
Lex Berezhny 6b3261aa33 Merge pull request #3373 from lbryio/fix_typo
fix typo in kwargs key
2021-07-26 15:29:29 -04:00
Victor Shyba 1849c02cb6 fix typo in kwargs key 2021-07-26 16:02:48 -03:00
Lex Berezhny 1ec74a89e2 Merge pull request #3367 from belikor/fix-search-claim-id
fix error when using `--claim_id` with `lbrynet claim search`
2021-07-23 10:08:57 -04:00
Victor Shyba c591792de9 has_source is a special case 2021-07-22 16:25:55 -03:00
Victor Shyba 3108543ae5 3 missing fields 2021-07-22 16:25:55 -03:00
Victor Shyba 1eb221c743 translate reposted, signature_valid and normalized 2021-07-22 16:25:55 -03:00
Alex Grin bebf6bc2e7 Update constants.py 2021-07-22 16:25:55 -03:00
Alex Grin 9e91cc2138 Update constants.py 2021-07-22 16:25:55 -03:00
Victor Shyba c5b939cfb7 fix tests 2021-07-22 16:25:55 -03:00
Victor Shyba 5bd411ca27 filtering hash->id 2021-07-22 16:25:55 -03:00
Victor Shyba a533cda6f0 ES: all _hash to _id 2021-07-22 16:25:55 -03:00
Lex Berezhny fe4b07b8ae v0.101.0
ci / lint (push) Waiting to run
ci / tests / unit (ubuntu-latest) (push) Waiting to run
ci / tests / integration (blockchain) (push) Waiting to run
ci / tests / integration (datanetwork) (push) Waiting to run
ci / tests / integration (other) (push) Waiting to run
2021-07-21 12:35:16 -04:00
Lex Berezhny f9f2ccd904 revert version 2021-07-21 12:28:41 -04:00
Lex Berezhny d9e87d7c32 publish after uploading release artifacts 2021-07-21 12:27:04 -04:00
Lex Berezhny a0092c0770 remove docker steps from github action build 2021-07-21 12:14:49 -04:00
Lex Berezhny 3100131125 checkout code in release job 2021-07-21 11:33:41 -04:00
Lex Berezhny 988880cf83 update set_build script to work on github 2021-07-21 11:32:37 -04:00
Lex Berezhny c3fb9672c4 re-enable skipping failing DHT unit test 2021-07-21 11:25:44 -04:00
Lex Berezhny 0a2d94e425 updated set_build to use GITHUB_ env vars 2021-07-21 09:19:58 -04:00
Lex Berezhny 8d9073cd31 v0.101.0 2021-07-20 22:52:44 -04:00
Lex Berezhny d075961ffa removed .gitlab-ci.yml 2021-07-20 22:52:05 -04:00
Lex Berezhny 7a72409b61 fix dht node test 2021-07-20 22:43:57 -04:00
Lex Berezhny 34fc530fba cleanup github actions to be able to drop gitlab 2021-07-20 22:43:57 -04:00
Jack Robison f257ff2f97 Merge pull request #3369 from lbryio/fix-hanging-tx-notification
fix stuck transaction notification due to race in mempool when advancing a block
2021-07-20 18:54:22 -04:00
Jack Robison 7ad5822c5b fix test 2021-07-20 16:03:34 -04:00
Jack Robison 9a8f9f0a94 fix stuck notification due to mempool/notification race 2021-07-20 15:14:10 -04:00
belikor 6421cecafb daemon: fix --claim_id with lbrynet claim search
For some reason, when using `claim_search`
with `--claim_id`, the arguments dictionary will also
contain `claim_ids` with an empty list, even if we didn't specify it.
```
lbrynet claim search --claim_id=8945573bcfcb7f8276187dfbb93545eac4ebf71a
```

Using both `claim_id` and `claim_ids` will raise a `ValueError`
exception so the daemon won't return a valid result
even if the claim ID is in fact valid.

So if `claim_id` exists, we need to discard `claim_ids`
if it is empty, before proceeding with the rest of the code.

On the other hand, if `claim_ids` is used, and `claim_id` is absent,
there will be no problem as `claim_id` won't be added to the dictionary.
```
lbrynet claim search --claim_ids=8945573bcfcb7f8276187dfbb93545eac4ebf71a
```
2021-07-19 22:24:43 -05:00
Alex Grin be544d6d89 Merge pull request #3358 from belikor/improve-install-md 2021-07-19 14:20:44 -04:00
Alex Grin 3c89ecafdd Merge branch 'master' into improve-install-md 2021-07-19 14:20:39 -04:00
Alex Grin 35ec4eec52 Update INSTALL.md 2021-07-19 14:20:15 -04:00
Alex Grin e47f737a2f Update INSTALL.md 2021-07-19 14:15:21 -04:00
Alex Grin ac671a065b Merge pull request #3356 from lbryio/propagate_external_ip_change 2021-07-19 14:12:26 -04:00
Alex Grin 74116cc550 Merge branch 'master' into propagate_external_ip_change 2021-07-19 14:12:19 -04:00
Alex Grin 406070a5c3 Merge pull request #3354 from belikor/note-download-blob-peer 2021-07-19 14:10:13 -04:00
Victor Shyba 0ccafd5b53 make get_or_create_usable_address respect the generator lock 2021-07-19 14:09:52 -04:00
Alex Grin 940f517aa3 Merge branch 'master' into note-download-blob-peer 2021-07-19 14:09:51 -04:00
Alex Grin 216e5f65ad Merge pull request #3363 from lbryio/troubleshoot_p2p_script
add script with web endpoints that can troubleshoot p2p/dht
2021-07-19 14:04:28 -04:00
Victor Shyba a74685d66d add script to troubleshoot p2p/dht 2021-07-19 15:01:37 -03:00
belikor b7791d2845 exchange_rate_manager: raise exception if 'error' is in json_response
If the error is not handled, the running daemon will continuously
print the following error message:
```
Traceback (most recent call last):
  File "lbry/extras/daemon/exchange_rate_manager.py", line 77, in get_rate
  File "lbry/extras/daemon/exchange_rate_manager.py", line 189, in get_rate_from_response
KeyError: 0
```

This started happening when the UPBit exchange decided to delist
the LBC coin.

Normally `json_response` should be a dictionary, not a list,
so `json_response[0]` causes an error.

By checking for the `'error'` key, we can raise the proper exception.

Once this is done, the message will be a warning, not a traceback.
```
WARNING  lbry.extras.daemon.exchange_rate_manager:92:
Failed to get exchange rate from UPbit: result not found
```
2021-07-19 13:41:49 -04:00
Victor Shyba d151a82d78 add libtool and automake to the dockerfiles so they can build coincurve 2021-07-15 17:11:19 -03:00
belikor 8ce61fbd52 INSTALL.md: break the big blocks of code, and remove the space
Remove the first space in the block of code as it is not necessary.

This
 ```
 $ python --version
 ```

Becomes this
```
$ python --version
```

Also break the big block of code into individual blocks.
2021-07-11 19:44:54 -05:00
belikor 90c24aade3 INSTALL.md: using Python 3.8 does not work, issue #2769
Because of issue #2769 at the moment the `lbrynet` daemon
will only work correctly with Python 3.7.

The `deadsnakes` personal package archive (PPA) provides
Python 3.7 for Ubuntu distributions that no longer have it
in their official repositories like 18.04 and 20.04.

If Python 3.8+ is used, the daemon will start but the RPC server
may not accept messages, returning the following:
```
Could not connect to daemon. Are you sure it's running?
```
2021-07-11 19:44:54 -05:00
belikor 6b3f787fee INSTALL.md: add more information on the virtual environments
Leave with `deactivate`.

Enter the environment again with
```
source lbry-venv/bin/activate
```

When developing, we can start the server interactively.
```
python lbry/extras/cli.py start
```

Parameters can be passed in the same way.
```
python lbry/extras/cli.py wallet balance
```

If a Python debugger (`pdb` or `ipdb`) is installed we can also start
it in this way, set up break points, and step through the code.
```
ipdb lbry/extras/cli.py
```
2021-07-11 19:44:25 -05:00
belikor 4ebe4ce1b7 scripts: note to further investigate in download_blob_from_peer
Currently `lbrynet blob get <hash>` does not work to download
single blobs which are not already present in the system.
The function locks up and never returns.
It only works for blobs that are in the `blobfiles` directory
already.

This bug is reported in lbryio/lbry-sdk, issue #2070.

Maybe this script can be investigated, and certain parts
can be added to `lbry.extras.daemon.daemon.jsonrpc_blob_get`
in order to solve the previous issue, and finally download
single blobs from the network (peers or reflector servers).
2021-07-09 11:53:35 -05:00
belikor 8c79740ee8 script/test_claim_search: fix the import of ClientSession
This is nothing special, it just allows the module
to run without throwing an error on the import.

From
```
from lbry.wallet.client.basenetwork import ClientSession
```

To
```
from lbry.wallet.network import ClientSession
```
2021-07-09 10:52:41 -04:00
belikor 59d027ca02 script/find_max_server: fix the import of ClientSession
This is nothing special, it just allows the module
to run without throwing an error on the import.

From
```
from lbry.wallet.client.basenetwork import ClientSession
```

To
```
from lbry.wallet.network import ClientSession
```
2021-07-09 10:52:41 -04:00
Ofek Lev 37a7345a90 Upgrade coincurve dependency 2021-07-09 10:51:03 -04:00
Victor Shyba c519d4651b loop.time is not usable on advance time, use wall time 2021-07-08 03:55:21 -03:00
Victor Shyba 9b3b609e40 re-enable test_losing_connection 2021-07-08 03:46:48 -03:00
Victor Shyba 6254f53716 propagate external ip changes from upnp component to dht node protocol 2021-07-08 03:46:05 -03:00
Jack Robison f05dc46432 Merge pull request #3342 from lbryio/bug_flush_counter
[resync required] Avoid flush counter overflows on long running hubs by increasing it to 32 bits
2021-07-07 23:45:47 -04:00
Victor Shyba 3de0982a4a limit request error logging to 16k 2021-07-07 18:39:38 -03:00
Victor Shyba c2184fb3bf run migration on history db open 2021-07-07 18:39:38 -03:00
Victor Shyba 919c09fcb0 add migration 2021-07-07 18:39:38 -03:00
Victor Shyba 1d9dbd40ec increase flush counter to 32 bits 2021-07-07 18:39:38 -03:00
belikor 0cd953a6f3 script/checktrie: fix the import to SQLDB
This is nothing special, it just allows the module
to run without throwing an error.

From
```
from lbry.wallet.server.db import SQLDB
```

To
```
from lbry.wallet.server.db.writer import SQLDB
```
2021-07-07 11:02:28 -03:00
Alex Grin 4db2b72351 Merge pull request #3347 from kodxana/master 2021-07-02 11:16:40 -04:00
kodxana dd54fcbdbd Create README.md 2021-07-01 18:21:20 +02:00
kodxana 3123cf7ac6 Added docker-compose 2021-07-01 18:17:36 +02:00
Victor Shyba 6b579dd4ce add dockerfiles for web sdk 2021-06-30 18:03:00 -03:00
Alex Grin 16dfaa3e27 Merge pull request #3343 from lbryio/example_es
add small example script showing how to read and update values to ES as we currently use it
2021-06-30 11:30:06 -04:00
Victor Shyba d7842b9f84 small script showing how to read/update values to ES as we currently use it 2021-06-25 12:41:05 -03:00
Alex Grin 115034fccb Merge pull request #3232 from lbryio/timeout 2021-06-25 11:05:25 -04:00
Victor Shyba 309e957a85 add concurrent_hub_requests conf 2021-06-24 21:21:19 -03:00
Victor Shyba d7007e402e move request semaphore to session and apply to all requests 2021-06-24 21:02:41 -03:00
Victor Shyba 91323a21cf add hub_timeout and propagate it to network code 2021-06-24 21:02:41 -03:00
Lex Berezhny fea893d76c v0.100.0 2021-06-22 13:33:03 -04:00
Lex Berezhny 761bc6ba4c revert release and fix test 2021-06-22 13:32:41 -04:00
Lex Berezhny 75172feb4e v0.100.0 2021-06-22 12:53:23 -04:00
Lex Berezhny 3285fb1608 revert release 2021-06-22 12:52:48 -04:00
Lex Berezhny 03a4c6910d v0.100.0 2021-06-22 12:51:36 -04:00
Lex Berezhny 485b958599 revert release 2021-06-22 12:50:11 -04:00
Lex Berezhny da47ba2f67 v0.100.0 2021-06-22 11:11:02 -04:00
Lex Berezhny c39195488a bug fix 2021-06-22 11:07:58 -04:00
Lex Berezhny 227fb0ae9b network integration test fix 2021-06-22 11:07:58 -04:00
Lex Berezhny b12ff5b503 test fixes 2021-06-22 11:07:58 -04:00
Lex Berezhny 0946c72b88 lint 2021-06-22 11:07:58 -04:00
Lex Berezhny 7d49b046d4 added support to config for determining if value is set and implemented hub selection logic 2021-06-22 11:07:58 -04:00
Lex Berezhny 5f0426c840 country jurisdiction added to hub UDP protocol 2021-06-22 11:07:58 -04:00
Lex Berezhny 73e239cc5f client side hub discovery pub/sub and hub metadata stored, removed old peers implementation 2021-06-22 11:07:58 -04:00
Lex Berezhny ad670f721a working client peer hub 2021-06-22 11:07:58 -04:00
Lex Berezhny 028a4a70cf wallet server federation, client portion 2021-06-22 11:07:58 -04:00
Lex Berezhny 77d7960347 increase lbc exchange rate threshold 2021-06-18 11:26:30 -04:00
Lex Berezhny 39821146bd increase lbc threshold in exchange rate integration tests even more 2021-06-17 10:23:33 -04:00
Lex Berezhny 7d505a41ac drop sqlite indexes from test 2021-06-15 18:22:42 -04:00
Lex Berezhny e457b2f0d6 fix trending to use built-in sqlite instead of apsw 2021-06-15 18:22:42 -04:00
Lex Berezhny c9cf7fd4d4 drop apsw in wallet.server.db.elasticsearch.sync 2021-06-15 18:22:42 -04:00
Lex Berezhny b0371dd33d update test reader to use plain sqlite 2021-06-15 18:22:42 -04:00
Lex Berezhny 25e16c3565 dropping apsw 2021-06-15 18:22:42 -04:00
Lex Berezhny 7b39527863 update exchange rate threshold in integration tests due to significant drop in LBC price 2021-06-15 15:58:59 -04:00
Alex Grin d861b08866 Merge pull request #3323 from lbryio/dht_leak 2021-06-07 16:15:59 -04:00
Victor Shyba fb438dc108 remove the unregister call 2021-06-04 12:47:16 -03:00
Victor Shyba 4e6b4f179b add items() to LRUCache 2021-06-04 12:20:44 -03:00
Victor Shyba 00d038c8f3 add default parameter to pop on LRUCache 2021-06-04 12:15:47 -03:00
Victor Shyba a9f6a68952 use LRU caches for DHT metrics 2021-06-04 11:54:37 -03:00
Alex Grin b9142bbc5a Merge pull request #3319 from lbryio/support_value_type
drop `value_type` for supports
2021-06-04 08:39:40 -04:00
Victor Shyba 6c812f663e drop value_type for support 2021-06-02 18:01:54 -03:00
Alex Grin a93ec9783a Update README.md 2021-06-02 14:10:19 -04:00
Lex Berezhny 2d184d77b6 v0.99.0 2021-06-02 12:07:37 -04:00
Victor Shyba bce299ccc7 fix docopt typo 2021-06-02 12:05:36 -04:00
Victor Shyba 235cebd14a fix test value 2021-06-02 12:05:36 -04:00
Victor Shyba a638aa9d53 add and test support for support_create anonymous --comment 2021-06-02 12:05:36 -04:00
Victor Shyba 67cce0ef7e test+implement --comment for support_create 2021-06-02 12:05:36 -04:00
Victor Shyba 82f4267bf6 add comment property/setter to the signable support class 2021-06-02 12:05:36 -04:00
Victor Shyba 45a9ca29c4 update generated support protobuf with field 2021-06-02 12:05:36 -04:00
Victor Shyba 7f4e813277 document schema update process 2021-06-02 12:05:36 -04:00
Lex Berezhny 3805ff4a0c fix purchase test 2021-06-02 11:34:21 -04:00
Lex Berezhny 464cfd475e properly format scripthash address on output 2021-06-02 11:34:21 -04:00
Lex Berezhny fe469ae57f create appropriate script for scripthash address 2021-06-02 11:34:21 -04:00
Lex Berezhny 550ef9a1c4 allows script addresses (beginning with r) to be used 2021-06-02 11:34:21 -04:00
Alex Grin 935adfb51a Merge pull request #3301 from lbryio/no_repeat_claim_id
add `--remove_duplicates` to the search api
2021-05-28 11:01:15 -04:00
Victor Shyba 3974df4a62 fix interaction between two modes 2021-05-27 20:14:12 -03:00
Victor Shyba 4870974161 update json api 2021-05-27 20:14:12 -03:00
Victor Shyba 8c4b0037f5 API: add --remove_duplicates to claim_search 2021-05-27 20:14:12 -03:00
Victor Shyba 2c6f763ef2 test picking oldest when originals doesnt match 2021-05-27 20:14:12 -03:00
Victor Shyba ca28de02d8 test and implementation for remove_duplicates on post-search filtering 2021-05-27 20:14:12 -03:00
Victor Shyba bfc15ea029 handle limit being 0 and skip reordering if 0/none 2021-05-27 20:14:12 -03:00
Victor Shyba 6e8b8a5920 always call search_ahead 2021-05-27 20:14:12 -03:00
Jack Robison 099f3b6a62 Merge pull request #3308 from lbryio/reflect_more
Don't set stream as reflected until reflector says it doesn't need any blob
2021-05-27 19:13:23 -04:00
Victor Shyba 142d182bc1 if progress was made, retry without a delay 2021-05-27 18:24:58 -03:00
Victor Shyba 1437871d88 fix reflector client: only set completed when server says so 2021-05-27 18:24:58 -03:00
Victor Shyba 352bf69409 improve test 2021-05-27 18:24:58 -03:00
Victor Shyba 9bdf3d23e1 test bug 3296, failing 2021-05-27 18:24:58 -03:00
Victor Shyba be8ecfa707 sort keys so helper scripts can send blobs using send_request 2021-05-27 18:24:58 -03:00
Lex Berezhny 51da0d0259 v0.98.0 2021-05-26 09:23:19 -04:00
Alex Grin f55b78a994 Merge pull request #3306 from lbryio/fix-collectionUpdateWithReplace 2021-05-18 15:25:53 -04:00
Alex Grin e1a44c93f8 Merge branch 'master' into fix-collectionUpdateWithReplace 2021-05-18 15:25:40 -04:00
Alex Grin 07e7087a09 Merge pull request #3303 from keikari/patch-1
Minor fix suggestion for issue #3240
2021-05-18 15:23:56 -04:00
Alex Grin 2c79c7e2f6 Merge branch 'master' into patch-1 2021-05-18 15:23:08 -04:00
Victor Shyba 09f6637fe0 remove unused multiprocessin.Manager 2021-05-17 15:07:32 -03:00
Victor Shyba 3784db3308 test collections update with --replace 2021-05-15 03:27:33 -03:00
zeppi 2b950ff5dd fix bug in collection_update --replace 2021-05-15 03:27:33 -03:00
Alex Grin 09339c9cfb Merge pull request #3305 from lbryio/fix_migrator_tool
fix hub Elasticsearch sync/migrations tool for when the db exists already
2021-05-14 11:06:07 -04:00
Victor Shyba ccadd88af5 fix cache call 2021-05-13 22:40:21 -03:00
Victor Shyba cc02a0efc2 fix es migration bug, expand test case 2021-05-13 19:00:53 -03:00
Victor Shyba 43a1385b79 test sync helper 2021-05-13 19:00:53 -03:00
Victor Shyba 5101464e3b add integration tests command on install.md 2021-05-13 19:00:36 -03:00
Victor Shyba 3d71478d38 update install.md with ES instructions 2021-05-13 19:00:36 -03:00
Victor Shyba 4989ed445e add ES to makefile 2021-05-13 19:00:36 -03:00
keikari d9413039ec Fix suggestion for issue #3240
L135: If `getattr()` returns `None`, use `""` instead to avoid error in issue #3240
2021-05-12 18:30:38 +03:00
Jack Robison eba0c9be34 fix typo 2021-05-07 16:51:19 -04:00
Jack Robison 48c9e9f3cc Merge pull request #3294 from lbryio/versioned-es-search-index
add versioning to ES search index and automate resync on version bumps
2021-05-07 15:38:21 -04:00
Jack Robison 81ebde88db resync ES search index on version bumps
-bump ES search index to version 1
2021-05-07 14:36:53 -04:00
Jack Robison 79ced9d0f8 Merge pull request #3262 from lbryio/channel_repost_has_source
Fix bug for `has_source=True` hiding channel reposts
2021-05-07 14:36:04 -04:00
Victor Shyba a4058b84ce clean out unused sharding 2021-05-07 15:03:37 -03:00
Victor Shyba 7bf211a52b apply reposted_claim_type on es sync 2021-05-07 15:03:37 -03:00
Victor Shyba d5f722792f fix and test has_source for channel reposts 2021-05-07 15:03:37 -03:00
Victor Shyba 0f02906c9b fix has_source for reposted channels 2021-05-07 15:03:37 -03:00
Victor Shyba 9582e228b1 assert instead of sleep 2021-05-07 15:02:31 -03:00
Victor Shyba 45f20431f9 update tests from the removed feed 2021-05-07 15:02:31 -03:00
Victor Shyba 7554e6d7f9 remove dead code 2021-05-07 15:02:31 -03:00
Victor Shyba cb8f26f177 remove broken feed 2021-05-07 15:02:31 -03:00
Jack Robison b5dfce7861 Revert "finished switch from using hash # in URLs to colon :"
This reverts commit 888aa558
2021-05-07 11:31:28 -04:00
Jack Robison 2ca5a65544 Revert "FindShortestID updated"
This reverts commit 8f04a50c
2021-05-07 11:30:31 -04:00
Jack Robison 17deb136db Revert "StreamCommands"
This reverts commit 2a8ccb06
2021-05-07 11:29:45 -04:00
Jack Robison 8c9710c76c Merge pull request #3293 from lbryio/fix-block-processor-crash-invalid-fee
fix invalid claim fees breaking the block processor
2021-05-07 10:03:40 -04:00
Jack Robison 32f7ecb261 fix invalid claim fees breaking the block processor 2021-05-06 11:18:58 -04:00
Victor Shyba fb77fde710 for debug, it is always whole page 2021-05-04 22:22:07 -03:00
Victor Shyba 3c67bb90d7 don't fail when a single one go on maintenance and set completion event regardless of failures 2021-05-04 22:22:07 -03:00
Victor Shyba dabb168853 dont log full exceptions on simple connection errors 2021-05-04 22:22:07 -03:00
Victor Shyba 45e5b3b219 dont log full pages 2021-05-04 22:22:07 -03:00
Alex Grin a6b7469923 Update README.md 2021-05-03 18:04:29 -04:00
Jack Robison cb5dab3033 Merge pull request #3285 from lbryio/restrict-udp-source
Restrict udp sources, add `ALLOW_LAN_UDP` hub setting
2021-04-29 10:19:32 -04:00
Jack Robison 21d0038ff2 add timestamps to hub log 2021-04-28 16:47:00 -04:00
Jack Robison c094d8f2e8 add ALLOW_LAN_UDP hub setting 2021-04-28 16:47:00 -04:00
Jack Robison c465d6a6c2 ignore udp packets with low source ports 2021-04-28 16:47:00 -04:00
Lex Berezhny 73d35bc985 v0.97.0 2021-04-28 16:23:46 -04:00
Lex Berezhny 2a8ccb065b StreamCommands 2021-04-28 16:21:01 -04:00
Lex Berezhny 8f04a50ce1 FindShortestID updated 2021-04-28 16:21:01 -04:00
Lex Berezhny 888aa5586b finished switch from using hash # in URLs to colon : 2021-04-28 16:21:01 -04:00
Lex Berezhny 99f56f5d22 v0.96.0 2021-04-28 15:26:58 -04:00
Jack Robison ad6281090d Merge pull request #3275 from lbryio/search_caching_issues
add caching to "search ahead" code and invalidate short_url cache on every block
2021-04-28 14:14:29 -04:00
Victor Shyba f0d334d3e2 refactor from review 2021-04-28 13:28:38 -03:00
Victor Shyba 5f829b048f use separator to avoid cache key conflicts 2021-04-27 22:57:04 -03:00
Victor Shyba 1a961e66ff invalidate short_id cache on new block 2021-04-27 22:57:04 -03:00
Victor Shyba fdb0e22656 cache search_ahead 2021-04-27 22:57:04 -03:00
Jack Robison 132ee1915f Merge pull request #3283 from lbryio/fix_multiprocessing_db
fix multiprocessing support on client db
2021-04-27 16:46:28 -04:00
Victor Shyba 44bf4f3c8f fix if statement from always evaluating a string 2021-04-27 17:10:04 -03:00
Alex Grintsvayg 6237767d5a Merge branch 'make-test'
* make-test:
  run tests using make
2021-04-23 15:26:26 -04:00
Alex Grintsvayg dec9d96417 run tests using make 2021-04-23 15:25:40 -04:00
Lex Berezhny b167c87267 v0.95.0 2021-04-23 14:55:38 -04:00
Lex Berezhny 2280fe8e8e default has_source to 1 2021-04-23 14:54:51 -04:00
Lex Berezhny 575d6dcd2d migration specifically for upgrading from client db v1.5 to v1.6 2021-04-23 14:54:51 -04:00
Lex Berezhny f729490c6b pending claims ordered towards top in claim_list 2021-04-23 11:00:58 -04:00
Lex Berezhny b32124cdd6 regenerate docs 2021-04-23 10:24:48 -04:00
Lex Berezhny 3d4321ee38 added --has_source/--has_no_source filters to claim_list 2021-04-23 10:24:48 -04:00
Alex Grintsvayg 85034b382e Revert "run tests using make"
This reverts commit 77a51d1ad4.
2021-04-21 11:41:16 -04:00
Alex Grintsvayg 77a51d1ad4 run tests using make 2021-04-20 15:41:09 -04:00
Alex Grin 33e0cdc2d7 Update docker-compose-wallet-server.yml 2021-04-16 11:58:02 -04:00
Alex Grin 6519faa2fe Update docker-compose-wallet-server.yml 2021-04-16 11:53:16 -04:00
Lex Berezhny 5e3a234cbe v0.94.1 2021-04-16 11:18:24 -04:00
Lex Berezhny e54c31d2d5 fix bug in how reserved balance is calculated 2021-04-16 11:17:51 -04:00
Alex Grin 66c0537251 Create ossar-analysis.yml 2021-04-15 15:24:26 -04:00
Alex Grin ac58516593 Create codeql-analysis.yml 2021-04-15 15:22:57 -04:00
Alex Grin c3da6322b5 Create SECURITY.md 2021-04-15 15:21:17 -04:00
130 changed files with 3873 additions and 3811 deletions

No files matched your search

+166 -59
View File
@@ -1,5 +1,6 @@
name: ci
on: pull_request
on: ["push", "pull_request"]
jobs:
lint:
@@ -10,58 +11,18 @@ jobs:
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- run: make install tools
- name: extract pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
- run: pip install --user --upgrade pip wheel
- run: pip install -e .[torrent,lint]
- run: make lint
tests-unit:
name: "tests / unit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- run: make install tools
- working-directory: lbry
env:
HOME: /tmp
run: coverage run -p --source=lbry -m unittest discover -vv tests.unit
tests-integration:
name: "tests / integration"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- datanetwork
- blockchain
- other
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.6.0
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- if: matrix.test == 'other'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ffmpeg
- run: pip install tox-travis
- run: tox -e ${{ matrix.test }}
build:
needs: ["lint", "tests-unit", "tests-integration"]
name: "build"
strategy:
matrix:
os:
@@ -74,22 +35,168 @@ jobs:
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Setup
- name: set pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: extract pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
- id: os-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ runner.os }}
- run: pip install --user --upgrade pip wheel
- if: startsWith(runner.os, 'linux')
run: pip install -e .[torrent,test]
- if: startsWith(runner.os, 'linux')
env:
HOME: /tmp
run: make test-unit-coverage
- if: startsWith(runner.os, 'linux') != true
run: pip install -e .[test]
- if: startsWith(runner.os, 'linux') != true
env:
HOME: /tmp
run: coverage run --source=lbry -m unittest tests/unit/test_conf.py
- name: submit coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: tests-unit-${{ steps.os-name.outputs.lowercase }}
COVERALLS_PARALLEL: true
run: |
pip install pyinstaller
pip install -e .
# https://stackoverflow.com/a/61693590
# https://github.com/pypa/setuptools/issues/1963
pip install --upgrade 'setuptools<45.0.0'
- if: startsWith(matrix.os, 'windows') == false
pip install coveralls
coveralls --service=github
tests-integration:
name: "tests / integration"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- datanetwork
- blockchain
- blockchain_legacy_search
- other
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.6.0
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- if: matrix.test == 'other'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ffmpeg
- name: extract pip cache
uses: actions/cache@v2
with:
path: ./.tox
key: tox-integration-${{ matrix.test }}-${{ hashFiles('setup.py') }}
restore-keys: txo-integration-${{ matrix.test }}-
- run: pip install tox coverage coveralls
- run: tox -e ${{ matrix.test }}
- name: submit coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: tests-integration-${{ matrix.test }}
COVERALLS_PARALLEL: true
run: |
coverage combine tests
coveralls --service=github
coverage:
needs: ["tests-unit", "tests-integration"]
runs-on: ubuntu-latest
steps:
- name: finalize coverage report submission
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install coveralls
coveralls --service=github --finish
build:
needs: ["lint", "tests-unit", "tests-integration"]
name: "build / binary"
strategy:
matrix:
os:
- ubuntu-18.04
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- id: os-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ runner.os }}
- name: set pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: extract pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: ${{ runner.os }}-pip-
- run: pip install pyinstaller==4.4
- run: pip install -e .
- if: startsWith(github.ref, 'refs/tags/v')
run: python docker/set_build.py
- if: startsWith(runner.os, 'linux') || startsWith(runner.os, 'mac')
name: Build & Run (Unix)
run: |
pyinstaller --onefile --name lbrynet lbry/extras/cli.py
chmod +x dist/lbrynet
dist/lbrynet --version
- if: startsWith(matrix.os, 'windows')
- if: startsWith(runner.os, 'windows')
name: Build & Run (Windows)
run: |
pip install pywin32
pip install pywin32==301
pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico --onefile --name lbrynet lbry/extras/cli.py
dist/lbrynet.exe --version
- uses: actions/upload-artifact@v2
with:
name: lbrynet-${{ steps.os-name.outputs.lowercase }}
path: dist/
release:
name: "release"
if: startsWith(github.ref, 'refs/tags/v')
needs: ["build"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@v2
- name: upload binaries
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_API_TOKEN }}
run: |
pip install githubrelease
chmod +x lbrynet-macos/lbrynet
chmod +x lbrynet-linux/lbrynet
zip --junk-paths lbrynet-mac.zip lbrynet-macos/lbrynet
zip --junk-paths lbrynet-linux.zip lbrynet-linux/lbrynet
zip --junk-paths lbrynet-windows.zip lbrynet-windows/lbrynet.exe
ls -lh
githubrelease release lbryio/lbry-sdk info ${GITHUB_REF#refs/tags/}
githubrelease asset lbryio/lbry-sdk upload ${GITHUB_REF#refs/tags/} \
lbrynet-mac.zip lbrynet-linux.zip lbrynet-windows.zip
githubrelease release lbryio/lbry-sdk publish ${GITHUB_REF#refs/tags/}
+22
View File
@@ -0,0 +1,22 @@
name: slack
on:
release:
types: [published]
jobs:
release:
name: "slack notification"
runs-on: ubuntu-latest
steps:
- uses: LoveToKnow/slackify-markdown-action@v1.0.0
id: markdown
with:
text: "There is a new SDK release: ${{github.event.release.html_url}}\n${{ github.event.release.body }}"
- uses: slackapi/slack-github-action@v1.14.0
env:
CHANGELOG: '<!channel> ${{ steps.markdown.outputs.text }}'
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_BOT_WEBHOOK }}
with:
payload: '{"type": "mrkdwn", "text": ${{ toJSON(env.CHANGELOG) }} }'
-220
View File
@@ -1,220 +0,0 @@
default:
image: python:3.7
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
variables:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
#cache:
# directories:
# - $HOME/venv
# - $HOME/.cache/pip
# - $HOME/Library/Caches/pip
# - $HOME/Library/Caches/Homebrew
# - $TRAVIS_BUILD_DIR/.tox
stages:
- test
- build
- assets
- release
.tagged:
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/'
when: on_success
test:lint:
stage: test
script:
- make install tools
- make lint
test:unit:
stage: test
script:
- make install tools
- HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit
test:datanetwork-integration:
stage: test
script:
- pip install tox-travis
- ELASTIC_HOST=elasticsearch tox -e datanetwork --recreate
test:blockchain-integration:
stage: test
script:
- curl "http://elasticsearch:9200/_cat/health"
- pip install tox-travis
- ELASTIC_HOST=elasticsearch tox -e blockchain
test:other-integration:
stage: test
script:
- apt-get update
- apt-get install -y --no-install-recommends ffmpeg
- pip install tox-travis
- ELASTIC_HOST=elasticsearch tox -e other
test:json-api:
stage: test
script:
- make install tools
- ELASTIC_HOST=elasticsearch HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
.build:
stage: build
artifacts:
expire_in: 1 day
paths:
- lbrynet-${OS}.zip
script:
- pip install --upgrade 'setuptools<45.0.0'
- pip install pyinstaller
- pip install -e .
- python3.7 docker/set_build.py # must come after lbry is installed because it imports lbry
- pyinstaller --onefile --name lbrynet lbry/extras/cli.py
- chmod +x dist/lbrynet
- zip --junk-paths ${CI_PROJECT_DIR}/lbrynet-${OS}.zip dist/lbrynet # gitlab expects artifacts to be in $CI_PROJECT_DIR
- openssl dgst -sha256 ${CI_PROJECT_DIR}/lbrynet-${OS}.zip | egrep -o [0-9a-f]+$ # get sha256 of asset. works on mac and ubuntu
- dist/lbrynet --version
build:linux:
extends: .build
image: ubuntu:16.04
variables:
OS: linux
before_script:
- apt-get update
- apt-get install -y --no-install-recommends software-properties-common zip curl build-essential
- add-apt-repository -y ppa:deadsnakes/ppa
- apt-get update
- apt-get install -y --no-install-recommends python3.7-dev
- python3.7 <(curl -q https://bootstrap.pypa.io/get-pip.py) # make sure we get pip with python3.7
- pip install lbry-libtorrent
build:mac:
extends: .build
tags: [macos] # makes gitlab use the mac runner
variables:
OS: mac
GIT_DEPTH: 5
VENV: /tmp/gitlab-lbry-sdk-venv
before_script:
# - brew upgrade python || true
- python3 --version | grep -q '^Python 3\.7\.' # dont upgrade python on every run. just make sure we're on the right Python
# - pip3 install --user --upgrade pip virtualenv
- pip3 --version | grep -q '\(python 3\.7\)'
- virtualenv --python=python3.7 "${VENV}"
- source "${VENV}/bin/activate"
after_script:
- rm -rf "${VENV}"
build:windows:
extends: .build
tags: [windows] # makes gitlab use the windows runner
variables:
OS: windows
GIT_DEPTH: 5
before_script:
- ./docker/install_choco.ps1
- 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
- pip install pip==19.3.1; $true # $true ignores errors. need this to get the correct coincurve wheel. see commit notes for details.
after_script:
- rmdir -Recurse venv
script:
- pip install --upgrade 'setuptools<45.0.0'
- pip install pyinstaller==3.5
- pip install -e .
- python docker/set_build.py # must come after lbry is installed because it imports lbry
- pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico -F -n lbrynet lbry/extras/cli.py
- 7z a -tzip $env:CI_PROJECT_DIR/lbrynet-${OS}.zip ./dist/lbrynet.exe
- checksum --type=sha256 --file=$env:CI_PROJECT_DIR/lbrynet-${OS}.zip
- dist/lbrynet.exe --version
# s3 = upload asset to s3 (build.lbry.io)
.s3:
stage: assets
variables:
GIT_STRATEGY: none
script:
- "[ -f lbrynet-${OS}.zip ]" # check that asset exists before trying to upload
- pip install awscli
- S3_PATH="daemon/gitlab-build-${CI_PIPELINE_ID}_commit-${CI_COMMIT_SHA:0:7}$( if [ ! -z ${CI_COMMIT_TAG} ]; then echo _tag-${CI_COMMIT_TAG}; else echo _branch-${CI_COMMIT_REF_NAME}; fi )"
- AWS_ACCESS_KEY_ID=${ARTIFACTS_KEY} AWS_SECRET_ACCESS_KEY=${ARTIFACTS_SECRET} AWS_REGION=${ARTIFACTS_REGION}
aws s3 cp lbrynet-${OS}.zip s3://${ARTIFACTS_BUCKET}/${S3_PATH}/lbrynet-${OS}.zip
s3:linux:
extends: .s3
variables: {OS: linux}
needs: ["build:linux"]
s3:mac:
extends: .s3
variables: {OS: mac}
needs: ["build:mac"]
s3:windows:
extends: .s3
variables: {OS: windows}
needs: ["build:windows"]
# github = upload assets to github when there's a tagged release
.github:
extends: .tagged
stage: assets
variables:
GIT_STRATEGY: none
script:
- "[ -f lbrynet-${OS}.zip ]" # check that asset exists before trying to upload. githubrelease won't error if its missing
- pip install githubrelease
- githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} asset lbryio/lbry-sdk upload ${CI_COMMIT_TAG} lbrynet-${OS}.zip
github:linux:
extends: .github
variables: {OS: linux}
needs: ["build:linux"]
github:mac:
extends: .github
variables: {OS: mac}
needs: ["build:mac"]
github:windows:
extends: .github
variables: {OS: windows}
needs: ["build:windows"]
publish:
extends: .tagged
stage: release
variables:
GIT_STRATEGY: none
script:
- pip install githubrelease
- githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} release lbryio/lbry-sdk publish ${CI_COMMIT_TAG}
- >
curl -X POST -H 'Content-type: application/json' --data '{"text":"<!channel> There is a new SDK release: https://github.com/lbryio/lbry-sdk/releases/tag/'"${CI_COMMIT_TAG}"'\n'"$(curl -s "https://api.github.com/repos/lbryio/lbry-sdk/releases/tags/${CI_COMMIT_TAG}" | egrep '\w*\"body\":' | cut -d':' -f 2- | tail -c +3 | head -c -2)"'", "channel":"tech"}' "$(echo ${SLACK_WEBHOOK_URL_BASE64} | base64 -d)"
+113 -44
View File
@@ -9,20 +9,29 @@ Here's a video walkthrough of this setup, which is itself hosted by the LBRY net
## Prerequisites
Running `lbrynet` from source requires Python 3.7 or higher. Get the installer for your OS [here](https://www.python.org/downloads/release/python-370/).
Running `lbrynet` from source requires Python 3.7. Get the installer for your OS [here](https://www.python.org/downloads/release/python-370/).
After installing python 3, you'll need to install some additional libraries depending on your operating system.
After installing Python 3.7, you'll need to install some additional libraries depending on your operating system.
Because of [issue #2769](https://github.com/lbryio/lbry-sdk/issues/2769)
at the moment the `lbrynet` daemon will only work correctly with Python 3.7.
If Python 3.8+ is used, the daemon will start but the RPC server
may not accept messages, returning the following:
```
Could not connect to daemon. Are you sure it's running?
```
### macOS
macOS users will need to install [xcode command line tools](https://developer.xamarin.com/guides/testcloud/calabash/configuring/osx/install-xcode-command-line-tools/) and [homebrew](http://brew.sh/).
These environment variables also need to be set:
1. PYTHONUNBUFFERED=1
2. EVENT_NOKQUEUE=1
```
PYTHONUNBUFFERED=1
EVENT_NOKQUEUE=1
```
Remaining dependencies can then be installed by running:
```
brew install python protobuf
```
@@ -31,14 +40,17 @@ Assistance installing Python3: https://docs.python-guide.org/starting/install3/o
### Linux
On Ubuntu (16.04 minimum, we recommend 18.04), install the following:
On Ubuntu (we recommend 18.04 or 20.04), install the following:
```
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install build-essential python3.7 python3.7-dev git python3.7-venv libssl-dev python-protobuf
```
The [deadsnakes PPA](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa) provides Python 3.7
for those Ubuntu distributions that no longer have it in their
official repositories.
On Raspbian, you will also need to install `python-pyparsing`.
If you're running another Linux distro, install the equivalent of the above packages for your system.
@@ -47,62 +59,119 @@ If you're running another Linux distro, install the equivalent of the above pack
### Linux/Mac
To install on Linux/Mac:
Clone the repository:
```bash
git clone https://github.com/lbryio/lbry-sdk.git
cd lbry-sdk
```
```
Clone the repository:
$ git clone https://github.com/lbryio/lbry-sdk.git
$ cd lbry-sdk
Create a Python virtual environment for lbry-sdk:
```bash
python3.7 -m venv lbry-venv
```
Create a Python virtual environment for lbry-sdk:
$ python3.7 -m venv lbry-venv
Activating lbry-sdk virtual environment:
$ source lbry-venv/bin/activate
Make sure you're on Python 3.7+ (as the default Python in virtual environment):
$ python --version
Activate virtual environment:
```bash
source lbry-venv/bin/activate
```
Install packages:
$ make install
Make sure you're on Python 3.7+ as default in the virtual environment:
```bash
python --version
```
If you are on Linux and using PyCharm, generates initial configs:
$ make idea
```
Install packages:
```bash
make install
```
To verify your installation, `which lbrynet` should return a path inside of the `lbry-venv` folder created by the `python3.7 -m venv lbry-venv` command.
If you are on Linux and using PyCharm, generates initial configs:
```bash
make idea
```
To verify your installation, `which lbrynet` should return a path inside
of the `lbry-venv` folder.
```bash
(lbry-venv) $ which lbrynet
/opt/lbry-sdk/lbry-venv/bin/lbrynet
```
To exit the virtual environment simply use the command `deactivate`.
### Windows
To install on Windows:
Clone the repository:
```bash
git clone https://github.com/lbryio/lbry-sdk.git
cd lbry-sdk
```
```
Clone the repository:
> git clone https://github.com/lbryio/lbry-sdk.git
> cd lbry-sdk
Create a Python virtual environment for lbry-sdk:
```bash
python -m venv lbry-venv
```
Create a Python virtual environment for lbry-sdk:
> python -m venv lbry-venv
Activate virtual environment:
```bash
lbry-venv\Scripts\activate
```
Activating lbry-sdk virtual environment:
> lbry-venv\Scripts\activate
Install packages:
> pip install -e .
```
Install packages:
```bash
pip install -e .
```
## Run the tests
### Elasticsearch
To run the unit tests from the repo directory:
For running integration tests, Elasticsearch is required to be available at localhost:9200/
```
python -m unittest discover tests.unit
```
The easiest way to start it is using docker with:
```bash
make elastic-docker
```
Alternative installation methods are available [at Elasticsearch website](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html).
To run the unit and integration tests from the repo directory:
```
python -m unittest discover tests.unit
python -m unittest discover tests.integration
```
## Usage
To start the API server:
`lbrynet start`
```
lbrynet start
```
Whenever the code inside [lbry-sdk/lbry](./lbry)
is modified we should run `make install` to recompile the `lbrynet`
executable with the newest code.
## Development
When developing, remember to enter the environment,
and if you wish start the server interactively.
```bash
$ source lbry-venv/bin/activate
(lbry-venv) $ python lbry/extras/cli.py start
```
Parameters can be passed in the same way.
```bash
(lbry-venv) $ python lbry/extras/cli.py wallet balance
```
If a Python debugger (`pdb` or `ipdb`) is installed we can also start it
in this way, set up break points, and step through the code.
```bash
(lbry-venv) $ pip install ipdb
(lbry-venv) $ ipdb lbry/extras/cli.py
```
Happy hacking!
+13 -11
View File
@@ -1,24 +1,26 @@
.PHONY: install tools lint test idea
.PHONY: install tools lint test test-unit test-unit-coverage test-integration idea
install:
pip install https://s3.amazonaws.com/files.lbry.io/python_libtorrent-1.2.4-py3-none-any.whl
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=2500000" pip install -U https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \
--global-option=fetch \
--global-option=--version --global-option=3.30.1 --global-option=--all \
--global-option=build --global-option=--enable --global-option=fts5
pip install -e .
tools:
pip install mypy==0.701 pylint==2.4.4
pip install coverage astroid pylint
lint:
pylint --rcfile=setup.cfg lbry
#mypy --ignore-missing-imports lbry
test:
test: test-unit test-integration
test-unit:
python -m unittest discover tests.unit
test-unit-coverage:
coverage run --source=lbry -m unittest discover -vv tests.unit
test-integration:
tox
idea:
mkdir -p .idea
cp -r scripts/idea/* .idea
elastic-docker:
docker run -d -v lbryhub:/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 -e"ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.12.1
+3 -3
View File
@@ -1,10 +1,10 @@
# <img src="https://raw.githubusercontent.com/lbryio/lbry-sdk/master/lbry.png" alt="LBRY" width="48" height="36" /> LBRY SDK [![Gitlab CI Badge](https://ci.lbry.tech/lbry/lbry-sdk/badges/master/pipeline.svg)](https://ci.lbry.tech/lbry/lbry-sdk)
# <img src="https://raw.githubusercontent.com/lbryio/lbry-sdk/master/lbry.png" alt="LBRY" width="48" height="36" /> LBRY SDK [![build](https://github.com/lbryio/lbry-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/lbryio/lbry-sdk/actions/workflows/main.yml) [![coverage](https://coveralls.io/repos/github/lbryio/lbry-sdk/badge.svg)](https://coveralls.io/github/lbryio/lbry-sdk)
LBRY is a decentralized peer-to-peer protocol for publishing and accessing digital content. It utilizes the [LBRY blockchain](https://github.com/lbryio/lbrycrd) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, rights and access rules. LBRY also provides a data network that consists of peers (seeders) uploading and downloading data from other peers, possibly in exchange for payments, as well as a distributed hash table used by peers to discover other peers.
LBRY SDK for Python is currently the most fully featured implementation of the LBRY Network protocols and includes many useful components and tools for building decentralized applications. Primary features and components include:
* Built on Python 3.7+ and `asyncio`.
* Built on Python 3.7 and `asyncio`.
* Kademlia DHT (Distributed Hash Table) implementation for finding peers to download from and announcing to peers what we have to host ([lbry.dht](https://github.com/lbryio/lbry-sdk/tree/master/lbry/dht)).
* Blob exchange protocol for transferring encrypted blobs of content and negotiating payments ([lbry.blob_exchange](https://github.com/lbryio/lbry-sdk/tree/master/lbry/blob_exchange)).
* Protobuf schema for encoding and decoding metadata stored on the blockchain ([lbry.schema](https://github.com/lbryio/lbry-sdk/tree/master/lbry/schema)).
@@ -41,7 +41,7 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
## Security
We take security seriously. Please contact security@lbry.com regarding any security issues. [Our GPG key is here](https://lbry.com/faq/gpg-key) if you need it.
We take security seriously. Please contact security@lbry.com regarding any security issues. [Our PGP key is here](https://lbry.com/faq/pgp-key) if you need it.
## Contact
+9
View File
@@ -0,0 +1,9 @@
# Security Policy
## Supported Versions
While we are not at v1.0 yet, only the latest release will be supported.
## Reporting a Vulnerability
See https://lbry.com/faq/security
+38
View File
@@ -0,0 +1,38 @@
FROM debian:10-slim
ARG user=lbry
ARG projects_dir=/home/$user
ARG DOCKER_TAG
ARG DOCKER_COMMIT=docker
ENV DOCKER_TAG=$DOCKER_TAG DOCKER_COMMIT=$DOCKER_COMMIT
RUN apt-get update && \
apt-get -y --no-install-recommends install \
wget \
automake libtool \
tar unzip \
build-essential \
pkg-config \
libleveldb-dev \
python3.7 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g 999 $user && useradd -m -u 999 -g $user $user
COPY . $projects_dir
RUN chown -R $user:$user $projects_dir
USER $user
WORKDIR $projects_dir
RUN make install
RUN python3 docker/set_build.py
RUN rm ~/.cache -rf
ENTRYPOINT ["python3", "scripts/dht_node.py"]
+1
View File
@@ -13,6 +13,7 @@ RUN apt-get update && \
wget \
tar unzip \
build-essential \
automake libtool \
pkg-config \
libleveldb-dev \
python3.7 \
+45
View File
@@ -0,0 +1,45 @@
FROM debian:10-slim
ARG user=lbry
ARG downloads_dir=/database
ARG projects_dir=/home/$user
ARG DOCKER_TAG
ARG DOCKER_COMMIT=docker
ENV DOCKER_TAG=$DOCKER_TAG DOCKER_COMMIT=$DOCKER_COMMIT
RUN apt-get update && \
apt-get -y --no-install-recommends install \
wget \
automake libtool \
tar unzip \
build-essential \
pkg-config \
libleveldb-dev \
python3.7 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g 999 $user && useradd -m -u 999 -g $user $user
RUN mkdir -p $downloads_dir
RUN chown -R $user:$user $downloads_dir
COPY . $projects_dir
RUN chown -R $user:$user $projects_dir
USER $user
WORKDIR $projects_dir
RUN pip install uvloop
RUN make install
RUN python3 docker/set_build.py
RUN rm ~/.cache -rf
# entry point
VOLUME $downloads_dir
COPY ./docker/webconf.yaml /webconf.yaml
ENTRYPOINT ["/home/lbry/.local/bin/lbrynet", "start", "--config=/webconf.yaml"]
+9
View File
@@ -0,0 +1,9 @@
### How to run with docker-compose
1. Edit config file and after that fix permissions with
```
sudo chown -R 999:999 webconf.yaml
```
2. Start SDK with
```
docker-compose up -d
```
+6 -1
View File
@@ -16,11 +16,16 @@ services:
- "2112:2112" # uncomment to enable prometheus
volumes:
- "wallet_server:/database"
env_file: [/home/lbry/wallet-server-env]
environment:
- DAEMON_URL=http://lbry:lbry@127.0.0.1:9245
- TCP_PORT=50001
- PROMETHEUS_PORT=2112
- QUERY_TIMEOUT_MS=3000 # how long search queries allowed to run before cancelling, in milliseconds
- TRENDING_ALGORITHMS=variable_decay
- MAX_SEND=10000000000000 # deprecated. leave it high until its removed
- MAX_SUBS=1000000000000 # deprecated. leave it high until its removed
- FILTERING_CHANNEL_IDS=770bd7ecba84fd2f7607fb15aedd2b172c2e153f 95e5db68a3101df19763f3a5182e4b12ba393ee8
- BLOCKING_CHANNEL_IDS=dd687b357950f6f271999971f43c785e8067c3a9 06871aa438032244202840ec59a469b303257cad b4a2528f436eca1bf3bf3e10ff3f98c57bd6c4c6 e4e230b131082f6b10c8f7994bbb83f29e8e6fb9
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: es01
+9
View File
@@ -0,0 +1,9 @@
version: '3'
services:
websdk:
image: vshyba/websdk
ports:
- '5279:5279'
- '5280:5280'
volumes:
- ./webconf.yaml:/webconf.yaml
+5 -3
View File
@@ -20,7 +20,7 @@ def _check_and_set(d: dict, key: str, value: str):
def main():
build_info = {item: build_info_mod.__dict__[item] for item in dir(build_info_mod) if not item.startswith("__")}
commit_hash = os.getenv('DOCKER_COMMIT', os.getenv('CI_COMMIT_SHA', os.getenv('TRAVIS_COMMIT')))
commit_hash = os.getenv('DOCKER_COMMIT', os.getenv('GITHUB_SHA'))
if commit_hash is None:
raise ValueError("Commit hash not found in env vars")
_check_and_set(build_info, "COMMIT_HASH", commit_hash[:6])
@@ -30,8 +30,10 @@ def main():
_check_and_set(build_info, "DOCKER_TAG", docker_tag)
_check_and_set(build_info, "BUILD", "docker")
else:
ci_tag = os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG'))
_check_and_set(build_info, "BUILD", "release" if re.match(r'v\d+\.\d+\.\d+$', str(ci_tag)) else "qa")
if re.match(r'refs/tags/v\d+\.\d+\.\d+$', str(os.getenv('GITHUB_REF'))):
_check_and_set(build_info, "BUILD", "release")
else:
_check_and_set(build_info, "BUILD", "qa")
log.debug("build info: %s", ", ".join([f"{k}={v}" for k, v in build_info.items()]))
with open(build_info_mod.__file__, 'w') as f:
+9
View File
@@ -0,0 +1,9 @@
allowed_origin: "*"
max_key_fee: "0.0 USD"
save_files: false
save_blobs: false
streaming_server: "0.0.0.0:5280"
api: "0.0.0.0:5279"
data_dir: /tmp
download_dir: /tmp
wallet_dir: /tmp
+152 -488
View File
@@ -54,10 +54,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1618443025,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp8wvxwurx\",\n \"download_path\": \"/tmp/tmp8wvxwurx/tmpoegrqi7y\",\n \"file_name\": \"tmpoegrqi7y\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#138446450b727414a2b9e9529341dc621a9e5470\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#138446450b727414a2b9e9529341dc621a9e5470",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#138446450b727414a2b9e9529341dc621a9e5470\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1630567653,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpbzob8k7r\",\n \"download_path\": \"/tmp/tmpbzob8k7r/tmpb146pf1q\",\n \"file_name\": \"tmpb146pf1q\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5ff5a0e1491f8a7b1ccba093b2963f9e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0170f30befb340325fd001b041c188e57c598d5f81dd671a785932239cd26885251126637352f3825ab44b6e2c2cef378b182f870b1f9050035fac0bb1956acf02bf696de46bc2526f2881f5b98c371975290eb8b00a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"77bf955798d4e67da2f877931216008c79f97a5788167e8bbb239b5f94ff13508c40c18604f29220efa7c79756f1a2ff\",\n \"stream_name\": \"tmpb146pf1q\",\n \"streaming_url\": \"http://localhost:5280/stream/5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"suggested_file_name\": \"tmpb146pf1q\",\n \"timestamp\": 1630567677,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -268,10 +268,10 @@
"examples": [
{
"title": "Publish a file",
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpjvdrb9mb\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpjvdrb9mb",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpjvdrb9mb\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000190f8282e51282b9c895496217ad872148bf766a73fd648aa8d0a3add68e37341010000006b483045022100ccf0fdf9740f4a201a447b3214b0cfdcdc8e7e002633852857d94eb3fe5e04ee022033466c5244db5dd86ce8ac4c217bdb91652bf596464a188b2512d2dc3fdad25c0121031bdedfa580a6ef204b6ed862bc1e2a7486dcfc3025fdea75b1d3ccb994c2b8d7ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706a76647262396d62180b22186170706c69636174696f6e2f6f637465742d73747265616d3230401fede72bffe7bae03fadee9f71b02298d596c6196a113c188e88179e2cec9a3ff2eabc0728a1122fbcccda064bed056d7576a914a7d1b376546d5185ca8213893533d18fb8f2c38688ac54826311000000001976a914603cc8baf0e5a91a27af508232c3fda4fc2f0fdc88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgiHMZg93NhGBhT1gopuZd6ZHkrFbaaFq7\",\n \"amount\": \"3.941448\",\n \"confirmations\": 3,\n \"height\": 217,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvpJMNYgqeBTBymiPCJqTTX7ZDMXZecy5M\",\n \"amount\": \"1.0\",\n \"claim_id\": \"705c80f0b6f70f212e0053afce483e34b5c864f4\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"a-new-stream\",\n \"normalized_name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#705c80f0b6f70f212e0053afce483e34b5c864f4\",\n \"timestamp\": null,\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpjvdrb9mb\",\n \"sd_hash\": \"401fede72bffe7bae03fadee9f71b02298d596c6196a113c188e88179e2cec9a3ff2eabc0728a1122fbcccda064bed05\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpHoyphaL4UPPA2xyzukAcKBR9LX5MuxoU\",\n \"amount\": \"2.917341\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"3.941448\",\n \"total_output\": \"3.917341\",\n \"txid\": \"198eabac5730927f8b6da9511788e7e67b779c8576158e3e7ad46b2fd3a6c8f7\"\n }\n}"
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp03r7_9ca\", \"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/tmp03r7_9ca",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp03r7_9ca\", \"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\": \"0100000001b765c49b00e0a553b516a41e94bcf6c38abfc705ed63736cf0c0e561698f2454010000006b483045022100c4f1270fc5a84e8a6f0bffad6440aa1b23b90e83d970b6cc60cf2398b2c762ae0220120a1226520a2d66843caa3b7c0a1d2779a8e5a98d069274b1e5c0fd8cbf3b9101210260bd481afc7f3eb2632d36de0ce39e50886e0682a7acb658c5a091a8cffb6270ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70303372375f396361180b22186170706c69636174696f6e2f6f637465742d73747265616d3230f9b1769c0e89beda641ec305c1065103a5b9d4dbf8262813431628e9703a2fe7542bc00d4edae17cb51c902b63b019e16d7576a914cd674ff84ce88a3671d5d9a946f883497d50c3aa88ac54826311000000001976a91427cf3fd6f52023fbf8776551641cf0ca8c449f4788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtm2gHnthSQ2n61dnJSeZCd873eHByQQ8r\",\n \"amount\": \"3.941448\",\n \"confirmations\": 3,\n \"height\": 217,\n \"nout\": 1,\n \"timestamp\": 1630567677,\n \"txid\": \"54248f6961e5c0f06c7363ed05c7bf8ac3f6bc941ea416b553a5e0009bc465b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzF2aecxjjueNYMHUCipNAzZ7NNAtLv4Nc\",\n \"amount\": \"1.0\",\n \"claim_id\": \"75d6cf604b30fa292603bf2b3686d1bfd3f149cf\",\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#75d6cf604b30fa292603bf2b3686d1bfd3f149cf\",\n \"timestamp\": null,\n \"txid\": \"06c1465e2e68fda3d6efb5d6e209e07d3ee1dd2e3ad18d49bc926c3e241ff934\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp03r7_9ca\",\n \"sd_hash\": \"f9b1769c0e89beda641ec305c1065103a5b9d4dbf8262813431628e9703a2fe7542bc00d4edae17cb51c902b63b019e1\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mj9SvUTwe82GnSov4HupzJSK12zx8qVZcM\",\n \"amount\": \"2.917341\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"06c1465e2e68fda3d6efb5d6e209e07d3ee1dd2e3ad18d49bc926c3e241ff934\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"3.941448\",\n \"total_output\": \"3.917341\",\n \"txid\": \"06c1465e2e68fda3d6efb5d6e209e07d3ee1dd2e3ad18d49bc926c3e241ff934\"\n }\n}"
}
]
},
@@ -332,10 +332,10 @@
"examples": [
{
"title": "Resolve a claim",
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"include_sent_supports\": false, \"include_sent_tips\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#a38a77a9154b679070b083e842040d6fb6b10c8e\": {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#138446450b727414a2b9e9529341dc621a9e5470\"], \"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#138446450b727414a2b9e9529341dc621a9e5470",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#138446450b727414a2b9e9529341dc621a9e5470\"], \"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#138446450b727414a2b9e9529341dc621a9e5470\": {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8/astream#1\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1630567677,\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1630567676,\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"short_url\": \"lbry://@channel#8\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
}
]
},
@@ -357,7 +357,7 @@
"curl": "curl -d'{\"method\": \"status\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet status",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"status\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"max_incoming_mbs\": 0.0,\n \"max_outgoing_mbs\": 0.0,\n \"outgoing_bps\": {},\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"ffmpeg_status\": {\n \"analyze_audio_volume\": true,\n \"available\": true,\n \"which\": \"/usr/bin/ffmpeg\"\n },\n \"file_manager\": {\n \"managed_files\": 0\n },\n \"installation_id\": \"A4wihkSEkF2FPuxriMgtMqKs3YRMfKqBQECtBc7VqMbeQbdyzeYxvaGDKddocF3273\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\",\n \"libtorrent_component\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"file_manager\": true,\n \"wallet\": true,\n \"wallet_server_payments\": true\n },\n \"wallet\": {\n \"available_servers\": 1,\n \"best_blockhash\": \"c5c00ff4c8a99ada6f6131e1b9681b1e0f0352cfddae5e083e53c5a0f53b5632\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected\": \"localhost:50002\",\n \"connected_features\": {\n \"daily_fee\": \"0\",\n \"description\": \"\",\n \"donation_address\": \"\",\n \"genesis_hash\": \"6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556\",\n \"hash_function\": \"sha256\",\n \"hosts\": {},\n \"payment_address\": \"\",\n \"protocol_max\": \"0.99.0\",\n \"protocol_min\": \"0.54.0\",\n \"pruning\": null,\n \"server_version\": \"0.93.0\",\n \"trending_algorithm\": \"zscore\"\n },\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 1,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.009554634998494294,\n \"port\": 50002\n }\n ]\n },\n \"wallet_server_payments\": {\n \"max_fee\": \"0.0\",\n \"running\": false\n }\n }\n}"
"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 \"disk_space\": {\n \"running\": true,\n \"space_used\": \"0\"\n },\n \"ffmpeg_status\": {\n \"analyze_audio_volume\": true,\n \"available\": true,\n \"which\": \"/usr/bin/ffmpeg\"\n },\n \"file_manager\": {\n \"managed_files\": 0\n },\n \"installation_id\": \"sefddTD9i1NVkZqNcjEFbL6PRRGmBXUfdGe3he54UKrFjrLUepzqGwtVbY5rXhw2j\",\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 \"disk_space\": 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\": \"1af1c53a3386a4b30141b631129c83c7a6ae052e587fb3b8c717d603810600eb\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected\": \"localhost:50002\",\n \"connected_features\": {\n \"daily_fee\": \"0\",\n \"description\": \"\",\n \"donation_address\": \"\",\n \"genesis_hash\": \"6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556\",\n \"hash_function\": \"sha256\",\n \"hosts\": {},\n \"payment_address\": \"\",\n \"protocol_max\": \"0.199.0\",\n \"protocol_min\": \"0.54.0\",\n \"pruning\": null,\n \"server_version\": \"0.102.0\",\n \"trending_algorithm\": \"zscore\"\n },\n \"headers_synchronization_progress\": 100,\n \"known_servers\": 0,\n \"servers\": [\n {\n \"availability\": true,\n \"host\": \"localhost\",\n \"latency\": 0.004395185000248603,\n \"port\": 50002\n }\n ]\n },\n \"wallet_server_payments\": {\n \"max_fee\": \"0.0\",\n \"running\": false\n }\n }\n}"
}
]
},
@@ -379,7 +379,7 @@
"curl": "curl -d'{\"method\": \"version\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet version",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"version\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"GNOME\",\n \"distro\": {\n \"codename\": \"xenial\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"16.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"16\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.93.0\",\n \"os_release\": \"4.4.0-116-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.9\",\n \"version\": \"0.93.0\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"ubuntu:GNOME\",\n \"distro\": {\n \"codename\": \"focal\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"20.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"20\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.102.0\",\n \"os_release\": \"5.11.0-27-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-5.11.0-27-generic-x86_64-with-debian-bullseye-sid\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.10\",\n \"version\": \"0.102.0\"\n }\n}"
}
]
}
@@ -433,10 +433,10 @@
"examples": [
{
"title": "Add an account from seed",
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\", \"single_key\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"boost property since welcome armed arch goddess correct stick traffic pyramid glory\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\", \"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\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1630567643,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPduGkPH4FUHQh6vCVc5PuD2t5148Qf3ds9oJ2b6MpGzKK6BD8QVWeYfkFPAqrEvtFXckYM7p83XaQGyaCiHFAi3hdUnfScwC\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XNJYGviqsh4ofwiRmQaonLUrHaAi5KSFzHYoDVBQTUwBGMQsNMBh3cvEAmp6uotNWBXa2kUJ3GiFHLyWEc7k1YtDkF7jGQW\",\n \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\"\n }\n}"
}
]
},
@@ -474,9 +474,9 @@
},
{
"title": "Get balance for specific account by id",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).json()",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}).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}"
}
]
@@ -511,7 +511,7 @@
"curl": "curl -d'{\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account create \"generated account\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
"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\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1630567643,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPduGkPH4FUHQh6vCVc5PuD2t5148Qf3ds9oJ2b6MpGzKK6BD8QVWeYfkFPAqrEvtFXckYM7p83XaQGyaCiHFAi3hdUnfScwC\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XNJYGviqsh4ofwiRmQaonLUrHaAi5KSFzHYoDVBQTUwBGMQsNMBh3cvEAmp6uotNWBXa2kUJ3GiFHLyWEc7k1YtDkF7jGQW\",\n \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\"\n }\n}"
}
]
},
@@ -566,24 +566,24 @@
"examples": [
{
"title": "Transfer 2 LBC from default account to specific account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000013bdd51995f94e53f67e228fcd1671abb1408f323a4149d54990ab2bb66b82b5b000000006a47304402205c826a87146e31e4f46366aad0dc94b729e6c50fe2b751e9ff09699642386e6402205a75d8fc65091facf6c98d7b056dc8e4b54b8e7c1ed3c25c8ba14b7fa44166d401210308d5d163a7d95504d3ee87df25306049989b48497c979e23d683abaea3a01816ffffffff0200c2eb0b000000001976a914c18783f1248df509b6fc72dca4a0c2dddbb206d988ac90d7ae2f000000001976a914728be3452ae563fedebd08b7095928eed5f3dcb388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkchdhJsAo2aK3uixecvmdkqX7Rqfr6BVT\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 0,\n \"timestamp\": 1618443043,\n \"txid\": \"5b2bb866bbb20a99549d14a423f30814bb1a67d1fc28e2673fe5945f9951dd3b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"myAF3rPAzpACseXDsTu2DZJcJNM1xdginP\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqxcuVhZfQhpBDVBXzBAaqrrdXtRHhX64i\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e9f00a343869c4b4481e652594b6f8eae760887301e1567780c4270bd30019e2010000006a47304402202d1e959145e5dc3ec42ee86fb60722c03a001e8ec11d8394752bd1695ca5279f02202c714f3d40917898a862e9fae707e80666463e393c248ada114abe1f892f86e201210267f2c1b36491d9597d967005cf254782bb5887988776e7c7e21ab4377a2d7d87ffffffff0200c2eb0b000000001976a914a858150692010ad17ca54a100925effc55d0bee888ac90d7ae2f000000001976a914948a164bd4049fac04830906efab835cbd41ec5888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhJhtMKzFMs7iFKnGUHUQZryjXad4v3Fi5\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"nout\": 1,\n \"timestamp\": 1630567675,\n \"txid\": \"e21900d30b27c4807756e101738860e7eaf8b69425651e48b4c46938340af0e9\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mu4MiuQqZpiH9UyFtjjRrTsE8EQMxUfzqR\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\"\n }\n}"
},
{
"title": "Spread LBC between multiple addresses",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --from_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b756701c12d340a9e629170326519d14e8c21ce1f71a3ac312275a98589f5e69000000006a4730440220352d5a1a84da2f0ba43f10e0275d79061176e2e8eb6ff1a9ec0f1f75c3388f4e02204fe559bd804e8f6e22c7059e2f5c9ec557ad23507e099674886b4237f1070681012102f0febe86a60274f0c53d21b59790fb44d8cda492953420eefece6807d1363b5affffffff03c0687804000000001976a9145a13bc90a6697226abea3c52290a19ef02fd7b1788acc0687804000000001976a9145a13bc90a6697226abea3c52290a19ef02fd7b1788ac6cb9fa02000000001976a914bd9def831d0cfbc8dec17de12d81f60ed86661fd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myAF3rPAzpACseXDsTu2DZJcJNM1xdginP\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxoZCsGM4svQVmca79sRbnkvjEqRor6AQZ\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"from_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\" --from_account=\"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"from_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ac67ce245e739fbe0755c92794067402f3b866313b5d1bcfff8a8fd4963628f8000000006a473044022022f87e8de1c4cd7209976d90ec1de48c67558402144446f16b4de58992fd4180022013380abab11bfb497de0a304150ead3924403287f6c984e7c0350f7d303179ef012103f867e609a6ec6841b477b00656003f603c6789517b921c7723ffaa0ebcf586d5ffffffff03c0687804000000001976a914a858150692010ad17ca54a100925effc55d0bee888acc0687804000000001976a914a858150692010ad17ca54a100925effc55d0bee888ac6cb9fa02000000001976a9148d6dce2e91024e46798fac5a083b39d89ce36a5388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"nout\": 0,\n \"timestamp\": 1630567676,\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mtQm7WpSZYAC5Wmt31xWM6uvYd8QBtea2B\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\"\n }\n}"
},
{
"title": "Transfer all LBC to a specified account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000038a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1000000006a47304402206678fa31d1cd7651dce9afdfe08d1d98b394d86c2bc2fa64f1f681e76541c05902202061bb6e3bc5ecfa49c51ff3b03d1486f6713406e8b66a434619db6b3a320cdf012102b0407e165d3f51c33d16024b6d3e05812bfc013fc709d2e4dc8b44bfeed40ef6ffffffff8a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1010000006a4730440220475c3c75bfecb5feb8774fd2ef2bb5bbb1f3ebe04f00a5baa452c3f2a5e7ca3e022023e57d0ec657d8fe7747100058a59183ae3b45dcb88454837c5d3b5f386fab29012102b0407e165d3f51c33d16024b6d3e05812bfc013fc709d2e4dc8b44bfeed40ef6ffffffff8a0c859386ff4318aa072a57c4be8b3518743837c5d3b4c8d8ba1d00d34179d1020000006b48304502210091d958cd83caf2c5569a694b6a5541bd83808ab848e3446c65dd0aaf63c8cfd202205966c66f64e3a2fe559c4889d44ff4416a72cfef4cbe58f712cdab4fd3e8cdcd0121037279e5dfdffe221ec3be66e3055697f9aa0cd76eff334102c4b62f350d2d9df1ffffffff015027eb0b000000001976a91447fa1ff84aea46fa180e2e25536f3f860ce4fbad88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxoZCsGM4svQVmca79sRbnkvjEqRor6AQZ\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1618443044,\n \"txid\": \"d17941d3001dbad8c8b4d3c537387418358bbec4572a07aa1843ff8693850c8a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mn5XueyJPEcHFvQUVjcuNgzGzcTJh18N9V\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000035e249c2d84895720c358bc33ee00a64b0ab9889732adb09a80a49134fc875ad2000000006a473044022074ac46e3d6b794b649bb229c1918f2124bea89da9b823e397e61f344e27e894b02206378546a40e1459b23c8a9f3cd07c3e18e5240a3a18cc9fd4f22ac5a965c1fb6012103f867e609a6ec6841b477b00656003f603c6789517b921c7723ffaa0ebcf586d5ffffffff5e249c2d84895720c358bc33ee00a64b0ab9889732adb09a80a49134fc875ad2010000006b483045022100f5e83245f943e62123e88cf38f2941158a20f37d4f02885d22a837b4bff66ee00220346a06c53326699cf3be01567537670e443485bb022fcb567631cf48f27e6e1d012103f867e609a6ec6841b477b00656003f603c6789517b921c7723ffaa0ebcf586d5ffffffff5e249c2d84895720c358bc33ee00a64b0ab9889732adb09a80a49134fc875ad2020000006b483045022100a1fb8e9e23ecfd29bed86e12b1a6ab977b930915f25b96e0e4b847ae6253d619022046206d189e59aa9806b810066ef26c9dd83dead212212bc35fc4101e03e6d39401210318857bbd3a2f61c04512dff77d4aac1db91eb9753d37fb7a8ddbdfbdd5c4beabffffffff015027eb0b000000001976a9145e10d78836b02121866dc204ea3e8617092e5bdd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 0,\n \"timestamp\": 1630567676,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mvs5LLQGfgY49FptN2H1dVWDxXAetAXDY7\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 1,\n \"timestamp\": 1630567676,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mtQm7WpSZYAC5Wmt31xWM6uvYd8QBtea2B\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"nout\": 2,\n \"timestamp\": 1630567676,\n \"txid\": \"d25a87fc3491a4809ab0ad329788b90a4ba600ee33bc58c3205789842d9c245e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mp6KzHPSgp4DW57qGcKAWR1S48EvDxnot3\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"ec420a34acc98a91e82aa19c25c1396aacc10be80262de8177813be8f5285ec8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"ec420a34acc98a91e82aa19c25c1396aacc10be80262de8177813be8f5285ec8\"\n }\n}"
}
]
},
@@ -641,7 +641,7 @@
"curl": "curl -d'{\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"certificates\": 0,\n \"coins\": 10.0,\n \"encrypted\": false,\n \"id\": \"mqvKp5ZDF8cdHGLWgUK1FcQXM8g4crXaJR\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mqvKp5ZDF8cdHGLWgUK1FcQXM8g4crXaJR\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XMJAjX6cW15csWwWuB9CkWTaUNVQ2ZPczoUG9oDQ9oATi7gKh9ZbgzpqAcBKYC9ojpc8AkrExLVJVZoWipGz5efd4dBoPpn\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"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\": \"mm5kqqENANLHxj2dhxJhs8zWiwdndbf2jM\",\n \"is_default\": true,\n \"ledger\": \"lbc_regtest\",\n \"name\": \"Account #mm5kqqENANLHxj2dhxJhs8zWiwdndbf2jM\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y27iMLaV6qbMCkraNnmt8HMmC3iSxSS61oTYHCJRz1YfzYtV2DUWvJDkvAzxnGye138VBr7FvDpUqdPK7Znf8TdhnfpAL1b\",\n \"satoshis\": 1000000000\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -686,10 +686,10 @@
"examples": [
{
"title": "Remove an account",
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}).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\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1630567643,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPduGkPH4FUHQh6vCVc5PuD2t5148Qf3ds9oJ2b6MpGzKK6BD8QVWeYfkFPAqrEvtFXckYM7p83XaQGyaCiHFAi3hdUnfScwC\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XNJYGviqsh4ofwiRmQaonLUrHaAi5KSFzHYoDVBQTUwBGMQsNMBh3cvEAmp6uotNWBXa2kUJ3GiFHLyWEc7k1YtDkF7jGQW\",\n \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\"\n }\n}"
}
]
},
@@ -782,10 +782,10 @@
"examples": [
{
"title": "Modify maximum number of times a change address can be reused",
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3 --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\", \"default\": false, \"change_max_uses\": 10}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 10\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1618443013,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfJHmRmEBqY8FdTQS2rzX2qDBPDaGjx2AcEyxn3LMnwa3E5YPHq8ZpSfe1BkbZ16jcUAEjLD9eq88tnaRJCuAy66iXa5eo5b\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YmKZKQtnEwnNCUvNCCBRc8oxfjcaADpZSjEjQS9wySBuQFZgNKG1K8xeFKkr4q8v7RFAR7BMr65KWmhMkQs6S7otJphiuvf\",\n \"seed\": \"arrange stereo dolphin donkey come absent decade topic wash detect celery feed\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\", \"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\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1630567643,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPduGkPH4FUHQh6vCVc5PuD2t5148Qf3ds9oJ2b6MpGzKK6BD8QVWeYfkFPAqrEvtFXckYM7p83XaQGyaCiHFAi3hdUnfScwC\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XNJYGviqsh4ofwiRmQaonLUrHaAi5KSFzHYoDVBQTUwBGMQsNMBh3cvEAmp6uotNWBXa2kUJ3GiFHLyWEc7k1YtDkF7jGQW\",\n \"seed\": \"boost property since welcome armed arch goddess correct stick traffic pyramid glory\"\n }\n}"
}
]
}
@@ -821,9 +821,9 @@
"examples": [
{
"title": "Check if address is mine",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"}}).json()",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"muFMoJK6g1gNktsXYWyDUzb4W8kc7bXKy3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine muFMoJK6g1gNktsXYWyDUzb4W8kc7bXKy3",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"muFMoJK6g1gNktsXYWyDUzb4W8kc7bXKy3\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -870,14 +870,14 @@
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet address list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mgqnNuhucGD9J7oYpUQcnZZztNzFSYJ5KS\",\n \"pubkey\": \"tpubDA9GDAntyJu4HmbR7c7EyWzFEKDECeqSb14d3YifaKU2Ph9tFSxAmCQrKKgxagHuzZrEVeYxuHXkwu6JKp8Scd5b9L3hSSJ5qY22atQS6Hq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxJfiUAYvhfuFihZNepmCwjzz7NvVuNxJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vs2Z4LncJZjs8zZy8b5hETsFXqoDbtd1GiwScZh4o2ffbjWsAG4Z34XFzugEMJs68cVTpVk6BdZPK4W44e6HivecHSBds85\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxsm9s8sAx5jmLahg1SrpvzaRffzj2AA7\",\n \"pubkey\": \"tpubDA9GDAntyJu4vMuDsT868vpXrEV33yw2cgp1B1LgSCUK6zJ7CTfowxZKLNyQxH36ujY8Ekoemnwja6x6aviULQfg5B4V4D8Mgea1USgf4HX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhzmw7ydKYLCbVMLq15MQyyEUFgcHzQ3BL\",\n \"pubkey\": \"tpubDA9GDAntyJu4o3MVQctgf8eKejPeix4M3qfK75Kx1aCzmqeqDm8mD5sYgoYEP7zYfKMxSkFqMNMgdV92JtasAyWYivQSFMax5oDtkNAAcmu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miLxXdofiV32WV8pqC1k7r4A4LBzQyAFDi\",\n \"pubkey\": \"tpubDA9GDAntyJu4ZV7fiiaij7vcEuzSVegX7XKhB4XHzMDpJfkxaPT1G7jFnZMdx39C52xS29k1TPweNhf3vAyxiSa8PEFqf5iZe49T3ioDs7V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miuGQtobwUUUvNVYSbTy1Rtkc1EwQHY12g\",\n \"pubkey\": \"tpubDA9GDAntyJu4hDzmiupeL5gMHr4xQcjPuTPRS7H1H2MYKnTj3Phti68KUpvoCKWzKhE9XbaQDkLUgWnw3gqANiWas238UUSBzgfM9ndxQmL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mk3HM14wCBxHyxy8bW49gCzJvkQ4zBtA3m\",\n \"pubkey\": \"tpubDA9GDAntyJu51GuH5BfoNbnjBQ9VMoG9CoVTFvq24bhNoMjtxSr9xR5NVaoYkUSoU3e2zqmpyNPjC1VSLvKiTybjhB9gWUhz4BVQJDDurGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"pubkey\": \"tpubDA9GDAntyJu4UAUZUQXucMiBxSLCojQ4qkTKpjDVrKbTfZAi1UPyGVbFoYkfH87NGuvqkDwGpikjibKqktc5ofRMeue9zTo4HWqKWV69qXJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpFELTTYqemLBmtgafsWSDTjutyDRdLAEm\",\n \"pubkey\": \"tpubDA9GDAntyJu4spsCHNCRFzZhVK6HNQjQi6WABo37kbnKhjAJeJrLShTHfDoKjce5QsHLFW1KugkfETunuoD1273ExyKbBia65ymB9s1YV22\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpQWL9xSrM4XkJ4FH8qtM5CTMckZMSqgKo\",\n \"pubkey\": \"tpubDA9GDAntyJu4QYiUCu3Wmgw6WJbtJAFKNQWQFuUVUgyAwdV1d8UHfbKuAN5Zmvwq5tnL6NXEhbyYPiiX185rCdzcfAcUJQR3Wy9DNe7qcPd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrRxg9qGbxfukSGUftm58D9oTw29o4mmiL\",\n \"pubkey\": \"tpubDA9GDAntyJu4nDDD8uGStKa5iDtyBQ6g25zKUsq4iTXDnRjEUQRRPKNdSN1MUzEgN5xaVYSgZ7sRZwJo3g6Xnsr7obc73rWmsrnxYbpUUnr\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrcS9djBy5HwSmrxtYtdf6kT1wixUBWa3m\",\n \"pubkey\": \"tpubDA9GDAntyJu4MxuucuCeLLfSHpXt6ungx72gZFR5JNWfURbxfbErrc5DX5k6yDc1ghWp1mdFnZ5qDKHJvtjRZn3VEoh6jyegcGr2yGMLXFc\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msMfQ56iSHYhnqTyUVAm3Tigmewcr8QavS\",\n \"pubkey\": \"tpubDA9GDAntyJu4GpzmR35c1g6vaFQWyXZBCp9xKQGfFKEcp7CMBAm5xz3yVrvzCmKSHb8zuQAYLfP49jE72jf1YXDxHEunsXvYXLKZp1quoBw\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msNmT5M49QemHnpgTNMisterDhWVqB6bYh\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLyvR2JgoNw4kWpPsRoGFhF8YQqe6iw5sWb97M4T53EVZTv3EZfDJuWprKSvYez2MgBuHdinWPeWJ9jZiKwb635boPGfRaS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msPFkCpS8PNATXFXYfUQ1uJH7B5Shipd2b\",\n \"pubkey\": \"tpubDA9GDAntyJu52WXPRnpT6LxVmLjzPg51pC18JSrZrCBhAE8FPpVE5j85Xk4ZHETYgBFrzCkLYT8Z6Rm2TwM1ZUnkdVWMVuz39y8PJiGXfNi\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"muda8aJu3N3ZNDTWg3kyGMQckWv4LaoVGj\",\n \"pubkey\": \"tpubDA9GDAntyJu4jUs2HWumGFzTpNW9spcXWfyTHhVCGDB8pwvm627NXCd2UeYzT22oFgBdDyJw1fZ4wR38x31fkeaLua6n4q5QrMggXcFFV8X\",\n \"Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mgFHBxv5E4sFvwUGGo38kEAy17ShnxH8wR\",\n \"pubkey\": \"tpubDA9GDAntyJu4JZQ83iwTiweQZQeacjzqAggyK6fcC5Twtv1Tx9m2JQCze6gC8ygn1vmpkmVXsS1kJx9YVk63goLrL5hpZKR3yVnzaka4Ave\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mh7M3qE7uYM5xsbVPCsoy8GovkPjRnpdZD\",\n \"pubkey\": \"tpubDA9GDAntyJu4a7hndHFRPprpVAfeBCQ6HCQgcBk5Z3KjHevV68WzRRbThhTbZin8eAnEUa7XSd3Es4HNNCzAoehZLQBFnmF5SwQY9seRaJn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mhTcH8cE3MVkWzyhnZGbEK7KgiHb73M4Dn\",\n \"pubkey\": \"tpubDA9GDAntyJu4wUjVRhu4DDBViocAiNu5pc6bHqv9JWhGBmEe4cGge36ZaHQbh2WjpAhL8sQcq9ch8zc4wsTA2V5GhdADPw1Y7x27k7FZKhD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mhxn7CVxZke1XW5Ds9EziUR6UGn8PYD5h4\",\n \"pubkey\": \"tpubDA9GDAntyJu4NWHpn3XDifdgHCFZ2izY5J8pKLm9KW6d6j6cc79HSUPWmZ87FcCswWVzkPvHgLQEja2WgafR4TRSNqG9YWjLb4Mk4AdKf7B\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"miDhUnNDNNe32VG2g88dswPivRF28eSXiK\",\n \"pubkey\": \"tpubDA9GDAntyJu4NAJGcTKReU8YPLLKZKrVZBw69LuQErmkmoG34zHyDjU8gaQnm41pbxcrLoLavCtQXwghw6sez4heCjoaHUGCEbm78YQRvu1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"migoW8Ks6whuwHL7bwJsaekyL1bBAxFuft\",\n \"pubkey\": \"tpubDA9GDAntyJu54TvpUgmSCUQib5DVPt32BrxppkbpJ8y2Rym7ami1g5XkxXQ7gXQXakBDStqLnM2gvRp8cxrWQ9UPGSLK2y9LeWkrwKpTqbb\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mj9Uy7F3RJDRHU11UZ1x14xDgrGA32ZcFB\",\n \"pubkey\": \"tpubDA9GDAntyJu4dLxTbBWeRXJKt3MLExpnUZtpwW9nnGacECe7V6W5XF9XD2q4jH6BqSR3TtVsAD7AxY6HxNDMCtuXCqm78jcuF8mWLbT4AS1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mkMAEVoNHAfctodz75skDcyPAWWemQU7Ny\",\n \"pubkey\": \"tpubDA9GDAntyJu4mWKuSePxpKruFPeiQB7W2H2FjiCt8ECe5uq6cyL1NsZbDtZT5eMA5TE1UVEHVTewtPWXYRvdNJfGyEJm6Yrq8T7ZtKxZ6MN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mkQjVtF9vv7Xaqj1wnMrJ9pN9VyeTJgDxY\",\n \"pubkey\": \"tpubDA9GDAntyJu4L65TpHRzD8x7gVNQb4cpeCX6jQ33rVFdBXE82zumk36wfAakiSYxGKmaUHgUezVsme6kvN4AwXHkKSjpGmWZLQDxFQvqFfA\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mm2nUb52jM6VYxw88YAN1yGRVwokrLkDuM\",\n \"pubkey\": \"tpubDA9GDAntyJu4QEMzBwaScsHNH4oVtx4bpFb8VhU2CKK8QJMzErjk63H4c1ZzLx47uAmVLWSRcA1tzvfYx2Rr2hUiaJJ77qm3uVQjvEDB7PX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mmQjfvGjmD9hr2tjMbuRkiLKXkmsAAe5yG\",\n \"pubkey\": \"tpubDA9GDAntyJu4EqV2qxMJdESJ7Uf9chzp9bgY4DaWMthFVyeNBDXmYDVAbTVVJTUvykx5jkwVN7wWSGMA5aZAZETqcGUK4GQEEz5vJYdQF8u\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mmpdJrBWLKXbfg9A8jNobUNXe2QeTYBVAr\",\n \"pubkey\": \"tpubDA9GDAntyJu53ArAJ76HFHVYSWjVHLeGVw3c15oqBZP33v2sgidBwmk11kPsgx6G3MV8WvSvoR2GQznkYXSc6MoHWoCp29f7Yvwszgc9V3A\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mpXcMmM2zExJhH5NiYMP4SvRYJMCxYJUwZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4zNu4NsmqpHbpHAnxQafkEbQNssaNz4Gf7EtXcNVn8BKNaADGLumF6LJXRCV35BdcUhib325aGZoLnF62bLSJDTzkR2DY5B9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mrqWceHpMpGcbu7BCqpQ8p9ob3qRWmjoXB\",\n \"pubkey\": \"tpubDA9GDAntyJu4XfXXN8zReHfXHTNae3HwzE99dJHDVMUE2fdZb8YJ2ALh8iz7tnf1XUohVJJxZ98v6HZhipfHu4w5Gv2i63VUcaomno6dSGh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"msDzY2VuBeD51bNUTXsQKuiyAPb9wZQSFQ\",\n \"pubkey\": \"tpubDA9GDAntyJu4sTcTdGkVL4oeqWz8JYvVAjc7stVeKLxWMU7eHEym6rvDC5ZKxJZcHGu9bNAM6yayV5VhEGsFfVP3NwHjJh1Kj9b4fQY86s3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mtGkypAUsHYWxJ3vjJtCvNhx5hdgpjhbMZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4gtxXJSkgYg6YfwkmqBbWyYuxNMJACw5g8BSiMt5gY8oXbGt5NuBZJNkAni3kZDJxpWynpvBTtx4apqxVMQCTL6D572PxQW5\",\n \"Line truncated
},
{
"title": "List addresses in specified account",
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mgqnNuhucGD9J7oYpUQcnZZztNzFSYJ5KS\",\n \"pubkey\": \"tpubDA9GDAntyJu4HmbR7c7EyWzFEKDECeqSb14d3YifaKU2Ph9tFSxAmCQrKKgxagHuzZrEVeYxuHXkwu6JKp8Scd5b9L3hSSJ5qY22atQS6Hq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxJfiUAYvhfuFihZNepmCwjzz7NvVuNxJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4Vs2Z4LncJZjs8zZy8b5hETsFXqoDbtd1GiwScZh4o2ffbjWsAG4Z34XFzugEMJs68cVTpVk6BdZPK4W44e6HivecHSBds85\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhxsm9s8sAx5jmLahg1SrpvzaRffzj2AA7\",\n \"pubkey\": \"tpubDA9GDAntyJu4vMuDsT868vpXrEV33yw2cgp1B1LgSCUK6zJ7CTfowxZKLNyQxH36ujY8Ekoemnwja6x6aviULQfg5B4V4D8Mgea1USgf4HX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mhzmw7ydKYLCbVMLq15MQyyEUFgcHzQ3BL\",\n \"pubkey\": \"tpubDA9GDAntyJu4o3MVQctgf8eKejPeix4M3qfK75Kx1aCzmqeqDm8mD5sYgoYEP7zYfKMxSkFqMNMgdV92JtasAyWYivQSFMax5oDtkNAAcmu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miLxXdofiV32WV8pqC1k7r4A4LBzQyAFDi\",\n \"pubkey\": \"tpubDA9GDAntyJu4ZV7fiiaij7vcEuzSVegX7XKhB4XHzMDpJfkxaPT1G7jFnZMdx39C52xS29k1TPweNhf3vAyxiSa8PEFqf5iZe49T3ioDs7V\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"miuGQtobwUUUvNVYSbTy1Rtkc1EwQHY12g\",\n \"pubkey\": \"tpubDA9GDAntyJu4hDzmiupeL5gMHr4xQcjPuTPRS7H1H2MYKnTj3Phti68KUpvoCKWzKhE9XbaQDkLUgWnw3gqANiWas238UUSBzgfM9ndxQmL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mk3HM14wCBxHyxy8bW49gCzJvkQ4zBtA3m\",\n \"pubkey\": \"tpubDA9GDAntyJu51GuH5BfoNbnjBQ9VMoG9CoVTFvq24bhNoMjtxSr9xR5NVaoYkUSoU3e2zqmpyNPjC1VSLvKiTybjhB9gWUhz4BVQJDDurGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mojEke6ziurRouuzdNaMxqeFgtjxh5ST2K\",\n \"pubkey\": \"tpubDA9GDAntyJu4UAUZUQXucMiBxSLCojQ4qkTKpjDVrKbTfZAi1UPyGVbFoYkfH87NGuvqkDwGpikjibKqktc5ofRMeue9zTo4HWqKWV69qXJ\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpFELTTYqemLBmtgafsWSDTjutyDRdLAEm\",\n \"pubkey\": \"tpubDA9GDAntyJu4spsCHNCRFzZhVK6HNQjQi6WABo37kbnKhjAJeJrLShTHfDoKjce5QsHLFW1KugkfETunuoD1273ExyKbBia65ymB9s1YV22\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mpQWL9xSrM4XkJ4FH8qtM5CTMckZMSqgKo\",\n \"pubkey\": \"tpubDA9GDAntyJu4QYiUCu3Wmgw6WJbtJAFKNQWQFuUVUgyAwdV1d8UHfbKuAN5Zmvwq5tnL6NXEhbyYPiiX185rCdzcfAcUJQR3Wy9DNe7qcPd\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrRxg9qGbxfukSGUftm58D9oTw29o4mmiL\",\n \"pubkey\": \"tpubDA9GDAntyJu4nDDD8uGStKa5iDtyBQ6g25zKUsq4iTXDnRjEUQRRPKNdSN1MUzEgN5xaVYSgZ7sRZwJo3g6Xnsr7obc73rWmsrnxYbpUUnr\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"mrcS9djBy5HwSmrxtYtdf6kT1wixUBWa3m\",\n \"pubkey\": \"tpubDA9GDAntyJu4MxuucuCeLLfSHpXt6ungx72gZFR5JNWfURbxfbErrc5DX5k6yDc1ghWp1mdFnZ5qDKHJvtjRZn3VEoh6jyegcGr2yGMLXFc\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msMfQ56iSHYhnqTyUVAm3Tigmewcr8QavS\",\n \"pubkey\": \"tpubDA9GDAntyJu4GpzmR35c1g6vaFQWyXZBCp9xKQGfFKEcp7CMBAm5xz3yVrvzCmKSHb8zuQAYLfP49jE72jf1YXDxHEunsXvYXLKZp1quoBw\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msNmT5M49QemHnpgTNMisterDhWVqB6bYh\",\n \"pubkey\": \"tpubDA9GDAntyJu4fLyvR2JgoNw4kWpPsRoGFhF8YQqe6iw5sWb97M4T53EVZTv3EZfDJuWprKSvYez2MgBuHdinWPeWJ9jZiKwb635boPGfRaS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"msPFkCpS8PNATXFXYfUQ1uJH7B5Shipd2b\",\n \"pubkey\": \"tpubDA9GDAntyJu52WXPRnpT6LxVmLjzPg51pC18JSrZrCBhAE8FPpVE5j85Xk4ZHETYgBFrzCkLYT8Z6Rm2TwM1ZUnkdVWMVuz39y8PJiGXfNi\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhJUYVePU6AjpuCsmHsdvDFebGbK9XsHZ3\",\n \"address\": \"muda8aJu3N3ZNDTWg3kyGMQckWv4LaoVGj\",\n \"pubkey\": \"tpubDA9GDAntyJu4jUs2HWumGFzTpNW9spcXWfyTHhVCGDB8pwvm627NXCd2UeYzT22oFgBdDyJw1fZ4wR38x31fkeaLua6n4q5QrMggXcFFV8X\",\n \"Line truncated
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mgFHBxv5E4sFvwUGGo38kEAy17ShnxH8wR\",\n \"pubkey\": \"tpubDA9GDAntyJu4JZQ83iwTiweQZQeacjzqAggyK6fcC5Twtv1Tx9m2JQCze6gC8ygn1vmpkmVXsS1kJx9YVk63goLrL5hpZKR3yVnzaka4Ave\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mh7M3qE7uYM5xsbVPCsoy8GovkPjRnpdZD\",\n \"pubkey\": \"tpubDA9GDAntyJu4a7hndHFRPprpVAfeBCQ6HCQgcBk5Z3KjHevV68WzRRbThhTbZin8eAnEUa7XSd3Es4HNNCzAoehZLQBFnmF5SwQY9seRaJn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mhTcH8cE3MVkWzyhnZGbEK7KgiHb73M4Dn\",\n \"pubkey\": \"tpubDA9GDAntyJu4wUjVRhu4DDBViocAiNu5pc6bHqv9JWhGBmEe4cGge36ZaHQbh2WjpAhL8sQcq9ch8zc4wsTA2V5GhdADPw1Y7x27k7FZKhD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mhxn7CVxZke1XW5Ds9EziUR6UGn8PYD5h4\",\n \"pubkey\": \"tpubDA9GDAntyJu4NWHpn3XDifdgHCFZ2izY5J8pKLm9KW6d6j6cc79HSUPWmZ87FcCswWVzkPvHgLQEja2WgafR4TRSNqG9YWjLb4Mk4AdKf7B\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"miDhUnNDNNe32VG2g88dswPivRF28eSXiK\",\n \"pubkey\": \"tpubDA9GDAntyJu4NAJGcTKReU8YPLLKZKrVZBw69LuQErmkmoG34zHyDjU8gaQnm41pbxcrLoLavCtQXwghw6sez4heCjoaHUGCEbm78YQRvu1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"migoW8Ks6whuwHL7bwJsaekyL1bBAxFuft\",\n \"pubkey\": \"tpubDA9GDAntyJu54TvpUgmSCUQib5DVPt32BrxppkbpJ8y2Rym7ami1g5XkxXQ7gXQXakBDStqLnM2gvRp8cxrWQ9UPGSLK2y9LeWkrwKpTqbb\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mj9Uy7F3RJDRHU11UZ1x14xDgrGA32ZcFB\",\n \"pubkey\": \"tpubDA9GDAntyJu4dLxTbBWeRXJKt3MLExpnUZtpwW9nnGacECe7V6W5XF9XD2q4jH6BqSR3TtVsAD7AxY6HxNDMCtuXCqm78jcuF8mWLbT4AS1\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mkMAEVoNHAfctodz75skDcyPAWWemQU7Ny\",\n \"pubkey\": \"tpubDA9GDAntyJu4mWKuSePxpKruFPeiQB7W2H2FjiCt8ECe5uq6cyL1NsZbDtZT5eMA5TE1UVEHVTewtPWXYRvdNJfGyEJm6Yrq8T7ZtKxZ6MN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mkQjVtF9vv7Xaqj1wnMrJ9pN9VyeTJgDxY\",\n \"pubkey\": \"tpubDA9GDAntyJu4L65TpHRzD8x7gVNQb4cpeCX6jQ33rVFdBXE82zumk36wfAakiSYxGKmaUHgUezVsme6kvN4AwXHkKSjpGmWZLQDxFQvqFfA\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mm2nUb52jM6VYxw88YAN1yGRVwokrLkDuM\",\n \"pubkey\": \"tpubDA9GDAntyJu4QEMzBwaScsHNH4oVtx4bpFb8VhU2CKK8QJMzErjk63H4c1ZzLx47uAmVLWSRcA1tzvfYx2Rr2hUiaJJ77qm3uVQjvEDB7PX\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mmQjfvGjmD9hr2tjMbuRkiLKXkmsAAe5yG\",\n \"pubkey\": \"tpubDA9GDAntyJu4EqV2qxMJdESJ7Uf9chzp9bgY4DaWMthFVyeNBDXmYDVAbTVVJTUvykx5jkwVN7wWSGMA5aZAZETqcGUK4GQEEz5vJYdQF8u\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mmpdJrBWLKXbfg9A8jNobUNXe2QeTYBVAr\",\n \"pubkey\": \"tpubDA9GDAntyJu53ArAJ76HFHVYSWjVHLeGVw3c15oqBZP33v2sgidBwmk11kPsgx6G3MV8WvSvoR2GQznkYXSc6MoHWoCp29f7Yvwszgc9V3A\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mpXcMmM2zExJhH5NiYMP4SvRYJMCxYJUwZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4zNu4NsmqpHbpHAnxQafkEbQNssaNz4Gf7EtXcNVn8BKNaADGLumF6LJXRCV35BdcUhib325aGZoLnF62bLSJDTzkR2DY5B9\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mrqWceHpMpGcbu7BCqpQ8p9ob3qRWmjoXB\",\n \"pubkey\": \"tpubDA9GDAntyJu4XfXXN8zReHfXHTNae3HwzE99dJHDVMUE2fdZb8YJ2ALh8iz7tnf1XUohVJJxZ98v6HZhipfHu4w5Gv2i63VUcaomno6dSGh\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"msDzY2VuBeD51bNUTXsQKuiyAPb9wZQSFQ\",\n \"pubkey\": \"tpubDA9GDAntyJu4sTcTdGkVL4oeqWz8JYvVAjc7stVeKLxWMU7eHEym6rvDC5ZKxJZcHGu9bNAM6yayV5VhEGsFfVP3NwHjJh1Kj9b4fQY86s3\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgUF5KXtPdtbB7AKMhcDvHFzkcztoeaFjr\",\n \"address\": \"mtGkypAUsHYWxJ3vjJtCvNhx5hdgpjhbMZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4gtxXJSkgYg6YfwkmqBbWyYuxNMJACw5g8BSiMt5gY8oXbGt5NuBZJNkAni3kZDJxpWynpvBTtx4apqxVMQCTL6D572PxQW5\",\n \"Line truncated
}
]
},
@@ -905,7 +905,7 @@
"curl": "curl -d'{\"method\": \"address_unused\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet address unused",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_unused\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\"\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"muFMoJK6g1gNktsXYWyDUzb4W8kc7bXKy3\"\n}"
}
]
}
@@ -940,6 +940,13 @@
"returns": "(bool) true if successful",
"examples": []
},
{
"name": "blob_clean",
"description": "Deletes blobs to cleanup disk space",
"arguments": [],
"returns": "(bool) true if successful",
"examples": []
},
{
"name": "blob_delete",
"description": "Delete a blob",
@@ -955,10 +962,10 @@
"examples": [
{
"title": "Delete a blob",
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete 50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\"\n}"
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"fcfdd5d1524e7310850316125f129d12cd5f2a3fc08e41c82d6a4dc3eec554cd383a71fc714957cb2a60ee9d62b5dd4c\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete fcfdd5d1524e7310850316125f129d12cd5f2a3fc08e41c82d6a4dc3eec554cd383a71fc714957cb2a60ee9d62b5dd4c",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"fcfdd5d1524e7310850316125f129d12cd5f2a3fc08e41c82d6a4dc3eec554cd383a71fc714957cb2a60ee9d62b5dd4c\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted fcfdd5d1524e7310850316125f129d12cd5f2a3fc08e41c82d6a4dc3eec554cd383a71fc714957cb2a60ee9d62b5dd4c\"\n}"
}
]
},
@@ -1036,7 +1043,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 \"50bd1ea0a07bf9b32b8cc43b6c2d83c9ae39ecf661894bc29c3620b0eed81cdbeeb46f70b8e490070626a50908852d88\",\n \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\n \"e914d184fcd2b66774b6e684c4e7e84321a169a42f8d1a1b68a7900c5cdb68899709ad487c339ce7cb255a7a83333973\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n \"fcfdd5d1524e7310850316125f129d12cd5f2a3fc08e41c82d6a4dc3eec554cd383a71fc714957cb2a60ee9d62b5dd4c\",\n \"f4a9c99dcc7c9c7d75b449b89719c614afcb0f2071a5beb6ebaeb737cb2c70b753d12556f7acfa4526dd8a0ae2c1f80d\",\n \"3654f14df3da475a8ef3dcf81ca855ca719102cfe3d905d48d77ad5a264d067e723e3cf76c41f8715e4ca9a6fe96d0d2\",\n \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\"\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 4,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1117,10 +1124,10 @@
"examples": [
{
"title": "Abandon a channel claim",
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 0eab90020ce7b538a56023804b578ab768ae7f7e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000018c7e5e938886d463184d19f3765beeeb7cdee54a04826ea456b074aa4c82371b000000006a47304402200a406c0c75ac86b78d09b1acf127754d10e6fee552bac6084de592baf5bed34b022029bffe5e2097e8b3bd07753a20e4e8f28da17ac58c9eeb64e149aba83be85f890121031eba8531bd21f9f4544320248dbe9e607654d8cd2455baa2a6935117923c36aaffffffff0134b7f505000000001976a9147d39b5aa38e3f712670d082b8e2f53583dc2db0588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 9,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mrw5tmWCPn8WTzyB8y7pQJAioKEYdDsY8w\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3cc1fcbc82b16f29467c5590e2af3868d4d28e16e45466bac58c8f17c3fdc23e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"3cc1fcbc82b16f29467c5590e2af3868d4d28e16e45466bac58c8f17c3fdc23e\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 815f8d597ce588c141b001d05f3240b3ef0bf370",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001903415ca80c2891a49dc94a4b6c24745942bef51dc55f698b5351654b763414e000000006a47304402207df0055a0ca72ca10b957db3f0b6d1638153f0a9c9f9999c6e115e7e1738d1eb02205a7f36deaee300b4690bd1becd89c6e2c18b3ffe60009a7f47ee255468f41d4801210344a78a03b26f6ce6bb8132537a36caf8826058e936f85ab6f916e844077d9c7effffffff0134b7f505000000001976a914203463813df637bd9ef85c62ecfaeee877a0288088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"claim_op\": \"update\",\n \"confirmations\": 9,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miTEgDsEndZW8oT7ssH9JTbVU7a8w3vGDD\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"79fba7e644be40ceeffb70eb4c902f847dd37114841495062424d1f0f9e3efe5\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"79fba7e644be40ceeffb70eb4c902f847dd37114841495062424d1f0f9e3efe5\"\n }\n}"
}
]
},
@@ -1250,14 +1257,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\": \"0100000001b756701c12d340a9e629170326519d14e8c21ce1f71a3ac312275a98589f5e69010000006b483045022100b3b82d37c5808726fdb4663a39a346c916434cc631b51dfbb3ace34516c8431702207a8072cbdf0cccc7d36a8202fbdcca7046992eaf9c05118c50763e9f60dcb9ab012102fb1f55f37d0ef3482f56a6c7b33bda4aeb720ced4de024fbacf2d33e229e92b0ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f6d7576a9143b288c8262a006dbe1a8c0ef23054dce2fabc5f388acc462a029000000001976a91440dd0374222ec32c8cbdfdabf78b047aac79ee0a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqxcuVhZfQhpBDVBXzBAaqrrdXtRHhX64i\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": null,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mmRvJcnGpU5ztvabtkF6bMZz1mAZa3FY2c\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ac67ce245e739fbe0755c92794067402f3b866313b5d1bcfff8a8fd4963628f8010000006b483045022100f4812b3ceadd83e2117b24b0fe04b95ed58b9c97925807a4d51182afac46299302200e6721670278dd7dfd35a5e79dd75e4fa451cbdc4c8d9339c08208143bacd5690121036d38ef731f352de7624d22ddc8ed881785313476fde65c094f72253825c8339dffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a66d7576a914d79bf84451de34c9e51af35b99a6f28f8c7a0a7e88acc462a029000000001976a914674e5620e316224972a18519f69513c70e0ec28a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mu4MiuQqZpiH9UyFtjjRrTsE8EQMxUfzqR\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"nout\": 1,\n \"timestamp\": 1630567676,\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": null,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mpwBjiw3Z5qyN5S8xFYPMvUuWZktaGakgu\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\"\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\": \"01000000018c7e5e938886d463184d19f3765beeeb7cdee54a04826ea456b074aa4c82371b010000006b483045022100cd41b0914d03d8fb08255c998533d1f6284560795d71be1e07e506164bf5b4de02201797598f0ae77c93fbcfa8d05348033576c9f08fd4604e4649bd32fb96716365012103d1fc67e9e31f0a79c3fa899a2a838a2052aac1945f5b7af86362e53fe8d6fc96ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004de37fee89d76e8bfd665cbaebf7d761ffd60b90fceb760e66519ebd1fdc9ec28bac6b5648ea59d12fe49439cff4521629b256d12c31bb326a56274612d5fbf0d121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914dee664a6af04fedaf4b72db7c10c540da96f458688ace221d305000000001976a91423ce70cde5af2946162467bffeced1ce901342a588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4dUANvGLRBQaWDSJAFWHGhrYDq9YpyzJg\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1qYJdyfzz1q54asE9aEsko1YqEPhrZgCd\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0c34795b6b724825df10bd775a925b7254d7151f\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@bigchannel\",\n \"normalized_name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#0c34795b6b724825df10bd775a925b7254d7151f\",\n \"timestamp\": null,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\n \"type\": \"claim\",\n \"value\": {\n \"cover\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"description\": \"A channel with lots of videos.\",\n \"email\": \"creator@smallmedia.com\",\n \"languages\": [\n \"pt-BR\",\n \"uk\"\n ],\n \"locations\": [\n {\n \"country\": \"BR\"\n },\n {\n \"city\": \"Kiyv\",\n \"country\": \"UA\"\n }\n ],\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004de37fee89d76e8bfd665cbaebf7d761ffd60b90fceb760e66519ebd1fdc9ec28bac6b5648ea59d12fe49439cff4521629b256d12c31bb326a56274612d5fbf0d\",\n \"public_key_id\": \"mqyx5B95ta17bMfhspn99D83b1XpJAw1Zm\",\n \"tags\": [\n \"music\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/logo.jpg\"\n },\n \"title\": \"Big Channel\",\n \"website_url\": \"http://smallmedia.com\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"minHFWqr3L7oyfNNPReBgTkRj4rykBaUod\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001903415ca80c2891a49dc94a4b6c24745942bef51dc55f698b5351654b763414e010000006a47304402201617c0a2a7c048f691946825cdd66801f69799499706b452fa47b1d2d5aa3391022020bd9a6b460ad76abc5bfe4a6f5a3043550ba8c1770ef66841208ee789c4dbca012103b4a9ce906f0715a69b834409f3a8d6870f54d9615ed6faf5e1257378515fa3daffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a0342000486e10e17cdf3265e77b7e95ab833c185c96b81c8ade8557ee9065312e8b131a4d0f507b2a9859daf610db169e106bda6625a208689d9c17e14c818a117ac5d59121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914e9ee76a5d08f9a103004075aed2633e3e318bd7888ace221d305000000001976a914cbc79ab1ff83ffdbfe069d693519515bcf10accd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvi6wBni9ExLJpdeCsbThprKWtLjtMXKsG\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"nout\": 1,\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n2qsQUx62EbBBiPGWEuZMuATNqC9M5SqeX\",\n \"amount\": \"1.0\",\n \"claim_id\": \"b2e9928d92a2f073161ac304fb02d04b03bbbabc\",\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#b2e9928d92a2f073161ac304fb02d04b03bbbabc\",\n \"timestamp\": null,\n \"txid\": \"b47233c19d326cef94b48baa25a27aaef6d861f74c576758866415dd4e07ce82\",\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\": \"3056301006072a8648ce3d020106052b8104000a0342000486e10e17cdf3265e77b7e95ab833c185c96b81c8ade8557ee9065312e8b131a4d0f507b2a9859daf610db169e106bda6625a208689d9c17e14c818a117ac5d59\",\n \"public_key_id\": \"n3AMnZt5A4PLyi9aSi4NsmbixkRKMMuoVD\",\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\": \"mz6Sak75qd3EYBNPNEsNdJsXbS9ebPx3j6\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"b47233c19d326cef94b48baa25a27aaef6d861f74c576758866415dd4e07ce82\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"b47233c19d326cef94b48baa25a27aaef6d861f74c576758866415dd4e07ce82\"\n }\n}"
}
]
},
@@ -1379,14 +1386,14 @@
"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\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\"\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\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1581,10 +1588,10 @@
"examples": [
{
"title": "Update a channel claim",
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel update 0eab90020ce7b538a56023804b578ab768ae7f7e --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000023e16dbb76483b3ee632a8513b4adbeaa4047bc263fb6d994a78063ed989b694c000000006b483045022100f24bd1711629458bae4e223a86b00f09de5a0cfc3db46abe2983f8c98c123508022036410fe58d335d4c7ed91e0fb2f1face27a268433c6c1cd43cb61dba212618280121031eba8531bd21f9f4544320248dbe9e607654d8cd2455baa2a6935117923c36aaffffffffc725bc5dfa2758b4c830afa2b95345996856f649167dafe8ad0d4e9fcd323bdd000000006a47304402204b2c819f11ec5aee2801b26feb1d1160e57833849039fec59dbf1cb51308469f022034b2cbcd3bfd89666350d9a2d0b17723035c21724d19dd631074d54e17ebed4301210339e49da6abc616cf1fd937dad637e2a987d0edfcceef85df9163ed3c3d042fd3ffffffff0200e1f50500000000a6b708406368616e6e656c147e7fae68b78a574b802360a538b5e70c0290ab0e4c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f420b4e6577204368616e6e656c6d6d76a9143b288c8262a006dbe1a8c0ef23054dce2fabc5f388ac6ebeea0b000000001976a914fd865231af47fb3f92a398f4b53e87209f9f33f588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mn5XueyJPEcHFvQUVjcuNgzGzcTJh18N9V\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1618443044,\n \"txid\": \"dd3b32cd9f4e0dade8af7d1649f65668994553b9a2af30c8b45827fa5dbc25c7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"has_signing_key\": true,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": null,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n4dUANvGLRBQaWDSJAFWHGhrYDq9YpyzJg\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"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 815f8d597ce588c141b001d05f3240b3ef0bf370 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"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\": \"0100000002eb18a9ee3369501c7e6f51c266c5fef90443a568282b62fe91a65689d510a1d3000000006b48304502210083c788a849d27647c1c54417273f824705b1dfbdf7fd8e827942da0473bc2204022077f84b5e33f1f1b32fa77a8d7524613c252dbdfa7871e00f1b895699ffe3ed8501210344a78a03b26f6ce6bb8132537a36caf8826058e936f85ab6f916e844077d9c7effffffffc85e28f5e83b817781de6202e80bc1ac6a39c1259ca12ae8918ac9ac340a42ec000000006a47304402204743e3360b3f4e438d3031ea9543ec6befacbed9a49f52abe5cabbe623d5c2c3022051d91fa11efdbbf789319ffcf68330203d961aee7c26e2eb1da7cb283028e09b012103a58d6ba353d8115d738ea8e2d13cba0600074cb718d568b98f9362a4325ab3e0ffffffff0200e1f50500000000a6b708406368616e6e656c1470f30befb340325fd001b041c188e57c598d5f814c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6420b4e6577204368616e6e656c6d6d76a914d79bf84451de34c9e51af35b99a6f28f8c7a0a7e88ac6ebeea0b000000001976a914a6a5acc19d4111ad37c90d023207650c75fa13d488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mp6KzHPSgp4DW57qGcKAWR1S48EvDxnot3\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"nout\": 0,\n \"timestamp\": 1630567676,\n \"txid\": \"ec420a34acc98a91e82aa19c25c1396aacc10be80262de8177813be8f5285ec8\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": null,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mvi6wBni9ExLJpdeCsbThprKWtLjtMXKsG\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\"\n }\n}"
}
]
}
@@ -1639,6 +1646,18 @@
"description": "restrict results to specific wallet",
"is_required": false
},
{
"name": "has_source",
"type": "bool",
"description": "list claims containing a source field",
"is_required": false
},
{
"name": "has_no_source",
"type": "bool",
"description": "list claims not containing a source field",
"is_required": false
},
{
"name": "page",
"type": "int",
@@ -1680,17 +1699,17 @@
"examples": [
{
"title": "List all your claims",
"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/",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"has_source\": false, \"has_no_source\": false, \"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\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"has_source\": false, \"has_no_source\": false, \"resolve\": false, \"no_totals\": false, \"include_received_tips\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\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/",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"has_source\": false, \"has_no_source\": false, \"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\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"claim_type\": [], \"claim_id\": [], \"name\": [], \"is_spent\": false, \"channel_id\": [], \"has_source\": false, \"has_no_source\": false, \"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\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\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}"
}
]
},
@@ -2016,6 +2035,12 @@
"description": "lookup and include a boolean indicating if claim being resolved is yours",
"is_required": false
},
{
"name": "remove_duplicates",
"type": "bool",
"description": "removes duplicated content from search by picking either the original claim or the oldest matching repost",
"is_required": false
},
{
"name": "has_source",
"type": "bool",
@@ -2039,17 +2064,17 @@
"examples": [
{
"title": "Search for all claims in channel",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"remove_duplicates\": false, \"has_source\": false, \"has_no_source\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --channel=@channel",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"claim_ids\": [], \"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"remove_duplicates\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8/astream#1\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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\": 1630567677,\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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\": 1630567676,\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"short_url\": \"lbry://@channel#8\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\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\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}' http://localhost:5279/",
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"remove_duplicates\": false, \"has_source\": false, \"has_no_source\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --name=\"astream\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"claim_ids\": [], \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": [], \"no_totals\": false, \"include_purchase_receipt\": false, \"include_is_my_output\": false, \"remove_duplicates\": false, \"has_source\": false, \"has_no_source\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blocked\": {\n \"channels\": [],\n \"total\": 0\n },\n \"items\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8/astream#1\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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\": 1630567677,\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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\": 1630567676,\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"short_url\": \"lbry://@channel#8\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\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}"
}
]
}
@@ -2237,10 +2262,10 @@
"examples": [
{
"title": "Create a collection of one stream",
"curl": "curl -d'{\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet collection create --name=tom --bid=1.0 --channel_id=0eab90020ce7b538a56023804b578ab768ae7f7e --claims=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"a38a77a9154b679070b083e842040d6fb6b10c8e\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001352603220e3ef634ad464b4741442cb104e01ed8591dbe042e43a3755c720a3c010000006a4730440220267c0cbb1839796bf27bfe340fd7710c38401632b67ce7468f006a035febd4e5022005479cc9d5919aa830f223426c64c2f0328183c4844d1952f3b5fbf2a17b5787012103ec8012b82ef9006ded31853c8d9f88987b41c49f6bf51987aa8926338c059c86ffffffff0200e1f5050000000091b503746f6d4c6f017e7fae68b78a574b802360a538b5e70c0290ab0ec5be96034711ff942992d7fdbb74e43de7a7a28d320d02d4f40fab1140c15626185b2eb1b63df34d4a4e0b5c881e1643e4bd3952ba05e8a279512d0dc3e571fa1a1812160a148e0cb1b66f0d0442e883b07090674b15a9778aa36d7576a914d1b6aec29af1ed142957018d3fa88c08fb82ea1888ac202c7e17000000001976a9140d1c9cbea85e8c53b4d847ca7663fc175b6b220588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4oCmyd3qN32UPMfcTx9B5HHxYdS7mWEvY\",\n \"amount\": \"4.947555\",\n \"confirmations\": 2,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"3c0a725c75a3432e04be1d59d81ee004b12c4441474b46ad34f63e0e22032635\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzdpNAErM6mUQpwhDWQvtFDBANqueRpHuy\",\n \"amount\": \"1.0\",\n \"claim_id\": \"b87ea4813529b45aa06537f487456e6672ac7993\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"tom\",\n \"normalized_name\": \"tom\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://tom#b87ea4813529b45aa06537f487456e6672ac7993\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"claim\",\n \"value\": {\n \"claims\": [\n \"a38a77a9154b679070b083e842040d6fb6b10c8e\"\n ]\n },\n \"value_type\": \"collection\"\n },\n {\n \"address\": \"mgiHMZg93NhGBhT1gopuZd6ZHkrFbaaFq7\",\n \"amount\": \"3.941448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.006107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.941448\",\n \"txid\": \"4173e368dd3a0a8daa48d63fa766f78b1472d87a219654899c2b28512e28f890\"\n }\n}"
"curl": "curl -d'{\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"138446450b727414a2b9e9529341dc621a9e5470\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet collection create --name=tom --bid=1.0 --channel_id=815f8d597ce588c141b001d05f3240b3ef0bf370 --claims=138446450b727414a2b9e9529341dc621a9e5470",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"collection_create\", \"params\": {\"name\": \"tom\", \"bid\": \"1.0\", \"claims\": [\"138446450b727414a2b9e9529341dc621a9e5470\"], \"allow_duplicate_name\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001699afb39155979142df871283129396c6601768b1c01b5a9dce8792b5d36e9ca010000006a47304402206915c5b6a023c9c379090ea6c0ce7b17f1947306b4e0e210ad480d1d9404c69e02205c5890d6c4de4e7dd4ec2eff7bbbd5fe4278191db787c9b69e2be1226293cc4f012103224e580ffe93840ae8b96b235e9f4c58570f57fa980774df8f8a93f42fc19f4fffffffff0200e1f5050000000091b503746f6d4c6f0170f30befb340325fd001b041c188e57c598d5f81a84a2000d064fd6747420b1753734b13fea27b2bdaeb2004bb58f647ea91386f1c1e5ccd40d5e3c9301a178c886d971fa2fca582be131d23de6e7aef4cf693c61a1812160a1470549e1a62dc419352e9b9a21474720b454684136d7576a914636031eb074819012fb131c5d785ab4a002cad0a88ac202c7e17000000001976a91491431e22d948adcac9e1e2f32a4aef46fc24744c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpszEfmsqHT4nQGbY4wwh3BtBuAhRAf3fV\",\n \"amount\": \"4.947555\",\n \"confirmations\": 2,\n \"height\": 215,\n \"nout\": 1,\n \"timestamp\": 1630567677,\n \"txid\": \"cae9365d2b79e8dca9b5011c8b7601666c3929312871f82d1479591539fb9a69\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpaQRnoSqgSRrTu2MBLDvDDUM4rnh73NVu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"47ead22e98caee988a0709ab559c21575e4e7556\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"tom\",\n \"normalized_name\": \"tom\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://tom#47ead22e98caee988a0709ab559c21575e4e7556\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"54248f6961e5c0f06c7363ed05c7bf8ac3f6bc941ea416b553a5e0009bc465b7\",\n \"type\": \"claim\",\n \"value\": {\n \"claims\": [\n \"138446450b727414a2b9e9529341dc621a9e5470\"\n ]\n },\n \"value_type\": \"collection\"\n },\n {\n \"address\": \"mtm2gHnthSQ2n61dnJSeZCd873eHByQQ8r\",\n \"amount\": \"3.941448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"54248f6961e5c0f06c7363ed05c7bf8ac3f6bc941ea416b553a5e0009bc465b7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.006107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.941448\",\n \"txid\": \"54248f6961e5c0f06c7363ed05c7bf8ac3f6bc941ea416b553a5e0009bc465b7\"\n }\n}"
}
]
},
@@ -2292,7 +2317,7 @@
"curl": "curl -d'{\"method\": \"collection_list\", \"params\": {\"resolve_claims\": 1, \"resolve\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet collection list --resolve --resolve_claims=1",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"collection_list\", \"params\": {\"resolve_claims\": 1, \"resolve\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mzdpNAErM6mUQpwhDWQvtFDBANqueRpHuy\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/tom#b\",\n \"claim_id\": \"b87ea4813529b45aa06537f487456e6672ac7993\",\n \"claim_op\": \"create\",\n \"claims\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0/astream#a\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"short_url\": \"lbry://astream#a\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1618443044,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"short_url\": \"lbry://@channel#0\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"confirmations\": 1,\n \"height\": 217,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 217,\n \"creation_height\": 217,\n \"creation_timestamp\": 1618443045,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263191,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 217,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\"Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mpaQRnoSqgSRrTu2MBLDvDDUM4rnh73NVu\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8/tom#4\",\n \"claim_id\": \"47ead22e98caee988a0709ab559c21575e4e7556\",\n \"claim_op\": \"create\",\n \"claims\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8/astream#1\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1630567677,\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"short_url\": \"lbry://astream#1\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#8\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1630567676,\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"short_url\": \"lbry://@channel#8\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"confirmations\": 1,\n \"height\": 217,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 217,\n \"creation_height\": 217,\n \"creation_timestamp\": 1630567677,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263191,\n \"is_controlling\": true,\n \"reposted\": 0,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 217,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\"Line truncated
}
]
},
@@ -2464,373 +2489,6 @@
}
]
},
"comment": {
"doc": "View, create and abandon comments.",
"commands": [
{
"name": "comment_abandon",
"description": "Abandon a comment published under your channel identity.",
"arguments": [
{
"name": "comment_id",
"type": "str",
"description": "The ID of the comment to be abandoned.",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(dict) Object with the `comment_id` passed in as the key, and a flag indicating if it was abandoned\n {\n <comment_id> (str): {\n \"abandoned\": (bool)\n }\n }",
"examples": [
{
"title": "Abandon a comment",
"curl": "curl -d'{\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment abandon 3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_abandon\", \"params\": {\"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\": {\n \"abandoned\": true\n }\n }\n}"
}
]
},
{
"name": "comment_create",
"description": "Create and associate a comment with a claim using your channel identity.",
"arguments": [
{
"name": "comment",
"type": "str",
"description": "Comment to be made, should be at most 2000 characters.",
"is_required": true
},
{
"name": "claim_id",
"type": "str",
"description": "The ID of the claim to comment on",
"is_required": true
},
{
"name": "parent_id",
"type": "str",
"description": "The ID of a comment to make a response to",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
"description": "The ID of the channel you want to post under",
"is_required": false
},
{
"name": "channel_name",
"type": "str",
"description": "The channel you want to post as, prepend with a '@'",
"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) Comment object if successfully made, (None) otherwise\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"claim_id\": (str) The claim commented on,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"is_pinned\": (boolean) Channel owner has pinned this comment,\n \"signature\": (str) The signature of the comment,\n \"signing_ts\": (str) The timestamp used to sign the comment,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n }",
"examples": [
{
"title": "Posting a comment as your channel",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"Thank you Based God\" --channel_name=@channel --claim_id=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"Thank you Based God\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
},
{
"title": "Use the parent_id param to make replies",
"curl": "curl -d'{\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet comment create --comment=\"I have photographic evidence confirming Sasquatch exists\" --channel_name=@channel --parent_id=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103 --claim_id=a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_create\", \"params\": {\"comment\": \"I have photographic evidence confirming Sasquatch exists\", \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"channel_name\": \"@channel\", \"channel_account_id\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_claim_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
}
]
},
{
"name": "comment_hide",
"description": "Hide a comment published to a claim you control.",
"arguments": [
{
"name": "comment_ids",
"type": "str, list",
"description": "one or more comment_id to hide.",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "lists containing the ids comments that are hidden and visible.\n\n {\n \"hidden\": (list) IDs of hidden comments.\n \"visible\": (list) IDs of visible comments.\n }",
"examples": []
},
{
"name": "comment_list",
"description": "List comments associated with a claim.",
"arguments": [
{
"name": "claim_id",
"type": "str",
"description": "The claim on which the comment will be made on",
"is_required": true
},
{
"name": "parent_id",
"type": "str",
"description": "CommentId of a specific thread you'd like to see",
"is_required": false
},
{
"name": "page",
"type": "int",
"description": "The page you'd like to see in the comment list.",
"is_required": false
},
{
"name": "page_size",
"type": "int",
"description": "The amount of comments that you'd like to retrieve",
"is_required": false
},
{
"name": "skip_validation",
"type": "bool",
"description": "Skip resolving comments to validate channel names",
"is_required": false
},
{
"name": "include_replies",
"type": "bool",
"description": "Whether or not you want to include replies in list",
"is_required": false
},
{
"name": "is_channel_signature_valid",
"type": "bool",
"description": "Only include comments with valid signatures. [Warning: Paginated total size will not change, even if list reduces]",
"is_required": false
},
{
"name": "visible",
"type": "bool",
"description": "Select only Visible Comments",
"is_required": false
},
{
"name": "hidden",
"type": "bool",
"description": "Select only Hidden Comments",
"is_required": false
}
],
"returns": "(dict) Containing the list, and information about the paginated content:\n {\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\": \"A List of dict objects representing comments.\"\n [\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n },\n ...\n ]\n }",
"examples": [
{
"title": "List all comments on a claim",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list a38a77a9154b679070b083e842040d6fb6b10c8e --include_replies",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"include_replies\": true, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n },\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
},
{
"title": "List a comment thread replying to a top level comment",
"curl": "curl -d'{\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet comment list a38a77a9154b679070b083e842040d6fb6b10c8e --parent_id=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\", \"include_replies\": false, \"skip_validation\": false, \"is_channel_signature_valid\": false, \"visible\": false, \"hidden\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"has_hidden_comments\": false,\n \"items\": [\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"I have photographic evidence confirming Sasquatch exists\",\n \"comment_id\": \"826a4f6851a1b3cc55cedf485c9d2d0e9b13955cf22976ef1fc3541f7442eba6578a6b2ff43bbd7a582d2586b46d70d7b7e7cfa599ded5ac83c0aa613bf280d3\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"signature\": \"14c3da32405d2a624bf34ce17cf2a47fbb3d263004de517e2baba688d74eb2c9d15458f60fb5341ed0e3e6bf217758150344df1421624eb565beb9541e00128a\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n },\n {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Thank you Based God\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_channel_signature_valid\": true,\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"signature\": \"570a75b22cc38d652ef23e5250223feeb8a4d1e2adac7d0382125be48384fabb26ef7e42e120a72b90c4bde13c08bf5372be5182d7e06f66d5cdbcbd60b806bc\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n ],\n \"page\": 1,\n \"page_size\": 50,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
}
]
},
{
"name": "comment_pin",
"description": "Pin a comment published to a claim you control.",
"arguments": [
{
"name": "comment_id",
"type": "str",
"description": "Hash identifying the comment to pin",
"is_required": true
},
{
"name": "channel_id",
"type": "str",
"description": "The ID of channel owning the commented claim",
"is_required": false
},
{
"name": "channel_name",
"type": "str",
"description": "The name of channel owning the commented claim",
"is_required": false
},
{
"name": "remove",
"type": "bool",
"description": "remove the pin",
"is_required": false
},
{
"name": "channel_account_id",
"type": "str",
"description": "one or more account ids for accounts to look in",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "lists containing the ids comments that are hidden and visible.\n\n {\n \"hidden\": (list) IDs of hidden comments.\n \"visible\": (list) IDs of visible comments.\n }",
"examples": []
},
{
"name": "comment_react",
"description": "Create and associate a reaction emoji with a comment using your channel identity.",
"arguments": [
{
"name": "comment_ids",
"type": "str",
"description": "one or more comment id reacted to, comma delimited",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
"description": "The ID of channel reacting",
"is_required": false
},
{
"name": "channel_name",
"type": "str",
"description": "The name of the channel reacting",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
},
{
"name": "channel_account_id",
"type": "str",
"description": "one or more account ids for accounts to look in",
"is_required": false
},
{
"name": "react_type",
"type": "str",
"description": "name of reaction type",
"is_required": false
},
{
"name": "remove",
"type": "bool",
"description": "remove specified react_type",
"is_required": false
},
{
"name": "clear_types",
"type": "str",
"description": "types to clear when adding another type",
"is_required": false
}
],
"returns": "(dict) Reaction object if successfully made, (None) otherwise\n {\n \"Reactions\": {\n <comment_id>: {\n <reaction_type>: (int) Count for this reaction\n ...\n }\n }",
"examples": []
},
{
"name": "comment_react_list",
"description": "List reactions emoji with a claim using your channel identity.",
"arguments": [
{
"name": "comment_ids",
"type": "str",
"description": "The comment ids reacted to, comma delimited",
"is_required": false
},
{
"name": "channel_id",
"type": "str",
"description": "The ID of channel reacting",
"is_required": false
},
{
"name": "channel_name",
"type": "str",
"description": "The name of the channel reacting",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
},
{
"name": "react_types",
"type": "str",
"description": "comma delimited reaction types",
"is_required": false
}
],
"returns": "(dict) Comment object if successfully made, (None) otherwise\n {\n \"my_reactions\": {\n <comment_id>: {\n <reaction_type>: (int) Count for this reaction type\n ...\n }\n }\n \"other_reactions\": {\n <comment_id>: {\n <reaction_type>: (int) Count for this reaction type\n ...\n }\n }\n }",
"examples": []
},
{
"name": "comment_update",
"description": "Edit a comment published as one of your channels.",
"arguments": [
{
"name": "comment",
"type": "str",
"description": "New comment replacing the old one",
"is_required": true
},
{
"name": "comment_id",
"type": "str",
"description": "Hash identifying the comment to edit",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(dict) Comment object if edit was successful, (None) otherwise\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"claim_id\": (str) The claim commented on,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"signing_ts\": (str) Timestamp used to sign the most recent signature,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"is_pinned\": (boolean) Channel owner has pinned this comment,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n }",
"examples": [
{
"title": "Edit the contents of a comment",
"curl": "curl -d'{\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}' http://localhost:5279/",
"lbrynet": "lbrynet comment update Where there was once sasquatch, there is not --comment_id=3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"comment_update\", \"params\": {\"comment\": \"Where there was once sasquatch, there is not\", \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"channel_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"comment\": \"Where there was once sasquatch, there is not\",\n \"comment_id\": \"3ae37ef7985f39b8ff8fd488c2e76304b09d3217874cbc6581b8520230addb9180b69d6d8b40c7f9b901df76fc2ad5c203ee98b2788f9de8e7d7a21f2d908103\",\n \"is_hidden\": false,\n \"is_pinned\": false,\n \"parent_id\": null,\n \"signature\": \"b003b1f6887f02128e0eaba8017ab3077a75a3283d6e3dad40b8dc48c250a26621329eaae09320561b4e70e480806a8fdce543b339bcc430b755ffe70e4ebe4b\",\n \"signing_ts\": \"1618443023\",\n \"timestamp\": \"1618443023\"\n }\n}"
}
]
}
]
},
"file": {
"doc": "File management.",
"commands": [
@@ -2915,9 +2573,9 @@
"examples": [
{
"title": "Delete a file",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"a38a77a9154b679070b083e842040d6fb6b10c8e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\"}}).json()",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"138446450b727414a2b9e9529341dc621a9e5470\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -2999,7 +2657,7 @@
"is_required": false
},
{
"name": "blobs_in_stream<blobs_in_stream>",
"name": "blobs_in_stream",
"type": "int",
"description": "get file with matching blobs in stream",
"is_required": false
@@ -3078,14 +2736,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\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"is_fully_reflected\": true,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 0\n },\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"e95315d7a89a8a0a785c83199e33e224678d5ffe\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"is_fully_reflected\": true,\n \"key\": \"2c3e1c66e4d1d8cac475ebdf7e777c99\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1618443021\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp3qk0qygt.png\",\n \"sd_hash\": \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/thumbnail.jpg\"\n },\n \"title\": \"Line truncated
"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\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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\": \"5ff5a0e1491f8a7b1ccba093b2963f9e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0170f30befb340325fd001b041c188e57c598d5f81dd671a785932239cd26885251126637352f3825ab44b6e2c2cef378b182f870b1f9050035fac0bb1956acf02bf696de46bc2526f2881f5b98c371975290eb8b00a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"77bf955798d4e67da2f877931216008c79f97a5788167e8bbb239b5f94ff13508c40c18604f29220efa7c79756f1a2ff\",\n \"stream_name\": \"tmpb146pf1q\",\n \"streaming_url\": \"http://localhost:5280/stream/5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"suggested_file_name\": \"tmpb146pf1q\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\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\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"7e64a9dc5a51f064999b5faca3275de1e8875882\",\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\": \"12b8744a005681b025c6062f2ef64430\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mnxa6w92YbS3NCccPANEzYHJY6bJGM7iUu\",\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\": \"1630567651\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpev348s69.png\",\n \"sd_hash\": \"3654f14df3da475a8ef3dcf81ca855ca719102cfe3d905d48d77ad5a264d067e723e3cf76c41f8715e4ca9a6fe96d0d2\",\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\": \"BlLine truncated
},
{
"title": "List files matching a parameter",
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"a38a77a9154b679070b083e842040d6fb6b10c8e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"added_on\": null,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"is_fully_reflected\": true,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 100,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 0\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"138446450b727414a2b9e9529341dc621a9e5470\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"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\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"is_fully_reflected\": true,\n \"key\": \"5ff5a0e1491f8a7b1ccba093b2963f9e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0170f30befb340325fd001b041c188e57c598d5f81dd671a785932239cd26885251126637352f3825ab44b6e2c2cef378b182f870b1f9050035fac0bb1956acf02bf696de46bc2526f2881f5b98c371975290eb8b00a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"77bf955798d4e67da2f877931216008c79f97a5788167e8bbb239b5f94ff13508c40c18604f29220efa7c79756f1a2ff\",\n \"stream_name\": \"tmpb146pf1q\",\n \"streaming_url\": \"http://localhost:5280/stream/5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"suggested_file_name\": \"tmpb146pf1q\",\n \"timestamp\": 1630567677,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\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}"
}
]
},
@@ -3202,10 +2860,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1618443025,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp8wvxwurx\",\n \"download_path\": \"/tmp/tmp8wvxwurx/tmpoegrqi7y_1\",\n \"file_name\": \"tmpoegrqi7y_1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5a38c8d3bcdb096a0e60cd11b17ba43d\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6887e0c8b0fbd096381feb0099e02e4c614bacc1f657062e12b9b5c53729bc2a4de0a2e14a28d56a0aa79fb4c4ec22e1\",\n \"stream_name\": \"tmpoegrqi7y\",\n \"streaming_url\": \"http://localhost:5280/stream/e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"suggested_file_name\": \"tmpoegrqi7y\",\n \"timestamp\": 1618443045,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"added_on\": 1630567653,\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 4,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpbzob8k7r\",\n \"download_path\": \"/tmp/tmpbzob8k7r/tmpb146pf1q_1\",\n \"file_name\": \"tmpb146pf1q_1\",\n \"height\": 214,\n \"is_fully_reflected\": false,\n \"key\": \"5ff5a0e1491f8a7b1ccba093b2963f9e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0170f30befb340325fd001b041c188e57c598d5f81dd671a785932239cd26885251126637352f3825ab44b6e2c2cef378b182f870b1f9050035fac0bb1956acf02bf696de46bc2526f2881f5b98c371975290eb8b00a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"purchase_receipt\": null,\n \"reflector_progress\": 0,\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"77bf955798d4e67da2f877931216008c79f97a5788167e8bbb239b5f94ff13508c40c18604f29220efa7c79756f1a2ff\",\n \"stream_name\": \"tmpb146pf1q\",\n \"streaming_url\": \"http://localhost:5280/stream/5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"suggested_file_name\": \"tmpb146pf1q\",\n \"timestamp\": 1630567677,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"uploading_to_reflector\": false,\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -3486,7 +3144,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\": \"http://localhost:2903/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\",\n \"libtorrent_component\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmp8wvxwurx\",\n \"download_dir\": \"/tmp/tmp8wvxwurx\",\n \"download_timeout\": 30.0,\n \"ffmpeg_path\": \"\",\n \"fixed_peer_delay\": 2.0,\n \"fixed_peers\": [\n [\n \"127.0.0.1\",\n 5567\n ]\n ],\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"max_wallet_server_fee\": \"0.0\",\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"prometheus_port\": 0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"save_blobs\": true,\n \"save_files\": true,\n \"save_resolved_claims\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"transaction_cache_size\": 10000,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"video_bitrate_maximum\": 5000000,\n \"video_encoder\": \"libx264 -crf 24 -preset faster -pix_fmt yuv420p\",\n \"video_scaler\": \"-vf \\\"scale=if(gte(iw\\\\,ih)\\\\,min(1920\\\\,iw)\\\\,-2):if(lt(iw\\\\,ih)\\\\,min(1920\\\\,ih)\\\\,-2)\\\" -maxrate 5500K -bufsize 5000K\",\n \"volume_analysis_time\": 240,\n \"volume_filter\": \"\",\n \"wallet_dir\": \"/tmp/tmp8wvxwurx\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
"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 \"blob_storage_limit\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"coin_selection_strategy\": \"standard\",\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_hub_requests\": 32,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/tmp/tmp8_tji32x/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpbzob8k7r\",\n \"download_dir\": \"/tmp/tmpbzob8k7r\",\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 \"hub_timeout\": 30.0,\n \"jurisdiction\": null,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"localhost\",\n 50002\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/tmpbzob8k7r\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
}
]
},
@@ -3561,10 +3219,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon a38a77a9154b679070b083e842040d6fb6b10c8e",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001abd0fd74424994db38aa6d0f5f8f928084f0107e6a111b9513e540c09e89ca68000000006b483045022100e03d8fb57669a36521399aa458918ffd07c88b0b46987270aaae552ec64161740220702fb7bf96728e9aaaa8cdb658f20637e043c9324e4a87c19de19f154fbedabc0121034d37b695b20296aa259fe7a1fc31a2e299c7ac65f5bda020e7f3d2b747e1d72affffffff0134b7f505000000001976a914f44e3067122b2c22d80a1dd911cfc6a23d77ec8f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3niqXr7i2Dnr4qNd8KXyzLGecwZ6hN5hv\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"863d3da7eac44aabfca6718351a32d2944383abf48f31c1e4a20818247f0e5c6\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"863d3da7eac44aabfca6718351a32d2944383abf48f31c1e4a20818247f0e5c6\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon 138446450b727414a2b9e9529341dc621a9e5470",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001c334ca5d1b1370052f2b60fc6a653b7cad13d9f4bf1b0a3bed9a3782922deb7e000000006b483045022100c1b03c480b02034ae6529403c51de347ccb713d9ab073efc31a7e535a54eec9c0220453935ecc35b3e6e7754e74999a73581cd243780c85e31d26f18a49a6f072e1d012102b63aea1d12a0766f1eb0c7b235875334c766ee60fb856900e5b69300463350edffffffff0134b7f505000000001976a914c1195a1c4c9dc0c3700019ed92f2c5a0919527d788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 214,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#138446450b727414a2b9e9529341dc621a9e5470\",\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"my7y5Zi2nYZGbHcMmGukzz3dzBKeLYnJej\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"9523336623012e46f92be3b1e41773f39afe1be21a96791ecd5a3ccbcef6c59f\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"9523336623012e46f92be3b1e41773f39afe1be21a96791ecd5a3ccbcef6c59f\"\n }\n}"
}
]
},
@@ -3795,17 +3453,17 @@
"examples": [
{
"title": "Create a stream claim without metadata",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoegrqi7y\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpoegrqi7y",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoegrqi7y\", \"validate_file\": false, \"optimize_file\": false, \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000013e16dbb76483b3ee632a8513b4adbeaa4047bc263fb6d994a78063ed989b694c010000006b483045022100eedde718729e57c9067ce65287c1936e9c95711bbc7b5c92397786ed265aa72502203cd5c50aeadeb2e0c7356386c33c9a15402fd973d9e125273fcbea6113385c4b012102e981259c2fff728c870ae1f037f03a0dbb71e63a083375b23a65bfec3ab7557fffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf76d7576a914b6eefba0730cb3bd7d5e13285f7acbcc7fae273c88ac38fb9423000000001976a914f2e0d23b629fdb04743939f4f5e8c123b07a3cba88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mmRvJcnGpU5ztvabtkF6bMZz1mAZa3FY2c\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"4c699b98ed6380a794d9b63f26bc4740aabeadb413852a63eeb38364b7db163e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": null,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3fB9L3NDF2GvyRmgLbN7yunFbRfhLonoh\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpb146pf1q\", \"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/tmpb146pf1q",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpb146pf1q\", \"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\": \"0100000001eb18a9ee3369501c7e6f51c266c5fef90443a568282b62fe91a65689d510a1d3010000006b483045022100a67bc9c7f59e9020652fe90a1f9011e56838997d8d7f8bfa81a48e4bd9f9aa2002205fbfc12942355ff689831bb0f1b5c5546dabf157868c4cf47e0ebf10835ac626012102a12507ff1f9dd615bdcbfe995067515ab164c0afca82c811f6512c71e73f003effffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad6d7576a91461f99b5d5a8b835507022131e7614ca5aed5c69f88ac38fb9423000000001976a9149bef62d82af2a9804e5bf3ecd2c0f3fd7d8f25b388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpwBjiw3Z5qyN5S8xFYPMvUuWZktaGakgu\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"nout\": 1,\n \"timestamp\": 1630567676,\n \"txid\": \"d3a110d58956a691fe622b2868a54304f9fec566c2516f7e1c506933eea918eb\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"timestamp\": null,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mujTodHBxPXwMP5evjeH151ZsGDA8CU1jc\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\"\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/tmp3qk0qygt.png\", \"validate_file\": false, \"optimize_file\": false, \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1618443021, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmp3qk0qygt.png --tags=blank --tags=art --languages=en --locations=US:NH:Manchester --fee_currency=LBC --fee_amount=0.3 --title=\"Blank Image\" --description=\"A blank PNG that is 5x7.\" --author=Picaso --license=\"Public Domain\" --license_url=http://public-domain.org --thumbnail_url=\"http://smallmedia.com/thumbnail.jpg\" --release_time=1618443021 --channel_id=\"0eab90020ce7b538a56023804b578ab768ae7f7e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp3qk0qygt.png\", \"validate_file\": false, \"optimize_file\": false, \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1618443021, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000013441794e4d4455ad35d7cf390a58e45a101b6bb3bbfc0fd2f91f148e0bffb269010000006a47304402203775193e4633f7963d60e8da83fad53551720f80e6b2fc51cbb46b25aefbef9802200917f13e7f5e766a5a6c04407ad5ead4210b3ae524896c5e515649679a6a315e0121036075c80e3878d380d90581e89eefc98350c3c956cf632572844afb8c3c20c97effffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101017e7fae68b78a574b802360a538b5e70c0290ab0e7c456455b5285b13b0ef426146320e87a58e37cc2ac41f7434af4cc89c6a258c50c8ed51bb74e9b97b660c92754cf3e6bbe6abf245efb8a0f7a953426768c09a0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7033716b30717967742e706e6718632209696d6167652f706e6732305835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f7267288df6dd83063222080112196fa3416b588bef6cfdfdd42502dc79efbbc7f77cacbdc2462a188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914a3416b588bef6cfdfdd42502dc79efbbc7f77cac88acac5e7d1d000000001976a914ff5da30c41efd003a04b9a1850f49b15da29efe488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3fB9L3NDF2GvyRmgLbN7yunFbRfhLonoh\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\n \"amount\": \"1.0\",\n \"claim_id\": \"e95315d7a89a8a0a785c83199e33e224678d5ffe\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"blank-image\",\n \"normalized_name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#e95315d7a89a8a0a785c83199e33e224678d5ffe\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"3c0a725c75a3432e04be1d59d81ee004b12c4441474b46ad34f63e0e22032635\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvQAojfY6jQ8guAJvzskes5RgMX1eyamKX\",\n \"amount\": \"0.3\",\n \"currency\": \"LBC\"\n },\n \"image\": {\n \"height\": 7,\n \"width\": 5\n },\n \"languages\": [\n \"en\"\n ],\n \"license\": \"Public Domain\",\n \"license_url\": \"http://public-domain.org\",\n \"locations\": [\n {\n \"city\": \"Manchester\",\n \"country\": \"US\",\n \"state\": \"NH\"\n }\n ],\n \"release_time\": \"1618443021\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp3qk0qygt.png\",\n \"sd_hash\": \"5835272f672cdcd63f7f7e1ebe7d32c66d9a38d7a7813ad842e1df70ade622ebe93439d9d929413975bc85dd8b8b2198\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbLine truncated
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpev348s69.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\": 1630567651, \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpev348s69.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=1630567651 --channel_id=\"815f8d597ce588c141b001d05f3240b3ef0bf370\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpev348s69.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\": 1630567651, \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b50e2ed0154414ccfb821ffa6164cfa7a7dd74988d0ff9a4769b857eb1c9fe10010000006b483045022100e6ce7b778a40884b08b9e1ec4826bebc31f4fa9a52c99c50b0162368f058126c02207c47e0867bf387b6239f3db0faa44b2345f488e000310cf8c93c6066ee5cd828012103c17d084dc82340293e6fcfbc805d82fad7453851b2f1b51843a2eb2d78fbe096ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db1010170f30befb340325fd001b041c188e57c598d5f81cef45e51ab648cff8ace11e8922e3a974c83b444443442c7d1672cefa340cd9a06d0354ce6aee791c91d76fe9259499ded55e773cd91b19d6515aca52a0a2a220ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7065763334387336392e706e6718632209696d6167652f706e6732303654f14df3da475a8ef3dcf81ca855ca719102cfe3d905d48d77ad5a264d067e723e3cf76c41f8715e4ca9a6fe96d0d2120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728e3f9c189063222080112196f51a12bb815be629bb9d43fdee188d93eb15513de27e775e6188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a91451a12bb815be629bb9d43fdee188d93eb15513de88acac5e7d1d000000001976a91466b37cf116dfdbdc949634387565a22df7e4c7fd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mujTodHBxPXwMP5evjeH151ZsGDA8CU1jc\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"nout\": 1,\n \"timestamp\": 1630567677,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnxa6w92YbS3NCccPANEzYHJY6bJGM7iUu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7e64a9dc5a51f064999b5faca3275de1e8875882\",\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#7e64a9dc5a51f064999b5faca3275de1e8875882\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"cae9365d2b79e8dca9b5011c8b7601666c3929312871f82d1479591539fb9a69\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mnxa6w92YbS3NCccPANEzYHJY6bJGM7iUu\",\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\": \"1630567651\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpev348s69.png\",\n \"sd_hash\": \"3654f14df3da475a8ef3dcf81ca855ca719102cfe3d905d48d77ad5a264d067e723e3cf76c41f8715e4ca9a6fe96d0d2\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thuLine truncated
}
]
},
@@ -3875,14 +3533,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\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"timestamp\": 1630567677,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\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\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": false,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1618443045,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_internal_transfer\": false,\n \"is_my_input\": true,\n \"is_my_output\": true,\n \"is_spent\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1630567677,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"timestamp\": 1630567677,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\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}"
}
]
},
@@ -4221,10 +3879,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update a38a77a9154b679070b083e842040d6fb6b10c8e --channel_id=\"0eab90020ce7b538a56023804b578ab768ae7f7e\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000023441794e4d4455ad35d7cf390a58e45a101b6bb3bbfc0fd2f91f148e0bffb269000000006b483045022100d26bd086f854c0d671f3634073ff898bc8d2d6ead98ac2799abf4f6362310cc0022061c523e7d9f0b2e732650fe087b9259f5224bef25eaf6e1f09690d887c4a3ce50121034d37b695b20296aa259fe7a1fc31a2e299c7ac65f5bda020e7f3d2b747e1d72afffffffff805b55115aae7eb94d273b4efb6e64efc938b481e93656192d7b695c979d0e9010000006b483045022100f9d4a48eda873982b0be8875326f026bce345294fff126ee75ed684e15de6d00022046c721e26f892b59fa8f18516712864ea26c3453a7bd5ee284f511da79fbfed6012103e4cea47ad83869186635013e5f5de7b8c47b561d1f19a91c14ad04812924ce73ffffffff0200e1f50500000000fd2301b7076173747265616d148e0cb1b66f0d0442e883b07090674b15a9778aa34ce8017e7fae68b78a574b802360a538b5e70c0290ab0e45189c73d176021eb2c62fc2349b4815e643564c1b1c350449ad07efde2f522aaf75ca442dfbe799901ff03bb0dcd27517911f05ea912a42b0165386a51d9a8b0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f65677271693779180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf76d6d76a914b6eefba0730cb3bd7d5e13285f7acbcc7fae273c88ac32a0d205000000001976a914305d98124bb22351ab3a4f69ca61f2175816ffb488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"timestamp\": 1618443045,\n \"txid\": \"69b2ff0b8e141ff9d20ffcbbb36b1b105ae4580a39cfd735ad55444d4e794134\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoegrqi7y\",\n \"sd_hash\": \"e09d3a34eac31d5ab272b595dbe640a9b74fe2a5fddcf90c2025f01f23f699c9404da2d30990d2712661f80c6bf7aaf7\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"minHFWqr3L7oyfNNPReBgTkRj4rykBaUod\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1618443044,\n \"txid\": \"e9d079c995b6d7926165931e488b93fc4ee6b6efb473d294ebe7aa1551b505f8\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxCDZnrJMEcmRVs848ECDmS6z7TaBhfnNW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#a38a77a9154b679070b083e842040d6fb6b10c8e\",\n \"signing_channel\": {\n \"address\": \"mkukjkqAmm8KEsS6ZiZrffwM8mkkGHcVvM\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#0eab90020ce7b538a56023804b578ab768ae7f7e\",\n \"timestamp\": 1618443044,\n \"txid\": \"1b37824caa74b056a46e82044ae5de7cebee5b76f3194d1863d48688935e7e8c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004ec0c2d07e0cdd79784393f38a0ecbbd15a6da3152b2cd104c41f48ebc98a7cbf625eba50bd13aa117f064166ac73c7004ddfebc47481675b83e8009fba09304f\",\n \"public_key_id\": \"mrdKouGoS6VJuYSt78gaCe54abKqe8nCnj\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"68ca899ec040e513951b116a7e10f08480928f5f0f6daa38db94494274fdd0ab\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n Line truncated
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update 138446450b727414a2b9e9529341dc621a9e5470 --channel_id=\"815f8d597ce588c141b001d05f3240b3ef0bf370\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\", \"validate_file\": false, \"optimize_file\": false, \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\", \"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\": \"0100000002b50e2ed0154414ccfb821ffa6164cfa7a7dd74988d0ff9a4769b857eb1c9fe10000000006a47304402206fddf588d2a39d5a5061eca78bba303758a16545209097796f9182cf090c2c7302203def11a7418c51bfea86f07ad5ae19a039b556e249d055e0b16fe5b8f5dc3eea012102b63aea1d12a0766f1eb0c7b235875334c766ee60fb856900e5b69300463350edffffffff82ce074edd1564865867574cf761d8f6ae7aa225aa8bb494ef6c329dc13372b4010000006b483045022100a5eda62fbaa798da5ba005598edca5bffccad96fbdd528af51e0ef2e14cd096002205f85f2bc192dfd486fa6df8a4a3f0b4849fd48dd434ed77f4cc7d572558852bb012103dc87ecad1cd1e0d2879c20be930f913307e7feb91b5b3a8f49fc3252baf473f4ffffffff0200e1f50500000000fd2301b7076173747265616d1470549e1a62dc419352e9b9a21474720b454684134ce80170f30befb340325fd001b041c188e57c598d5f81dd671a785932239cd26885251126637352f3825ab44b6e2c2cef378b182f870b1f9050035fac0bb1956acf02bf696de46bc2526f2881f5b98c371975290eb8b00a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706231343670663171180b22186170706c69636174696f6e2f6f637465742d73747265616d32305b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad6d6d76a91461f99b5d5a8b835507022131e7614ca5aed5c69f88ac32a0d205000000001976a914d62a8c4306aa05143093d535373f2aca556c965088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"timestamp\": 1630567677,\n \"txid\": \"10fec9b17e859b76a4f90f8d9874dda7a7cf6461fa1f82fbcc144415d02e0eb5\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpb146pf1q\",\n \"sd_hash\": \"5b99f91996841d06c64c7f0aa35aa3e3e9dfb79e88b74138dd6cf919551dc661f7e571b78069b61bed9f5c12cc77c6ad\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mz6Sak75qd3EYBNPNEsNdJsXbS9ebPx3j6\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"nout\": 1,\n \"timestamp\": 1630567676,\n \"txid\": \"b47233c19d326cef94b48baa25a27aaef6d861f74c576758866415dd4e07ce82\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpSzreoT2ukyzd3c5h2Sf9vEedb6MvHX59\",\n \"amount\": \"1.0\",\n \"claim_id\": \"138446450b727414a2b9e9529341dc621a9e5470\",\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#138446450b727414a2b9e9529341dc621a9e5470\",\n \"signing_channel\": {\n \"address\": \"n1AzRGYFcKbdXVAD8WnM2x8kT3HTr7L9f7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"815f8d597ce588c141b001d05f3240b3ef0bf370\",\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#815f8d597ce588c141b001d05f3240b3ef0bf370\",\n \"timestamp\": 1630567676,\n \"txid\": \"4e4163b7541635b598f655dc51ef2b944547c2b6a494dc491a89c280ca153490\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004d423b3b41984ef96038ca03278bdcfd3147f88fa3054d0706a2e8c8e8064dee8dcef501042c1ec2ed062565f3119613ca475fd85f958d5ccc9e3c39beb4fc7a6\",\n \"public_key_id\": \"mhz4rWgbySXKByVvkfkhRGGGbmQgy59v2Z\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"7eeb2d9282379aed3b0a1bbff4d913ad7c3b656afc602b2f0570131b5dca34c3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n Line truncated
}
]
}
@@ -4347,6 +4005,12 @@
"description": "ids of accounts to fund this transaction",
"is_required": false
},
{
"name": "comment",
"type": "str",
"description": "add a comment to the support",
"is_required": false
},
{
"name": "preview",
"type": "bool",
@@ -4439,7 +4103,7 @@
},
{
"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 !!!!!",
"description": "List total staked supports for a claim, grouped by the channel that signed the support.\n\nIf claim_id is a channel claim, you can use --include_channel_content to also include supports for\ncontent claims in the channel.\n\n!!!! NOTE: PAGINATION DOES NOT DO ANYTHING AT THE MOMENT !!!!!",
"arguments": [
{
"name": "claim_id",
@@ -4600,7 +4264,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\": \"2021-04-14 19:30\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1618443044,\n \"txid\": \"695e9f58985a2712c33a1af7e11cc2e8149d5126031729e6a940d3121c7056b7\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2021-04-14 19:30\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1618443043,\n \"txid\": \"5b2bb866bbb20a99549d14a423f30814bb1a67d1fc28e2673fe5945f9951dd3b\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2021-09-02 10:27\",\n \"fee\": \"-0.000124\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1630567676,\n \"txid\": \"f8283696d48f8affcf1b5d3b3166b8f30274069427c95507be9f735e24ce67ac\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2021-09-02 10:27\",\n \"fee\": \"0.0\",\n \"purchase_info\": [],\n \"support_info\": [],\n \"timestamp\": 1630567675,\n \"txid\": \"e21900d30b27c4807756e101738860e7eaf8b69425651e48b4c46938340af0e9\",\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}"
}
]
},
@@ -5398,4 +5062,4 @@
}
]
}
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = "0.94.0"
__version__ = "0.104.0"
version = tuple(map(int, __version__.split('.'))) # pylint: disable=invalid-name
+34 -22
View File
@@ -1,5 +1,6 @@
import os
import re
import time
import asyncio
import binascii
import logging
@@ -70,12 +71,16 @@ class AbstractBlob:
'writers',
'verified',
'writing',
'readers'
'readers',
'added_on',
'is_mine',
]
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None):
def __init__(
self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None, added_on: typing.Optional[int] = None, is_mine: bool = False,
):
self.loop = loop
self.blob_hash = blob_hash
self.length = length
@@ -85,6 +90,8 @@ class AbstractBlob:
self.verified: asyncio.Event = asyncio.Event(loop=self.loop)
self.writing: asyncio.Event = asyncio.Event(loop=self.loop)
self.readers: typing.List[typing.BinaryIO] = []
self.added_on = added_on or time.time()
self.is_mine = is_mine
if not is_valid_blobhash(blob_hash):
raise InvalidBlobHashError(blob_hash)
@@ -180,20 +187,21 @@ class AbstractBlob:
@classmethod
async def create_from_unencrypted(
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
unencrypted: bytes, blob_num: int,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], None]] = None) -> BlobInfo:
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
unencrypted: bytes, blob_num: int, added_on: int, is_mine: bool,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], None]] = None,
) -> BlobInfo:
"""
Create an encrypted BlobFile from plaintext bytes
"""
blob_bytes, blob_hash = encrypt_blob_bytes(key, iv, unencrypted)
length = len(blob_bytes)
blob = cls(loop, blob_hash, length, blob_completed_callback, blob_dir)
blob = cls(loop, blob_hash, length, blob_completed_callback, blob_dir, added_on, is_mine)
writer = blob.get_blob_writer()
writer.write(blob_bytes)
await blob.verified.wait()
return BlobInfo(blob_num, length, binascii.hexlify(iv).decode(), blob_hash)
return BlobInfo(blob_num, length, binascii.hexlify(iv).decode(), blob_hash, added_on, is_mine)
def save_verified_blob(self, verified_bytes: bytes):
if self.verified.is_set():
@@ -248,11 +256,13 @@ class BlobBuffer(AbstractBlob):
"""
An in-memory only blob
"""
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None):
def __init__(
self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None, added_on: typing.Optional[int] = None, is_mine: bool = False
):
self._verified_bytes: typing.Optional[BytesIO] = None
super().__init__(loop, blob_hash, length, blob_completed_callback, blob_directory)
super().__init__(loop, blob_hash, length, blob_completed_callback, blob_directory, added_on, is_mine)
@contextlib.contextmanager
def _reader_context(self) -> typing.ContextManager[typing.BinaryIO]:
@@ -289,10 +299,12 @@ class BlobFile(AbstractBlob):
"""
A blob existing on the local file system
"""
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None):
super().__init__(loop, blob_hash, length, blob_completed_callback, blob_directory)
def __init__(
self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
blob_directory: typing.Optional[str] = None, added_on: typing.Optional[int] = None, is_mine: bool = False
):
super().__init__(loop, blob_hash, length, blob_completed_callback, blob_directory, added_on, is_mine)
if not blob_directory or not os.path.isdir(blob_directory):
raise OSError(f"invalid blob directory '{blob_directory}'")
self.file_path = os.path.join(self.blob_directory, self.blob_hash)
@@ -343,12 +355,12 @@ class BlobFile(AbstractBlob):
@classmethod
async def create_from_unencrypted(
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
unencrypted: bytes, blob_num: int,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'],
asyncio.Task]] = None) -> BlobInfo:
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
unencrypted: bytes, blob_num: int, added_on: float, is_mine: bool,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None
) -> BlobInfo:
if not blob_dir or not os.path.isdir(blob_dir):
raise OSError(f"cannot create blob in directory: '{blob_dir}'")
return await super().create_from_unencrypted(
loop, blob_dir, key, iv, unencrypted, blob_num, blob_completed_callback
loop, blob_dir, key, iv, unencrypted, blob_num, added_on, is_mine, blob_completed_callback
)
+7 -1
View File
@@ -7,13 +7,19 @@ class BlobInfo:
'blob_num',
'length',
'iv',
'added_on',
'is_mine'
]
def __init__(self, blob_num: int, length: int, iv: str, blob_hash: typing.Optional[str] = None):
def __init__(
self, blob_num: int, length: int, iv: str,
blob_hash: typing.Optional[str] = None, added_on=0, is_mine=False):
self.blob_hash = blob_hash
self.blob_num = blob_num
self.length = length
self.iv = iv
self.added_on = added_on
self.is_mine = is_mine
def as_dict(self) -> typing.Dict:
d = {
+12 -8
View File
@@ -36,30 +36,30 @@ class BlobManager:
self.config.blob_lru_cache_size)
self.connection_manager = ConnectionManager(loop)
def _get_blob(self, blob_hash: str, length: typing.Optional[int] = None):
def _get_blob(self, blob_hash: str, length: typing.Optional[int] = None, is_mine: bool = False):
if self.config.save_blobs or (
is_valid_blobhash(blob_hash) and os.path.isfile(os.path.join(self.blob_dir, blob_hash))):
return BlobFile(
self.loop, blob_hash, length, self.blob_completed, self.blob_dir
self.loop, blob_hash, length, self.blob_completed, self.blob_dir, is_mine=is_mine
)
return BlobBuffer(
self.loop, blob_hash, length, self.blob_completed, self.blob_dir
self.loop, blob_hash, length, self.blob_completed, self.blob_dir, is_mine=is_mine
)
def get_blob(self, blob_hash, length: typing.Optional[int] = None):
def get_blob(self, blob_hash, length: typing.Optional[int] = None, is_mine: bool = False):
if blob_hash in self.blobs:
if self.config.save_blobs and isinstance(self.blobs[blob_hash], BlobBuffer):
buffer = self.blobs.pop(blob_hash)
if blob_hash in self.completed_blob_hashes:
self.completed_blob_hashes.remove(blob_hash)
self.blobs[blob_hash] = self._get_blob(blob_hash, length)
self.blobs[blob_hash] = self._get_blob(blob_hash, length, is_mine)
if buffer.is_readable():
with buffer.reader_context() as reader:
self.blobs[blob_hash].write_blob(reader.read())
if length and self.blobs[blob_hash].length is None:
self.blobs[blob_hash].set_length(length)
else:
self.blobs[blob_hash] = self._get_blob(blob_hash, length)
self.blobs[blob_hash] = self._get_blob(blob_hash, length, is_mine)
return self.blobs[blob_hash]
def is_blob_verified(self, blob_hash: str, length: typing.Optional[int] = None) -> bool:
@@ -105,9 +105,13 @@ class BlobManager:
if isinstance(blob, BlobFile):
if blob.blob_hash not in self.completed_blob_hashes:
self.completed_blob_hashes.add(blob.blob_hash)
return self.loop.create_task(self.storage.add_blobs((blob.blob_hash, blob.length), finished=True))
return self.loop.create_task(self.storage.add_blobs(
(blob.blob_hash, blob.length, blob.added_on, blob.is_mine), finished=True)
)
else:
return self.loop.create_task(self.storage.add_blobs((blob.blob_hash, blob.length), finished=False))
return self.loop.create_task(self.storage.add_blobs(
(blob.blob_hash, blob.length, blob.added_on, blob.is_mine), finished=False)
)
def check_completed_blobs(self, blob_hashes: typing.List[str]) -> typing.List[str]:
"""Returns of the blobhashes_to_check, which are valid"""
+53
View File
@@ -0,0 +1,53 @@
import asyncio
import logging
log = logging.getLogger(__name__)
class DiskSpaceManager:
def __init__(self, config, db, blob_manager, cleaning_interval=30 * 60):
self.config = config
self.db = db
self.blob_manager = blob_manager
self.cleaning_interval = cleaning_interval
self.running = False
self.task = None
async def get_space_used_bytes(self):
return await self.db.get_stored_blob_disk_usage()
async def get_space_used_mb(self):
return int(await self.get_space_used_bytes()/1024.0/1024.0)
async def clean(self):
if not self.config.blob_storage_limit:
return 0
delete = []
available = (self.config.blob_storage_limit*1024*1024) - await self.get_space_used_bytes()
if available > 0:
return 0
for blob_hash, file_size, _ in await self.db.get_stored_blobs(is_mine=False):
delete.append(blob_hash)
available += file_size
if available > 0:
break
if delete:
await self.db.stop_all_files()
await self.blob_manager.delete_blobs(delete, delete_from_db=True)
return len(delete)
async def cleaning_loop(self):
while self.running:
await asyncio.sleep(self.cleaning_interval)
await self.clean()
async def start(self):
self.running = True
self.task = asyncio.create_task(self.cleaning_loop())
self.task.add_done_callback(lambda _: log.info("Stopping blob cleanup service."))
async def stop(self):
if self.running:
self.running = False
self.task.cancel()
+9 -3
View File
@@ -18,7 +18,7 @@ MAX_REQUEST_SIZE = 1200
class BlobServerProtocol(asyncio.Protocol):
def __init__(self, loop: asyncio.AbstractEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str,
idle_timeout: float = 30.0, transfer_timeout: float = 60.0):
idle_timeout: float = 30.0, transfer_timeout: float = 60.0, blob_callback=None):
self.loop = loop
self.blob_manager = blob_manager
self.idle_timeout = idle_timeout
@@ -32,6 +32,7 @@ class BlobServerProtocol(asyncio.Protocol):
self.started_transfer = asyncio.Event(loop=self.loop)
self.transfer_finished = asyncio.Event(loop=self.loop)
self.close_on_idle_task: typing.Optional[asyncio.Task] = None
self.blob_handling_callback: typing.Optional[typing.Callable] = blob_callback
async def close_on_idle(self):
while self.transport:
@@ -92,6 +93,9 @@ class BlobServerProtocol(asyncio.Protocol):
if download_request:
blob = self.blob_manager.get_blob(download_request.requested_blob)
if self.blob_handling_callback:
await self.blob_handling_callback(blob)
blob = self.blob_manager.get_blob(download_request.requested_blob)
if blob.get_is_verified():
incoming_blob = {'blob_hash': blob.blob_hash, 'length': blob.length}
responses.append(BlobDownloadResponse(incoming_blob=incoming_blob))
@@ -152,7 +156,7 @@ class BlobServerProtocol(asyncio.Protocol):
class BlobServer:
def __init__(self, loop: asyncio.AbstractEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str,
idle_timeout: float = 30.0, transfer_timeout: float = 60.0):
idle_timeout: float = 30.0, transfer_timeout: float = 60.0, blob_callback=None):
self.loop = loop
self.blob_manager = blob_manager
self.server_task: typing.Optional[asyncio.Task] = None
@@ -161,6 +165,7 @@ class BlobServer:
self.idle_timeout = idle_timeout
self.transfer_timeout = transfer_timeout
self.server_protocol_class = BlobServerProtocol
self.blob_handling_callback: typing.Optional[typing.Callable] = blob_callback
def start_server(self, port: int, interface: typing.Optional[str] = '0.0.0.0'):
if self.server_task is not None:
@@ -169,7 +174,8 @@ class BlobServer:
async def _start_server():
server = await self.loop.create_server(
lambda: self.server_protocol_class(self.loop, self.blob_manager, self.lbrycrd_address,
self.idle_timeout, self.transfer_timeout),
self.idle_timeout, self.transfer_timeout,
blob_callback=self.blob_handling_callback),
interface, port
)
self.started_listening.set()
+106 -18
View File
@@ -1,8 +1,8 @@
import os
import re
import sys
import typing
import logging
from typing import List, Dict, Tuple, Union, TypeVar, Generic, Optional
from argparse import ArgumentParser
from contextlib import contextmanager
from appdirs import user_data_dir, user_config_dir
@@ -15,7 +15,7 @@ log = logging.getLogger(__name__)
NOT_SET = type('NOT_SET', (object,), {}) # pylint: disable=invalid-name
T = typing.TypeVar('T')
T = TypeVar('T')
CURRENCIES = {
'BTC': {'type': 'crypto'},
@@ -24,11 +24,11 @@ CURRENCIES = {
}
class Setting(typing.Generic[T]):
class Setting(Generic[T]):
def __init__(self, doc: str, default: typing.Optional[T] = None,
previous_names: typing.Optional[typing.List[str]] = None,
metavar: typing.Optional[str] = None):
def __init__(self, doc: str, default: Optional[T] = None,
previous_names: Optional[List[str]] = None,
metavar: Optional[str] = None):
self.doc = doc
self.default = default
self.previous_names = previous_names or []
@@ -45,7 +45,7 @@ class Setting(typing.Generic[T]):
def no_cli_name(self):
return f"--no-{self.name.replace('_', '-')}"
def __get__(self, obj: typing.Optional['BaseConfig'], owner) -> T:
def __get__(self, obj: Optional['BaseConfig'], owner) -> T:
if obj is None:
return self
for location in obj.search_order:
@@ -53,7 +53,7 @@ class Setting(typing.Generic[T]):
return location[self.name]
return self.default
def __set__(self, obj: 'BaseConfig', val: typing.Union[T, NOT_SET]):
def __set__(self, obj: 'BaseConfig', val: Union[T, NOT_SET]):
if val == NOT_SET:
for location in obj.modify_order:
if self.name in location:
@@ -63,6 +63,18 @@ class Setting(typing.Generic[T]):
for location in obj.modify_order:
location[self.name] = val
def is_set(self, obj: 'BaseConfig') -> bool:
for location in obj.search_order:
if self.name in location:
return True
return False
def is_set_to_default(self, obj: 'BaseConfig') -> bool:
for location in obj.search_order:
if self.name in location:
return location[self.name] == self.default
return False
def validate(self, value):
raise NotImplementedError()
@@ -87,7 +99,7 @@ class String(Setting[str]):
f"Setting '{self.name}' must be a string."
# TODO: removes this after pylint starts to understand generics
def __get__(self, obj: typing.Optional['BaseConfig'], owner) -> str: # pylint: disable=useless-super-delegation
def __get__(self, obj: Optional['BaseConfig'], owner) -> str: # pylint: disable=useless-super-delegation
return super().__get__(obj, owner)
@@ -191,7 +203,7 @@ class MaxKeyFee(Setting[dict]):
)
parser.add_argument(
self.no_cli_name,
help=f"Disable maximum key fee check.",
help="Disable maximum key fee check.",
dest=self.name,
const=None,
action="store_const",
@@ -200,7 +212,7 @@ class MaxKeyFee(Setting[dict]):
class StringChoice(String):
def __init__(self, doc: str, valid_values: typing.List[str], default: str, *args, **kwargs):
def __init__(self, doc: str, valid_values: List[str], default: str, *args, **kwargs):
super().__init__(doc, default, *args, **kwargs)
if not valid_values:
raise ValueError("No valid values provided")
@@ -273,6 +285,75 @@ class Strings(ListSetting):
f"'{self.name}' must be a string."
class KnownHubsList:
def __init__(self, config: 'Config' = None, file_name: str = 'known_hubs.yml'):
self.file_name = file_name
self.path = os.path.join(config.wallet_dir, self.file_name) if config else None
self.hubs: Dict[Tuple[str, int], Dict] = {}
if self.exists:
self.load()
@property
def exists(self):
return self.path and os.path.exists(self.path)
@property
def serialized(self) -> Dict[str, Dict]:
return {f"{host}:{port}": details for (host, port), details in self.hubs.items()}
def filter(self, match_none=False, **kwargs):
if not kwargs:
return self.hubs
result = {}
for hub, details in self.hubs.items():
for key, constraint in kwargs.items():
value = details.get(key)
if value == constraint or (match_none and value is None):
result[hub] = details
break
return result
def load(self):
if self.path:
with open(self.path, 'r') as known_hubs_file:
raw = known_hubs_file.read()
for hub, details in yaml.safe_load(raw).items():
self.set(hub, details)
def save(self):
if self.path:
with open(self.path, 'w') as known_hubs_file:
known_hubs_file.write(yaml.safe_dump(self.serialized, default_flow_style=False))
def set(self, hub: str, details: Dict):
if hub and hub.count(':') == 1:
host, port = hub.split(':')
hub_parts = (host, int(port))
if hub_parts not in self.hubs:
self.hubs[hub_parts] = details
return hub
def add_hubs(self, hubs: List[str]):
added = False
for hub in hubs:
if self.set(hub, {}) is not None:
added = True
return added
def items(self):
return self.hubs.items()
def __bool__(self):
return len(self) > 0
def __len__(self):
return self.hubs.__len__()
def __iter__(self):
return iter(self.hubs)
class EnvironmentAccess:
PREFIX = 'LBRY_'
@@ -377,7 +458,7 @@ class ConfigFileAccess:
del self.data[key]
TBC = typing.TypeVar('TBC', bound='BaseConfig')
TBC = TypeVar('TBC', bound='BaseConfig')
class BaseConfig:
@@ -508,6 +589,9 @@ class CLIConfig(TranscodeConfig):
class Config(CLIConfig):
jurisdiction = String("Limit interactions to wallet server in this jurisdiction.")
# directories
data_dir = Path("Directory path to store blobs.", metavar='DIR')
download_dir = Path(
@@ -544,11 +628,13 @@ class Config(CLIConfig):
# protocol timeouts
download_timeout = Float("Cumulative timeout for a stream to begin downloading before giving up", 30.0)
blob_download_timeout = Float("Timeout to download a blob from a peer", 30.0)
hub_timeout = Float("Timeout when making a hub request", 30.0)
peer_connect_timeout = Float("Timeout to establish a TCP connection to a peer", 3.0)
node_rpc_timeout = Float("Timeout when making a DHT request", constants.RPC_TIMEOUT)
# blob announcement and download
save_blobs = Toggle("Save encrypted blob files for hosting, otherwise download blobs to memory only.", True)
blob_storage_limit = Integer("Disk space in MB to be allocated for blob storage. 0 = no limit", 0)
blob_lru_cache_size = Integer(
"LRU cache size for decrypted downloaded blobs used to minimize re-downloading the same blobs when "
"replying to a range request. Set to 0 to disable.", 32
@@ -565,6 +651,7 @@ class Config(CLIConfig):
"Maximum number of peers to connect to while downloading a blob", 4,
previous_names=['max_connections_per_stream']
)
concurrent_hub_requests = Integer("Maximum number of concurrent hub requests", 32)
fixed_peer_delay = Float(
"Amount of seconds before adding the reflector servers as potential peers to download from in case dht"
"peers are not found or are slow", 2.0
@@ -605,19 +692,19 @@ class Config(CLIConfig):
('spv19.lbry.com', 50001),
])
known_dht_nodes = Servers("Known nodes for bootstrapping connection to the DHT", [
('dht.lbry.grin.io', 4444), # Grin
('dht.lbry.madiator.com', 4444), # Madiator
('lbrynet1.lbry.com', 4444), # US EAST
('lbrynet2.lbry.com', 4444), # US WEST
('lbrynet3.lbry.com', 4444), # EU
('lbrynet4.lbry.com', 4444) # ASIA
])
comment_server = String("Comment server API URL", "https://comments.lbry.com/api/v2")
# blockchain
blockchain_name = String("Blockchain name - lbrycrd_main, lbrycrd_regtest, or lbrycrd_testnet", 'lbrycrd_main')
# daemon
save_files = Toggle("Save downloaded files when calling `get` by default", True)
save_files = Toggle("Save downloaded files when calling `get` by default", False)
components_to_skip = Strings("components which will be skipped during start-up of daemon", [])
share_usage_data = Toggle(
"Whether to share usage stats and diagnostic info with LBRY.", False,
@@ -655,6 +742,7 @@ class Config(CLIConfig):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.set_default_paths()
self.known_hubs = KnownHubsList(self)
def set_default_paths(self):
if 'darwin' in sys.platform.lower():
@@ -676,7 +764,7 @@ class Config(CLIConfig):
return os.path.join(self.data_dir, 'lbrynet.log')
def get_windows_directories() -> typing.Tuple[str, str, str]:
def get_windows_directories() -> Tuple[str, str, str]:
from lbry.winpaths import get_path, FOLDERID, UserHandle, \
PathNotFoundException # pylint: disable=import-outside-toplevel
@@ -698,14 +786,14 @@ def get_windows_directories() -> typing.Tuple[str, str, str]:
return data_dir, lbryum_dir, download_dir
def get_darwin_directories() -> typing.Tuple[str, str, str]:
def get_darwin_directories() -> Tuple[str, str, str]:
data_dir = user_data_dir('LBRY')
lbryum_dir = os.path.expanduser('~/.lbryum')
download_dir = os.path.expanduser('~/Downloads')
return data_dir, lbryum_dir, download_dir
def get_linux_directories() -> typing.Tuple[str, str, str]:
def get_linux_directories() -> Tuple[str, str, str]:
try:
with open(os.path.join(user_config_dir(), 'user-dirs.dirs'), 'r') as xdg:
down_dir = re.search(r'XDG_DOWNLOAD_DIR=(.+)', xdg.read())
+3 -4
View File
@@ -1,7 +1,6 @@
import logging
import asyncio
import typing
import binascii
import socket
from lbry.utils import resolve_host
from lbry.dht import constants
@@ -80,7 +79,7 @@ class Node:
await fut
async def announce_blob(self, blob_hash: str) -> typing.List[bytes]:
hash_value = binascii.unhexlify(blob_hash.encode())
hash_value = bytes.fromhex(blob_hash)
assert len(hash_value) == constants.HASH_LENGTH
peers = await self.peer_search(hash_value)
@@ -95,7 +94,7 @@ class Node:
stored_to = [node_id for node_id, contacted in stored_to_tup if contacted]
if stored_to:
log.debug(
"Stored %s to %i of %i attempted peers", binascii.hexlify(hash_value).decode()[:8],
"Stored %s to %i of %i attempted peers", hash_value.hex()[:8],
len(stored_to), len(peers)
)
else:
@@ -223,7 +222,7 @@ class Node:
# prioritize peers who reply to a dht ping first
# this minimizes attempting to make tcp connections that won't work later to dead or unreachable peers
async for results in self.get_iterative_value_finder(binascii.unhexlify(blob_hash.encode())):
async for results in self.get_iterative_value_finder(bytes.fromhex(blob_hash)):
to_put = []
for peer in results:
if peer.address == self.protocol.external_ip and self.protocol.peer_port == peer.tcp_port:
+12 -13
View File
@@ -1,10 +1,9 @@
import typing
import asyncio
import logging
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.utils import is_valid_public_ipv4 as _is_valid_public_ipv4, LRUCache
from lbry.dht import constants
from lbry.dht.serialization.datagram import make_compact_address, make_compact_ip, decode_compact_address
@@ -31,12 +30,12 @@ class PeerManager:
self._rpc_failures: typing.Dict[
typing.Tuple[str, int], typing.Tuple[typing.Optional[float], typing.Optional[float]]
] = {}
self._last_replied: typing.Dict[typing.Tuple[str, int], float] = {}
self._last_sent: typing.Dict[typing.Tuple[str, int], float] = {}
self._last_requested: typing.Dict[typing.Tuple[str, int], float] = {}
self._node_id_mapping: typing.Dict[typing.Tuple[str, int], bytes] = {}
self._node_id_reverse_mapping: typing.Dict[bytes, typing.Tuple[str, int]] = {}
self._node_tokens: typing.Dict[bytes, (float, bytes)] = {}
self._last_replied: typing.Dict[typing.Tuple[str, int], float] = LRUCache(2048)
self._last_sent: typing.Dict[typing.Tuple[str, int], float] = LRUCache(2048)
self._last_requested: typing.Dict[typing.Tuple[str, int], float] = LRUCache(2048)
self._node_id_mapping: typing.Dict[typing.Tuple[str, int], bytes] = LRUCache(2048)
self._node_id_reverse_mapping: typing.Dict[bytes, typing.Tuple[str, int]] = LRUCache(2048)
self._node_tokens: typing.Dict[bytes, (float, bytes)] = LRUCache(2048)
def reset(self):
for statistic in (self._rpc_failures, self._last_replied, self._last_sent, self._last_requested):
@@ -154,11 +153,11 @@ class KademliaPeer:
def __post_init__(self):
if self._node_id is not None:
if not len(self._node_id) == constants.HASH_LENGTH:
raise ValueError("invalid node_id: {}".format(hexlify(self._node_id).decode()))
if self.udp_port is not None and not 1 <= self.udp_port <= 65535:
raise ValueError("invalid udp port")
if self.tcp_port is not None and not 1 <= self.tcp_port <= 65535:
raise ValueError("invalid tcp port")
raise ValueError("invalid node_id: {}".format(self._node_id.hex()))
if self.udp_port is not None and not 1024 <= self.udp_port <= 65535:
raise ValueError(f"invalid udp port: {self.address}:{self.udp_port}")
if self.tcp_port is not None and not 1024 <= self.tcp_port <= 65535:
raise ValueError(f"invalid tcp port: {self.address}:{self.tcp_port}")
if not is_valid_public_ipv4(self.address, self.allow_localhost):
raise ValueError(f"invalid ip address: '{self.address}'")
+3
View File
@@ -16,6 +16,9 @@ class DictDataStore:
self._peer_manager = peer_manager
self.completed_blobs: typing.Set[str] = set()
def __len__(self):
return self._data_store.__len__()
def removed_expired_peers(self):
now = self.loop.time()
keys = list(self._data_store.keys())
+2 -3
View File
@@ -1,5 +1,4 @@
import asyncio
from binascii import hexlify
from itertools import chain
from collections import defaultdict
import typing
@@ -198,7 +197,7 @@ class IterativeFinder:
added += 1
log.debug("running %d probes", len(self.running_probes))
if not added and not self.running_probes:
log.debug("search for %s exhausted", hexlify(self.key)[:8])
log.debug("search for %s exhausted", self.key.hex()[:8])
self.search_exhausted()
def _schedule_probe(self, peer: 'KademliaPeer'):
@@ -271,7 +270,7 @@ class IterativeNodeFinder(IterativeFinder):
self.yielded_peers: typing.Set['KademliaPeer'] = set()
async def send_probe(self, peer: 'KademliaPeer') -> FindNodeResponse:
log.debug("probing %s:%d %s", peer.address, peer.udp_port, hexlify(peer.node_id)[:8] if peer.node_id else '')
log.debug("probing %s:%d %s", peer.address, peer.udp_port, peer.node_id.hex()[:8] if peer.node_id else '')
response = await self.protocol.get_rpc_peer(peer).find_node(self.key)
return FindNodeResponse(self.key, response)
+13 -11
View File
@@ -4,7 +4,6 @@ import functools
import hashlib
import asyncio
import typing
import binascii
import random
from asyncio.protocols import DatagramProtocol
from asyncio.transports import DatagramTransport
@@ -97,8 +96,7 @@ class KademliaRPC:
if not rpc_contact.tcp_port or peer.compact_address_tcp() != rpc_contact.compact_address_tcp()
]
# if we don't have k storing peers to return and we have this hash locally, include our contact information
if len(peers) < constants.K and binascii.hexlify(key).decode() in self.protocol.data_store.completed_blobs:
peers.append(self.compact_address())
peers.append(self.compact_address())
if not peers:
response[PAGE_KEY] = 0
else:
@@ -415,8 +413,8 @@ class KademliaProtocol(DatagramProtocol):
self._wakeup_routing_task.clear()
def _handle_rpc(self, sender_contact: 'KademliaPeer', message: RequestDatagram):
assert sender_contact.node_id != self.node_id, (binascii.hexlify(sender_contact.node_id)[:8].decode(),
binascii.hexlify(self.node_id)[:8].decode())
assert sender_contact.node_id != self.node_id, (sender_contact.node_id.hex()[:8],
self.node_id.hex()[:8])
method = message.method
if method not in [b'ping', b'store', b'findNode', b'findValue']:
raise AttributeError('Invalid method: %s' % message.method.decode())
@@ -452,7 +450,11 @@ class KademliaProtocol(DatagramProtocol):
try:
peer = self.routing_table.get_peer(request_datagram.node_id)
except IndexError:
peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
try:
peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
except ValueError as err:
log.warning("error replying to %s: %s", address[0], str(err))
return
try:
self._handle_rpc(peer, request_datagram)
# if the contact is not known to be bad (yet) and we haven't yet queried it, send it a ping so that it
@@ -552,12 +554,12 @@ class KademliaProtocol(DatagramProtocol):
address[0], address[1], OLD_PROTOCOL_ERRORS[error_datagram.response]
)
def datagram_received(self, datagram: bytes, address: typing.Tuple[str, int]) -> None: # pylint: disable=arguments-differ
def datagram_received(self, datagram: bytes, address: typing.Tuple[str, int]) -> None: # pylint: disable=arguments-renamed
try:
message = decode_datagram(datagram)
except (ValueError, TypeError, DecodeError):
self.peer_manager.report_failure(address[0], address[1])
log.warning("Couldn't decode dht datagram from %s: %s", address, binascii.hexlify(datagram).decode())
log.warning("Couldn't decode dht datagram from %s: %s", address, datagram.hex())
return
if isinstance(message, RequestDatagram):
@@ -599,7 +601,7 @@ class KademliaProtocol(DatagramProtocol):
if len(data) > constants.MSG_SIZE_LIMIT:
log.warning("cannot send datagram larger than %i bytes (packet is %i bytes)",
constants.MSG_SIZE_LIMIT, len(data))
log.debug("Packet is too large to send: %s", binascii.hexlify(data[:3500]).decode())
log.debug("Packet is too large to send: %s", data[:3500].hex())
raise ValueError(
f"cannot send datagram larger than {constants.MSG_SIZE_LIMIT} bytes (packet is {len(data)} bytes)"
)
@@ -659,13 +661,13 @@ class KademliaProtocol(DatagramProtocol):
res = await self.get_rpc_peer(peer).store(hash_value)
if res != b"OK":
raise ValueError(res)
log.debug("Stored %s to %s", binascii.hexlify(hash_value).decode()[:8], peer)
log.debug("Stored %s to %s", hash_value.hex()[:8], peer)
return peer.node_id, True
try:
return await __store()
except asyncio.TimeoutError:
log.debug("Timeout while storing blob_hash %s at %s", binascii.hexlify(hash_value).decode()[:8], peer)
log.debug("Timeout while storing blob_hash %s at %s", hash_value.hex()[:8], peer)
return peer.node_id, False
except ValueError as err:
log.error("Unexpected response: %s", err)
+1 -1
View File
@@ -50,7 +50,7 @@ class KBucket:
self.peers.append(peer)
return True
else:
for i in range(len(self.peers)):
for i, _ in enumerate(self.peers):
local_peer = self.peers[i]
if local_peer.node_id == peer.node_id:
self.peers.remove(local_peer)
+3 -3
View File
@@ -181,7 +181,7 @@ def decode_datagram(datagram: bytes) -> typing.Union[RequestDatagram, ResponseDa
def make_compact_ip(address: str) -> bytearray:
compact_ip = reduce(lambda buff, x: buff + bytearray([int(x)]), address.split('.'), bytearray())
if len(compact_ip) != 4:
raise ValueError(f"invalid IPv4 length")
raise ValueError("invalid IPv4 length")
return compact_ip
@@ -190,7 +190,7 @@ def make_compact_address(node_id: bytes, address: str, port: int) -> bytearray:
if not 0 < port < 65536:
raise ValueError(f'Invalid port: {port}')
if len(node_id) != constants.HASH_BITS // 8:
raise ValueError(f"invalid node node_id length")
raise ValueError("invalid node node_id length")
return compact_ip + port.to_bytes(2, 'big') + node_id
@@ -201,5 +201,5 @@ def decode_compact_address(compact_address: bytes) -> typing.Tuple[bytes, str, i
if not 0 < port < 65536:
raise ValueError(f'Invalid port: {port}')
if len(node_id) != constants.HASH_BITS // 8:
raise ValueError(f"invalid node node_id length")
raise ValueError("invalid node node_id length")
return node_id, address, port
+7 -1
View File
@@ -34,6 +34,7 @@ Code | Name | Message
**11x** | InputValue(ValueError) | Invalid argument value provided to command.
111 | GenericInputValue | The value '{value}' for argument '{argument}' is not valid.
112 | InputValueIsNone | None or null is not valid value for argument '{argument}'.
113 | ConflictingInputValue | Only '{first_argument}' or '{second_argument}' is allowed, not both.
**2xx** | Configuration | Configuration errors.
201 | ConfigWrite | Cannot write configuration file '{path}'. -- When writing the default config fails on startup, such as due to permission issues.
202 | ConfigRead | Cannot find provided configuration file '{path}'. -- Can't open the config file user provided via command line args.
@@ -53,13 +54,18 @@ Code | Name | Message
407 | DataDownload | Failed to download blob. *generic*
410 | Resolve | Failed to resolve '{url}'.
411 | ResolveTimeout | Failed to resolve '{url}' within the timeout.
411 | ResolveCensored | Resolve of '{url}' was censored by channel with claim id '{claim_id(censor_hash)}'.
411 | ResolveCensored | Resolve of '{url}' was censored by channel with claim id '{censor_id}'.
420 | KeyFeeAboveMaxAllowed | {message}
421 | InvalidPassword | Password is invalid.
422 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
423 | TooManyClaimSearchParameters | {key} cant have more than {limit} items.
431 | ServerPaymentInvalidAddress | Invalid address from wallet server: '{address}' - skipping payment round.
432 | ServerPaymentWalletLocked | Cannot spend funds with locked wallet, skipping payment round.
433 | ServerPaymentFeeAboveMaxAllowed | Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.
434 | WalletNotLoaded | Wallet {wallet_id} is not loaded.
435 | WalletAlreadyLoaded | Wallet {wallet_path} is already loaded.
436 | WalletNotFound | Wallet not found at {wallet_path}.
437 | WalletAlreadyExists | Wallet {wallet_path} already exists, use `wallet_add` to load it.
**5xx** | Blob | **Blobs**
500 | BlobNotFound | Blob not found.
501 | BlobPermissionDenied | Permission denied to read blob.
+47 -3
View File
@@ -76,6 +76,14 @@ class InputValueIsNoneError(InputValueError):
super().__init__(f"None or null is not valid value for argument '{argument}'.")
class ConflictingInputValueError(InputValueError):
def __init__(self, first_argument, second_argument):
self.first_argument = first_argument
self.second_argument = second_argument
super().__init__(f"Only '{first_argument}' or '{second_argument}' is allowed, not both.")
class ConfigurationError(BaseError):
"""
Configuration errors.
@@ -215,10 +223,10 @@ class ResolveTimeoutError(WalletError):
class ResolveCensoredError(WalletError):
def __init__(self, url, censor_hash):
def __init__(self, url, censor_id):
self.url = url
self.censor_hash = censor_hash
super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{claim_id(censor_hash)}'.")
self.censor_id = censor_id
super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{censor_id}'.")
class KeyFeeAboveMaxAllowedError(WalletError):
@@ -242,6 +250,14 @@ class IncompatibleWalletServerError(WalletError):
super().__init__(f"'{server}:{port}' has an incompatibly old version.")
class TooManyClaimSearchParametersError(WalletError):
def __init__(self, key, limit):
self.key = key
self.limit = limit
super().__init__(f"{key} cant have more than {limit} items.")
class ServerPaymentInvalidAddressError(WalletError):
def __init__(self, address):
@@ -263,6 +279,34 @@ class ServerPaymentFeeAboveMaxAllowedError(WalletError):
super().__init__(f"Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.")
class WalletNotLoadedError(WalletError):
def __init__(self, wallet_id):
self.wallet_id = wallet_id
super().__init__(f"Wallet {wallet_id} is not loaded.")
class WalletAlreadyLoadedError(WalletError):
def __init__(self, wallet_path):
self.wallet_path = wallet_path
super().__init__(f"Wallet {wallet_path} is already loaded.")
class WalletNotFoundError(WalletError):
def __init__(self, wallet_path):
self.wallet_path = wallet_path
super().__init__(f"Wallet not found at {wallet_path}.")
class WalletAlreadyExistsError(WalletError):
def __init__(self, wallet_path):
self.wallet_path = wallet_path
super().__init__(f"Wallet {wallet_path} already exists, use `wallet_add` to load it.")
class BlobError(BaseError):
"""
**Blobs**
+1 -1
View File
@@ -63,7 +63,7 @@ class ErrorClass:
@staticmethod
def get_fields(args):
if len(args) > 1:
return f''.join(f'\n{INDENT*2}self.{field} = {field}' for field in args[1:])
return ''.join(f'\n{INDENT*2}self.{field} = {field}' for field in args[1:])
return ''
@staticmethod
+1 -1
View File
@@ -101,7 +101,7 @@ class ArgumentParser(argparse.ArgumentParser):
self._optionals.title = 'Options'
if group_name is None:
self.epilog = (
f"Run 'lbrynet COMMAND --help' for more information on a command or group."
"Run 'lbrynet COMMAND --help' for more information on a command or group."
)
else:
self.epilog = (
-79
View File
@@ -1,79 +0,0 @@
import logging
import time
import hashlib
import binascii
import ecdsa
from lbry import utils
from lbry.crypto.hash import sha256
from lbry.wallet.transaction import Output
log = logging.getLogger(__name__)
def get_encoded_signature(signature):
signature = signature.encode() if isinstance(signature, str) else signature
r = int(signature[:int(len(signature) / 2)], 16)
s = int(signature[int(len(signature) / 2):], 16)
return ecdsa.util.sigencode_der(r, s, len(signature) * 4)
def cid2hash(claim_id: str) -> bytes:
return binascii.unhexlify(claim_id.encode())[::-1]
def is_comment_signed_by_channel(comment: dict, channel: Output, sign_comment_id=False):
if isinstance(channel, Output):
try:
signing_field = comment['comment_id'] if sign_comment_id else comment['comment']
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):
signing_field = comment['comment_id'] if sign_comment_id else comment['comment']
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)
return {
'signature': binascii.hexlify(signature).decode(),
'signing_ts': timestamp
}
def sign_reaction(reaction: dict, channel: Output):
signing_field = reaction['channel_name']
reaction.update(sign(channel, signing_field.encode()))
async def jsonrpc_post(url: str, method: str, params: dict = None, **kwargs) -> any:
params = params or {}
params.update(kwargs)
json_body = {'jsonrpc': '2.0', 'id': 1, 'method': method, 'params': params}
async with utils.aiohttp_request('POST', url, json=json_body) as response:
try:
result = await response.json()
return result['result'] if 'result' in result else result
except Exception as cte:
log.exception('Unable to decode response from server: %s', cte)
return await response.text()
+38 -2
View File
@@ -15,6 +15,7 @@ from lbry.dht.node import Node
from lbry.dht.peer import is_valid_public_ipv4
from lbry.dht.blob_announcer import BlobAnnouncer
from lbry.blob.blob_manager import BlobManager
from lbry.blob.disk_space_manager import DiskSpaceManager
from lbry.blob_exchange.server import BlobServer
from lbry.stream.stream_manager import StreamManager
from lbry.file.file_manager import FileManager
@@ -40,6 +41,7 @@ WALLET_SERVER_PAYMENTS_COMPONENT = "wallet_server_payments"
DHT_COMPONENT = "dht"
HASH_ANNOUNCER_COMPONENT = "hash_announcer"
FILE_MANAGER_COMPONENT = "file_manager"
DISK_SPACE_COMPONENT = "disk_space"
PEER_PROTOCOL_SERVER_COMPONENT = "peer_protocol_server"
UPNP_COMPONENT = "upnp"
EXCHANGE_RATE_MANAGER_COMPONENT = "exchange_rate_manager"
@@ -59,7 +61,7 @@ class DatabaseComponent(Component):
@staticmethod
def get_current_db_revision():
return 14
return 15
@property
def revision_filename(self):
@@ -138,7 +140,7 @@ class WalletComponent(Component):
'availability': session.available,
} for session in sessions
],
'known_servers': len(self.wallet_manager.ledger.network.config['default_servers']),
'known_servers': len(self.wallet_manager.ledger.network.known_hubs),
'available_servers': 1 if is_connected else 0
}
@@ -375,6 +377,36 @@ class FileManagerComponent(Component):
self.file_manager.stop()
class DiskSpaceComponent(Component):
component_name = DISK_SPACE_COMPONENT
depends_on = [DATABASE_COMPONENT, BLOB_COMPONENT]
def __init__(self, component_manager):
super().__init__(component_manager)
self.disk_space_manager: typing.Optional[DiskSpaceManager] = None
@property
def component(self) -> typing.Optional[DiskSpaceManager]:
return self.disk_space_manager
async def get_status(self):
if self.disk_space_manager:
return {
'space_used': str(await self.disk_space_manager.get_space_used_mb()),
'running': self.disk_space_manager.running,
}
return {'space_used': '0', 'running': False}
async def start(self):
db = self.component_manager.get_component(DATABASE_COMPONENT)
blob_manager = self.component_manager.get_component(BLOB_COMPONENT)
self.disk_space_manager = DiskSpaceManager(self.conf, db, blob_manager)
await self.disk_space_manager.start()
async def stop(self):
await self.disk_space_manager.stop()
class TorrentComponent(Component):
component_name = LIBTORRENT_COMPONENT
@@ -481,6 +513,10 @@ class UPnPComponent(Component):
log.info("external ip changed from %s to %s", self.external_ip, external_ip)
if external_ip:
self.external_ip = external_ip
dht_component = self.component_manager.get_component(DHT_COMPONENT)
if dht_component:
dht_node = dht_component.component
dht_node.protocol.external_ip = external_ip
# assert self.external_ip is not None # TODO: handle going/starting offline
if not self.upnp_redirects and self.upnp: # setup missing redirects
File diff suppressed because it is too large. Load diff
+9 -27
View File
@@ -5,7 +5,7 @@ import logging
from statistics import median
from decimal import Decimal
from typing import Optional, Iterable, Type
from aiohttp.client_exceptions import ContentTypeError
from aiohttp.client_exceptions import ContentTypeError, ClientConnectionError
from lbry.error import InvalidExchangeRateResponseError, CurrencyConversionError
from lbry.utils import aiohttp_request
from lbry.wallet.dewies import lbc_to_dewies
@@ -79,18 +79,23 @@ class MarketFeed:
log.debug("Saving rate update %f for %s from %s", rate, self.market, self.name)
self.rate = ExchangeRate(self.market, rate, int(time.time()))
self.last_check = time.time()
self.event.set()
return self.rate
except asyncio.CancelledError:
raise
except asyncio.TimeoutError:
log.warning("Timed out fetching exchange rate from %s.", self.name)
except json.JSONDecodeError as e:
log.warning("Could not parse exchange rate response from %s: %s", self.name, e.doc)
msg = e.doc if '<html>' not in e.doc else 'unexpected content type.'
log.warning("Could not parse exchange rate response from %s: %s", self.name, msg)
log.debug(e.doc)
except InvalidExchangeRateResponseError as e:
log.warning(str(e))
except ClientConnectionError as e:
log.warning("Error trying to connect to exchange rate %s: %s", self.name, str(e))
except Exception as e:
log.exception("Exchange rate error (%s from %s):", self.market, self.name)
finally:
self.event.set()
async def keep_updated(self):
while True:
@@ -130,27 +135,6 @@ class BittrexUSDFeed(BaseBittrexFeed):
url = "https://api.bittrex.com/v3/markets/LBC-USD/ticker"
class BaseCryptonatorFeed(MarketFeed):
name = "Cryptonator"
market = None
url = None
def get_rate_from_response(self, json_response):
if 'ticker' not in json_response or 'price' not in json_response['ticker']:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return float(json_response['ticker']['price'])
class CryptonatorBTCFeed(BaseCryptonatorFeed):
market = "BTCLBC"
url = "https://api.cryptonator.com/api/ticker/btc-lbc"
class CryptonatorUSDFeed(BaseCryptonatorFeed):
market = "USDLBC"
url = "https://api.cryptonator.com/api/ticker/usd-lbc"
class BaseCoinExFeed(MarketFeed):
name = "CoinEx"
market = None
@@ -202,7 +186,7 @@ class UPbitBTCFeed(MarketFeed):
params = {"markets": "BTC-LBC"}
def get_rate_from_response(self, json_response):
if len(json_response) != 1 or 'trade_price' not in json_response[0]:
if "error" in json_response or len(json_response) != 1 or 'trade_price' not in json_response[0]:
raise InvalidExchangeRateResponseError(self.name, 'result not found')
return 1.0 / float(json_response[0]['trade_price'])
@@ -210,8 +194,6 @@ class UPbitBTCFeed(MarketFeed):
FEEDS: Iterable[Type[MarketFeed]] = (
BittrexBTCFeed,
BittrexUSDFeed,
CryptonatorBTCFeed,
CryptonatorUSDFeed,
CoinExBTCFeed,
CoinExUSDFeed,
HotbitBTCFeed,
+1 -3
View File
@@ -123,7 +123,7 @@ class JSONResponseEncoder(JSONEncoder):
self.ledger = ledger
self.include_protobuf = include_protobuf
def default(self, obj): # pylint: disable=method-hidden,arguments-differ,too-many-return-statements
def default(self, obj): # pylint: disable=method-hidden,arguments-renamed,too-many-return-statements
if isinstance(obj, Account):
return self.encode_account(obj)
if isinstance(obj, Wallet):
@@ -234,8 +234,6 @@ class JSONResponseEncoder(JSONEncoder):
output['value_type'] = txo.claim.claim_type
if txo.claim.is_channel:
output['has_signing_key'] = txo.has_private_key
elif txo.script.is_support_claim_data:
output['value_type'] = 'emoji'
if check_signature and txo.signable.is_signed:
if txo.channel is not None:
output['signing_channel'] = self.encode_output(txo.channel)
@@ -35,6 +35,8 @@ def migrate_db(conf, start, end):
from .migrate12to13 import do_migration
elif current == 13:
from .migrate13to14 import do_migration
elif current == 14:
from .migrate14to15 import do_migration
else:
raise Exception(f"DB migration of version {current} to {current+1} is not available")
try:
@@ -0,0 +1,16 @@
import os
import sqlite3
def do_migration(conf):
db_path = os.path.join(conf.data_dir, "lbrynet.sqlite")
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.executescript("""
alter table blob add column added_on integer not null default 0;
alter table blob add column is_mine integer not null default 1;
""")
connection.commit()
connection.close()
+39 -10
View File
@@ -170,8 +170,8 @@ def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Di
def store_stream(transaction: sqlite3.Connection, sd_blob: 'BlobFile', descriptor: 'StreamDescriptor'):
# add all blobs, except the last one, which is empty
transaction.executemany(
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?)",
((blob.blob_hash, blob.length, 0, 0, "pending", 0, 0)
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?, ?, ?)",
((blob.blob_hash, blob.length, 0, 0, "pending", 0, 0, blob.added_on, blob.is_mine)
for blob in (descriptor.blobs[:-1] if len(descriptor.blobs) > 1 else descriptor.blobs) + [sd_blob])
).fetchall()
# associate the blobs to the stream
@@ -242,7 +242,9 @@ class SQLiteStorage(SQLiteMixin):
should_announce integer not null default 0,
status text not null,
last_announced_time integer,
single_announce integer
single_announce integer,
added_on integer not null,
is_mine integer not null default 0
);
create table if not exists stream (
@@ -356,19 +358,19 @@ class SQLiteStorage(SQLiteMixin):
# # # # # # # # # blob functions # # # # # # # # #
async def add_blobs(self, *blob_hashes_and_lengths: typing.Tuple[str, int], finished=False):
async def add_blobs(self, *blob_hashes_and_lengths: typing.Tuple[str, int, int, int], finished=False):
def _add_blobs(transaction: sqlite3.Connection):
transaction.executemany(
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?)",
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?, ?, ?)",
(
(blob_hash, length, 0, 0, "pending" if not finished else "finished", 0, 0)
for blob_hash, length in blob_hashes_and_lengths
(blob_hash, length, 0, 0, "pending" if not finished else "finished", 0, 0, added_on, is_mine)
for blob_hash, length, added_on, is_mine in blob_hashes_and_lengths
)
).fetchall()
if finished:
transaction.executemany(
"update blob set status='finished' where blob.blob_hash=?", (
(blob_hash, ) for blob_hash, _ in blob_hashes_and_lengths
(blob_hash, ) for blob_hash, _, _, _ in blob_hashes_and_lengths
)
).fetchall()
return await self.db.run(_add_blobs)
@@ -435,6 +437,29 @@ class SQLiteStorage(SQLiteMixin):
def get_all_blob_hashes(self):
return self.run_and_return_list("select blob_hash from blob")
async def get_stored_blobs(self, is_mine: bool):
is_mine = 1 if is_mine else 0
return await self.db.execute_fetchall(
"select blob_hash, blob_length, added_on from blob where is_mine=? order by added_on asc",
(is_mine,)
)
async def get_stored_blob_disk_usage(self, is_mine: Optional[bool] = None):
if is_mine is None:
sql, args = "select coalesce(sum(blob_length), 0) from blob", ()
else:
is_mine = 1 if is_mine else 0
sql, args = "select coalesce(sum(blob_length), 0) from blob where is_mine=?", (is_mine,)
return (await self.db.execute_fetchone(sql, args))[0]
async def update_blob_ownership(self, sd_hash, is_mine: bool):
is_mine = 1 if is_mine else 0
await self.db.execute_fetchall(
"update blob set is_mine = ? where blob_hash in ("
" select blob_hash from blob natural join stream_blob natural join stream where sd_hash = ?"
") OR blob_hash = ?", (is_mine, sd_hash, sd_hash)
)
def sync_missing_blobs(self, blob_files: typing.Set[str]) -> typing.Awaitable[typing.Set[str]]:
def _sync_blobs(transaction: sqlite3.Connection) -> typing.Set[str]:
finished_blob_hashes = tuple(
@@ -570,6 +595,10 @@ class SQLiteStorage(SQLiteMixin):
log.debug("update file status %s -> %s", stream_hash, new_status)
return self.db.execute_fetchall("update file set status=? where stream_hash=?", (new_status, stream_hash))
def stop_all_files(self):
log.debug("stopping all files")
return self.db.execute_fetchall("update file set status=?", ("stopped",))
async def change_file_download_dir_and_file_name(self, stream_hash: str, download_dir: typing.Optional[str],
file_name: typing.Optional[str]):
if not file_name or not download_dir:
@@ -617,7 +646,7 @@ class SQLiteStorage(SQLiteMixin):
).fetchall()
download_dir = binascii.hexlify(self.conf.download_dir.encode()).decode()
transaction.executemany(
f"update file set download_directory=? where stream_hash=?",
"update file set download_directory=? where stream_hash=?",
((download_dir, stream_hash) for stream_hash in stream_hashes)
).fetchall()
await self.db.run_with_foreign_keys_disabled(_recover)
@@ -861,6 +890,6 @@ class SQLiteStorage(SQLiteMixin):
transaction.execute('delete from peer').fetchall()
transaction.executemany(
'insert into peer(node_id, address, udp_port, tcp_port) values (?, ?, ?, ?)',
tuple([(binascii.hexlify(p.node_id), p.address, p.udp_port, p.tcp_port) for p in peers])
((binascii.hexlify(p.node_id), p.address, p.udp_port, p.tcp_port) for p in peers)
).fetchall()
return await self.db.run(_save_kademlia_peers)
+1 -1
View File
@@ -132,7 +132,7 @@ class SourceManager:
else:
streams = list(self._sources.values())
if sort_by:
streams.sort(key=lambda s: getattr(s, sort_by))
streams.sort(key=lambda s: getattr(s, sort_by) or "")
if reverse:
streams.reverse()
return streams
+2 -2
View File
@@ -69,8 +69,8 @@ class VideoFileAnalyzer:
version = str(e)
if code != 0 or not version.startswith("ffmpeg"):
log.warning("Unable to run ffmpeg, but it was requested. Code: %d; Message: %s", code, version)
raise FileNotFoundError(f"Unable to locate or run ffmpeg or ffprobe. Please install FFmpeg "
f"and ensure that it is callable via PATH or conf.ffmpeg_path")
raise FileNotFoundError("Unable to locate or run ffmpeg or ffprobe. Please install FFmpeg "
"and ensure that it is callable via PATH or conf.ffmpeg_path")
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which_ffmpeg)
return version
+24
View File
@@ -0,0 +1,24 @@
Schema
=====
Those files are generated from the [types repo](https://github.com/lbryio/types). If you are modifying/adding a new type, make sure it is cloned in the same root folder as the SDK repo, like:
```
repos/
- lbry-sdk/
- types/
```
Then, [download protoc 3.2.0](https://github.com/protocolbuffers/protobuf/releases/tag/v3.2.0), add it to your PATH. On linux it is:
```bash
cd ~/.local/bin
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
unzip protoc-3.2.0-linux-x86_64.zip bin/protoc -d..
```
Finally, `make` should update everything in place.
### Why protoc 3.2.0?
Different/newer versions will generate larger diffs and we need to make sure they are good. In theory, we can just update to latest and it will all work, but it is a good practice to check blockchain data and retro compatibility before bumping versions (if you do, please update this section!).
+13 -5
View File
@@ -32,6 +32,17 @@ def calculate_sha384_file_hash(file_path):
return sha384.digest()
def country_int_to_str(country: int) -> str:
r = LocationMessage.Country.Name(country)
return r[1:] if r.startswith('R') else r
def country_str_to_int(country: str) -> int:
if len(country) == 3:
country = 'R' + country
return LocationMessage.Country.Value(country)
class Dimmensional(Metadata):
__slots__ = ()
@@ -423,14 +434,11 @@ class Language(Metadata):
@property
def region(self) -> str:
if self.message.region:
r = LocationMessage.Country.Name(self.message.region)
return r[1:] if r.startswith('R') else r
return country_int_to_str(self.message.region)
@region.setter
def region(self, region: str):
if len(region) == 3:
region = 'R'+region
self.message.region = LocationMessage.Country.Value(region)
self.message.region = country_str_to_int(region)
class LanguageList(BaseMessageList[Language]):
+15 -2
View File
@@ -40,7 +40,7 @@ class Censor:
def censor(self, row) -> bool:
if self.is_censored(row):
censoring_channel_hash = row['censoring_channel_hash']
censoring_channel_hash = bytes.fromhex(row['censoring_channel_id'])[::-1]
self.censored.setdefault(censoring_channel_hash, set())
self.censored[censoring_channel_hash].add(row['tx_hash'])
return True
@@ -150,6 +150,19 @@ class Outputs:
outputs.blocked, outputs.blocked_total
)
@classmethod
def from_grpc(cls, outputs: OutputsMessage) -> 'Outputs':
txs = set()
for txo_message in chain(outputs.txos, outputs.extra_txos):
if txo_message.WhichOneof('meta') == 'error':
continue
txs.add((hexlify(txo_message.tx_hash[::-1]).decode(), txo_message.height))
return cls(
outputs.txos, outputs.extra_txos, txs,
outputs.offset, outputs.total,
outputs.blocked, outputs.blocked_total
)
@classmethod
def to_base64(cls, txo_rows, extra_txo_rows, offset=0, total=None, blocked=None) -> str:
return base64.b64encode(cls.to_bytes(txo_rows, extra_txo_rows, offset, total, blocked)).decode()
@@ -179,7 +192,7 @@ class Outputs:
txo_message.error.code = ErrorMessage.NOT_FOUND
elif isinstance(txo, ResolveCensoredError):
txo_message.error.code = ErrorMessage.BLOCKED
set_reference(txo_message.error.blocked.channel, extra_row_dict.get(txo.censor_hash))
set_reference(txo_message.error.blocked.channel, extra_row_dict.get(bytes.fromhex(txo.censor_id)[::-1]))
return
txo_message.tx_hash = txo['txo_hash'][:32]
txo_message.nout, = struct.unpack('<I', txo['txo_hash'][32:])
+8
View File
@@ -13,3 +13,11 @@ class Support(Signable):
@emoji.setter
def emoji(self, emoji: str):
self.message.emoji = emoji
@property
def comment(self) -> str:
return self.message.comment
@comment.setter
def comment(self, comment: str):
self.message.comment = comment
+740
View File
@@ -0,0 +1,740 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: hub.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import lbry.schema.types.v2.result_pb2 as result__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='hub.proto',
package='pb',
syntax='proto3',
serialized_options=b'Z$github.com/lbryio/hub/protobuf/go/pb',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\thub.proto\x12\x02pb\x1a\x0cresult.proto\"0\n\x0fInvertibleField\x12\x0e\n\x06invert\x18\x01 \x01(\x08\x12\r\n\x05value\x18\x02 \x03(\t\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"j\n\nRangeField\x12\x1d\n\x02op\x18\x01 \x01(\x0e\x32\x11.pb.RangeField.Op\x12\r\n\x05value\x18\x02 \x03(\t\".\n\x02Op\x12\x06\n\x02\x45Q\x10\x00\x12\x07\n\x03LTE\x10\x01\x12\x07\n\x03GTE\x10\x02\x12\x06\n\x02LT\x10\x03\x12\x06\n\x02GT\x10\x04\"\x9c\r\n\rSearchRequest\x12%\n\x08\x63laim_id\x18\x01 \x01(\x0b\x32\x13.pb.InvertibleField\x12\'\n\nchannel_id\x18\x02 \x01(\x0b\x32\x13.pb.InvertibleField\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\r\n\x05limit\x18\x04 \x01(\r\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12\x0e\n\x06offset\x18\x06 \x01(\r\x12\x16\n\x0eis_controlling\x18\x07 \x01(\x08\x12\x1d\n\x15last_take_over_height\x18\x08 \x01(\t\x12\x12\n\nclaim_name\x18\t \x01(\t\x12\x17\n\x0fnormalized_name\x18\n \x01(\t\x12#\n\x0btx_position\x18\x0b \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06\x61mount\x18\x0c \x01(\x0b\x32\x0e.pb.RangeField\x12!\n\ttimestamp\x18\r \x01(\x0b\x32\x0e.pb.RangeField\x12*\n\x12\x63reation_timestamp\x18\x0e \x01(\x0b\x32\x0e.pb.RangeField\x12\x1e\n\x06height\x18\x0f \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0f\x63reation_height\x18\x10 \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x61\x63tivation_height\x18\x11 \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x11\x65xpiration_height\x18\x12 \x01(\x0b\x32\x0e.pb.RangeField\x12$\n\x0crelease_time\x18\x13 \x01(\x0b\x32\x0e.pb.RangeField\x12\x11\n\tshort_url\x18\x14 \x01(\t\x12\x15\n\rcanonical_url\x18\x15 \x01(\t\x12\r\n\x05title\x18\x16 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x17 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x18 \x01(\t\x12\x12\n\nclaim_type\x18\x19 \x03(\t\x12$\n\x0crepost_count\x18\x1a \x01(\x0b\x32\x0e.pb.RangeField\x12\x13\n\x0bstream_type\x18\x1b \x03(\t\x12\x12\n\nmedia_type\x18\x1c \x03(\t\x12\"\n\nfee_amount\x18\x1d \x01(\x0b\x32\x0e.pb.RangeField\x12\x14\n\x0c\x66\x65\x65_currency\x18\x1e \x01(\t\x12 \n\x08\x64uration\x18\x1f \x01(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11reposted_claim_id\x18 \x01(\t\x12#\n\x0b\x63\x65nsor_type\x18! \x01(\x0b\x32\x0e.pb.RangeField\x12\x19\n\x11\x63laims_in_channel\x18\" \x01(\t\x12$\n\x0c\x63hannel_join\x18# \x01(\x0b\x32\x0e.pb.RangeField\x12)\n\x12is_signature_valid\x18$ \x01(\x0b\x32\r.pb.BoolValue\x12(\n\x10\x65\x66\x66\x65\x63tive_amount\x18% \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0esupport_amount\x18& \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_group\x18\' \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_mixed\x18( \x01(\x0b\x32\x0e.pb.RangeField\x12&\n\x0etrending_local\x18) \x01(\x0b\x32\x0e.pb.RangeField\x12\'\n\x0ftrending_global\x18* \x01(\x0b\x32\x0e.pb.RangeField\x12\r\n\x05tx_id\x18+ \x01(\t\x12 \n\x07tx_nout\x18, \x01(\x0b\x32\x0f.pb.UInt32Value\x12\x11\n\tsignature\x18- \x01(\t\x12\x18\n\x10signature_digest\x18. \x01(\t\x12\x18\n\x10public_key_bytes\x18/ \x01(\t\x12\x15\n\rpublic_key_id\x18\x30 \x01(\t\x12\x10\n\x08\x61ny_tags\x18\x31 \x03(\t\x12\x10\n\x08\x61ll_tags\x18\x32 \x03(\t\x12\x10\n\x08not_tags\x18\x33 \x03(\t\x12\x1d\n\x15has_channel_signature\x18\x34 \x01(\x08\x12!\n\nhas_source\x18\x35 \x01(\x0b\x32\r.pb.BoolValue\x12 \n\x18limit_claims_per_channel\x18\x36 \x01(\r\x12\x15\n\rany_languages\x18\x37 \x03(\t\x12\x15\n\rall_languages\x18\x38 \x03(\t\x12\x19\n\x11remove_duplicates\x18\x39 \x01(\x08\x12\x11\n\tno_totals\x18: \x01(\x08\x32\x31\n\x03Hub\x12*\n\x06Search\x12\x11.pb.SearchRequest\x1a\x0b.pb.Outputs\"\x00\x42&Z$github.com/lbryio/hub/protobuf/go/pbb\x06proto3'
,
dependencies=[result__pb2.DESCRIPTOR,])
_RANGEFIELD_OP = _descriptor.EnumDescriptor(
name='Op',
full_name='pb.RangeField.Op',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='EQ', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LTE', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='GTE', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LT', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='GT', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=199,
serialized_end=245,
)
_sym_db.RegisterEnumDescriptor(_RANGEFIELD_OP)
_INVERTIBLEFIELD = _descriptor.Descriptor(
name='InvertibleField',
full_name='pb.InvertibleField',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='invert', full_name='pb.InvertibleField.invert', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='pb.InvertibleField.value', index=1,
number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=31,
serialized_end=79,
)
_BOOLVALUE = _descriptor.Descriptor(
name='BoolValue',
full_name='pb.BoolValue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='pb.BoolValue.value', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=81,
serialized_end=107,
)
_UINT32VALUE = _descriptor.Descriptor(
name='UInt32Value',
full_name='pb.UInt32Value',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='pb.UInt32Value.value', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=109,
serialized_end=137,
)
_RANGEFIELD = _descriptor.Descriptor(
name='RangeField',
full_name='pb.RangeField',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='op', full_name='pb.RangeField.op', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='pb.RangeField.value', index=1,
number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
_RANGEFIELD_OP,
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=139,
serialized_end=245,
)
_SEARCHREQUEST = _descriptor.Descriptor(
name='SearchRequest',
full_name='pb.SearchRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='claim_id', full_name='pb.SearchRequest.claim_id', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='channel_id', full_name='pb.SearchRequest.channel_id', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='text', full_name='pb.SearchRequest.text', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='limit', full_name='pb.SearchRequest.limit', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='order_by', full_name='pb.SearchRequest.order_by', index=4,
number=5, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='offset', full_name='pb.SearchRequest.offset', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='is_controlling', full_name='pb.SearchRequest.is_controlling', index=6,
number=7, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='last_take_over_height', full_name='pb.SearchRequest.last_take_over_height', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='claim_name', full_name='pb.SearchRequest.claim_name', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='normalized_name', full_name='pb.SearchRequest.normalized_name', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tx_position', full_name='pb.SearchRequest.tx_position', index=10,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='amount', full_name='pb.SearchRequest.amount', index=11,
number=12, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='timestamp', full_name='pb.SearchRequest.timestamp', index=12,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='creation_timestamp', full_name='pb.SearchRequest.creation_timestamp', index=13,
number=14, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='height', full_name='pb.SearchRequest.height', index=14,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='creation_height', full_name='pb.SearchRequest.creation_height', index=15,
number=16, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='activation_height', full_name='pb.SearchRequest.activation_height', index=16,
number=17, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='expiration_height', full_name='pb.SearchRequest.expiration_height', index=17,
number=18, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='release_time', full_name='pb.SearchRequest.release_time', index=18,
number=19, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='short_url', full_name='pb.SearchRequest.short_url', index=19,
number=20, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='canonical_url', full_name='pb.SearchRequest.canonical_url', index=20,
number=21, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='title', full_name='pb.SearchRequest.title', index=21,
number=22, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='author', full_name='pb.SearchRequest.author', index=22,
number=23, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='pb.SearchRequest.description', index=23,
number=24, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='claim_type', full_name='pb.SearchRequest.claim_type', index=24,
number=25, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='repost_count', full_name='pb.SearchRequest.repost_count', index=25,
number=26, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='stream_type', full_name='pb.SearchRequest.stream_type', index=26,
number=27, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='media_type', full_name='pb.SearchRequest.media_type', index=27,
number=28, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='fee_amount', full_name='pb.SearchRequest.fee_amount', index=28,
number=29, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='fee_currency', full_name='pb.SearchRequest.fee_currency', index=29,
number=30, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='duration', full_name='pb.SearchRequest.duration', index=30,
number=31, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reposted_claim_id', full_name='pb.SearchRequest.reposted_claim_id', index=31,
number=32, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='censor_type', full_name='pb.SearchRequest.censor_type', index=32,
number=33, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='claims_in_channel', full_name='pb.SearchRequest.claims_in_channel', index=33,
number=34, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='channel_join', full_name='pb.SearchRequest.channel_join', index=34,
number=35, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='is_signature_valid', full_name='pb.SearchRequest.is_signature_valid', index=35,
number=36, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='effective_amount', full_name='pb.SearchRequest.effective_amount', index=36,
number=37, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='support_amount', full_name='pb.SearchRequest.support_amount', index=37,
number=38, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trending_group', full_name='pb.SearchRequest.trending_group', index=38,
number=39, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trending_mixed', full_name='pb.SearchRequest.trending_mixed', index=39,
number=40, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trending_local', full_name='pb.SearchRequest.trending_local', index=40,
number=41, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trending_global', full_name='pb.SearchRequest.trending_global', index=41,
number=42, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tx_id', full_name='pb.SearchRequest.tx_id', index=42,
number=43, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tx_nout', full_name='pb.SearchRequest.tx_nout', index=43,
number=44, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='signature', full_name='pb.SearchRequest.signature', index=44,
number=45, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='signature_digest', full_name='pb.SearchRequest.signature_digest', index=45,
number=46, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='public_key_bytes', full_name='pb.SearchRequest.public_key_bytes', index=46,
number=47, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='public_key_id', full_name='pb.SearchRequest.public_key_id', index=47,
number=48, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='any_tags', full_name='pb.SearchRequest.any_tags', index=48,
number=49, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='all_tags', full_name='pb.SearchRequest.all_tags', index=49,
number=50, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='not_tags', full_name='pb.SearchRequest.not_tags', index=50,
number=51, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='has_channel_signature', full_name='pb.SearchRequest.has_channel_signature', index=51,
number=52, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='has_source', full_name='pb.SearchRequest.has_source', index=52,
number=53, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='limit_claims_per_channel', full_name='pb.SearchRequest.limit_claims_per_channel', index=53,
number=54, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='any_languages', full_name='pb.SearchRequest.any_languages', index=54,
number=55, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='all_languages', full_name='pb.SearchRequest.all_languages', index=55,
number=56, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='remove_duplicates', full_name='pb.SearchRequest.remove_duplicates', index=56,
number=57, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='no_totals', full_name='pb.SearchRequest.no_totals', index=57,
number=58, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=248,
serialized_end=1940,
)
_RANGEFIELD.fields_by_name['op'].enum_type = _RANGEFIELD_OP
_RANGEFIELD_OP.containing_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['claim_id'].message_type = _INVERTIBLEFIELD
_SEARCHREQUEST.fields_by_name['channel_id'].message_type = _INVERTIBLEFIELD
_SEARCHREQUEST.fields_by_name['tx_position'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['amount'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['timestamp'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['creation_timestamp'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['height'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['creation_height'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['activation_height'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['expiration_height'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['release_time'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['repost_count'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['fee_amount'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['duration'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['censor_type'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['channel_join'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['is_signature_valid'].message_type = _BOOLVALUE
_SEARCHREQUEST.fields_by_name['effective_amount'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['support_amount'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['trending_group'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['trending_mixed'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['trending_local'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['trending_global'].message_type = _RANGEFIELD
_SEARCHREQUEST.fields_by_name['tx_nout'].message_type = _UINT32VALUE
_SEARCHREQUEST.fields_by_name['has_source'].message_type = _BOOLVALUE
DESCRIPTOR.message_types_by_name['InvertibleField'] = _INVERTIBLEFIELD
DESCRIPTOR.message_types_by_name['BoolValue'] = _BOOLVALUE
DESCRIPTOR.message_types_by_name['UInt32Value'] = _UINT32VALUE
DESCRIPTOR.message_types_by_name['RangeField'] = _RANGEFIELD
DESCRIPTOR.message_types_by_name['SearchRequest'] = _SEARCHREQUEST
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
InvertibleField = _reflection.GeneratedProtocolMessageType('InvertibleField', (_message.Message,), {
'DESCRIPTOR' : _INVERTIBLEFIELD,
'__module__' : 'hub_pb2'
# @@protoc_insertion_point(class_scope:pb.InvertibleField)
})
_sym_db.RegisterMessage(InvertibleField)
BoolValue = _reflection.GeneratedProtocolMessageType('BoolValue', (_message.Message,), {
'DESCRIPTOR' : _BOOLVALUE,
'__module__' : 'hub_pb2'
# @@protoc_insertion_point(class_scope:pb.BoolValue)
})
_sym_db.RegisterMessage(BoolValue)
UInt32Value = _reflection.GeneratedProtocolMessageType('UInt32Value', (_message.Message,), {
'DESCRIPTOR' : _UINT32VALUE,
'__module__' : 'hub_pb2'
# @@protoc_insertion_point(class_scope:pb.UInt32Value)
})
_sym_db.RegisterMessage(UInt32Value)
RangeField = _reflection.GeneratedProtocolMessageType('RangeField', (_message.Message,), {
'DESCRIPTOR' : _RANGEFIELD,
'__module__' : 'hub_pb2'
# @@protoc_insertion_point(class_scope:pb.RangeField)
})
_sym_db.RegisterMessage(RangeField)
SearchRequest = _reflection.GeneratedProtocolMessageType('SearchRequest', (_message.Message,), {
'DESCRIPTOR' : _SEARCHREQUEST,
'__module__' : 'hub_pb2'
# @@protoc_insertion_point(class_scope:pb.SearchRequest)
})
_sym_db.RegisterMessage(SearchRequest)
DESCRIPTOR._options = None
_HUB = _descriptor.ServiceDescriptor(
name='Hub',
full_name='pb.Hub',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=1942,
serialized_end=1991,
methods=[
_descriptor.MethodDescriptor(
name='Search',
full_name='pb.Hub.Search',
index=0,
containing_service=None,
input_type=_SEARCHREQUEST,
output_type=result__pb2._OUTPUTS,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_HUB)
DESCRIPTOR.services_by_name['Hub'] = _HUB
# @@protoc_insertion_point(module_scope)
+67
View File
@@ -0,0 +1,67 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import lbry.schema.types.v2.hub_pb2 as hub__pb2
import lbry.schema.types.v2.result_pb2 as result__pb2
class HubStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Search = channel.unary_unary(
'/pb.Hub/Search',
request_serializer=hub__pb2.SearchRequest.SerializeToString,
response_deserializer=result__pb2.Outputs.FromString,
)
class HubServicer(object):
"""Missing associated documentation comment in .proto file."""
def Search(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_HubServicer_to_server(servicer, server):
rpc_method_handlers = {
'Search': grpc.unary_unary_rpc_method_handler(
servicer.Search,
request_deserializer=hub__pb2.SearchRequest.FromString,
response_serializer=result__pb2.Outputs.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'pb.Hub', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class Hub(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def Search(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.Hub/Search',
hub__pb2.SearchRequest.SerializeToString,
result__pb2.Outputs.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+9 -2
View File
@@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='support.proto',
package='pb',
syntax='proto3',
serialized_pb=_b('\n\rsupport.proto\x12\x02pb\"\x18\n\x07Support\x12\r\n\x05\x65moji\x18\x01 \x01(\tb\x06proto3')
serialized_pb=_b('\n\rsupport.proto\x12\x02pb\")\n\x07Support\x12\r\n\x05\x65moji\x18\x01 \x01(\t\x12\x0f\n\x07\x63omment\x18\x02 \x01(\tb\x06proto3')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@@ -40,6 +40,13 @@ _SUPPORT = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='comment', full_name='pb.Support.comment', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
@@ -53,7 +60,7 @@ _SUPPORT = _descriptor.Descriptor(
oneofs=[
],
serialized_start=21,
serialized_end=45,
serialized_end=62,
)
DESCRIPTOR.message_types_by_name['Support'] = _SUPPORT
+17 -7
View File
@@ -4,6 +4,7 @@ import binascii
import logging
import typing
import asyncio
import time
import re
from collections import OrderedDict
from cryptography.hazmat.primitives.ciphers.algorithms import AES
@@ -152,15 +153,19 @@ class StreamDescriptor:
h.update(self.old_sort_json())
return h.hexdigest()
async def make_sd_blob(self, blob_file_obj: typing.Optional[AbstractBlob] = None,
old_sort: typing.Optional[bool] = False,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], None]] = None):
async def make_sd_blob(
self, blob_file_obj: typing.Optional[AbstractBlob] = None, old_sort: typing.Optional[bool] = False,
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], None]] = None,
added_on: float = None, is_mine: bool = False
):
sd_hash = self.calculate_sd_hash() if not old_sort else self.calculate_old_sort_sd_hash()
if not old_sort:
sd_data = self.as_json()
else:
sd_data = self.old_sort_json()
sd_blob = blob_file_obj or BlobFile(self.loop, sd_hash, len(sd_data), blob_completed_callback, self.blob_dir)
sd_blob = blob_file_obj or BlobFile(
self.loop, sd_hash, len(sd_data), blob_completed_callback, self.blob_dir, added_on, is_mine
)
if blob_file_obj:
blob_file_obj.set_length(len(sd_data))
if not sd_blob.get_is_verified():
@@ -252,20 +257,25 @@ class StreamDescriptor:
iv_generator = iv_generator or random_iv_generator()
key = key or os.urandom(AES.block_size // 8)
blob_num = -1
added_on = time.time()
async for blob_bytes in file_reader(file_path):
blob_num += 1
blob_info = await BlobFile.create_from_unencrypted(
loop, blob_dir, key, next(iv_generator), blob_bytes, blob_num, blob_completed_callback
loop, blob_dir, key, next(iv_generator), blob_bytes, blob_num, added_on, True, blob_completed_callback
)
blobs.append(blob_info)
blobs.append(
BlobInfo(len(blobs), 0, binascii.hexlify(next(iv_generator)).decode())) # add the stream terminator
# add the stream terminator
BlobInfo(len(blobs), 0, binascii.hexlify(next(iv_generator)).decode(), None, added_on, True)
)
file_name = os.path.basename(file_path)
suggested_file_name = sanitize_file_name(file_name)
descriptor = cls(
loop, blob_dir, file_name, binascii.hexlify(key).decode(), suggested_file_name, blobs
)
sd_blob = await descriptor.make_sd_blob(old_sort=old_sort, blob_completed_callback=blob_completed_callback)
sd_blob = await descriptor.make_sd_blob(
old_sort=old_sort, blob_completed_callback=blob_completed_callback, added_on=added_on, is_mine=True
)
descriptor.sd_hash = sd_blob.blob_hash
return descriptor
+1 -4
View File
@@ -254,7 +254,7 @@ class ManagedStream(ManagedDownloadSource):
self.finished_writing.clear()
self.started_writing.clear()
try:
open(output_path, 'wb').close()
open(output_path, 'wb').close() # pylint: disable=consider-using-with
async for blob_info, decrypted in self._aiter_read_stream(connection_id=self.SAVING_ID):
log.info("write blob %i/%i", blob_info.blob_num + 1, len(self.descriptor.blobs) - 1)
await self.loop.run_in_executor(None, self._write_decrypted_blob, output_path, decrypted)
@@ -372,9 +372,6 @@ class ManagedStream(ManagedDownloadSource):
protocol.transport.close()
self.uploading_to_reflector = False
if not self.fully_reflected.is_set():
self.fully_reflected.set()
await self.blob_manager.storage.update_reflected_stream(self.sd_hash, f"{host}:{port}")
return sent
async def update_content_claim(self, claim_info: Optional[typing.Dict] = None):
+1 -1
View File
@@ -59,7 +59,7 @@ class StreamReflectorClient(asyncio.Protocol):
return
async def send_request(self, request_dict: typing.Dict, timeout: int = 180):
msg = json.dumps(request_dict)
msg = json.dumps(request_dict, sort_keys=True)
try:
self.transport.write(msg.encode())
self.pending_request = self.loop.create_task(asyncio.wait_for(self.response_queue.get(), timeout))
+18 -13
View File
@@ -17,7 +17,7 @@ log = logging.getLogger(__name__)
class ReflectorServerProtocol(asyncio.Protocol):
def __init__(self, blob_manager: 'BlobManager', response_chunk_size: int = 10000,
stop_event: asyncio.Event = None, incoming_event: asyncio.Event = None,
not_incoming_event: asyncio.Event = None):
not_incoming_event: asyncio.Event = None, partial_event: asyncio.Event = None):
self.loop = asyncio.get_event_loop()
self.blob_manager = blob_manager
self.server_task: asyncio.Task = None
@@ -34,6 +34,7 @@ class ReflectorServerProtocol(asyncio.Protocol):
self.stop_event = stop_event or asyncio.Event(loop=self.loop)
self.chunk_size = response_chunk_size
self.wait_for_stop_task: typing.Optional[asyncio.Task] = None
self.partial_event = partial_event
async def wait_for_stop(self):
await self.stop_event.wait()
@@ -115,10 +116,14 @@ class ReflectorServerProtocol(asyncio.Protocol):
if self.writer:
self.writer.close_handle()
self.writer = None
self.send_response({"send_sd_blob": False, 'needed': [
blob.blob_hash for blob in self.descriptor.blobs[:-1]
if not self.blob_manager.get_blob(blob.blob_hash).get_is_verified()
]})
needs = [blob.blob_hash
for blob in self.descriptor.blobs[:-1]
if not self.blob_manager.get_blob(blob.blob_hash).get_is_verified()]
if needs and not self.partial_event.is_set():
needs = needs[:3]
self.partial_event.set()
self.send_response({"send_sd_blob": False, 'needed_blobs': needs})
return
return
elif self.descriptor:
@@ -153,7 +158,7 @@ class ReflectorServerProtocol(asyncio.Protocol):
class ReflectorServer:
def __init__(self, blob_manager: 'BlobManager', response_chunk_size: int = 10000,
stop_event: asyncio.Event = None, incoming_event: asyncio.Event = None,
not_incoming_event: asyncio.Event = None):
not_incoming_event: asyncio.Event = None, partial_needs=False):
self.loop = asyncio.get_event_loop()
self.blob_manager = blob_manager
self.server_task: typing.Optional[asyncio.Task] = None
@@ -163,19 +168,19 @@ class ReflectorServer:
self.not_incoming_event = not_incoming_event or asyncio.Event(loop=self.loop)
self.response_chunk_size = response_chunk_size
self.stop_event = stop_event
self.partial_needs = partial_needs # for testing cases where it doesn't know what it wants
def start_server(self, port: int, interface: typing.Optional[str] = '0.0.0.0'):
if self.server_task is not None:
raise Exception("already running")
async def _start_server():
server = await self.loop.create_server(
lambda: ReflectorServerProtocol(
self.blob_manager, self.response_chunk_size, self.stop_event, self.incoming_event,
self.not_incoming_event
),
interface, port
)
partial_event = asyncio.Event()
if not self.partial_needs:
partial_event.set()
server = await self.loop.create_server(lambda: ReflectorServerProtocol(
self.blob_manager, self.response_chunk_size, self.stop_event, self.incoming_event,
self.not_incoming_event, partial_event), interface, port)
self.started_listening.set()
self.stopped_listening.clear()
log.info("Reflector server listening on TCP %s:%i", interface, port)
+8 -2
View File
@@ -215,7 +215,7 @@ class StreamManager(SourceManager):
server, port = random.choice(self.config.reflector_servers)
if stream.sd_hash in self.running_reflector_uploads:
return self.running_reflector_uploads[stream.sd_hash]
task = self.loop.create_task(stream.upload_to_reflector(server, port))
task = self.loop.create_task(self._retriable_reflect_stream(stream, server, port))
self.running_reflector_uploads[stream.sd_hash] = task
task.add_done_callback(
lambda _: None if stream.sd_hash not in self.running_reflector_uploads else
@@ -223,6 +223,12 @@ class StreamManager(SourceManager):
)
return task
async def _retriable_reflect_stream(self, stream, host, port):
sent = await stream.upload_to_reflector(host, port)
while not stream.is_fully_reflected and stream.reflector_progress > 0 and len(sent) > 0:
stream.reflector_progress = 0
sent = await stream.upload_to_reflector(host, port)
async def create(self, file_path: str, key: Optional[bytes] = None,
iv_generator: Optional[typing.Generator[bytes, None, None]] = None) -> ManagedStream:
descriptor = await StreamDescriptor.create_stream(
@@ -230,7 +236,7 @@ class StreamManager(SourceManager):
blob_completed_callback=self.blob_manager.blob_completed
)
await self.storage.store_stream(
self.blob_manager.get_blob(descriptor.sd_hash), descriptor
self.blob_manager.get_blob(descriptor.sd_hash, is_mine=True), descriptor
)
row_id = await self.storage.save_published_file(
descriptor.stream_hash, os.path.basename(file_path), os.path.dirname(file_path), 0
+42 -10
View File
@@ -18,7 +18,7 @@ from lbry.wallet import WalletManager, Wallet, Ledger, Account, Transaction
from lbry.conf import Config
from lbry.wallet.util import satoshis_to_coins
from lbry.wallet.orchstr8 import Conductor
from lbry.wallet.orchstr8.node import BlockchainNode, WalletNode
from lbry.wallet.orchstr8.node import BlockchainNode, WalletNode, HubNode
from lbry.extras.daemon.daemon import Daemon, jsonrpc_dumps_pretty
from lbry.extras.daemon.components import Component, WalletComponent
@@ -223,6 +223,7 @@ class IntegrationTestCase(AsyncioTestCase):
super().__init__(*args, **kwargs)
self.conductor: Optional[Conductor] = None
self.blockchain: Optional[BlockchainNode] = None
self.hub: Optional[HubNode] = None
self.wallet_node: Optional[WalletNode] = None
self.manager: Optional[WalletManager] = None
self.ledger: Optional[Ledger] = None
@@ -237,7 +238,10 @@ class IntegrationTestCase(AsyncioTestCase):
self.addCleanup(self.conductor.stop_spv)
await self.conductor.start_wallet()
self.addCleanup(self.conductor.stop_wallet)
await self.conductor.start_hub()
self.addCleanup(self.conductor.stop_hub)
self.blockchain = self.conductor.blockchain_node
self.hub = self.conductor.hub_node
self.wallet_node = self.conductor.wallet_node
self.manager = self.wallet_node.manager
self.ledger = self.wallet_node.ledger
@@ -350,7 +354,12 @@ class CommandTestCase(IntegrationTestCase):
server_tmp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, server_tmp_dir)
self.server_config = Config()
self.server_config = Config(
data_dir=server_tmp_dir,
wallet_dir=server_tmp_dir,
save_files=True,
download_dir=server_tmp_dir
)
self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, ':memory:')
await self.server_storage.open()
@@ -374,6 +383,7 @@ class CommandTestCase(IntegrationTestCase):
await daemon.stop()
async def add_daemon(self, wallet_node=None, seed=None):
start_wallet_node = False
if wallet_node is None:
wallet_node = WalletNode(
self.wallet_node.manager_class,
@@ -381,22 +391,24 @@ class CommandTestCase(IntegrationTestCase):
port=self.extra_wallet_node_port
)
self.extra_wallet_node_port += 1
await wallet_node.start(self.conductor.spv_node, seed=seed)
self.extra_wallet_nodes.append(wallet_node)
start_wallet_node = True
upload_dir = os.path.join(wallet_node.data_path, 'uploads')
os.mkdir(upload_dir)
conf = Config()
conf.data_dir = wallet_node.data_path
conf.wallet_dir = wallet_node.data_path
conf.download_dir = wallet_node.data_path
conf = Config(
# needed during instantiation to access known_hubs path
data_dir=wallet_node.data_path,
wallet_dir=wallet_node.data_path,
save_files=True,
download_dir=wallet_node.data_path
)
conf.upload_dir = upload_dir # not a real conf setting
conf.share_usage_data = False
conf.use_upnp = False
conf.reflect_streams = True
conf.blockchain_name = 'lbrycrd_regtest'
conf.lbryum_servers = [('127.0.0.1', 50001)]
conf.lbryum_servers = [(self.conductor.spv_node.hostname, self.conductor.spv_node.port)]
conf.reflector_servers = [('127.0.0.1', 5566)]
conf.fixed_peers = [('127.0.0.1', 5567)]
conf.known_dht_nodes = []
@@ -408,7 +420,13 @@ class CommandTestCase(IntegrationTestCase):
]
if self.skip_libtorrent:
conf.components_to_skip.append(LIBTORRENT_COMPONENT)
wallet_node.manager.config = conf
if start_wallet_node:
await wallet_node.start(self.conductor.spv_node, seed=seed, config=conf)
self.extra_wallet_nodes.append(wallet_node)
else:
wallet_node.manager.config = conf
wallet_node.manager.ledger.config['known_hubs'] = conf.known_hubs
def wallet_maker(component_manager):
wallet_component = WalletComponent(component_manager)
@@ -577,6 +595,11 @@ class CommandTestCase(IntegrationTestCase):
self.daemon.jsonrpc_support_abandon(*args, **kwargs), confirm
)
async def account_send(self, *args, confirm=True, **kwargs):
return await self.confirm_and_render(
self.daemon.jsonrpc_account_send(*args, **kwargs), confirm
)
async def wallet_send(self, *args, confirm=True, **kwargs):
return await self.confirm_and_render(
self.daemon.jsonrpc_wallet_send(*args, **kwargs), confirm
@@ -590,6 +613,12 @@ class CommandTestCase(IntegrationTestCase):
await asyncio.wait([self.ledger.wait(tx, self.blockchain.block_expected) for tx in txs])
return self.sout(txs)
async def blob_clean(self):
return await self.out(self.daemon.jsonrpc_blob_clean())
async def status(self):
return await self.out(self.daemon.jsonrpc_status())
async def resolve(self, uri, **kwargs):
return (await self.out(self.daemon.jsonrpc_resolve(uri, **kwargs)))[uri]
@@ -620,6 +649,9 @@ class CommandTestCase(IntegrationTestCase):
async def transaction_list(self, *args, **kwargs):
return (await self.out(self.daemon.jsonrpc_transaction_list(*args, **kwargs)))['items']
async def blob_list(self, *args, **kwargs):
return (await self.out(self.daemon.jsonrpc_blob_list(*args, **kwargs)))['items']
@staticmethod
def get_claim_id(tx):
return tx['outputs'][0]['claim_id']
+12 -14
View File
@@ -21,7 +21,6 @@ import pkg_resources
import certifi
import aiohttp
from prometheus_client import Counter
from prometheus_client.registry import REGISTRY
from lbry.schema.claim import Claim
@@ -156,7 +155,7 @@ def async_timed_cache(duration: int):
async def _inner(*args, **kwargs) -> typing.Any:
loop = asyncio.get_running_loop()
time_now = loop.time()
key = tuple([args, tuple([tuple([k, kwargs[k]]) for k in kwargs])])
key = (args, tuple(kwargs.items()))
if key in cache and (time_now - cache[key][1] < duration):
return cache[key][0]
to_cache = await func(*args, **kwargs)
@@ -174,7 +173,7 @@ def cache_concurrent(async_fn):
@functools.wraps(async_fn)
async def wrapper(*args, **kwargs):
key = tuple([args, tuple([tuple([k, kwargs[k]]) for k in kwargs])])
key = (args, tuple(kwargs.items()))
cache[key] = cache.get(key) or asyncio.create_task(async_fn(*args, **kwargs))
try:
return await cache[key]
@@ -276,12 +275,6 @@ class LRUCacheWithMetrics:
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:
@@ -310,11 +303,14 @@ class LRUCache:
self.cache.popitem(last=False)
self.cache[key] = value
def items(self):
return self.cache.items()
def clear(self):
self.cache.clear()
def pop(self, key):
return self.cache.pop(key)
def pop(self, key, default=None):
return self.cache.pop(key, default)
def __setitem__(self, key, value):
return self.set(key, value)
@@ -346,7 +342,7 @@ def lru_cache_concurrent(cache_size: typing.Optional[int] = None,
@functools.wraps(async_fn)
async def _inner(*args, **kwargs):
key = tuple([args, tuple([tuple([k, kwargs[k]]) for k in kwargs])])
key = (args, tuple(kwargs.items()))
if key in lru_cache:
return lru_cache.get(key)
@@ -380,13 +376,15 @@ 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):
def is_valid_public_ipv4(address, allow_localhost: bool = False, allow_lan: bool = False):
try:
parsed_ip = ipaddress.ip_address(address)
if parsed_ip.is_loopback and allow_localhost:
return True
if allow_lan and parsed_ip.is_private:
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)):
parsed_ip.is_multicast, parsed_ip.is_reserved, parsed_ip.is_private)):
return False
else:
return not any((CARRIER_GRADE_NAT_SUBNET.supernet_of(ipaddress.ip_network(f"{address}/32")),
Binary file not shown.
+3 -2
View File
@@ -96,7 +96,8 @@ class AddressManager:
return [r['address'] for r in records]
async def get_or_create_usable_address(self) -> str:
addresses = await self.get_addresses(only_usable=True, limit=10)
async with self.address_generator_lock:
addresses = await self.get_addresses(only_usable=True, limit=10)
if addresses:
return random.choice(addresses)
addresses = await self.ensure_address_gap()
@@ -249,7 +250,7 @@ class Account:
generator_name = address_generator.get('name', HierarchicalDeterministic.name)
self.address_generator = self.address_generators[generator_name]
self.receiving, self.change = self.address_generator.from_dict(self, address_generator)
self.address_managers = {am.chain_number: am for am in {self.receiving, self.change}}
self.address_managers = {am.chain_number: am for am in (self.receiving, self.change)}
self.channel_keys = channel_keys
ledger.add_account(self)
wallet.add_account(self)
+5 -3
View File
@@ -46,9 +46,11 @@ class _KeyBase:
if len(raw_serkey) != 33:
raise ValueError('raw_serkey must have length 33')
return (ver_bytes + bytes((self.depth,))
+ self.parent_fingerprint() + self.n.to_bytes(4, 'big')
+ self.chain_code + raw_serkey)
return (
ver_bytes + bytes((self.depth,))
+ self.parent_fingerprint() + self.n.to_bytes(4, 'big')
+ self.chain_code + raw_serkey
)
def identifier(self):
raise NotImplementedError
+24 -11
View File
@@ -18,7 +18,7 @@ from .constants import TXO_TYPES, CLAIM_TYPES
from .util import date_to_julian_day
from concurrent.futures.thread import ThreadPoolExecutor # pylint: disable=wrong-import-order
if platform.system() == 'Windows' or 'ANDROID_ARGUMENT' or 'KIVY_BUILD' in os.environ:
if platform.system() == 'Windows' or ({'ANDROID_ARGUMENT', 'KIVY_BUILD'} & os.environ.keys()):
from concurrent.futures.thread import ThreadPoolExecutor as ReaderExecutorClass # pylint: disable=reimported
else:
from concurrent.futures.process import ProcessPoolExecutor as ReaderExecutorClass
@@ -82,10 +82,10 @@ class AIOSQLite:
"read_count", "Number of database reads", namespace="daemon_database"
)
acquire_write_lock_metric = Histogram(
f'write_lock_acquired', 'Time to acquire the write lock', namespace="daemon_database", buckets=HISTOGRAM_BUCKETS
'write_lock_acquired', 'Time to acquire the write lock', namespace="daemon_database", buckets=HISTOGRAM_BUCKETS
)
held_write_lock_metric = Histogram(
f'write_lock_held', 'Length of time the write lock is held for', namespace="daemon_database",
'write_lock_held', 'Length of time the write lock is held for', namespace="daemon_database",
buckets=HISTOGRAM_BUCKETS
)
@@ -446,6 +446,10 @@ class SQLiteMixin:
version = await self.db.execute_fetchone("SELECT version FROM version LIMIT 1;")
if version == (self.SCHEMA_VERSION,):
return
if version == ("1.5",) and self.SCHEMA_VERSION == "1.6":
await self.db.execute("ALTER TABLE txo ADD COLUMN has_source bool DEFAULT 1;")
await self.db.execute("UPDATE version SET version = ?", (self.SCHEMA_VERSION,))
return
await self.db.executescript('\n'.join(
f"DROP TABLE {table};" for table in tables
) + '\n' + 'PRAGMA WAL_CHECKPOINT(FULL);' + '\n' + 'VACUUM;')
@@ -502,7 +506,7 @@ def _get_spendable_utxos(transaction: sqlite3.Connection, accounts: List, decode
amount_to_reserve: int, reserved_amount: int, floor: int, ceiling: int,
fee_per_byte: int) -> int:
accounts_fmt = ",".join(["?"] * len(accounts))
txo_query = f"""
txo_query = """
SELECT tx.txid, txo.txoid, tx.raw, tx.height, txo.position as nout, tx.is_verified, txo.amount FROM txo
INNER JOIN account_address USING (address)
LEFT JOIN txi USING (txoid)
@@ -592,7 +596,7 @@ def get_and_reserve_spendable_utxos(transaction: sqlite3.Connection, accounts: L
class Database(SQLiteMixin):
SCHEMA_VERSION = "1.5"
SCHEMA_VERSION = "1.6"
PRAGMAS = """
pragma journal_mode=WAL;
@@ -646,6 +650,7 @@ class Database(SQLiteMixin):
txo_type integer not null default 0,
claim_id text,
claim_name text,
has_source bool,
channel_id text,
reposted_claim_id text
@@ -690,7 +695,8 @@ class Database(SQLiteMixin):
'address': txo.get_address(self.ledger),
'position': txo.position,
'amount': txo.amount,
'script': sqlite3.Binary(txo.script.source)
'script': sqlite3.Binary(txo.script.source),
'has_source': False,
}
if txo.is_claim:
if txo.can_decode_claim:
@@ -698,8 +704,11 @@ class Database(SQLiteMixin):
row['txo_type'] = TXO_TYPES.get(claim.claim_type, TXO_TYPES['stream'])
if claim.is_repost:
row['reposted_claim_id'] = claim.repost.reference.claim_id
row['has_source'] = True
if claim.is_signed:
row['channel_id'] = claim.signing_channel_id
if claim.is_stream:
row['has_source'] = claim.stream.has_source
else:
row['txo_type'] = TXO_TYPES['stream']
elif txo.is_support:
@@ -760,9 +769,10 @@ class Database(SQLiteMixin):
conn.execute(*self._insert_sql(
"txo", self.txo_to_row(tx, txo), ignore_duplicate=True
)).fetchall()
elif txo.script.is_pay_script_hash:
# TODO: implement script hash payments
log.warning('Database.save_transaction_io: pay script hash is not implemented!')
elif txo.script.is_pay_script_hash and is_my_input:
conn.execute(*self._insert_sql(
"txo", self.txo_to_row(tx, txo), ignore_duplicate=True
)).fetchall()
def save_transaction_io(self, tx: Transaction, address, txhash, history):
return self.save_transaction_io_batch([tx], address, txhash, history)
@@ -1015,7 +1025,7 @@ class Database(SQLiteMixin):
if 'order_by' not in constraints or constraints['order_by'] == 'height':
constraints['order_by'] = [
"tx.height=0 DESC", "tx.height DESC", "tx.position DESC", "txo.position"
"tx.height in (0, -1) DESC", "tx.height DESC", "tx.position DESC", "txo.position"
]
elif constraints.get('order_by', None) == 'none':
del constraints['order_by']
@@ -1146,7 +1156,10 @@ class Database(SQLiteMixin):
constraints['accounts'] = accounts
result = (await self.select_txos(
f"COALESCE(SUM(amount), 0) AS total,"
f"COALESCE(SUM(CASE WHEN txo_type != {TXO_TYPES['other']} THEN amount ELSE 0 END), 0) AS reserved,"
f"COALESCE(SUM("
f" CASE WHEN"
f" txo_type NOT IN ({TXO_TYPES['other']}, {TXO_TYPES['purchase']})"
f" THEN amount ELSE 0 END), 0) AS reserved,"
f"COALESCE(SUM("
f" CASE WHEN"
f" txo_type IN ({','.join(map(str, CLAIM_TYPES))})"
+23 -5
View File
@@ -178,15 +178,25 @@ class Ledger(metaclass=LedgerRegistry):
raw_address = cls.pubkey_address_prefix + h160
return Base58.encode(bytearray(raw_address + double_sha256(raw_address)[0:4]))
@classmethod
def hash160_to_script_address(cls, h160):
raw_address = cls.script_address_prefix + h160
return Base58.encode(bytearray(raw_address + double_sha256(raw_address)[0:4]))
@staticmethod
def address_to_hash160(address):
return Base58.decode(address)[1:21]
@classmethod
def is_valid_address(cls, address):
def is_pubkey_address(cls, address):
decoded = Base58.decode_check(address)
return decoded[0] == cls.pubkey_address_prefix[0]
@classmethod
def is_script_address(cls, address):
decoded = Base58.decode_check(address)
return decoded[0] == cls.script_address_prefix[0]
@classmethod
def public_key_to_address(cls, public_key):
return cls.hash160_to_address(hash160(public_key))
@@ -713,8 +723,10 @@ class Ledger(metaclass=LedgerRegistry):
self.hash160_to_address(txi.txo_ref.txo.pubkey_hash)
)
for txo in tx.outputs:
if txo.has_address:
if txo.is_pubkey_hash:
addresses.add(self.hash160_to_address(txo.pubkey_hash))
elif txo.is_script_hash:
addresses.add(self.hash160_to_script_address(txo.script_hash))
start = int(time.perf_counter())
while timeout and (int(time.perf_counter()) - start) <= timeout:
if await self._wait_round(tx, height, addresses):
@@ -738,7 +750,7 @@ class Ledger(metaclass=LedgerRegistry):
))[1] if record['history'] else []
for txid, local_height in local_history:
if txid == tx.id:
if local_height >= height:
if local_height >= height or (local_height == 0 and height > local_height):
return True
log.warning(
"local history has higher height than remote for %s (%i vs %i)", txid,
@@ -756,9 +768,13 @@ class Ledger(metaclass=LedgerRegistry):
include_is_my_output=False,
include_sent_supports=False,
include_sent_tips=False,
include_received_tips=False) -> Tuple[List[Output], dict, int, int]:
include_received_tips=False,
hub_server=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?
if hub_server:
outputs = Outputs.from_grpc(encoded_outputs)
else:
outputs = Outputs.from_base64(encoded_outputs or b'') # TODO: why is the server returning None?
txs: List[Transaction] = []
if len(outputs.txs) > 0:
async for tx in self.request_transactions(tuple(outputs.txs), cached=True):
@@ -875,6 +891,7 @@ class Ledger(metaclass=LedgerRegistry):
claim_search(**kwargs), accounts,
include_purchase_receipt=include_purchase_receipt,
include_is_my_output=include_is_my_output,
hub_server=new_sdk_server is not None
)
async def get_claim_by_claim_id(self, accounts, claim_id, **kwargs) -> Output:
@@ -1189,6 +1206,7 @@ class TestNetLedger(Ledger):
extended_private_key_prefix = unhexlify('04358394')
checkpoints = {}
class RegTestLedger(Ledger):
network_name = 'regtest'
headers_class = UnvalidatedHeaders
+24 -4
View File
@@ -3,12 +3,14 @@ import json
import typing
import logging
import asyncio
from distutils.util import strtobool
from binascii import unhexlify
from decimal import Decimal
from typing import List, Type, MutableSequence, MutableMapping, Optional
from lbry.error import KeyFeeAboveMaxAllowedError
from lbry.conf import Config
from lbry.error import KeyFeeAboveMaxAllowedError, WalletNotLoadedError
from lbry.conf import Config, NOT_SET
from .dewies import dewies_to_lbc
from .account import Account
@@ -95,7 +97,7 @@ class WalletManager:
for wallet in self.wallets:
if wallet.id == wallet_id:
return wallet
raise ValueError(f"Couldn't find wallet: {wallet_id}.")
raise WalletNotLoadedError(wallet_id)
@staticmethod
def get_balance(wallet):
@@ -181,8 +183,14 @@ class WalletManager:
}[config.blockchain_name]
ledger_config = {
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'yes'),
'auto_connect': True,
'explicit_servers': [],
'hub_timeout': config.hub_timeout,
'default_servers': config.lbryum_servers,
'known_hubs': config.known_hubs,
'jurisdiction': config.jurisdiction,
'concurrent_hub_requests': config.concurrent_hub_requests,
'data_path': config.wallet_dir,
'tx_cache_size': config.transaction_cache_size
}
@@ -195,6 +203,10 @@ class WalletManager:
os.path.join(wallets_directory, 'default_wallet')
)
if Config.lbryum_servers.is_set_to_default(config):
with config.update_config() as c:
c.lbryum_servers = NOT_SET
manager = cls.from_config({
'ledgers': {ledger_id: ledger_config},
'wallets': [
@@ -224,10 +236,18 @@ class WalletManager:
async def reset(self):
self.ledger.config = {
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'yes'),
'auto_connect': True,
'default_servers': self.config.lbryum_servers,
'explicit_servers': [],
'default_servers': Config.lbryum_servers.default,
'known_hubs': self.config.known_hubs,
'jurisdiction': self.config.jurisdiction,
'hub_timeout': self.config.hub_timeout,
'concurrent_hub_requests': self.config.concurrent_hub_requests,
'data_path': self.config.wallet_dir,
}
if Config.lbryum_servers.is_set(self.config):
self.ledger.config['explicit_servers'] = self.config.lbryum_servers
await self.ledger.stop()
await self.ledger.start()
+74 -26
View File
@@ -7,6 +7,9 @@ from time import perf_counter
from collections import defaultdict
from typing import Dict, Optional, Tuple
import aiohttp
import grpc
from lbry.schema.types.v2 import hub_pb2_grpc
from lbry.schema.types.v2.hub_pb2 import SearchRequest
from lbry import __version__
from lbry.utils import resolve_host
@@ -14,12 +17,13 @@ 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
from lbry.conf import KnownHubsList
log = logging.getLogger(__name__)
class ClientSession(BaseClientSession):
def __init__(self, *args, network: 'Network', server, timeout=30, **kwargs):
def __init__(self, *args, network: 'Network', server, timeout=30, concurrency=32, **kwargs):
self.network = network
self.server = server
super().__init__(*args, **kwargs)
@@ -29,7 +33,11 @@ class ClientSession(BaseClientSession):
self.response_time: Optional[float] = None
self.connection_latency: Optional[float] = None
self._response_samples = 0
self.pending_amount = 0
self._concurrency = asyncio.Semaphore(concurrency)
@property
def concurrency(self):
return self._concurrency._value
@property
def available(self):
@@ -55,9 +63,9 @@ class ClientSession(BaseClientSession):
return result
async def send_request(self, method, args=()):
self.pending_amount += 1
log.debug("send %s%s to %s:%i (%i timeout)", method, tuple(args), self.server[0], self.server[1], self.timeout)
try:
await self._concurrency.acquire()
if method == 'server.version':
return await self.send_timed_server_version_request(args, self.timeout)
request = asyncio.ensure_future(super().send_request(method, args))
@@ -91,7 +99,7 @@ class ClientSession(BaseClientSession):
# self.synchronous_close()
raise
finally:
self.pending_amount -= 1
self._concurrency.release()
async def ensure_server_version(self, required=None, timeout=3):
required = required or self.network.PROTOCOL_VERSION
@@ -154,7 +162,6 @@ class Network:
# self._switch_task: Optional[asyncio.Task] = None
self.running = False
self.remote_height: int = 0
self._concurrency = asyncio.Semaphore(16)
self._on_connected_controller = StreamController()
self.on_connected = self._on_connected_controller.stream
@@ -165,9 +172,13 @@ class Network:
self._on_status_controller = StreamController(merge_repeated_events=True)
self.on_status = self._on_status_controller.stream
self._on_hub_controller = StreamController(merge_repeated_events=True)
self.on_hub = self._on_hub_controller.stream
self.subscription_controllers = {
'blockchain.headers.subscribe': self._on_header_controller,
'blockchain.address.subscribe': self._on_status_controller,
'blockchain.peers.subscribe': self._on_hub_controller,
}
self.aiohttp_session: Optional[aiohttp.ClientSession] = None
@@ -179,6 +190,16 @@ class Network:
def config(self):
return self.ledger.config
@property
def known_hubs(self):
if 'known_hubs' not in self.config:
return KnownHubsList()
return self.config['known_hubs']
@property
def jurisdiction(self):
return self.config.get("jurisdiction")
def disconnect(self):
if self._keepalive_task and not self._keepalive_task.done():
self._keepalive_task.cancel()
@@ -189,6 +210,7 @@ class Network:
self.running = True
self.aiohttp_session = aiohttp.ClientSession()
self.on_header.listen(self._update_remote_height)
self.on_hub.listen(self._update_hubs)
self._loop_task = asyncio.create_task(self.network_loop())
self._urgent_need_reconnect.set()
@@ -216,7 +238,13 @@ class Network:
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']))
if self.config['explicit_servers']:
hubs = self.config['explicit_servers']
elif self.known_hubs:
hubs = self.known_hubs
else:
hubs = self.config['default_servers']
await asyncio.gather(*(resolve_spv(server, port) for (server, port) in hubs))
return hostname_to_ip, ip_to_hostnames
async def get_n_fastest_spvs(self, timeout=3.0) -> Dict[Tuple[str, int], Optional[SPVPong]]:
@@ -226,8 +254,9 @@ class Network:
sent_ping_timestamps = {}
_, ip_to_hostnames = await self.resolve_spv_dns()
n = len(ip_to_hostnames)
log.info("%i possible spv servers to try (%i urls in config)", n, len(self.config['default_servers']))
log.info("%i possible spv servers to try (%i urls in config)", n, len(self.config['explicit_servers']))
pongs = {}
known_hubs = self.known_hubs
try:
await loop.create_datagram_endpoint(lambda: connection, ('0.0.0.0', 0))
# could raise OSError if it cant bind
@@ -242,6 +271,9 @@ class Network:
'/'.join(ip_to_hostnames[remote]), remote[1], round(latency * 1000, 2),
pong.available, pong.height)
known_hubs.hubs.setdefault((ip_to_hostnames[remote][0], remote[1]), {}).update(
{"country": pong.country_name}
)
if pong.available:
pongs[(ip_to_hostnames[remote][0], remote[1])] = pong
return pongs
@@ -256,14 +288,19 @@ class Network:
random_server = random.choice(list(ip_to_hostnames.keys()))
host, port = random_server
log.warning("trying fallback to randomly selected spv: %s:%i", host, port)
known_hubs.hubs.setdefault((host, port), {})
return {(host, port): None}
finally:
connection.close()
async def connect_to_fastest(self) -> Optional[ClientSession]:
fastest_spvs = await self.get_n_fastest_spvs()
for (host, port) in fastest_spvs:
client = ClientSession(network=self, server=(host, port))
for (host, port), pong in fastest_spvs.items():
if (pong is not None and self.jurisdiction is not None) and \
(pong.country_name != self.jurisdiction):
continue
client = ClientSession(network=self, server=(host, port), timeout=self.config['hub_timeout'],
concurrency=self.config['concurrent_hub_requests'])
try:
await client.create_connection()
log.warning("Connected to spv server %s:%i", host, port)
@@ -293,6 +330,8 @@ class Network:
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.debug("discover other hubs %s:%i", *client.server)
await self._update_hubs(await client.send_request('server.peers.subscribe', []))
log.info("subscribe to headers %s:%i", *client.server)
self._update_remote_height((await self.subscribe_headers(),))
self._on_connected_controller.add(True)
@@ -344,24 +383,31 @@ class Network:
raise ConnectionError("Attempting to send rpc request when connection is not available.")
async def retriable_call(self, function, *args, **kwargs):
async with self._concurrency:
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
try:
return await function(*args, **kwargs)
except asyncio.TimeoutError:
log.warning("Wallet server call timed out, retrying.")
except ConnectionError:
log.warning("connection error")
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
try:
return await function(*args, **kwargs)
except asyncio.TimeoutError:
log.warning("Wallet server call timed out, retrying.")
except ConnectionError:
log.warning("connection error")
raise asyncio.CancelledError() # if we got here, we are shutting down
def _update_remote_height(self, header_args):
self.remote_height = header_args[0]["height"]
async def _update_hubs(self, hubs):
if hubs and hubs != ['']:
try:
if self.known_hubs.add_hubs(hubs):
self.known_hubs.save()
except Exception:
log.exception("could not add hubs: %s", hubs)
def get_transaction(self, tx_hash, known_height=None):
# use any server if its old, otherwise restrict to who gave us the history
restricted = known_height in (None, -1, 0) or 0 > known_height > self.remote_height - 10
@@ -432,11 +478,13 @@ class Network:
return result['result']
async def new_claim_search(self, server, **kwargs):
kwargs['protobuf'] = True
message = {"method": "claim_search", "params": kwargs}
async with self.aiohttp_session.post(server, json=message) as r:
result = await r.json()
return result['result']
async with grpc.aio.insecure_channel(server) as channel:
stub = hub_pb2_grpc.HubStub(channel)
try:
response = await stub.Search(SearchRequest(**kwargs))
except grpc.aio.AioRpcError as error:
raise RPCError(error.code(), error.details())
return response
async def sum_supports(self, server, **kwargs):
message = {"method": "support_sum", "params": kwargs}
+3
View File
@@ -1,2 +1,5 @@
__hub_url__ = (
"https://github.com/lbryio/hub/releases/download/v0.2021.08.24-beta/hub"
)
from .node import Conductor
from .service import ConductorService
+164 -9
View File
@@ -8,6 +8,8 @@ import logging
import tempfile
import subprocess
import importlib
from distutils.util import strtobool
from binascii import hexlify
from typing import Type, Optional
import urllib.request
@@ -17,7 +19,8 @@ import lbry
from lbry.wallet.server.server import Server
from lbry.wallet.server.env import Env
from lbry.wallet import Wallet, Ledger, RegTestLedger, WalletManager, Account, BlockHeightEvent
from lbry.conf import KnownHubsList, Config
from lbry.wallet.orchstr8 import __hub_url__
log = logging.getLogger(__name__)
@@ -47,10 +50,12 @@ class Conductor:
self.wallet_node = WalletNode(
self.manager_module, RegTestLedger, default_seed=seed
)
self.hub_node = HubNode(__hub_url__, "hub", self.spv_node)
self.blockchain_started = False
self.spv_started = False
self.wallet_started = False
self.hub_started = False
self.log = log.getChild('conductor')
@@ -66,6 +71,17 @@ class Conductor:
await self.blockchain_node.stop(cleanup=True)
self.blockchain_started = False
async def start_hub(self):
if not self.hub_started:
asyncio.create_task(self.hub_node.start())
await self.blockchain_node.running.wait()
self.hub_started = True
async def stop_hub(self):
if self.hub_started:
await self.hub_node.stop(cleanup=True)
self.hub_started = False
async def start_spv(self):
if not self.spv_started:
await self.spv_node.start(self.blockchain_node)
@@ -107,7 +123,8 @@ class Conductor:
class WalletNode:
def __init__(self, manager_class: Type[WalletManager], ledger_class: Type[Ledger],
verbose: bool = False, port: int = 5280, default_seed: str = None) -> None:
verbose: bool = False, port: int = 5280, default_seed: str = None,
data_path: str = None) -> None:
self.manager_class = manager_class
self.ledger_class = ledger_class
self.verbose = verbose
@@ -115,12 +132,12 @@ class WalletNode:
self.ledger: Optional[Ledger] = None
self.wallet: Optional[Wallet] = None
self.account: Optional[Account] = None
self.data_path: Optional[str] = None
self.data_path: str = data_path or tempfile.mkdtemp()
self.port = port
self.default_seed = default_seed
self.known_hubs = KnownHubsList()
async def start(self, spv_node: 'SPVNode', seed=None, connect=True):
self.data_path = tempfile.mkdtemp()
async def start(self, spv_node: 'SPVNode', seed=None, connect=True, config=None):
wallets_dir = os.path.join(self.data_path, 'wallets')
os.mkdir(wallets_dir)
wallet_file_name = os.path.join(wallets_dir, 'my_wallet.json')
@@ -129,13 +146,19 @@ class WalletNode:
self.manager = self.manager_class.from_config({
'ledgers': {
self.ledger_class.get_id(): {
'use_go_hub': not strtobool(os.environ.get('ENABLE_LEGACY_SEARCH') or 'yes'),
'api_port': self.port,
'default_servers': [(spv_node.hostname, spv_node.port)],
'data_path': self.data_path
'explicit_servers': [(spv_node.hostname, spv_node.port)],
'default_servers': Config.lbryum_servers.default,
'data_path': self.data_path,
'known_hubs': config.known_hubs if config else KnownHubsList(),
'hub_timeout': 30,
'concurrent_hub_requests': 32,
}
},
'wallets': [wallet_file_name]
})
self.manager.config = config
self.ledger = self.manager.ledgers[self.ledger_class]
self.wallet = self.manager.default_wallet
if not self.wallet:
@@ -172,9 +195,12 @@ class SPVNode:
self.udp_port = self.port
self.session_timeout = 600
self.rpc_port = '0' # disabled by default
self.stopped = False
self.index_name = None
async def start(self, blockchain_node: 'BlockchainNode', extraconf=None):
self.data_path = tempfile.mkdtemp()
self.index_name = uuid4().hex
conf = {
'DESCRIPTION': '',
'PAYMENT_ADDRESS': '',
@@ -189,7 +215,7 @@ class SPVNode:
'MAX_QUERY_WORKERS': '0',
'INDIVIDUAL_TAG_INDEXES': '',
'RPC_PORT': self.rpc_port,
'ES_INDEX_PREFIX': uuid4().hex,
'ES_INDEX_PREFIX': self.index_name,
'ES_MODE': 'writer',
}
if extraconf:
@@ -201,10 +227,13 @@ class SPVNode:
await self.server.start()
async def stop(self, cleanup=True):
if self.stopped:
return
try:
await self.server.db.search_index.delete_index()
await self.server.db.search_index.stop()
await self.server.stop()
self.stopped = True
finally:
cleanup and self.cleanup()
@@ -410,7 +439,7 @@ class BlockchainNode:
return self._cli_cmnd('getnewaddress', "", address_type)
async def get_balance(self):
return float(await self._cli_cmnd('getbalance'))
return await self._cli_cmnd('getbalance')
def send_to_address(self, address, amount):
return self._cli_cmnd('sendtoaddress', address, str(amount))
@@ -429,3 +458,129 @@ class BlockchainNode:
def get_raw_transaction(self, txid):
return self._cli_cmnd('getrawtransaction', txid, '1')
class HubProcess(asyncio.SubprocessProtocol):
def __init__(self):
self.ready = asyncio.Event()
self.stopped = asyncio.Event()
self.log = log.getChild('hub')
def pipe_data_received(self, fd, data):
if self.log:
self.log.info(data.decode())
if b'error' in data.lower():
self.ready.set()
raise SystemError(data.decode())
if b'listening on' in data:
self.ready.set()
def process_exited(self):
self.stopped.set()
self.ready.set()
class HubNode:
def __init__(self, url, daemon, spv_node):
self.spv_node = spv_node
self.debug = False
self.latest_release_url = url
self.project_dir = os.path.dirname(os.path.dirname(__file__))
self.bin_dir = os.path.join(self.project_dir, 'bin')
self.daemon_bin = os.path.join(self.bin_dir, daemon)
self.cli_bin = os.path.join(self.bin_dir, daemon)
self.log = log.getChild('hub')
self.transport = None
self.protocol = None
self.hostname = 'localhost'
self.rpcport = 50051 # avoid conflict with default rpc port
self.stopped = False
self.restart_ready = asyncio.Event()
self.restart_ready.set()
self.running = asyncio.Event()
@property
def exists(self):
return (
os.path.exists(self.cli_bin) and
os.path.exists(self.daemon_bin)
)
def download(self):
downloaded_file = os.path.join(
self.bin_dir,
self.latest_release_url[self.latest_release_url.rfind('/')+1:]
)
if not os.path.exists(self.bin_dir):
os.mkdir(self.bin_dir)
if not os.path.exists(downloaded_file):
self.log.info('Downloading: %s', self.latest_release_url)
with urllib.request.urlopen(self.latest_release_url) as response:
with open(downloaded_file, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
self.log.info('Extracting: %s', downloaded_file)
if downloaded_file.endswith('.zip'):
with zipfile.ZipFile(downloaded_file) as dotzip:
dotzip.extractall(self.bin_dir)
# zipfile bug https://bugs.python.org/issue15795
os.chmod(self.cli_bin, 0o755)
os.chmod(self.daemon_bin, 0o755)
elif downloaded_file.endswith('.tar.gz'):
with tarfile.open(downloaded_file) as tar:
tar.extractall(self.bin_dir)
os.chmod(self.daemon_bin, 0o755)
return self.exists
def ensure(self):
return self.exists or self.download()
async def start(self):
assert self.ensure()
loop = asyncio.get_event_loop()
asyncio.get_child_watcher().attach_loop(loop)
command = [
self.daemon_bin, 'serve', '--esindex', self.spv_node.index_name + 'claims', '--debug'
]
self.log.info(' '.join(command))
while not self.stopped:
if self.running.is_set():
await asyncio.sleep(1)
continue
await self.restart_ready.wait()
try:
if not self.debug:
self.transport, self.protocol = await loop.subprocess_exec(
HubProcess, *command
)
await self.protocol.ready.wait()
assert not self.protocol.stopped.is_set()
self.running.set()
except asyncio.CancelledError:
self.running.clear()
raise
except Exception as e:
self.running.clear()
log.exception('failed to start hub', exc_info=e)
async def stop(self, cleanup=True):
self.stopped = True
try:
if not self.debug:
self.transport.terminate()
await self.protocol.stopped.wait()
self.transport.close()
finally:
if cleanup:
self.cleanup()
def cleanup(self):
pass
+2 -1
View File
@@ -436,7 +436,8 @@ class RPCSession(SessionBase):
except CancelledError:
raise
except Exception:
self.logger.exception(f'exception handling {request}')
reqstr = str(request)
self.logger.exception(f'exception handling {reqstr[:16_000]}')
result = RPCError(JSONRPC.INTERNAL_ERROR,
'internal server error')
if isinstance(request, Request):
-5
View File
@@ -798,11 +798,6 @@ class LBRYBlockProcessor(BlockProcessor):
finally:
if self.sql:
self.sql.commit()
if self.sql and self.db.first_sync and self.height == self.daemon.cached_height():
self.timer.run(self.sql.execute, self.sql.SEARCH_INDEXES, timer_name='executing SEARCH_INDEXES')
if self.env.individual_tag_indexes:
self.timer.run(self.sql.execute, self.sql.TAG_INDEXES, timer_name='executing TAG_INDEXES')
self.timer.run(self.sql.execute, self.sql.LANGUAGE_INDEXES, timer_name='executing LANGUAGE_INDEXES')
def advance_txs(self, height, txs, header, block_hash):
timer = self.timer.sub_timers['advance_blocks']
+1 -1
View File
@@ -25,7 +25,7 @@ def main():
parser = get_argument_parser()
args = parser.parse_args()
coin_class = get_coin_class(args.spvserver)
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-4s %(name)s:%(lineno)d: %(message)s")
logging.info('lbry.server starting')
logging.getLogger('aiohttp').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
+1 -5
View File
@@ -17,10 +17,6 @@ class FindShortestID:
if self.short_id:
return '#'+self.short_id
@classmethod
def factory(cls):
return cls(), cls.step, cls.finalize
def register_canonical_functions(connection):
connection.createaggregatefunction("shortest_id", FindShortestID.factory, 2)
connection.create_aggregate("shortest_id", 2, FindShortestID)
@@ -35,27 +35,48 @@ INDEX_DEFAULT_SETTINGS = {
}
}
}
FIELDS = {'is_controlling', 'last_take_over_height', 'claim_id', 'claim_name', 'normalized', 'tx_position', 'amount',
'timestamp', 'creation_timestamp', 'height', 'creation_height', 'activation_height', 'expiration_height',
'release_time', 'short_url', 'canonical_url', 'title', 'author', 'description', 'claim_type', 'reposted',
'stream_type', 'media_type', 'fee_amount', 'fee_currency', 'duration', 'reposted_claim_hash', 'censor_type',
'claims_in_channel', 'channel_join', 'signature_valid', 'effective_amount', 'support_amount',
'trending_group', 'trending_mixed', 'trending_local', 'trending_global', 'channel_id', 'tx_id', 'tx_nout',
'signature', 'signature_digest', 'public_key_bytes', 'public_key_hash', 'public_key_id', '_id', 'tags',
'reposted_claim_id'}
TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id',
'media_type', 'normalized', 'public_key_bytes', 'public_key_hash', 'short_url', 'signature',
'signature_digest', 'stream_type', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags'}
FIELDS = {
'_id',
'claim_id', 'claim_type', 'claim_name', 'normalized_name',
'tx_id', 'tx_nout', 'tx_position',
'short_url', 'canonical_url',
'is_controlling', 'last_take_over_height',
'public_key_bytes', 'public_key_id', 'claims_in_channel', 'channel_join_height',
'channel_id', 'signature', 'signature_digest', 'is_signature_valid',
'amount', 'effective_amount', 'support_amount',
'fee_amount', 'fee_currency',
'height', 'creation_height', 'activation_height', 'expiration_height',
'stream_type', 'media_type', 'censor_type',
'title', 'author', 'description',
'timestamp', 'creation_timestamp',
'duration', 'release_time',
'tags', 'languages', 'has_source', 'reposted_claim_type',
'reposted_claim_id', 'repost_count',
'trending_group', 'trending_mixed', 'trending_local', 'trending_global',
}
TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id', 'censoring_channel_id',
'media_type', 'normalized_name', 'public_key_bytes', 'public_key_id', 'short_url', 'signature',
'signature_digest', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags'}
RANGE_FIELDS = {
'height', 'creation_height', 'activation_height', 'expiration_height',
'timestamp', 'creation_timestamp', 'duration', 'release_time', 'fee_amount',
'tx_position', 'channel_join', 'reposted', 'limit_claims_per_channel',
'tx_position', 'channel_join', 'repost_count', 'limit_claims_per_channel',
'amount', 'effective_amount', 'support_amount',
'trending_group', 'trending_mixed', 'censor_type',
'trending_local', 'trending_global',
}
ALL_FIELDS = RANGE_FIELDS | TEXT_FIELDS | FIELDS
REPLACEMENTS = {
'name': 'normalized',
'name': 'normalized_name',
'txid': 'tx_id',
'claim_hash': '_id'
'nout': 'tx_nout',
'valid_channel_signature': 'is_signature_valid',
'stream_types': 'stream_type',
'media_types': 'media_type',
'reposted': 'repost_count'
}
+129 -57
View File
@@ -1,7 +1,7 @@
import asyncio
import struct
from binascii import unhexlify
from collections import Counter
from collections import Counter, deque
from decimal import Decimal
from operator import itemgetter
from typing import Optional, List, Iterable, Union
@@ -10,14 +10,14 @@ from elasticsearch import AsyncElasticsearch, NotFoundError, ConnectionError
from elasticsearch.helpers import async_streaming_bulk
from lbry.crypto.base58 import Base58
from lbry.error import ResolveCensoredError, claim_id as parse_claim_id
from lbry.error import ResolveCensoredError, TooManyClaimSearchParametersError
from lbry.schema.result import Outputs, Censor
from lbry.schema.tags import clean_tags
from lbry.schema.url import URL, normalize_name
from lbry.utils import LRUCache
from lbry.wallet.server.db.common import CLAIM_TYPES, STREAM_TYPES
from lbry.wallet.server.db.elasticsearch.constants import INDEX_DEFAULT_SETTINGS, REPLACEMENTS, FIELDS, TEXT_FIELDS, \
RANGE_FIELDS
RANGE_FIELDS, ALL_FIELDS
from lbry.wallet.server.util import class_logger
@@ -33,7 +33,15 @@ class StreamResolution(str):
return LookupError(f'Could not find claim at "{url}".')
class IndexVersionMismatch(Exception):
def __init__(self, got_version, expected_version):
self.got_version = got_version
self.expected_version = expected_version
class SearchIndex:
VERSION = 1
def __init__(self, index_prefix: str, search_timeout=3.0, elastic_host='localhost', elastic_port=9200):
self.search_timeout = search_timeout
self.sync_timeout = 600 # wont hit that 99% of the time, but can hit on a fresh import
@@ -42,15 +50,27 @@ class SearchIndex:
self.index = index_prefix + 'claims'
self.logger = class_logger(__name__, self.__class__.__name__)
self.claim_cache = LRUCache(2 ** 15)
self.short_id_cache = LRUCache(2 ** 17) # never invalidated, since short ids are forever
self.short_id_cache = LRUCache(2 ** 17)
self.search_cache = LRUCache(2 ** 17)
self.resolution_cache = LRUCache(2 ** 17)
self._elastic_host = elastic_host
self._elastic_port = elastic_port
async def start(self):
async def get_index_version(self) -> int:
try:
template = await self.sync_client.indices.get_template(self.index)
return template[self.index]['version']
except NotFoundError:
return 0
async def set_index_version(self, version):
await self.sync_client.indices.put_template(
self.index, body={'version': version, 'index_patterns': ['ignored']}, ignore=400
)
async def start(self) -> bool:
if self.sync_client:
return
return False
hosts = [{'host': self._elastic_host, 'port': self._elastic_port}]
self.sync_client = AsyncElasticsearch(hosts, timeout=self.sync_timeout)
self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout)
@@ -61,8 +81,17 @@ class SearchIndex:
except ConnectionError:
self.logger.warning("Failed to connect to Elasticsearch. Waiting for it!")
await asyncio.sleep(1)
res = await self.sync_client.indices.create(self.index, INDEX_DEFAULT_SETTINGS, ignore=400)
return res.get('acknowledged', False)
acked = res.get('acknowledged', False)
if acked:
await self.set_index_version(self.VERSION)
return acked
index_version = await self.get_index_version()
if index_version != self.VERSION:
self.logger.error("es search index has an incompatible version: %s vs %s", index_version, self.VERSION)
raise IndexVersionMismatch(index_version, self.VERSION)
return acked
def stop(self):
clients = [self.sync_client, self.search_client]
@@ -104,7 +133,7 @@ class SearchIndex:
update = expand_query(claim_id__in=list(blockdict.keys()), censor_type=f"<{censor_type}")
key = 'channel_id' if channels else 'claim_id'
update['script'] = {
"source": f"ctx._source.censor_type={censor_type}; ctx._source.censoring_channel_hash=params[ctx._source.{key}]",
"source": f"ctx._source.censor_type={censor_type}; ctx._source.censoring_channel_id=params[ctx._source.{key}]",
"lang": "painless",
"params": blockdict
}
@@ -133,7 +162,11 @@ class SearchIndex:
await self.sync_client.update_by_query(
self.index, body=self.update_filter_query(Censor.RESOLVE, blocked_channels, True), slices=4)
await self.sync_client.indices.refresh(self.index)
self.clear_caches()
def clear_caches(self):
self.search_cache.clear()
self.short_id_cache.clear()
self.claim_cache.clear()
self.resolution_cache.clear()
@@ -175,7 +208,7 @@ class SearchIndex:
censored = [
result if not isinstance(result, dict) or not censor.censor(result)
else ResolveCensoredError(url, result['censoring_channel_hash'])
else ResolveCensoredError(url, result['censoring_channel_id'])
for url, result in zip(urls, results)
]
return results, censored, censor
@@ -198,7 +231,7 @@ class SearchIndex:
self.claim_cache.set(result['claim_id'], result)
async def full_id_from_short_id(self, name, short_id, channel_id=None):
key = (channel_id or '') + name + short_id
key = '#'.join((channel_id or '', name, short_id))
if key not in self.short_id_cache:
query = {'name': name, 'claim_id': short_id}
if channel_id:
@@ -219,54 +252,88 @@ class SearchIndex:
if not kwargs['channel_id'] or not isinstance(kwargs['channel_id'], str):
return [], 0, 0
try:
if 'limit_claims_per_channel' in kwargs:
return await self.search_ahead(**kwargs), 0, 0
else:
result = (await self.search_client.search(
expand_query(**kwargs), index=self.index,
track_total_hits=False if kwargs.get('no_totals') else 10_000
))['hits']
return await self.search_ahead(**kwargs)
except NotFoundError:
return [], 0, 0
return expand_result(result['hits']), 0, result.get('total', {}).get('value', 0)
async def search_ahead(self, **kwargs):
# 'limit_claims_per_channel' case. Fetch 1000 results, reorder, slice, inflate and return
per_channel_per_page = kwargs.pop('limit_claims_per_channel')
limit = kwargs.pop('limit', 10)
per_channel_per_page = kwargs.pop('limit_claims_per_channel', 0) or 0
remove_duplicates = kwargs.pop('remove_duplicates', False)
page_size = kwargs.pop('limit', 10)
offset = kwargs.pop('offset', 0)
kwargs['limit'] = 1000
query = expand_query(**kwargs)
result = (await self.search_client.search(
query, index=self.index, track_total_hits=False, _source_includes=['_id', 'channel_id']
))['hits']
to_inflate = []
channel_counter = Counter()
delayed = []
while result['hits'] or delayed:
if len(to_inflate) % limit == 0:
channel_counter.clear()
cache_item = ResultCacheItem.from_cache(f"ahead{per_channel_per_page}{kwargs}", self.search_cache)
if cache_item.result is not None:
reordered_hits = cache_item.result
else:
async with cache_item.lock:
if cache_item.result:
reordered_hits = cache_item.result
else:
query = expand_query(**kwargs)
search_hits = deque((await self.search_client.search(
query, index=self.index, track_total_hits=False,
_source_includes=['_id', 'channel_id', 'reposted_claim_id', 'creation_height']
))['hits']['hits'])
if remove_duplicates:
search_hits = self.__remove_duplicates(search_hits)
if per_channel_per_page > 0:
reordered_hits = self.__search_ahead(search_hits, page_size, per_channel_per_page)
else:
reordered_hits = [(hit['_id'], hit['_source']['channel_id']) for hit in search_hits]
cache_item.result = reordered_hits
result = list(await self.get_many(*(claim_id for claim_id, _ in reordered_hits[offset:(offset + page_size)])))
return result, 0, len(reordered_hits)
def __remove_duplicates(self, search_hits: deque) -> deque:
known_ids = {} # claim_id -> (creation_height, hit_id), where hit_id is either reposted claim id or original
dropped = set()
for hit in search_hits:
hit_height, hit_id = hit['_source']['creation_height'], hit['_source']['reposted_claim_id'] or hit['_id']
if hit_id not in known_ids:
known_ids[hit_id] = (hit_height, hit['_id'])
else:
previous_height, previous_id = known_ids[hit_id]
if hit_height < previous_height:
known_ids[hit_id] = (hit_height, hit['_id'])
dropped.add(previous_id)
else:
dropped.add(hit['_id'])
return deque(hit for hit in search_hits if hit['_id'] not in dropped)
def __search_ahead(self, search_hits: list, page_size: int, per_channel_per_page: int):
reordered_hits = []
channel_counters = Counter()
next_page_hits_maybe_check_later = deque()
while search_hits or next_page_hits_maybe_check_later:
if reordered_hits and len(reordered_hits) % page_size == 0:
channel_counters.clear()
elif not reordered_hits:
pass
else:
break # means last page was incomplete and we are left with bad replacements
new_delayed = []
for id, chann in delayed:
if channel_counter[chann] < per_channel_per_page:
to_inflate.append((id, chann))
channel_counter[hit_channel_id] += 1
for _ in range(len(next_page_hits_maybe_check_later)):
claim_id, channel_id = next_page_hits_maybe_check_later.popleft()
if per_channel_per_page > 0 and channel_counters[channel_id] < per_channel_per_page:
reordered_hits.append((claim_id, channel_id))
channel_counters[channel_id] += 1
else:
new_delayed.append((id, chann))
delayed = new_delayed
while result['hits']:
hit = result['hits'].pop(0)
next_page_hits_maybe_check_later.append((claim_id, channel_id))
while search_hits:
hit = search_hits.popleft()
hit_id, hit_channel_id = hit['_id'], hit['_source']['channel_id']
if channel_counter[hit_channel_id] < per_channel_per_page:
to_inflate.append((hit_id, hit_channel_id))
channel_counter[hit_channel_id] += 1
if len(to_inflate) % limit == 0:
if hit_channel_id is None or per_channel_per_page <= 0:
reordered_hits.append((hit_id, hit_channel_id))
elif channel_counters[hit_channel_id] < per_channel_per_page:
reordered_hits.append((hit_id, hit_channel_id))
channel_counters[hit_channel_id] += 1
if len(reordered_hits) % page_size == 0:
break
else:
delayed.append((hit_id, hit_channel_id))
return list(await self.get_many(*(claim_id for claim_id, _ in to_inflate[offset:(offset + limit)])))
next_page_hits_maybe_check_later.append((hit_id, hit_channel_id))
return reordered_hits
async def resolve_url(self, raw_url):
if raw_url not in self.resolution_cache:
@@ -344,7 +411,7 @@ class SearchIndex:
txo_rows = [row for row in txo_rows if isinstance(row, dict)]
referenced_ids = set(filter(None, map(itemgetter('reposted_claim_id'), txo_rows)))
referenced_ids |= set(filter(None, (row['channel_id'] for row in txo_rows)))
referenced_ids |= set(map(parse_claim_id, filter(None, (row['censoring_channel_hash'] for row in txo_rows))))
referenced_ids |= set(filter(None, (row['censoring_channel_id'] for row in txo_rows)))
referenced_txos = []
if referenced_ids:
@@ -365,20 +432,22 @@ def extract_doc(doc, index):
doc['reposted_claim_id'] = None
channel_hash = doc.pop('channel_hash')
doc['channel_id'] = channel_hash[::-1].hex() if channel_hash else channel_hash
channel_hash = doc.pop('censoring_channel_hash')
doc['censoring_channel_hash'] = channel_hash[::-1].hex() if channel_hash else channel_hash
doc['censoring_channel_id'] = doc.get('censoring_channel_id')
txo_hash = doc.pop('txo_hash')
doc['tx_id'] = txo_hash[:32][::-1].hex()
doc['tx_nout'] = struct.unpack('<I', txo_hash[32:])[0]
doc['repost_count'] = doc.pop('reposted')
doc['is_controlling'] = bool(doc['is_controlling'])
doc['signature'] = (doc.pop('signature') or b'').hex() or None
doc['signature_digest'] = (doc.pop('signature_digest') or b'').hex() or None
doc['public_key_bytes'] = (doc.pop('public_key_bytes') or b'').hex() or None
doc['public_key_hash'] = (doc.pop('public_key_hash') or b'').hex() or None
doc['signature_valid'] = bool(doc['signature_valid'])
doc['public_key_id'] = (doc.pop('public_key_hash') or b'').hex() or None
doc['is_signature_valid'] = bool(doc['signature_valid'])
doc['claim_type'] = doc.get('claim_type', 0) or 0
doc['stream_type'] = int(doc.get('stream_type', 0) or 0)
doc['has_source'] = bool(doc['has_source'])
doc['normalized_name'] = doc.pop('normalized')
doc = {key: value for key, value in doc.items() if key in ALL_FIELDS}
return {'doc': doc, '_id': doc['claim_id'], '_index': index, '_op_type': 'update', 'doc_as_upsert': True}
@@ -396,6 +465,8 @@ def expand_query(**kwargs):
for key, value in kwargs.items():
key = key.replace('claim.', '')
many = key.endswith('__in') or isinstance(value, list)
if many and len(value) > 2048:
raise TooManyClaimSearchParametersError(key, 2048)
if many:
key = key.replace('__in', '')
value = list(filter(None, value))
@@ -409,6 +480,8 @@ def expand_query(**kwargs):
value = CLAIM_TYPES[value]
else:
value = [CLAIM_TYPES[claim_type] for claim_type in value]
elif key == 'stream_type':
value = STREAM_TYPES[value] if isinstance(value, str) else list(map(STREAM_TYPES.get, value))
if key == '_id':
if isinstance(value, Iterable):
value = [item[::-1].hex() for item in value]
@@ -417,9 +490,8 @@ def expand_query(**kwargs):
if not many and key in ('_id', 'claim_id') and len(value) < 20:
partial_id = True
if key == 'public_key_id':
key = 'public_key_hash'
value = Base58.decode(value)[1:21].hex()
if key == 'signature_valid':
if key in ('signature_valid', 'has_source'):
continue # handled later
if key in TEXT_FIELDS:
key += '.keyword'
@@ -448,8 +520,6 @@ def expand_query(**kwargs):
query['must'].append({"terms": {'claim_id.keyword': value}})
elif key == 'media_types':
query['must'].append({"terms": {'media_type.keyword': value}})
elif key == 'stream_types':
query['must'].append({"terms": {'stream_type': [STREAM_TYPES[stype] for stype in value]}})
elif key == 'any_languages':
query['must'].append({"terms": {'languages': clean_tags(value)}})
elif key == 'any_languages':
@@ -469,12 +539,12 @@ def expand_query(**kwargs):
if kwargs.get('has_channel_signature'):
query['must'].append({"exists": {"field": "signature_digest"}})
if 'signature_valid' in kwargs:
query['must'].append({"term": {"signature_valid": bool(kwargs["signature_valid"])}})
query['must'].append({"term": {"is_signature_valid": bool(kwargs["signature_valid"])}})
elif 'signature_valid' in kwargs:
query.setdefault('should', [])
query["minimum_should_match"] = 1
query['should'].append({"bool": {"must_not": {"exists": {"field": "signature_digest"}}}})
query['should'].append({"term": {"signature_valid": bool(kwargs["signature_valid"])}})
query['should'].append({"term": {"is_signature_valid": bool(kwargs["signature_valid"])}})
if 'has_source' in kwargs:
query.setdefault('should', [])
query["minimum_should_match"] = 1
@@ -482,6 +552,7 @@ def expand_query(**kwargs):
query['should'].append(
{"bool": {"must": [{"match": {"has_source": kwargs['has_source']}}, is_stream_or_repost]}})
query['should'].append({"bool": {"must_not": [is_stream_or_repost]}})
query['should'].append({"bool": {"must": [{"term": {"reposted_claim_type": CLAIM_TYPES['channel']}}]}})
if kwargs.get('text'):
query['must'].append(
{"simple_query_string":
@@ -539,8 +610,9 @@ def expand_result(results):
result['channel_hash'] = unhexlify(result['channel_id'])[::-1] if result['channel_id'] else None
result['txo_hash'] = unhexlify(result['tx_id'])[::-1] + struct.pack('<I', result['tx_nout'])
result['tx_hash'] = unhexlify(result['tx_id'])[::-1]
if result['censoring_channel_hash']:
result['censoring_channel_hash'] = unhexlify(result['censoring_channel_hash'])[::-1]
result['reposted'] = result.pop('repost_count')
result['signature_valid'] = result.pop('is_signature_valid')
result['normalized'] = result.pop('normalized_name')
expanded.append(result)
if inner_hits:
return expand_result(inner_hits)
+49 -37
View File
@@ -5,84 +5,96 @@ import os
from collections import namedtuple
from multiprocessing import Process
import apsw
import sqlite3
from elasticsearch import AsyncElasticsearch
from elasticsearch.helpers import async_bulk
from lbry.wallet.server.env import Env
from lbry.wallet.server.coin import LBC
from lbry.wallet.server.db.elasticsearch.search import extract_doc, SearchIndex
INDEX = 'claims'
from lbry.wallet.server.db.elasticsearch.search import extract_doc, SearchIndex, IndexVersionMismatch
async def get_all(db, shard_num, shards_total, limit=0):
async def get_all(db, shard_num, shards_total, limit=0, index_name='claims'):
logging.info("shard %d starting", shard_num)
def exec_factory(cursor, statement, bindings):
tpl = namedtuple('row', (d[0] for d in cursor.getdescription()))
cursor.setrowtrace(lambda cursor, row: tpl(*row))
return True
db.setexectrace(exec_factory)
def namedtuple_factory(cursor, row):
Row = namedtuple('Row', (d[0] for d in cursor.description))
return Row(*row)
db.row_factory = namedtuple_factory
total = db.execute(f"select count(*) as total from claim where height % {shards_total} = {shard_num};").fetchone()[0]
for num, claim in enumerate(db.execute(f"""
SELECT claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
(select cr.has_source from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_has_source,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash)
WHERE claim.height % {shards_total} = {shard_num}
ORDER BY claim.height desc
SELECT claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
cr.has_source as reposted_has_source,
cr.claim_type as reposted_claim_type,
cr.stream_type as reposted_stream_type,
cr.media_type as reposted_media_type,
cr.duration as reposted_duration,
cr.fee_amount as reposted_fee_amount,
cr.fee_currency as reposted_fee_currency,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash) LEFT JOIN claim cr ON cr.claim_hash=claim.reposted_claim_hash
WHERE claim.height % {shards_total} = {shard_num}
ORDER BY claim.height desc
""")):
claim = dict(claim._asdict())
claim['has_source'] = bool(claim.pop('reposted_has_source') or claim['has_source'])
claim['stream_type'] = claim.pop('reposted_stream_type') or claim['stream_type']
claim['media_type'] = claim.pop('reposted_media_type') or claim['media_type']
claim['fee_amount'] = claim.pop('reposted_fee_amount') or claim['fee_amount']
claim['fee_currency'] = claim.pop('reposted_fee_currency') or claim['fee_currency']
claim['duration'] = claim.pop('reposted_duration') or claim['duration']
claim['censor_type'] = 0
claim['censoring_channel_hash'] = None
claim['censoring_channel_id'] = None
claim['tags'] = claim['tags'].split(',,') if claim['tags'] else []
claim['languages'] = claim['languages'].split(' ') if claim['languages'] else []
if num % 10_000 == 0:
logging.info("%d/%d", num, total)
yield extract_doc(claim, INDEX)
yield extract_doc(claim, index_name)
if 0 < limit <= num:
break
async def consume(producer):
async def consume(producer, index_name):
env = Env(LBC)
logging.info("ES sync host: %s:%i", env.elastic_host, env.elastic_port)
es = AsyncElasticsearch([{'host': env.elastic_host, 'port': env.elastic_port}])
try:
await async_bulk(es, producer, request_timeout=120)
await es.indices.refresh(index=INDEX)
await es.indices.refresh(index=index_name)
finally:
await es.close()
async def make_es_index():
async def make_es_index(index=None):
env = Env(LBC)
index = SearchIndex('', elastic_host=env.elastic_host, elastic_port=env.elastic_port)
if index is None:
index = SearchIndex('', elastic_host=env.elastic_host, elastic_port=env.elastic_port)
try:
return await index.start()
except IndexVersionMismatch as err:
logging.info(
"dropping ES search index (version %s) for upgrade to version %s", err.got_version, err.expected_version
)
await index.delete_index()
await index.stop()
return await index.start()
finally:
index.stop()
async def run(args, shard):
def itsbusy(*_):
logging.info("shard %d: db is busy, retry", shard)
return True
db = apsw.Connection(args.db_path, flags=apsw.SQLITE_OPEN_READONLY | apsw.SQLITE_OPEN_URI)
db.setbusyhandler(itsbusy)
db.cursor().execute('pragma journal_mode=wal;')
db.cursor().execute('pragma temp_store=memory;')
producer = get_all(db.cursor(), shard, args.clients, limit=args.blocks)
await asyncio.gather(*(consume(producer) for _ in range(min(8, args.clients))))
async def run(db_path, clients, blocks, shard, index_name='claims'):
db = sqlite3.connect(db_path, isolation_level=None, check_same_thread=False, uri=True)
db.execute('pragma journal_mode=wal;')
db.execute('pragma temp_store=memory;')
producer = get_all(db, shard, clients, limit=blocks, index_name=index_name)
await asyncio.gather(*(consume(producer, index_name=index_name) for _ in range(min(8, clients))))
def __run(args, shard):
asyncio.run(run(args, shard))
asyncio.run(run(args.db_path, args.clients, args.blocks, shard))
def run_elastic_sync():
+1 -1
View File
@@ -231,7 +231,7 @@ def run(db, height, final_height, recalculate_claim_hashes):
FROM claim
WHERE claim_hash IN
({','.join('?' for _ in recalculate_claim_hashes)});
""", recalculate_claim_hashes):
""", list(recalculate_claim_hashes)):
trending_data.update_claim(row[0], 1E-8*row[1], time_boost)
trending_log("done.\n")
@@ -5,7 +5,7 @@ decay rate for high valued claims.
import math
import time
import apsw
import sqlite3
# Half life in blocks *for lower LBC claims* (it's shorter for whale claims)
HALF_LIFE = 200
@@ -96,16 +96,16 @@ class TrendingDB:
"""
def __init__(self):
self.conn = apsw.Connection(":memory:")
self.conn = sqlite3.connect(":memory:", check_same_thread=False)
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)
return self.conn.execute(query, *args, **kwargs)
def executemany(self, query, *args, **kwargs):
return self.cursor.executemany(query, *args, **kwargs)
return self.conn.executemany(query, *args, **kwargs)
def begin(self):
self.execute("BEGIN;")
@@ -251,7 +251,7 @@ class TrendingDB:
FROM claims
WHERE claim_hash IN
({','.join('?' for _ in self.write_needed)});
""", self.write_needed).fetchall()
""", list(self.write_needed)).fetchall()
db.executemany("""UPDATE claim SET trending_mixed = ?
WHERE claim_hash = ?;""", rows)
@@ -278,7 +278,7 @@ class TrendingDB:
FROM claim
WHERE claim_hash IN
({','.join('?' for _ in recalculate_claim_hashes)});
""", recalculate_claim_hashes):
""", list(recalculate_claim_hashes)):
claim_hash, lbc = row
# Insert into trending db if it does not exist
+2 -6
View File
@@ -47,14 +47,10 @@ class ZScore:
return self.last
return (self.last - self.mean) / (self.standard_deviation or 1)
@classmethod
def factory(cls):
return cls(), cls.step, cls.finalize
def install(connection):
connection.createaggregatefunction("zscore", ZScore.factory, 1)
connection.cursor().execute(CREATE_TREND_TABLE)
connection.create_aggregate("zscore", 1, ZScore)
connection.executescript(CREATE_TREND_TABLE)
def run(db, height, final_height, affected_claims):
+46 -42
View File
@@ -1,11 +1,10 @@
import os
import apsw
import sqlite3
from typing import Union, Tuple, Set, List
from itertools import chain
from decimal import Decimal
from collections import namedtuple
from multiprocessing import Manager
from binascii import unhexlify, hexlify
from lbry.wallet.server.leveldb import LevelDB
from lbry.wallet.server.util import class_logger
@@ -22,6 +21,7 @@ from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS, INDEXED_LANGUAGES
from lbry.wallet.server.db.elasticsearch import SearchIndex
ATTRIBUTE_ARRAY_MAX_LENGTH = 100
sqlite3.enable_callback_tracebacks(True)
class SQLDB:
@@ -220,7 +220,6 @@ class SQLDB:
self.db = None
self.logger = class_logger(__name__, self.__class__.__name__)
self.ledger = Ledger if main.coin.NET == 'mainnet' else RegTestLedger
self.state_manager = None
self.blocked_streams = None
self.blocked_channels = None
self.blocking_channel_hashes = {
@@ -235,27 +234,19 @@ class SQLDB:
self.pending_deletes = set()
def open(self):
self.db = apsw.Connection(
self._db_path,
flags=(
apsw.SQLITE_OPEN_READWRITE |
apsw.SQLITE_OPEN_CREATE |
apsw.SQLITE_OPEN_URI
)
)
def exec_factory(cursor, statement, bindings):
tpl = namedtuple('row', (d[0] for d in cursor.getdescription()))
cursor.setrowtrace(lambda cursor, row: tpl(*row))
return True
self.db.setexectrace(exec_factory)
self.execute(self.PRAGMAS)
self.execute(self.CREATE_TABLES_QUERY)
self.db = sqlite3.connect(self._db_path, isolation_level=None, check_same_thread=False, uri=True)
def namedtuple_factory(cursor, row):
Row = namedtuple('Row', (d[0] for d in cursor.description))
return Row(*row)
self.db.row_factory = namedtuple_factory
self.db.executescript(self.PRAGMAS)
self.db.executescript(self.CREATE_TABLES_QUERY)
register_canonical_functions(self.db)
self.state_manager = Manager()
self.blocked_streams = self.state_manager.dict()
self.blocked_channels = self.state_manager.dict()
self.filtered_streams = self.state_manager.dict()
self.filtered_channels = self.state_manager.dict()
self.blocked_streams = {}
self.blocked_channels = {}
self.filtered_streams = {}
self.filtered_channels = {}
self.update_blocked_and_filtered_claims()
for algorithm in self.trending:
algorithm.install(self.db)
@@ -263,8 +254,6 @@ class SQLDB:
def close(self):
if self.db is not None:
self.db.close()
if self.state_manager is not None:
self.state_manager.shutdown()
def update_blocked_and_filtered_claims(self):
self.update_claims_from_channel_hashes(
@@ -324,10 +313,10 @@ class SQLDB:
return f"DELETE FROM {table} WHERE {where}", values
def execute(self, *args):
return self.db.cursor().execute(*args)
return self.db.execute(*args)
def executemany(self, *args):
return self.db.cursor().executemany(*args)
return self.db.executemany(*args)
def begin(self):
self.execute('begin;')
@@ -406,7 +395,8 @@ class SQLDB:
if isinstance(fee.currency, str):
claim_record['fee_currency'] = fee.currency.lower()
if isinstance(fee.amount, Decimal):
claim_record['fee_amount'] = int(fee.amount*1000)
if fee.amount >= 0 and int(fee.amount*1000) < 9223372036854775807:
claim_record['fee_amount'] = int(fee.amount*1000)
elif claim.is_repost:
claim_record['claim_type'] = CLAIM_TYPES['repost']
claim_record['reposted_claim_hash'] = claim.repost.reference.claim_hash
@@ -624,7 +614,7 @@ class SQLDB:
channel_hash IN ({','.join('?' for _ in changed_channel_keys)}) AND
signature IS NOT NULL
"""
for affected_claim in self.execute(sql, changed_channel_keys.keys()):
for affected_claim in self.execute(sql, list(changed_channel_keys.keys())):
if affected_claim.claim_hash not in signables:
claim_updates.append({
'claim_hash': affected_claim.claim_hash,
@@ -681,7 +671,7 @@ class SQLDB:
signature_valid=CASE WHEN signature IS NOT NULL THEN 0 END,
channel_join=NULL, canonical_url=NULL
WHERE channel_hash IN ({','.join('?' for _ in spent_claims)})
""", spent_claims
""", list(spent_claims)
)
sub_timer.stop()
@@ -806,12 +796,13 @@ class SQLDB:
def update_claimtrie(self, height, changed_claim_hashes, deleted_names, timer):
r = timer.run
binary_claim_hashes = list(changed_claim_hashes)
r(self._calculate_activation_height, height)
r(self._update_support_amount, changed_claim_hashes)
r(self._update_support_amount, binary_claim_hashes)
r(self._update_effective_amount, height, changed_claim_hashes)
r(self._perform_overtake, height, changed_claim_hashes, list(deleted_names))
r(self._update_effective_amount, height, binary_claim_hashes)
r(self._perform_overtake, height, binary_claim_hashes, list(deleted_names))
r(self._update_effective_amount, height)
r(self._perform_overtake, height, [], [])
@@ -822,34 +813,47 @@ class SQLDB:
)
def enqueue_changes(self):
for claim in self.execute(f"""
query = """
SELECT claimtrie.claim_hash as is_controlling,
claimtrie.last_take_over_height,
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
(select cr.has_source from claim cr where cr.claim_hash = claim.reposted_claim_hash) as reposted_has_source,
cr.has_source as reposted_has_source,
cr.claim_type as reposted_claim_type,
cr.stream_type as reposted_stream_type,
cr.media_type as reposted_media_type,
cr.duration as reposted_duration,
cr.fee_amount as reposted_fee_amount,
cr.fee_currency as reposted_fee_currency,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash)
FROM claim LEFT JOIN claimtrie USING (claim_hash) LEFT JOIN claim cr ON cr.claim_hash=claim.reposted_claim_hash
WHERE claim.claim_hash in (SELECT claim_hash FROM changelog)
"""):
"""
for claim in self.execute(query):
claim = claim._asdict()
id_set = set(filter(None, (claim['claim_hash'], claim['channel_hash'], claim['reposted_claim_hash'])))
claim['censor_type'] = 0
claim['censoring_channel_hash'] = None
censoring_channel_hash = None
claim['has_source'] = bool(claim.pop('reposted_has_source') or claim['has_source'])
claim['stream_type'] = claim.pop('reposted_stream_type') or claim['stream_type']
claim['media_type'] = claim.pop('reposted_media_type') or claim['media_type']
claim['fee_amount'] = claim.pop('reposted_fee_amount') or claim['fee_amount']
claim['fee_currency'] = claim.pop('reposted_fee_currency') or claim['fee_currency']
claim['duration'] = claim.pop('reposted_duration') or claim['duration']
for reason_id in id_set:
if reason_id in self.blocked_streams:
claim['censor_type'] = 2
claim['censoring_channel_hash'] = self.blocked_streams.get(reason_id)
censoring_channel_hash = self.blocked_streams.get(reason_id)
elif reason_id in self.blocked_channels:
claim['censor_type'] = 2
claim['censoring_channel_hash'] = self.blocked_channels.get(reason_id)
censoring_channel_hash = self.blocked_channels.get(reason_id)
elif reason_id in self.filtered_streams:
claim['censor_type'] = 1
claim['censoring_channel_hash'] = self.filtered_streams.get(reason_id)
censoring_channel_hash = self.filtered_streams.get(reason_id)
elif reason_id in self.filtered_channels:
claim['censor_type'] = 1
claim['censoring_channel_hash'] = self.filtered_channels.get(reason_id)
censoring_channel_hash = self.filtered_channels.get(reason_id)
claim['censoring_channel_id'] = censoring_channel_hash[::-1].hex() if censoring_channel_hash else None
claim['tags'] = claim['tags'].split(',,') if claim['tags'] else []
claim['languages'] = claim['languages'].split(' ') if claim['languages'] else []
+6
View File
@@ -73,9 +73,12 @@ class Env:
self.tor_banner_file = self.default('TOR_BANNER_FILE', self.banner_file)
self.anon_logs = self.boolean('ANON_LOGS', False)
self.log_sessions = self.integer('LOG_SESSIONS', 3600)
self.allow_lan_udp = self.boolean('ALLOW_LAN_UDP', False)
self.country = self.default('COUNTRY', 'US')
# Peer discovery
self.peer_discovery = self.peer_discovery_enum()
self.peer_announce = self.boolean('PEER_ANNOUNCE', True)
self.peer_hubs = self.extract_peer_hubs()
self.force_proxy = self.boolean('FORCE_PROXY', False)
self.tor_proxy_host = self.default('TOR_PROXY_HOST', 'localhost')
self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None)
@@ -268,3 +271,6 @@ class Env:
return self.PD_SELF
else:
return self.PD_ON
def extract_peer_hubs(self):
return [hub.strip() for hub in self.default('PEER_HUBS', '').split(',') if hub.strip()]
+32 -7
View File
@@ -16,13 +16,13 @@ from collections import defaultdict
from functools import partial
from lbry.wallet.server import util
from lbry.wallet.server.util import pack_be_uint16, unpack_be_uint16_from
from lbry.wallet.server.util import pack_be_uint32, unpack_be_uint32_from, unpack_be_uint16_from
from lbry.wallet.server.hash import hash_to_hex_str, HASHX_LEN
class History:
DB_VERSIONS = [0]
DB_VERSIONS = [0, 1]
def __init__(self):
self.logger = util.class_logger(__name__, self.__class__.__name__)
@@ -32,9 +32,34 @@ class History:
self.unflushed_count = 0
self.db = None
@property
def needs_migration(self):
return self.db_version != max(self.DB_VERSIONS)
def migrate(self):
# 0 -> 1: flush_count from 16 to 32 bits
self.logger.warning("HISTORY MIGRATION IN PROGRESS. Please avoid shutting down before it finishes.")
with self.db.write_batch() as batch:
for key, value in self.db.iterator(prefix=b''):
if len(key) != 13:
continue
flush_id, = unpack_be_uint16_from(key[-2:])
new_key = key[:-2] + pack_be_uint32(flush_id)
batch.put(new_key, value)
self.logger.warning("history migration: new keys added, removing old ones.")
for key, value in self.db.iterator(prefix=b''):
if len(key) == 13:
batch.delete(key)
self.logger.warning("history migration: writing new state.")
self.db_version = 1
self.write_state(batch)
self.logger.warning("history migration: done.")
def open_db(self, db_class, for_sync, utxo_flush_count, compacting):
self.db = db_class('hist', for_sync)
self.read_state()
if self.needs_migration:
self.migrate()
self.clear_excess(utxo_flush_count)
# An incomplete compaction needs to be cancelled otherwise
# restarting it will corrupt the history
@@ -81,7 +106,7 @@ class History:
keys = []
for key, hist in self.db.iterator(prefix=b''):
flush_id, = unpack_be_uint16_from(key[-2:])
flush_id, = unpack_be_uint32_from(key[-4:])
if flush_id > utxo_flush_count:
keys.append(key)
@@ -126,7 +151,7 @@ class History:
def flush(self):
start_time = time.time()
self.flush_count += 1
flush_id = pack_be_uint16(self.flush_count)
flush_id = pack_be_uint32(self.flush_count)
unflushed = self.unflushed
with self.db.write_batch() as batch:
@@ -250,7 +275,7 @@ class History:
write_size = 0
keys_to_delete.update(hist_map)
for n, chunk in enumerate(util.chunks(full_hist, max_row_size)):
key = hashX + pack_be_uint16(n)
key = hashX + pack_be_uint32(n)
if hist_map.get(key) == chunk:
keys_to_delete.remove(key)
else:
@@ -301,8 +326,8 @@ class History:
# Loop over 2-byte prefixes
cursor = self.comp_cursor
while write_size < limit and cursor < 65536:
prefix = pack_be_uint16(cursor)
while write_size < limit and cursor < (1 << 32):
prefix = pack_be_uint32(cursor)
write_size += self._compact_prefix(prefix, write_items,
keys_to_delete)
cursor += 1
-302
View File
@@ -1,302 +0,0 @@
# Copyright (c) 2017, Neil Booth
#
# All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Representation of a peer server."""
from ipaddress import ip_address
from lbry.wallet.server import util
from lbry.wallet.server.util import cachedproperty
from typing import Dict
class Peer:
# Protocol version
ATTRS = ('host', 'features',
# metadata
'source', 'ip_addr',
'last_good', 'last_try', 'try_count')
FEATURES = ('pruning', 'server_version', 'protocol_min', 'protocol_max',
'ssl_port', 'tcp_port')
# This should be set by the application
DEFAULT_PORTS: Dict[str, int] = {}
def __init__(self, host, features, source='unknown', ip_addr=None,
last_good=0, last_try=0, try_count=0):
"""Create a peer given a host name (or IP address as a string),
a dictionary of features, and a record of the source."""
assert isinstance(host, str)
assert isinstance(features, dict)
assert host in features.get('hosts', {})
self.host = host
self.features = features.copy()
# Canonicalize / clean-up
for feature in self.FEATURES:
self.features[feature] = getattr(self, feature)
# Metadata
self.source = source
self.ip_addr = ip_addr
# last_good represents the last connection that was
# successful *and* successfully verified, at which point
# try_count is set to 0. Failure to connect or failure to
# verify increment the try_count.
self.last_good = last_good
self.last_try = last_try
self.try_count = try_count
# Transient, non-persisted metadata
self.bad = False
self.other_port_pairs = set()
self.status = 2
@classmethod
def peers_from_features(cls, features, source):
peers = []
if isinstance(features, dict):
hosts = features.get('hosts')
if isinstance(hosts, dict):
peers = [Peer(host, features, source=source)
for host in hosts if isinstance(host, str)]
return peers
@classmethod
def deserialize(cls, item):
"""Deserialize from a dictionary."""
return cls(**item)
def matches(self, peers):
"""Return peers whose host matches our hostname or IP address.
Additionally include all peers whose IP address matches our
hostname if that is an IP address.
"""
candidates = (self.host.lower(), self.ip_addr)
return [peer for peer in peers
if peer.host.lower() in candidates
or peer.ip_addr == self.host]
def __str__(self):
return self.host
def update_features(self, features):
"""Update features in-place."""
try:
tmp = Peer(self.host, features)
except Exception:
pass
else:
self.update_features_from_peer(tmp)
def update_features_from_peer(self, peer):
if peer != self:
self.features = peer.features
for feature in self.FEATURES:
setattr(self, feature, getattr(peer, feature))
def connection_port_pairs(self):
"""Return a list of (kind, port) pairs to try when making a
connection."""
# Use a list not a set - it's important to try the registered
# ports first.
pairs = [('SSL', self.ssl_port), ('TCP', self.tcp_port)]
while self.other_port_pairs:
pairs.append(self.other_port_pairs.pop())
return [pair for pair in pairs if pair[1]]
def mark_bad(self):
"""Mark as bad to avoid reconnects but also to remember for a
while."""
self.bad = True
def check_ports(self, other):
"""Remember differing ports in case server operator changed them
or removed one."""
if other.ssl_port != self.ssl_port:
self.other_port_pairs.add(('SSL', other.ssl_port))
if other.tcp_port != self.tcp_port:
self.other_port_pairs.add(('TCP', other.tcp_port))
return bool(self.other_port_pairs)
@cachedproperty
def is_tor(self):
return self.host.endswith('.onion')
@cachedproperty
def is_valid(self):
ip = self.ip_address
if ip:
return ((ip.is_global or ip.is_private)
and not (ip.is_multicast or ip.is_unspecified))
return util.is_valid_hostname(self.host)
@cachedproperty
def is_public(self):
ip = self.ip_address
if ip:
return self.is_valid and not ip.is_private
else:
return self.is_valid and self.host != 'localhost'
@cachedproperty
def ip_address(self):
"""The host as a python ip_address object, or None."""
try:
return ip_address(self.host)
except ValueError:
return None
def bucket(self):
if self.is_tor:
return 'onion'
if not self.ip_addr:
return ''
return tuple(self.ip_addr.split('.')[:2])
def serialize(self):
"""Serialize to a dictionary."""
return {attr: getattr(self, attr) for attr in self.ATTRS}
def _port(self, key):
hosts = self.features.get('hosts')
if isinstance(hosts, dict):
host = hosts.get(self.host)
port = self._integer(key, host)
if port and 0 < port < 65536:
return port
return None
def _integer(self, key, d=None):
d = d or self.features
result = d.get(key) if isinstance(d, dict) else None
if isinstance(result, str):
try:
result = int(result)
except ValueError:
pass
return result if isinstance(result, int) else None
def _string(self, key):
result = self.features.get(key)
return result if isinstance(result, str) else None
@cachedproperty
def genesis_hash(self):
"""Returns None if no SSL port, otherwise the port as an integer."""
return self._string('genesis_hash')
@cachedproperty
def ssl_port(self):
"""Returns None if no SSL port, otherwise the port as an integer."""
return self._port('ssl_port')
@cachedproperty
def tcp_port(self):
"""Returns None if no TCP port, otherwise the port as an integer."""
return self._port('tcp_port')
@cachedproperty
def server_version(self):
"""Returns the server version as a string if known, otherwise None."""
return self._string('server_version')
@cachedproperty
def pruning(self):
"""Returns the pruning level as an integer. None indicates no
pruning."""
pruning = self._integer('pruning')
if pruning and pruning > 0:
return pruning
return None
def _protocol_version_string(self, key):
version_str = self.features.get(key)
ptuple = util.protocol_tuple(version_str)
return util.version_string(ptuple)
@cachedproperty
def protocol_min(self):
"""Minimum protocol version as a string, e.g., 1.0"""
return self._protocol_version_string('protocol_min')
@cachedproperty
def protocol_max(self):
"""Maximum protocol version as a string, e.g., 1.1"""
return self._protocol_version_string('protocol_max')
def to_tuple(self):
"""The tuple ((ip, host, details) expected in response
to a peers subscription."""
details = self.real_name().split()[1:]
return (self.ip_addr or self.host, self.host, details)
def real_name(self):
"""Real name of this peer as used on IRC."""
def port_text(letter, port):
if port == self.DEFAULT_PORTS.get(letter):
return letter
else:
return letter + str(port)
parts = [self.host, 'v' + self.protocol_max]
if self.pruning:
parts.append(f'p{self.pruning:d}')
for letter, port in (('s', self.ssl_port), ('t', self.tcp_port)):
if port:
parts.append(port_text(letter, port))
return ' '.join(parts)
@classmethod
def from_real_name(cls, real_name, source):
"""Real name is a real name as on IRC, such as
"erbium1.sytes.net v1.0 s t"
Returns an instance of this Peer class.
"""
host = 'nohost'
features = {}
ports = {}
for n, part in enumerate(real_name.split()):
if n == 0:
host = part
continue
if part[0] in ('s', 't'):
if len(part) == 1:
port = cls.DEFAULT_PORTS[part[0]]
else:
port = part[1:]
if part[0] == 's':
ports['ssl_port'] = port
else:
ports['tcp_port'] = port
elif part[0] == 'v':
features['protocol_max'] = features['protocol_min'] = part[1:]
elif part[0] == 'p':
features['pruning'] = part[1:]
features.update(ports)
features['hosts'] = {host: ports}
return cls(host, features, source)
-506
View File
@@ -1,506 +0,0 @@
# Copyright (c) 2017-2018, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
"""Peer management."""
import asyncio
import random
import socket
import ssl
import time
import typing
from asyncio import Event, sleep
from collections import defaultdict, Counter
from lbry.wallet.tasks import TaskGroup
from lbry.wallet.rpc import (
Connector, RPCSession, SOCKSProxy, Notification, handler_invocation,
SOCKSError, RPCError
)
from lbry.wallet.server.peer import Peer
from lbry.wallet.server.util import class_logger, protocol_tuple
PEER_GOOD, PEER_STALE, PEER_NEVER, PEER_BAD = range(4)
STALE_SECS = 24 * 3600
WAKEUP_SECS = 300
class BadPeerError(Exception):
pass
def assert_good(message, result, instance):
if not isinstance(result, instance):
raise BadPeerError(f'{message} returned bad result type '
f'{type(result).__name__}')
class PeerSession(RPCSession):
"""An outgoing session to a peer."""
async def handle_request(self, request):
# We subscribe so might be unlucky enough to get a notification...
if (isinstance(request, Notification) and
request.method == 'blockchain.headers.subscribe'):
pass
else:
await handler_invocation(None, request) # Raises
class PeerManager:
"""Looks after the DB of peer network servers.
Attempts to maintain a connection with up to 8 peers.
Issues a 'peers.subscribe' RPC to them and tells them our data.
"""
def __init__(self, env, db):
self.logger = class_logger(__name__, self.__class__.__name__)
# Initialise the Peer class
Peer.DEFAULT_PORTS = env.coin.PEER_DEFAULT_PORTS
self.env = env
self.db = db
# Our clearnet and Tor Peers, if any
sclass = env.coin.SESSIONCLS
self.myselves = [Peer(ident.host, sclass.server_features(env), 'env')
for ident in env.identities]
self.server_version_args = sclass.server_version_args()
# Peers have one entry per hostname. Once connected, the
# ip_addr property is either None, an onion peer, or the
# IP address that was connected to. Adding a peer will evict
# any other peers with the same host name or IP address.
self.peers: typing.Set[Peer] = set()
self.permit_onion_peer_time = time.time()
self.proxy = None
self.group = TaskGroup()
def _my_clearnet_peer(self):
"""Returns the clearnet peer representing this server, if any."""
clearnet = [peer for peer in self.myselves if not peer.is_tor]
return clearnet[0] if clearnet else None
def _set_peer_statuses(self):
"""Set peer statuses."""
cutoff = time.time() - STALE_SECS
for peer in self.peers:
if peer.bad:
peer.status = PEER_BAD
elif peer.last_good > cutoff:
peer.status = PEER_GOOD
elif peer.last_good:
peer.status = PEER_STALE
else:
peer.status = PEER_NEVER
def _features_to_register(self, peer, remote_peers):
"""If we should register ourselves to the remote peer, which has
reported the given list of known peers, return the clearnet
identity features to register, otherwise None.
"""
# Announce ourself if not present. Don't if disabled, we
# are a non-public IP address, or to ourselves.
if not self.env.peer_announce or peer in self.myselves:
return None
my = self._my_clearnet_peer()
if not my or not my.is_public:
return None
# Register if no matches, or ports have changed
for peer in my.matches(remote_peers):
if peer.tcp_port == my.tcp_port and peer.ssl_port == my.ssl_port:
return None
return my.features
def _permit_new_onion_peer(self):
"""Accept a new onion peer only once per random time interval."""
now = time.time()
if now < self.permit_onion_peer_time:
return False
self.permit_onion_peer_time = now + random.randrange(0, 1200)
return True
async def _import_peers(self):
"""Import hard-coded peers from a file or the coin defaults."""
imported_peers = self.myselves.copy()
# Add the hard-coded ones unless only reporting ourself
if self.env.peer_discovery != self.env.PD_SELF:
imported_peers.extend(Peer.from_real_name(real_name, 'coins.py')
for real_name in self.env.coin.PEERS)
await self._note_peers(imported_peers, limit=None)
async def _detect_proxy(self):
"""Detect a proxy if we don't have one and some time has passed since
the last attempt.
If found self.proxy is set to a SOCKSProxy instance, otherwise
None.
"""
host = self.env.tor_proxy_host
if self.env.tor_proxy_port is None:
ports = [9050, 9150, 1080]
else:
ports = [self.env.tor_proxy_port]
while True:
self.logger.info(f'trying to detect proxy on "{host}" '
f'ports {ports}')
proxy = await SOCKSProxy.auto_detect_host(host, ports, None)
if proxy:
self.proxy = proxy
self.logger.info(f'detected {proxy}')
return
self.logger.info('no proxy detected, will try later')
await sleep(900)
async def _note_peers(self, peers, limit=2, check_ports=False,
source=None):
"""Add a limited number of peers that are not already present."""
new_peers = []
for peer in peers:
if not peer.is_public or (peer.is_tor and not self.proxy):
continue
matches = peer.matches(self.peers)
if not matches:
new_peers.append(peer)
elif check_ports:
for match in matches:
if match.check_ports(peer):
self.logger.info(f'ports changed for {peer}')
match.retry_event.set()
if new_peers:
source = source or new_peers[0].source
if limit:
random.shuffle(new_peers)
use_peers = new_peers[:limit]
else:
use_peers = new_peers
for peer in use_peers:
self.logger.info(f'accepted new peer {peer} from {source}')
peer.retry_event = Event()
self.peers.add(peer)
await self.group.add(self._monitor_peer(peer))
async def _monitor_peer(self, peer):
# Stop monitoring if we were dropped (a duplicate peer)
while peer in self.peers:
if await self._should_drop_peer(peer):
self.peers.discard(peer)
break
# Figure out how long to sleep before retrying. Retry a
# good connection when it is about to turn stale, otherwise
# exponentially back off retries.
if peer.try_count == 0:
pause = STALE_SECS - WAKEUP_SECS * 2
else:
pause = WAKEUP_SECS * 2 ** peer.try_count
pending, done = await asyncio.wait([peer.retry_event.wait()], timeout=pause)
if done:
peer.retry_event.clear()
async def _should_drop_peer(self, peer):
peer.try_count += 1
is_good = False
for kind, port in peer.connection_port_pairs():
peer.last_try = time.time()
kwargs = {}
if kind == 'SSL':
kwargs['ssl'] = ssl.SSLContext(ssl.PROTOCOL_TLS)
host = self.env.cs_host(for_rpc=False)
if isinstance(host, list):
host = host[0]
if self.env.force_proxy or peer.is_tor:
if not self.proxy:
return
kwargs['proxy'] = self.proxy
kwargs['resolve'] = not peer.is_tor
elif host:
# Use our listening Host/IP for outgoing non-proxy
# connections so our peers see the correct source.
kwargs['local_addr'] = (host, None)
peer_text = f'[{peer}:{port} {kind}]'
try:
async with Connector(PeerSession, peer.host, port,
**kwargs) as session:
await asyncio.wait_for(
self._verify_peer(session, peer),
120 if peer.is_tor else 30
)
is_good = True
break
except BadPeerError as e:
self.logger.error(f'{peer_text} marking bad: ({e})')
peer.mark_bad()
break
except RPCError as e:
self.logger.error(f'{peer_text} RPC error: {e.message} '
f'({e.code})')
except (OSError, SOCKSError, ConnectionError, asyncio.TimeoutError) as e:
self.logger.info(f'{peer_text} {e}')
if is_good:
now = time.time()
elapsed = now - peer.last_try
self.logger.info(f'{peer_text} verified in {elapsed:.1f}s')
peer.try_count = 0
peer.last_good = now
peer.source = 'peer'
# At most 2 matches if we're a host name, potentially
# several if we're an IP address (several instances
# can share a NAT).
matches = peer.matches(self.peers)
for match in matches:
if match.ip_address:
if len(matches) > 1:
self.peers.remove(match)
# Force the peer's monitoring task to exit
match.retry_event.set()
elif peer.host in match.features['hosts']:
match.update_features_from_peer(peer)
else:
# Forget the peer if long-term unreachable
if peer.last_good and not peer.bad:
try_limit = 10
else:
try_limit = 3
if peer.try_count >= try_limit:
desc = 'bad' if peer.bad else 'unreachable'
self.logger.info(f'forgetting {desc} peer: {peer}')
return True
return False
async def _verify_peer(self, session, peer):
if not peer.is_tor:
address = session.peer_address()
if address:
peer.ip_addr = address[0]
# server.version goes first
message = 'server.version'
result = await session.send_request(message, self.server_version_args)
assert_good(message, result, list)
# Protocol version 1.1 returns a pair with the version first
if len(result) != 2 or not all(isinstance(x, str) for x in result):
raise BadPeerError(f'bad server.version result: {result}')
server_version, protocol_version = result
peer.server_version = server_version
peer.features['server_version'] = server_version
ptuple = protocol_tuple(protocol_version)
await asyncio.wait([
self._send_headers_subscribe(session, peer, ptuple),
self._send_server_features(session, peer),
self._send_peers_subscribe(session, peer)
])
async def _send_headers_subscribe(self, session, peer, ptuple):
message = 'blockchain.headers.subscribe'
result = await session.send_request(message)
assert_good(message, result, dict)
our_height = self.db.db_height
if ptuple < (1, 3):
their_height = result.get('block_height')
else:
their_height = result.get('height')
if not isinstance(their_height, int):
raise BadPeerError(f'invalid height {their_height}')
if abs(our_height - their_height) > 5:
raise BadPeerError(f'bad height {their_height:,d} '
f'(ours: {our_height:,d})')
# Check prior header too in case of hard fork.
check_height = min(our_height, their_height)
raw_header = self.db.raw_header(check_height)
if ptuple >= (1, 4):
ours = raw_header.hex()
message = 'blockchain.block.header'
theirs = await session.send_request(message, [check_height])
assert_good(message, theirs, str)
if ours != theirs:
raise BadPeerError(f'our header {ours} and '
f'theirs {theirs} differ')
else:
ours = self.env.coin.electrum_header(raw_header, check_height)
ours = ours.get('prev_block_hash')
message = 'blockchain.block.get_header'
theirs = await session.send_request(message, [check_height])
assert_good(message, theirs, dict)
theirs = theirs.get('prev_block_hash')
if ours != theirs:
raise BadPeerError(f'our header hash {ours} and '
f'theirs {theirs} differ')
async def _send_server_features(self, session, peer):
message = 'server.features'
features = await session.send_request(message)
assert_good(message, features, dict)
hosts = [host.lower() for host in features.get('hosts', {})]
if self.env.coin.GENESIS_HASH != features.get('genesis_hash'):
raise BadPeerError('incorrect genesis hash')
elif peer.host.lower() in hosts:
peer.update_features(features)
else:
raise BadPeerError(f'not listed in own hosts list {hosts}')
async def _send_peers_subscribe(self, session, peer):
message = 'server.peers.subscribe'
raw_peers = await session.send_request(message)
assert_good(message, raw_peers, list)
# Check the peers list we got from a remote peer.
# Each is expected to be of the form:
# [ip_addr, hostname, ['v1.0', 't51001', 's51002']]
# Call add_peer if the remote doesn't appear to know about us.
try:
real_names = [' '.join([u[1]] + u[2]) for u in raw_peers]
peers = [Peer.from_real_name(real_name, str(peer))
for real_name in real_names]
except Exception:
raise BadPeerError('bad server.peers.subscribe response')
await self._note_peers(peers)
features = self._features_to_register(peer, peers)
if not features:
return
self.logger.info(f'registering ourself with {peer}')
# We only care to wait for the response
await session.send_request('server.add_peer', [features])
#
# External interface
#
async def discover_peers(self):
"""Perform peer maintenance. This includes
1) Forgetting unreachable peers.
2) Verifying connectivity of new peers.
3) Retrying old peers at regular intervals.
"""
if self.env.peer_discovery != self.env.PD_ON:
self.logger.info('peer discovery is disabled')
return
self.logger.info(f'beginning peer discovery. Force use of '
f'proxy: {self.env.force_proxy}')
self.group.add(self._detect_proxy())
self.group.add(self._import_peers())
def info(self) -> typing.Dict[str, int]:
"""The number of peers."""
self._set_peer_statuses()
counter = Counter(peer.status for peer in self.peers)
return {
'bad': counter[PEER_BAD],
'good': counter[PEER_GOOD],
'never': counter[PEER_NEVER],
'stale': counter[PEER_STALE],
'total': len(self.peers),
}
async def add_localRPC_peer(self, real_name):
"""Add a peer passed by the admin over LocalRPC."""
await self._note_peers([Peer.from_real_name(real_name, 'RPC')])
async def on_add_peer(self, features, source_info):
"""Add a peer (but only if the peer resolves to the source)."""
if not source_info:
self.logger.info('ignored add_peer request: no source info')
return False
source = source_info[0]
peers = Peer.peers_from_features(features, source)
if not peers:
self.logger.info('ignored add_peer request: no peers given')
return False
# Just look at the first peer, require it
peer = peers[0]
host = peer.host
if peer.is_tor:
permit = self._permit_new_onion_peer()
reason = 'rate limiting'
else:
getaddrinfo = asyncio.get_event_loop().getaddrinfo
try:
infos = await getaddrinfo(host, 80, type=socket.SOCK_STREAM)
except socket.gaierror:
permit = False
reason = 'address resolution failure'
else:
permit = any(source == info[-1][0] for info in infos)
reason = 'source-destination mismatch'
if permit:
self.logger.info(f'accepted add_peer request from {source} '
f'for {host}')
await self._note_peers([peer], check_ports=True)
else:
self.logger.warning(f'rejected add_peer request from {source} '
f'for {host} ({reason})')
return permit
def on_peers_subscribe(self, is_tor):
"""Returns the server peers as a list of (ip, host, details) tuples.
We return all peers we've connected to in the last day.
Additionally, if we don't have onion routing, we return a few
hard-coded onion servers.
"""
cutoff = time.time() - STALE_SECS
recent = [peer for peer in self.peers
if peer.last_good > cutoff and
not peer.bad and peer.is_public]
onion_peers = []
# Always report ourselves if valid (even if not public)
peers = {myself for myself in self.myselves
if myself.last_good > cutoff}
# Bucket the clearnet peers and select up to two from each
buckets = defaultdict(list)
for peer in recent:
if peer.is_tor:
onion_peers.append(peer)
else:
buckets[peer.bucket()].append(peer)
for bucket_peers in buckets.values():
random.shuffle(bucket_peers)
peers.update(bucket_peers[:2])
# Add up to 20% onion peers (but up to 10 is OK anyway)
random.shuffle(onion_peers)
max_onion = 50 if is_tor else max(10, len(peers) // 4)
peers.update(onion_peers[:max_onion])
return [peer.to_tuple() for peer in peers]
def proxy_peername(self):
"""Return the peername of the proxy, if there is a proxy, otherwise
None."""
return self.proxy.peername if self.proxy else None
def rpc_data(self):
"""Peer data for the peers RPC method."""
self._set_peer_statuses()
descs = ['good', 'stale', 'never', 'bad']
def peer_data(peer):
data = peer.serialize()
data['status'] = descs[peer.status]
return data
def peer_key(peer):
return (peer.bad, -peer.last_good)
return [peer_data(peer) for peer in sorted(self.peers, key=peer_key)]
+2 -2
View File
@@ -114,8 +114,8 @@ class Server:
await self.start_prometheus()
if self.env.udp_port:
await self.bp.status_server.start(
0, bytes.fromhex(self.bp.coin.GENESIS_HASH)[::-1],
self.env.host, self.env.udp_port
0, bytes.fromhex(self.bp.coin.GENESIS_HASH)[::-1], self.env.country,
self.env.host, self.env.udp_port, self.env.allow_lan_udp
)
await _start_cancellable(self.bp.fetch_and_process_blocks)
+26 -18
View File
@@ -15,14 +15,13 @@ from asyncio import Event, sleep
from collections import defaultdict
from functools import partial
from binascii import hexlify
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from elasticsearch import ConnectionTimeout
from prometheus_client import Counter, Info, Histogram, Gauge
import lbry
from lbry.utils import LRUCacheWithMetrics
from lbry.error import TooManyClaimSearchParametersError
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
@@ -39,7 +38,6 @@ from lbry.wallet.server import text
from lbry.wallet.server import util
from lbry.wallet.server.hash import sha256, hash_to_hex_str, hex_str_to_hash, HASHX_LEN, Base58Error
from lbry.wallet.server.daemon import DaemonError
from lbry.wallet.server.peers import PeerManager
if typing.TYPE_CHECKING:
from lbry.wallet.server.env import Env
from lbry.wallet.server.mempool import MemPool
@@ -185,7 +183,6 @@ class SessionManager:
self.bp = bp
self.daemon = daemon
self.mempool = mempool
self.peer_mgr = PeerManager(env, db)
self.shutdown_event = shutdown_event
self.logger = util.class_logger(__name__, self.__class__.__name__)
self.servers: typing.Dict[str, asyncio.AbstractServer] = {}
@@ -209,7 +206,7 @@ class SessionManager:
else:
protocol_class = self.env.coin.SESSIONCLS
protocol_factory = partial(protocol_class, self, self.db,
self.mempool, self.peer_mgr, kind)
self.mempool, kind)
host, port = args[:2]
try:
@@ -369,7 +366,7 @@ class SessionManager:
'logged': logged,
'paused': paused,
'pid': os.getpid(),
'peers': self.peer_mgr.info(),
'peers': [],
'requests': pending_requests,
'method_counts': method_counts,
'sessions': self.session_count(),
@@ -436,7 +433,7 @@ class SessionManager:
real_name: "bch.electrumx.cash t50001 s50002" for example
"""
await self.peer_mgr.add_localRPC_peer(real_name)
await self._notify_peer(real_name)
return f"peer '{real_name}' added"
async def rpc_disconnect(self, session_ids):
@@ -487,7 +484,7 @@ class SessionManager:
async def rpc_peers(self):
"""Return a list of data about server peers."""
return self.peer_mgr.rpc_data()
return self.env.peer_hubs
async def rpc_query(self, items, limit):
"""Return a list of data about server peers."""
@@ -578,7 +575,6 @@ class SessionManager:
# Peer discovery should start after the external servers
# because we connect to ourself
await asyncio.wait([
self.peer_mgr.discover_peers(),
self._clear_stale_sessions(),
self._log_sessions(),
self._manage_servers()
@@ -638,6 +634,15 @@ class SessionManager:
self.history_cache[hashX] = await self.db.limited_history(hashX, limit=limit)
return self.history_cache[hashX]
def _notify_peer(self, peer):
notify_tasks = [
session.send_notification('blockchain.peers.subscribe', [peer])
for session in self.sessions.values() if session.subscribe_peers
]
if notify_tasks:
self.logger.info(f'notify {len(notify_tasks)} sessions of new peers')
asyncio.create_task(asyncio.wait(notify_tasks))
async def _notify_sessions(self, height, touched, new_touched):
"""Notify sessions about height changes and touched addresses."""
height_changed = height != self.notified_height
@@ -704,7 +709,7 @@ class SessionBase(RPCSession):
request_handlers: typing.Dict[str, typing.Callable] = {}
version = '0.5.7'
def __init__(self, session_mgr, db, mempool, peer_mgr, kind):
def __init__(self, session_mgr, db, mempool, kind):
connection = JSONRPCConnection(JSONRPCAutoDetect)
self.env = session_mgr.env
super().__init__(connection=connection)
@@ -712,7 +717,6 @@ class SessionBase(RPCSession):
self.session_mgr = session_mgr
self.db = db
self.mempool = mempool
self.peer_mgr = peer_mgr
self.kind = kind # 'RPC', 'TCP' etc.
self.coin = self.env.coin
self.anon_logs = self.env.anon_logs
@@ -904,6 +908,7 @@ class LBRYElectrumX(SessionBase):
LBRYElectrumX.set_server_features(self.env)
self.subscribe_headers = False
self.subscribe_headers_raw = False
self.subscribe_peers = False
self.connection.max_response_size = self.env.max_send
self.hashX_subs = {}
self.sv_seen = False
@@ -1022,7 +1027,13 @@ class LBRYElectrumX(SessionBase):
async def claimtrie_search(self, **kwargs):
if kwargs:
return await self.run_and_cache_query('search', kwargs)
try:
return await self.run_and_cache_query('search', kwargs)
except TooManyClaimSearchParametersError as err:
await asyncio.sleep(2)
self.logger.warning("Got an invalid query from %s, for %s with more than %d elements.",
self.peer_address()[0], err.key, err.limit)
return RPCError(1, str(err))
async def claimtrie_resolve(self, *urls):
if urls:
@@ -1084,7 +1095,8 @@ class LBRYElectrumX(SessionBase):
async def peers_subscribe(self):
"""Return the server peers as a list of (ip, host, details) tuples."""
return self.peer_mgr.on_peers_subscribe(self.is_tor())
self.subscribe_peers = True
return self.env.peer_hubs
async def address_status(self, hashX):
"""Returns an address status.
@@ -1327,11 +1339,7 @@ class LBRYElectrumX(SessionBase):
async def banner(self):
"""Return the server banner text."""
banner = f'You are connected to an {self.version} server.'
if self.is_tor():
banner_file = self.env.tor_banner_file
else:
banner_file = self.env.banner_file
banner_file = self.env.banner_file
if banner_file:
try:
with codecs.open(banner_file, 'r', 'utf-8') as f:
+56 -19
View File
@@ -3,7 +3,8 @@ import struct
from time import perf_counter
import logging
from typing import Optional, Tuple, NamedTuple
from lbry.utils import LRUCache
from lbry.utils import LRUCache, is_valid_public_ipv4
from lbry.schema.attrs import country_str_to_int, country_int_to_str
# from prometheus_client import Counter
@@ -13,6 +14,9 @@ _MAGIC = 1446058291 # genesis blocktime (which is actually wrong)
_PAD_BYTES = b'\x00' * 64
PROTOCOL_VERSION = 1
class SPVPing(NamedTuple):
magic: int
protocol_version: int
@@ -22,8 +26,8 @@ class SPVPing(NamedTuple):
return struct.pack(b'!lB64s', *self)
@staticmethod
def make(protocol_version=1) -> bytes:
return SPVPing(_MAGIC, protocol_version, _PAD_BYTES).encode()
def make() -> bytes:
return SPVPing(_MAGIC, PROTOCOL_VERSION, _PAD_BYTES).encode()
@classmethod
def decode(cls, packet: bytes):
@@ -33,24 +37,40 @@ class SPVPing(NamedTuple):
return decoded
PONG_ENCODING = b'!BBL32s4sH'
class SPVPong(NamedTuple):
protocol_version: int
flags: int
height: int
tip: bytes
source_address_raw: bytes
country: int
def encode(self):
return struct.pack(b'!BBl32s4s', *self)
return struct.pack(PONG_ENCODING, *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]
def encode_address(address: str):
return bytes(int(b) for b in address.split("."))
@classmethod
def make(cls, flags: int, height: int, tip: bytes, source_address: str, country: str) -> bytes:
return SPVPong(
PROTOCOL_VERSION, flags, height, tip,
cls.encode_address(source_address),
country_str_to_int(country)
).encode()
@classmethod
def make_sans_source_address(cls, flags: int, height: int, tip: bytes, country: str) -> Tuple[bytes, bytes]:
pong = cls.make(flags, height, tip, '0.0.0.0', country)
return pong[:38], pong[42:]
@classmethod
def decode(cls, packet: bytes):
return cls(*struct.unpack(b'!BBl32s4s', packet[:42]))
return cls(*struct.unpack(PONG_ENCODING, packet[:44]))
@property
def available(self) -> bool:
@@ -60,29 +80,41 @@ class SPVPong(NamedTuple):
def ip_address(self) -> str:
return ".".join(map(str, self.source_address_raw))
@property
def country_name(self):
return country_int_to_str(self.country)
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()})"
f" height={self.height}, tip={self.tip[::-1].hex()}, country={self.country_name})"
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):
def __init__(
self, height: int, tip: bytes, country: str,
throttle_cache_size: int = 1024, throttle_reqs_per_sec: int = 10,
allow_localhost: bool = False, allow_lan: bool = False
):
super().__init__()
self.transport: Optional[asyncio.transports.DatagramTransport] = None
self._height = height
self._tip = tip
self._flags = 0
self._cached_response = None
self._country = country
self._left_cache = self._right_cache = 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
self._allow_localhost = allow_localhost
self._allow_lan = allow_lan
def update_cached_response(self):
self._cached_response = SPVPong.make(self._height, self._tip, self._flags, self.PROTOCOL_VERSION)
self._left_cache, self._right_cache = SPVPong.make_sans_source_address(
self._flags, max(0, self._height), self._tip, self._country
)
def set_unavailable(self):
self._flags &= 0b11111110
@@ -109,7 +141,7 @@ class SPVServerStatusProtocol(asyncio.DatagramProtocol):
return False
def make_pong(self, host):
return self._cached_response + bytes(int(b) for b in host.split("."))
return self._left_cache + SPVPong.encode_address(host) + self._right_cache
def datagram_received(self, data: bytes, addr: Tuple[str, int]):
if self.should_throttle(addr[0]):
@@ -119,7 +151,11 @@ class SPVServerStatusProtocol(asyncio.DatagramProtocol):
except (ValueError, struct.error, AttributeError, TypeError):
# log.exception("derp")
return
self.transport.sendto(self.make_pong(addr[0]), addr)
if addr[1] >= 1024 and is_valid_public_ipv4(
addr[0], allow_localhost=self._allow_localhost, allow_lan=self._allow_lan):
self.transport.sendto(self.make_pong(addr[0]), addr)
else:
log.warning("odd packet from %s:%i", addr[0], addr[1])
# ping_count_metric.inc()
def connection_made(self, transport) -> None:
@@ -137,12 +173,14 @@ class StatusServer:
def __init__(self):
self._protocol: Optional[SPVServerStatusProtocol] = None
async def start(self, height: int, tip: bytes, interface: str, port: int):
async def start(self, height: int, tip: bytes, country: str, interface: str, port: int, allow_lan: bool = False):
if self.is_running:
return
loop = asyncio.get_event_loop()
self._protocol = SPVServerStatusProtocol(height, tip)
interface = interface if interface.lower() != 'localhost' else '127.0.0.1'
self._protocol = SPVServerStatusProtocol(
height, tip, country, allow_localhost=interface == '127.0.0.1', allow_lan=allow_lan
)
await loop.create_datagram_endpoint(lambda: self._protocol, (interface, port))
log.info("started udp status server on %s:%i", interface, port)
@@ -169,13 +207,12 @@ class StatusServer:
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)
self._ping_packet = SPVPing.make()
def datagram_received(self, data: bytes, addr: Tuple[str, int]):
try:
+1 -1
View File
@@ -1,3 +1,3 @@
# need this to avoid circular import
PROTOCOL_MIN = (0, 54, 0)
PROTOCOL_MAX = (0, 99, 0)
PROTOCOL_MAX = (0, 199, 0)
+34 -6
View File
@@ -272,16 +272,31 @@ class Output(InputOutput):
def id(self):
return self.ref.id
@property
def is_pubkey_hash(self):
return 'pubkey_hash' in self.script.values
@property
def pubkey_hash(self):
return self.script.values['pubkey_hash']
@property
def is_script_hash(self):
return 'script_hash' in self.script.values
@property
def script_hash(self):
return self.script.values['script_hash']
@property
def has_address(self):
return 'pubkey_hash' in self.script.values
return self.is_pubkey_hash or self.is_script_hash
def get_address(self, ledger):
return ledger.hash160_to_address(self.pubkey_hash)
if self.is_pubkey_hash:
return ledger.hash160_to_address(self.pubkey_hash)
elif self.is_script_hash:
return ledger.hash160_to_script_address(self.script_hash)
def get_estimator(self, ledger):
return OutputEffectiveAmountEstimator(ledger, self)
@@ -290,6 +305,10 @@ class Output(InputOutput):
def pay_pubkey_hash(cls, amount, pubkey_hash):
return cls(amount, OutputScript.pay_pubkey_hash(pubkey_hash))
@classmethod
def pay_script_hash(cls, amount, pubkey_hash):
return cls(amount, OutputScript.pay_script_hash(pubkey_hash))
@classmethod
def deserialize_from(cls, stream):
return cls(
@@ -440,6 +459,12 @@ class Output(InputOutput):
self.signable.signature = channel.private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256)
self.script.generate()
def sign_data(self, data:bytes, timestamp:str) -> str:
pieces = [timestamp.encode(), self.claim_hash, data]
digest = sha256(b''.join(pieces))
signature = self.private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256)
return hexlify(signature).decode()
def clear_signature(self):
self.channel = None
self.signable.clear_signature()
@@ -906,15 +931,18 @@ class Transaction:
@classmethod
def support(cls, claim_name: str, claim_id: str, amount: int, holding_address: str,
funding_accounts: List['Account'], change_account: 'Account', signing_channel: Output = None):
funding_accounts: List['Account'], change_account: 'Account', signing_channel: Output = None,
comment: str = None):
ledger, _ = cls.ensure_all_have_same_ledger_and_wallet(funding_accounts, change_account)
if signing_channel is not None:
if signing_channel is not None or comment is not None:
support = Support()
support.emoji = '👍'
if comment is not None:
support.comment = comment
support_output = Output.pay_support_data_pubkey_hash(
amount, claim_name, claim_id, support, ledger.address_to_hash160(holding_address)
)
support_output.sign(signing_channel, b'placeholder txid:nout')
if signing_channel is not None:
support_output.sign(signing_channel, b'placeholder txid:nout')
else:
support_output = Output.pay_support_pubkey_hash(
amount, claim_name, claim_id, ledger.address_to_hash160(holding_address)
+1 -1
View File
@@ -35,7 +35,7 @@ class WalletServerPayer:
if not address or not amount:
continue
if not self.ledger.is_valid_address(address):
if not self.ledger.is_pubkey_address(address):
self._on_payment_controller.add_error(ServerPaymentInvalidAddressError(address))
continue
+1 -1
View File
@@ -2,7 +2,7 @@ import sys
import asyncio
from binascii import hexlify
from lbry.wallet.server.db import SQLDB
from lbry.wallet.server.db.writer import SQLDB
from lbry.wallet.server.coin import LBC
from lbry.wallet.server.daemon import Daemon
+48
View File
@@ -0,0 +1,48 @@
import asyncio
import argparse
import logging
from typing import Optional
from lbry.dht.constants import generate_id
from lbry.dht.node import Node
from lbry.dht.peer import PeerManager
from lbry.extras.daemon.storage import SQLiteStorage
from lbry.conf import Config
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)-4s %(name)s:%(lineno)d: %(message)s")
log = logging.getLogger(__name__)
async def main(host: str, port: int, db_file_path: str, bootstrap_node: Optional[str]):
loop = asyncio.get_event_loop()
conf = Config()
storage = SQLiteStorage(conf, db_file_path, loop, loop.time)
if bootstrap_node:
nodes = bootstrap_node.split(':')
nodes = [(nodes[0], int(nodes[1]))]
else:
nodes = conf.known_dht_nodes
await storage.open()
node = Node(
loop, PeerManager(loop), generate_id(), port, port, 3333, None,
storage=storage
)
node.start(host, nodes)
while True:
await asyncio.sleep(10)
log.info("Known peers: %d. Storing contact information for %d blobs from %d peers.",
len(node.protocol.routing_table.get_peers()), len(node.protocol.data_store),
len(node.protocol.data_store.get_storing_contacts()))
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Starts a single DHT node, which then can be used as a seed node or just a contributing node.")
parser.add_argument("--host", default='0.0.0.0', type=str, help="Host to listen for requests. Default: 0.0.0.0")
parser.add_argument("--port", default=4444, type=int, help="Port to listen for requests. Default: 4444")
parser.add_argument("--db_file", default='/tmp/dht.db', type=str, help="DB file to save peers. Default: /tmp/dht.db")
parser.add_argument("--bootstrap_node", default=None, type=str,
help="Node to connect for bootstraping this node. Leave unset to use the default ones. "
"Format: host:port Example: lbrynet1.lbry.com:4444")
args = parser.parse_args()
asyncio.run(main(args.host, args.port, args.db_file, args.bootstrap_node))
+22 -2
View File
@@ -1,3 +1,19 @@
"""A simple script that attempts to directly download a single blob.
To Do:
------
Currently `lbrynet blob get <hash>` does not work to download single blobs
which are not already present in the system. The function locks up and
never returns.
It only works for blobs that are in the `blobfiles` directory already.
This bug is reported in lbryio/lbry-sdk, issue #2070.
Maybe this script can be investigated, and certain parts can be added to
`lbry.extras.daemon.daemon.jsonrpc_blob_get`
in order to solve the previous issue, and finally download single blobs
from the network (peers or reflector servers).
"""
import sys
import os
import asyncio
@@ -32,7 +48,7 @@ async def main(blob_hash: str, url: str):
)
host = host_info[0][4][0]
storage = SQLiteStorage(conf, os.path.join(conf.data_dir, "lbrynet.sqlite"))
storage = SQLiteStorage(conf, ":memory:")
blob_manager = BlobManager(loop, os.path.join(conf.data_dir, "blobfiles"), storage, conf)
await storage.open()
await blob_manager.setup()
@@ -47,7 +63,11 @@ async def main(blob_hash: str, url: str):
print(f"deleted {blob_hash}")
if __name__ == "__main__": # usage: python download_blob_from_peer.py <blob_hash> [host url:port]
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: download_blob_from_peer.py <blob_hash> [host_url:port]")
sys.exit(1)
url = 'reflector.lbry.com:5567'
if len(sys.argv) > 2:
url = sys.argv[2]
+46
View File
@@ -0,0 +1,46 @@
import asyncio
from pprint import pprint
from elasticsearch import AsyncElasticsearch
from elasticsearch._async.helpers import async_scan, async_bulk
DB = {}
INDEX = 'claims'
async def generate_support_amounts(client: AsyncElasticsearch):
async for doc in async_scan(client):
DB[doc['_id']] = doc['_source']['support_amount']
if len(DB) > 10:
break
pprint(DB)
def generate_support_to_trending():
for claim_id, amount in DB.items():
yield {'doc': {"trending_mixed": amount}, '_id': claim_id, '_index': INDEX, '_op_type': 'update'}
async def write_trending(client: AsyncElasticsearch):
await async_bulk(client, generate_support_to_trending())
def get_client(host='localhost', port=9201):
hosts = [{'host': host, 'port': port}]
return AsyncElasticsearch(hosts, timeout=port)
async def run():
client = get_client()
await generate_support_amounts(client)
await write_trending(client)
for claim_id, value in DB.items():
if value > 0:
break
doc = await client.get(INDEX, claim_id)
pprint(doc)
pprint(DB[claim_id])
await client.close()
asyncio.get_event_loop().run_until_complete(run())
+1 -1
View File
@@ -2,7 +2,7 @@ import time
import asyncio
import random
from argparse import ArgumentParser
from lbry.wallet.client.basenetwork import ClientSession
from lbry.wallet.network import ClientSession
class AgentSmith(ClientSession):
-45
View File
@@ -13,7 +13,6 @@ 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
@@ -67,10 +66,6 @@ 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):
@@ -330,41 +325,6 @@ class Examples(CommandTestCase):
await self.daemon.jsonrpc_channel_abandon(self.get_claim_id(big_stream))
await self.generate(1)
# comments
comment = await r(
'Posting a comment as your channel',
'comment', 'create', '--comment="Thank you Based God"',
'--channel_name=@channel', f'--claim_id={stream_id}'
)
reply = await r(
'Use the parent_id param to make replies',
'comment', 'create',
'--comment="I have photographic evidence confirming Sasquatch exists"',
f'--channel_name=@channel', f'--parent_id={comment["comment_id"]}',
f'--claim_id={stream_id}'
)
await r(
'List all comments on a claim',
'comment', 'list', stream_id, '--include_replies'
)
await r(
'List a comment thread replying to a top level comment',
'comment', 'list', stream_id,
f'--parent_id={comment["comment_id"]}'
)
await r(
'Edit the contents of a comment',
'comment', 'update', 'Where there was once sasquatch, there is not',
f'--comment_id={comment["comment_id"]}'
)
await self.daemon.jsonrpc_comment_abandon(reply['comment_id'])
# collections
collection = await r(
'Create a collection of one stream',
@@ -431,11 +391,6 @@ class Examples(CommandTestCase):
# abandon all the things
await r(
'Abandon a comment',
'comment', 'abandon', comment['comment_id']
)
abandon_stream = await r(
'Abandon a stream claim',
'stream', 'abandon', stream_id
+6 -4
View File
@@ -151,19 +151,21 @@ def release(args):
for pr in gh.search_issues(f"merged:>={previous_release._json_data['created_at']} repo:lbryio/lbry-sdk"):
area_labels = list(get_labels(pr, 'area'))
type_label = get_label(pr, 'type')
pr_url = f'[#{pr.number}]({pr.html_url})'
user_url = f'[{pr.user["login"]}]({pr.user["html_url"]})'
if area_labels and type_label:
for area_name in area_labels:
for incompat in get_backwards_incompatible(pr.body or ""):
incompats.append(f' * [{area_name}] {incompat.strip()} ({pr.html_url})')
incompats.append(f' * [{area_name}] {incompat.strip()} ({pr_url})')
for release_text in get_release_text(pr.body or ""):
release_texts.append(release_text)
if type_label == 'fixup':
fixups.append(f' * {pr.title} ({pr.html_url}) by {pr.user["login"]}')
fixups.append(f' * {pr.title} ({pr_url}) by {user_url}')
else:
area = areas.setdefault(area_name, [])
area.append(f' * [{type_label}] {pr.title} ({pr.html_url}) by {pr.user["login"]}')
area.append(f' * [{type_label}] {pr.title} ({pr_url}) by {user_url}')
else:
unlabeled.append(f' * {pr.title} ({pr.html_url}) by {pr.user["login"]}')
unlabeled.append(f' * {pr.title} ({pr_url}) by {user_url}')
area_names = list(areas.keys())
area_names.sort()
+25 -11
View File
@@ -1,31 +1,45 @@
import sys
import os
import asyncio
import logging
from lbry.blob_exchange.client import request_blob
from lbry.utils import resolve_host
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)-4s %(name)s:%(lineno)d: %(message)s")
from lbry.blob.blob_manager import BlobManager
from lbry.blob_exchange.server import BlobServer
from lbry.schema.address import decode_address
from lbry.extras.daemon.storage import SQLiteStorage
from lbry.wallet import Ledger
from lbry.conf import Config
async def main(address: str):
try:
decode_address(address)
except:
if not Ledger.is_pubkey_address(address):
print(f"'{address}' is not a valid lbrycrd address")
return 1
loop = asyncio.get_running_loop()
conf = Config()
storage = SQLiteStorage(os.path.expanduser("~/.lbrynet/lbrynet.sqlite"))
async def ensure_blob(blob):
upstream_host, upstream_port = conf.fixed_peers[0]
upstream_host = await resolve_host(upstream_host, upstream_port, 'tcp')
success, proto = await request_blob(loop, blob, upstream_host, int(upstream_port), conf.peer_connect_timeout,
conf.blob_download_timeout)
print(success, proto)
if proto:
proto.close()
storage = SQLiteStorage(conf, os.path.expanduser("/tmp/lbrynet.sqlite"))
await storage.open()
blob_manager = BlobManager(loop, os.path.expanduser("~/.lbrynet/blobfiles"), storage)
blob_manager = BlobManager(loop, os.path.expanduser("/tmp/blobfiles"), storage, conf)
await blob_manager.setup()
server = await loop.create_server(
lambda: BlobServer(loop, blob_manager, address),
'0.0.0.0', 4444)
server = BlobServer(loop, blob_manager, address, blob_callback=ensure_blob)
try:
async with server:
await server.serve_forever()
server.start_server(6666, '0.0.0.0')
while True:
await asyncio.sleep(1)
finally:
await storage.close()
+1 -1
View File
@@ -1,5 +1,5 @@
import asyncio
from lbry.wallet.client.basenetwork import ClientSession
from lbry.wallet.network import ClientSession
from lbry.wallet.rpc.jsonrpc import RPCError
import logging
import json
@@ -0,0 +1,71 @@
import asyncio
from aiohttp import web
from lbry.blob_exchange.serialization import BlobRequest, BlobResponse
from lbry.dht.constants import generate_id
from lbry.dht.node import Node
from lbry.dht.peer import make_kademlia_peer, PeerManager
from lbry.extras.daemon.storage import SQLiteStorage
loop = asyncio.get_event_loop()
NODE = Node(
loop, PeerManager(loop), generate_id(), 60600, 60600, 3333, None,
storage=SQLiteStorage(None, ":memory:", loop, loop.time)
)
async def check_p2p(ip, port):
writer = None
try:
reader, writer = await asyncio.open_connection(ip, port)
writer.write(BlobRequest.make_request_for_blob_hash('0'*96).serialize())
return BlobResponse.deserialize(await reader.readuntil(b'}')).get_address_response().lbrycrd_address
except OSError:
return None
finally:
if writer:
writer.close()
await writer.wait_closed()
async def check_dht(ip, port):
peer = make_kademlia_peer(None, ip, udp_port=int(port))
return await NODE.protocol.get_rpc_peer(peer).ping()
async def endpoint_p2p(request):
p2p_port = request.match_info.get('p2p_port', "3333")
try:
address = await asyncio.wait_for(check_p2p(request.remote, p2p_port), 3)
except asyncio.TimeoutError:
address = None
return {"status": address is not None, "port": p2p_port, "payment_address": address}
async def endpoint_dht(request):
dht_port = request.match_info.get('dht_port', "3333")
try:
response = await check_dht(request.remote, dht_port)
except asyncio.TimeoutError:
response = None
return {"status": response == b'pong', "port": dht_port}
async def endpoint_default(request):
return {"dht_status": await endpoint_dht(request), "p2p_status": await endpoint_p2p(request)}
def as_json_response_wrapper(endpoint):
async def json_endpoint(*args, **kwargs):
return web.json_response(await endpoint(*args, **kwargs))
return json_endpoint
app = web.Application()
app.add_routes([web.get('/', as_json_response_wrapper(endpoint_default)),
web.get('/dht/{dht_port}', as_json_response_wrapper(endpoint_dht)),
web.get('/p2p/{p2p_port}', as_json_response_wrapper(endpoint_p2p))])
if __name__ == '__main__':
loop.create_task(NODE.start_listening("0.0.0.0"))
web.run_app(app, port=60666)
+5
View File
@@ -5,6 +5,9 @@ branch = True
source =
lbry
.tox/*/lib/python*/site-packages/lbry
omit =
lbry/wallet/orchstr8/
.tox/*/lib/python*/site-packages/lbry/wallet/orchstr8/node.py
[cryptography.*,coincurve.*,pbkdf2, libtorrent]
ignore_missing_imports = True
@@ -21,6 +24,7 @@ disable=
c-extension-no-member,
fixme,
broad-except,
raise-missing-from,
no-else-return,
cyclic-import,
missing-docstring,
@@ -37,5 +41,6 @@ disable=
too-many-public-methods,
too-many-return-statements,
too-many-instance-attributes,
unspecified-encoding,
protected-access,
unused-argument
+9 -3
View File
@@ -43,7 +43,7 @@ setup(
'base58==1.0.0',
'cffi==1.13.2',
'cryptography==2.5',
'protobuf==3.6.1',
'protobuf==3.17.2',
'msgpack==0.6.1',
'prometheus_client==0.7.1',
'ecdsa==0.13.3',
@@ -51,12 +51,18 @@ setup(
'docopt==0.6.2',
'hachoir',
'multidict==4.6.1',
'coincurve==11.0.0',
'coincurve==15.0.0',
'pbkdf2==1.3',
'attrs==18.2.0',
'pylru==1.1.0',
'elasticsearch==7.10.1'
'elasticsearch==7.10.1',
'grpcio==1.38.0'
] + PLYVEL,
extras_require={
'torrent': ['lbry-libtorrent'],
'lint': ['pylint==2.10.0'],
'test': ['coverage'],
},
classifiers=[
'Framework :: AsyncIO',
'Intended Audience :: Developers',
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff. Show more