Compare commits

...
70 Commits
Author SHA1 Message Date
Lex Berezhny 7743a6a71d v0.43.2 2019-10-17 13:38:52 -04:00
Lex Berezhny 65a18e78dd publish checks all accounts before forwarding to stream_create/stream_update 2019-10-17 13:38:19 -04:00
Lex Berezhny 12a0cbf4e1 improve preference sync integration test 2019-10-16 17:19:10 -04:00
Lex Berezhny 55c2073813 v0.43.1 2019-10-16 15:50:10 -04:00
Lex Berezhny 39bc8c45c3 test fix 2019-10-16 15:49:10 -04:00
Lex Berezhny 46465f5409 removed WALLET_IS_UNLOCKED condition since it does not take into account multi-wallet 2019-10-16 15:49:10 -04:00
Lex Berezhny 7b5f23e17d incorporate password in the wallet.hash 2019-10-16 15:49:10 -04:00
Lex Berezhny 380efc5ae0 regen docs 2019-10-16 12:06:05 -04:00
Lex Berezhny d1a123997d sync_apply always updates local password if encrypt-on-disk is enabled 2019-10-16 12:06:05 -04:00
Lex Berezhny 722419dffc migrate per-account on disk encryption to encrypt-on-disk preference 2019-10-16 12:06:05 -04:00
Lex Berezhny bcd69f812e sync_apply overwrites local password when encrypt-on-disk is true 2019-10-16 12:06:05 -04:00
Lex Berezhny 1075cd9995 regenerated api.json 2019-10-16 12:06:05 -04:00
Lex Berezhny e5be1ff157 bug fixes and encrypt-on-disk preference 2019-10-16 12:06:05 -04:00
Lex Berezhny 398fe55083 renamed: test_sync.py -> test_wallet_commands.py 2019-10-16 12:06:05 -04:00
shyba b4ee537f7c Merge pull request #2553 from lbryio/choco_37
pin choco py to 37 on win build
2019-10-16 12:11:06 -03:00
Victor Shyba b0ad30a5d8 pin choco py to 37 on win build 2019-10-16 11:48:33 -03:00
Lex Berezhny 26d17e2e69 updated api.json docs 2019-10-15 12:12:35 -04:00
Lex Berezhny 43b619b2c6 release script fix for PRs with null body 2019-10-14 19:09:32 -04:00
Lex Berezhny 0e4426e084 v0.43.0 2019-10-14 13:07:15 -04:00
Jack Robison a27943ea14 update time_to_first_byte.py 2019-10-14 12:59:59 -04:00
Lex Berezhny b8b24da292 encrypt/decrypt/lock/unlock commands return True 2019-10-14 12:57:09 -04:00
Lex Berezhny 45eef03576 fixes 2019-10-14 12:57:09 -04:00
Lex Berezhny 270f77df24 wallet encryption 2019-10-14 12:57:09 -04:00
Lex Berezhny dc580b9eff wip wallet encrypt/decrypt API 2019-10-14 12:57:09 -04:00
Lex Berezhny fed7e94d8d added wallet send command 2019-10-14 10:43:54 -04:00
Lex Berezhny 9bb0ca2f0d async def 2019-10-13 22:32:09 -04:00
Lex Berezhny 3d82becadc utxo release applies to all accounts in wallet 2019-10-13 22:32:09 -04:00
Lex Berezhny e2b92c99ef added wallet balance command 2019-10-13 20:06:11 -04:00
Lex Berezhny fea7275148 mypy fixes 2019-10-12 20:23:29 -04:00
Lex Berezhny 64581fc81b pylint 2019-10-12 20:23:29 -04:00
Lex Berezhny 37ae302fc6 timestamped top-level wallet preferences 2019-10-12 20:23:29 -04:00
Alex Grin c51cc02a87 Merge pull request #2527 from lbryio/faster_trending
only do trending calculations near the tip of the chain
2019-10-11 13:20:35 -04:00
Thomas Zarebczan 6c92fbd8de add oga and ogv mime types
https://gingertech.net/2008/09/05/new-ogg-mime-types-ratified/#targetText=The%20new%20Ogg%20MIME%20types,I%20files%20for%20backwards%20compatibility.
2019-10-11 11:40:36 -04:00
Alex Grintsvayg 065215cc27 only do trending calculations near the tip of the chain 2019-10-11 10:51:50 -04:00
StrikerRUS eb8a88dbd6 refactored integration folder as well 2019-10-11 10:31:54 -04:00
StrikerRUS 62e3258dda revert spaces fixes 2019-10-11 10:31:54 -04:00
StrikerRUS 9959d2c70d use more specific asserts in torba tests 2019-10-11 10:31:54 -04:00
Miroslav Kovar 19e8b6e11f Add test 2019-10-11 10:12:18 -04:00
Miroslav Kovar 63447d1ec3 Make more readable 2019-10-11 10:12:18 -04:00
Miroslav Kovar 75fac93544 Make --verbose behave as per doc 2019-10-11 10:12:18 -04:00
Alex Grin 23f7faa74c Merge pull request #2502 from lbryio/minor_changes
small clarifying changes
2019-10-10 08:59:47 -04:00
Alex Grintsvayg 284fdb2fcb small clarifying changes 2019-10-09 15:42:32 -04:00
Jack Robison 44b27bbfc8 Merge pull request #2487 from lbryio/fix-connection-reset
handle error if range request transport is reset
2019-10-08 16:20:07 -04:00
Jack Robison 35d2d55a27 handle error if range request transport is reset 2019-10-08 14:37:51 -04:00
Jack Robison 292f1953e1 Merge pull request #2521 from lbryio/resolve-ipv4-only
fix resolving fixed peers from an ipv6 connection
2019-10-08 14:37:49 -04:00
Jack Robison 5cd0828dd3 force ipv4 when resolving a url
-log violating ip addresses
2019-10-08 13:31:06 -04:00
Jack Robison 077281a77a v0.42.2 2019-10-07 13:03:51 -04:00
Jack Robison 7055d250d0 Merge pull request #2503 from lbryio/reuse-loggly
Reuse loggly connection
2019-10-07 12:30:04 -04:00
Jack Robison 8c0196301d Merge pull request #2489 from lbryio/dht_object_cache
DHT object cache revamp
2019-10-07 12:27:07 -04:00
Jack Robison f99aacd9dc improve store_to_peer retry, reduce error verbosity 2019-10-07 12:26:49 -04:00
Jack Robison 43b83bec83 remove dead code 2019-10-07 12:26:49 -04:00
Jack Robison fc1b4658fc re-use loggly connection 2019-10-07 12:26:49 -04:00
Victor Shyba 05a28ea346 handle attempts to add peers with no node id and issue a warning 2019-10-07 13:20:38 -03:00
Victor Shyba 624f986978 handle peer_is_good for unknown node id 2019-10-07 13:20:38 -03:00
Victor Shyba 91a9957918 avoid peer mutability
Mutability can be harmful here, specially on fields used for __hash__
It can also make the cache less efficient
2019-10-07 13:20:38 -03:00
Victor Shyba 8cd18e47e7 get_kad... -> make_kad.. 2019-10-07 13:20:38 -03:00
Victor Shyba 517868f73c fix unit tests 2019-10-07 13:20:38 -03:00
Victor Shyba 18d80f4ed5 1 and 65536 arent valid ports 2019-10-07 13:20:38 -03:00
Victor Shyba 2e2c751d75 check for none on tcp port 2019-10-07 13:20:38 -03:00
Victor Shyba 7aa5e2cbe1 use a dataclass experiment 2019-10-07 13:20:38 -03:00
Victor Shyba 7d6db20081 use cache for dht peer objects 2019-10-07 13:20:38 -03:00
Miroslav Kovar 911ec9444b Decrease the status refresh rate 2019-10-07 11:42:40 -04:00
Miroslav Kovar 2883c6bab3 Fix incorrect counting of total bytes sent / received 2019-10-07 11:42:40 -04:00
OrginalS f5fed54195 Punctuation
Added missing punctuation and changed existing to more fitting one.
2019-10-07 10:58:13 -04:00
Rishav Sharma 91b1446375 Grammar correction 2019-10-07 10:50:14 -04:00
Lex Berezhny 56df145052 updating/abanding streams/channels works across all accounts 2019-10-07 09:57:22 -04:00
Lex Berezhny 9e873f77f9 bug fixes related to cross-account / wallet operations 2019-10-07 09:57:22 -04:00
Alex Grintsvayg 27bbd91635 include fn name and args in jsonrpc error message 2019-10-04 11:25:01 -04:00
Alex Grintsvayg 2c73c80c9f fix formatting 2019-10-04 09:52:29 -04:00
Hugo 3a3a9b5f4e Fix spelling 2019-10-03 21:40:06 -04:00
78 changed files with 1466 additions and 1028 deletions

No files matched your search

+1 -1
View File
@@ -110,7 +110,7 @@ jobs:
- OS=windows
- PATH=/c/Python37:/c/Python37/Scripts:/C/Windows/System32/downlevel:$PATH
before_install:
- choco install python --x86
- choco install python --version=3.7.4 --x86
- python -m pip install --upgrade pip
- pip install pywin32
script:
+4 -4
View File
@@ -1,6 +1,6 @@
# Installing LBRY
If only the JSON-RPC API server is needed, the recommended way to install LBRY is to use a pre-built binary. We provide binaries for all major operating systems. See the [README](README.md).
If only the JSON-RPC API server is needed, the recommended way to install LBRY is to use a pre-built binary. We provide binaries for all major operating systems. See the [README](README.md)!
These instructions are for installing LBRY from source, which is recommended if you are interested in doing development work or LBRY is not available on your operating system (godspeed, TempleOS users).
@@ -9,7 +9,7 @@ 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 or higher. 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.
@@ -17,7 +17,7 @@ After installing python 3, you'll need to install some additional libraries depe
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
These environment variables also need to be set:
1. PYTHONUNBUFFERED=1
2. EVENT_NOKQUEUE=1
@@ -27,7 +27,7 @@ Remaining dependencies can then be installed by running:
brew install python protobuf
```
Assistance installing Python3: https://docs.python-guide.org/starting/install3/osx/
Assistance installing Python3: https://docs.python-guide.org/starting/install3/osx/.
### Linux
+1 -1
View File
@@ -2,7 +2,7 @@
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 full featured implementation of the LBRY Network protocols and includes many useful components and tools for building decentralized applications. Primary features and components:
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`.
* 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/lbry/dht)).
+258 -222
View File
@@ -41,10 +41,10 @@
"examples": [
{
"title": "Get a file",
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpfhl810yq\",\n \"download_path\": \"/tmp/tmpfhl810yq/tmp7rhvd_bl\",\n \"file_name\": \"tmp7rhvd_bl\",\n \"height\": 214,\n \"key\": \"0e6b81fe73602d02ed07933b0206b959\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01492d77be7594cd9bbe2e4575e42784b6b28671a97feea119e096fecb7cb354773d7583f38083842dccac76f7b8ddd2be2fc1fb4474693226de36237515a582f1734eaa25c6968af898c3ed913144d0fbab1398b20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"dbea4542edea266956561fb9e0e13acfc63785d5777f33ea1a95c4e5979eac84e55dbf49e338b264b5fccb1c9f73e025\",\n \"stream_name\": \"tmp7rhvd_bl\",\n \"streaming_url\": \"http://localhost:5280/stream/0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"suggested_file_name\": \"tmp7rhvd_bl\",\n \"timestamp\": 1569257570,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"written_bytes\": 11\n }\n}"
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#c011186b47f0499392fdd22d73a2ec5426b8556f\"}}' http://localhost:5279/",
"lbrynet": "lbrynet get astream#c011186b47f0499392fdd22d73a2ec5426b8556f",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#c011186b47f0499392fdd22d73a2ec5426b8556f\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmppl4ona5o\",\n \"download_path\": \"/tmp/tmppl4ona5o/tmp5h1lifqx\",\n \"file_name\": \"tmp5h1lifqx\",\n \"height\": 214,\n \"key\": \"0fed669177b7d4889715b0522ad6f103\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d3419c789f3367513a7e0058af1abbfbf6049f2b9792102b78fcfdc53716733ffce3fca52fdeb3971fd08970bf4d1c0e1c61e1c7409b65f9ae0326773cec1417748ca581c1cbb6ecaf6f892ac84d8350cadce0fe0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"ead8d80c803c7eea3c9d6f2575b6734c93af8d6ecbbf7b19458e564d1e7f5463ae71e638d7dfdc9f57e709482bdfec3d\",\n \"stream_name\": \"tmp5h1lifqx\",\n \"streaming_url\": \"http://localhost:5280/stream/04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"suggested_file_name\": \"tmp5h1lifqx\",\n \"timestamp\": 1571238738,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"written_bytes\": 11\n }\n}"
}
]
},
@@ -225,10 +225,10 @@
"examples": [
{
"title": "Publish a file",
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpdfuo3gmq\", \"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/tmpdfuo3gmq",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpdfuo3gmq\", \"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\": \"0100000001fbaccf3734b23175a913bbd9721721ef36f636e8d585559258b225e206b09735010000006a47304402200907f6c8a12358e1602076c26beff37c5e0ef4263eb4ebbe69d4e3395ef1b5b7022074dccc98aa36996e9ff4bcb8727990a294fd171948a0615e82fa81fea9671f14012102af7cd2d2a6fa88971b3239735073a0670f6a3967395a39d50b0749fba4171932ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706466756f33676d71180b22186170706c69636174696f6e2f6f637465742d73747265616d32309903238ece0883cc34f74ee54c768e04108700661ffcbae927b8fb62b5263a428338351bd8cc8d4457fde170de2222096d7576a9142a2c602b33ea0d86869a13de250d544a200aa8b288ace0b46217000000001976a914ae0c488ca0c9f8568ab53124ea6f9229254f662488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpWdtWBngcJdFfgSSK53CbM9XpTjbDgeUt\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257570,\n \"txid\": \"3597b006e225b258925585d5e836f636ef211772d9bb13a97531b23437cfacfb\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjMwqPKw4YiDoBY4jKmrjWR25DboFU1naH\",\n \"amount\": \"1.0\",\n \"claim_id\": \"538df0b96e9f7cf5d86e7f590547bab0c9a626e5\",\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#538df0b96e9f7cf5d86e7f590547bab0c9a626e5\",\n \"timestamp\": null,\n \"txid\": \"67cf8d5b3087f50ceaa7b4046c05d37588d4c02a44d5555b0f28b3b0219c2613\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpdfuo3gmq\",\n \"sd_hash\": \"9903238ece0883cc34f74ee54c768e04108700661ffcbae927b8fb62b5263a428338351bd8cc8d4457fde170de222209\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mwPEau2Wd5iBwSX1Hq9AouQi82TBfQx6ef\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"67cf8d5b3087f50ceaa7b4046c05d37588d4c02a44d5555b0f28b3b0219c2613\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"67cf8d5b3087f50ceaa7b4046c05d37588d4c02a44d5555b0f28b3b0219c2613\"\n }\n}"
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmph4xyq79u\", \"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/tmph4xyq79u",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmph4xyq79u\", \"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\": \"010000000181505245d7d35675af19d701fcad8ae5c14a67811dbdaf4ce73ccf8001287661010000006b4830450221008747caa2fc713bebcc30c9dfd6d6b60ee51a18970b2babf0968b41e0645c303b022017f306dba16a70ebfd05e78226997ee6ff2ca63cf49987ea92abfef832d48390012103df8678597e4d6b38b58f5a6fad26137f6a28f709c2bcbffe58e0f3424f3a6824ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706834787971373975180b22186170706c69636174696f6e2f6f637465742d73747265616d323070b8dff584a902490200bb12dcd9e26b19a0f39ab9f88081feab9771ff0291432d4af477b2aba75a51150e12432ed4666d7576a91420462a2025c78b6d04449cdc310492c89fd2173788ace0b46217000000001976a914a400f5d79f8e0b492fbac2d6666f713bd9bd6ff388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mx65ZKvF4XK8kbychCzHUyTrbHdX3LaRA3\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238738,\n \"txid\": \"6176280180cf3ce74cafbd1d81674ac1e58aadfc01d719af7556d3d745525081\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miTbyK19e5Mifkw3GviKECMuB7SD8uNajP\",\n \"amount\": \"1.0\",\n \"claim_id\": \"82bb19a6ed8ce2b575a8df6e89e617b93851dcc6\",\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#82bb19a6ed8ce2b575a8df6e89e617b93851dcc6\",\n \"timestamp\": null,\n \"txid\": \"1077c79e835c0cf0e50aa64bcdc31b0f05c281166288bbf34c9bc19e4b09f1fb\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmph4xyq79u\",\n \"sd_hash\": \"70b8dff584a902490200bb12dcd9e26b19a0f39ab9f88081feab9771ff0291432d4af477b2aba75a51150e12432ed466\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mvU8GEnbv1idD7cFAwudn69Udz3iESw8VX\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1077c79e835c0cf0e50aa64bcdc31b0f05c281166288bbf34c9bc19e4b09f1fb\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"1077c79e835c0cf0e50aa64bcdc31b0f05c281166288bbf34c9bc19e4b09f1fb\"\n }\n}"
}
]
},
@@ -247,10 +247,10 @@
"examples": [
{
"title": "Resolve a claim",
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"]}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"]}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\": {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a/astream#e\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1569257570,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"short_url\": \"lbry://astream#e\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1569257569,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"short_url\": \"lbry://@channel#a\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#c011186b47f0499392fdd22d73a2ec5426b8556f\"]}}' http://localhost:5279/",
"lbrynet": "lbrynet resolve astream#c011186b47f0499392fdd22d73a2ec5426b8556f",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#c011186b47f0499392fdd22d73a2ec5426b8556f\"]}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#c011186b47f0499392fdd22d73a2ec5426b8556f\": {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#c\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1571238738,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"has_signing_key\": false,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1571238737,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
}
]
},
@@ -272,7 +272,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 \"outgoing_bps\": {},\n \"time\": 688458.591165067,\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"NojpYmvo438LSLqw5L4tHTQgBuamMpLd92rWvHavywauMqEq6YAgeBAdiF5iowsAR\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"blockchain_headers\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"stream_manager\": true,\n \"wallet\": true\n },\n \"stream_manager\": {\n \"managed_files\": 0\n },\n \"wallet\": {\n \"best_blockhash\": \"2f40996e8ba0ff6f000ad05e6dbb09d976911d8865c540952e2e4f9f4fa4290f\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected_servers\": [\n {\n \"host\": \"localhost\",\n \"latency\": 0.01,\n \"port\": 50002\n }\n ],\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"outgoing_bps\": {},\n \"time\": 388184.158997449,\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"5Y77dj4w9ZYpC3cJsYNUT69Wqu18bmciLsoKRswmRbQL56mtC2Hp4z7zbG9CBdwcPY\",\n \"is_running\": true,\n \"skipped_components\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"startup_status\": {\n \"blob_manager\": true,\n \"blockchain_headers\": true,\n \"database\": true,\n \"exchange_rate_manager\": true,\n \"stream_manager\": true,\n \"wallet\": true\n },\n \"stream_manager\": {\n \"managed_files\": 0\n },\n \"wallet\": {\n \"best_blockhash\": \"2bcf4a972ea760294b1c7a86698f6c63a064b429fcc4801286a866dbd1d54667\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected_servers\": [\n {\n \"host\": \"localhost\",\n \"latency\": 0.01,\n \"port\": 50002\n }\n ]\n }\n }\n}"
}
]
},
@@ -294,7 +294,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.41.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.4\",\n \"torba_version\": \"0.5.7\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"GNOME\",\n \"distro\": {\n \"codename\": \"xenial\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"16.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"16\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.43.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.4\",\n \"torba_version\": \"0.5.7\"\n }\n}"
}
]
}
@@ -348,10 +348,10 @@
"examples": [
{
"title": "Add an account from seed",
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\", \"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\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1569257536.923754,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPe2V9SJN7nLMebwticCtsiLJcx7sdckaP38qs3HRZWHZMbMVaCXAK4xCM4nHZzraKmsU1VLJMggzzELeqjVFZVHHHt4bKP36\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XVWwKx2iBk1mAyQemY5nHduQEduw32Nmsd6dfgF9gnBDmUdZg3TtLf2aSuQJDHgdGhFYFmUGtXA7mXSN7t4VitUf5S2Zsvt\",\n \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\", \"single_key\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account add \"new account\" --seed=\"drastic model curious weapon language crush wrong spy whisper labor elite never\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\", \"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\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1571238704.9340613,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfGJvwZyd6WDNjkrqnr2LCHUWD7AWp4tURDpZSPqFoqy1FGM4arnuSqGvUL6TeMA6imGekHtX1QwEZFP29sGGMWenveG2qbv\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YjLiqDeDVusVJnNmxBDEmb5HVdCpELgsFi5L4neqzLasRP7BWXh4ysQLJ62Z5CggDHXeAmPkMNrsSBu6N75uzXxLaYTPDHz\",\n \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\"\n }\n}"
}
]
},
@@ -395,9 +395,9 @@
},
{
"title": "Get balance for specific account by id",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"reserved_subtotals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"reserved_subtotals\": false}}).json()",
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"reserved_subtotals\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet account balance \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"reserved_subtotals\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"available\": \"2.0\",\n \"reserved\": \"0.0\",\n \"reserved_subtotals\": null,\n \"total\": \"2.0\"\n }\n}"
}
]
@@ -432,56 +432,10 @@
"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\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1569257536.747635,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPe2V9SJN7nLMebwticCtsiLJcx7sdckaP38qs3HRZWHZMbMVaCXAK4xCM4nHZzraKmsU1VLJMggzzELeqjVFZVHHHt4bKP36\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XVWwKx2iBk1mAyQemY5nHduQEduw32Nmsd6dfgF9gnBDmUdZg3TtLf2aSuQJDHgdGhFYFmUGtXA7mXSN7t4VitUf5S2Zsvt\",\n \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\"\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\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1571238704.7281725,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfGJvwZyd6WDNjkrqnr2LCHUWD7AWp4tURDpZSPqFoqy1FGM4arnuSqGvUL6TeMA6imGekHtX1QwEZFP29sGGMWenveG2qbv\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YjLiqDeDVusVJnNmxBDEmb5HVdCpELgsFi5L4neqzLasRP7BWXh4ysQLJ62Z5CggDHXeAmPkMNrsSBu6N75uzXxLaYTPDHz\",\n \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\"\n }\n}"
}
]
},
{
"name": "account_decrypt",
"description": "Decrypt an encrypted account, this will remove the wallet password. The account must be unlocked to decrypt it",
"arguments": [
{
"name": "account_id",
"type": "str",
"description": "id for the account to decrypt",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is decrypted, otherwise false",
"examples": []
},
{
"name": "account_encrypt",
"description": "Encrypt an unencrypted account with a password",
"arguments": [
{
"name": "new_password",
"type": "str",
"description": "password to encrypt account",
"is_required": true
},
{
"name": "account_id",
"type": "str",
"description": "id for the account to encrypt, encrypts default account if not provided",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is decrypted, otherwise false",
"examples": []
},
{
"name": "account_fund",
"description": "Transfer some amount (or --everything) to an account from another\naccount (can be the same account). Amounts are interpreted as LBC.\nYou can also spread the transfer across a number of --outputs (cannot\nbe used together with --everything).",
@@ -533,24 +487,24 @@
"examples": [
{
"title": "Transfer 2 LBC from default account to specific account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000015defa5f98290c9cd5e3b56c30cf8ba90f4dc7df6423a387454c518609fe3d321010000006a47304402201cdf69509091643e97aaad1490d36b61b3f105cb5c0d8cdfaf24705ee7e2be7b02203cdfe31ef74b36fa87ae50d5082d3feb7fcf135d0d2058d78b5bcf7a44e69175012102eae03c5c5672d468f6235862b515086e899ef7656daeee3826f6b8884c3f3163ffffffff0200c2eb0b000000001976a9142c2c9f4764ffebdd615dd8e448b6bcdad4ad6c9888ac90d7ae2f000000001976a914dc60627811f2576e34027c3a44a2e880b041ad3188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2ThhAh4zrH4CZFa34rTE7dLebRk9rFGCx\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257568,\n \"txid\": \"21d3e39f6018c55474383a42f67ddcf490baf80cc3563b5ecdc99082f9a5ef5d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjYXUu3nt8omp36T2xDgm2r9ZaRZQr6hXj\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n1cCRBMAxWtrVzQJN9T8syLDRA131yKd8U\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\" --amount=2.0 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012a2d4d3f8e6d07bd3426e56dd37bc676d9b41b475b89a16641a19f5c01ecf09f010000006a4730440220646316b376aac4f8c6b7caa2df43826f78f840d7e789f26873e2c18fa2f8a19c02206556cfe7affe33acb6be8a5f19b4397cb87fa0c4f00502c79df17ef111393da801210262cdc19e281f5797bc4a37e5ac88731e8b30fb03edc8115a670afc9ba0a81930ffffffff0200c2eb0b000000001976a9140156d196c4fc4424210fc4b4c5f64f1e3376e8b388ac90d7ae2f000000001976a914f8a94b8ca292c753cedd6458e41de88b92fa2d4088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myrBDH4gYYrJTdzJjtmweZuV5JfBXD7omH\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238736,\n \"txid\": \"9ff0ec015c9fa14166a1895b471bb4d976c67bd36de52634bd076d8e3f4d2d2a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mfe2yWquHbZGuzZBcnM1h7ezpDpkXCTySN\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n4BkgTZV2xNeusnQR7zDz4qNYsqMScMFpN\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\"\n }\n}"
},
{
"title": "Spread LBC between multiple addresses",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"from_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\" --from_account=\"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"from_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000183055a4c89811b824f2b3df5e19d30e87520c54f9010f26f801f410e5ab89902000000006b483045022100bb1e19fe88df0a37944c500c8970a3fce8ec3d3a1b75458177af1ba86b2a6dc9022037a07effad6b798d4244c003be098dab78712d8c87e59e05b88f529986d2ed5c012103ecafe60391b0ace02608477110a6ab13eb74ec2eb1676653e640bafb9692c9b7ffffffff03c0687804000000001976a9146f644e713c1e89ce6fc3c63be9ce050810e1c1b388acc0687804000000001976a9146f644e713c1e89ce6fc3c63be9ce050810e1c1b388ac6cb9fa02000000001976a91441eebfcf17b2cb5b03e63795ba171c782d053d7288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mjYXUu3nt8omp36T2xDgm2r9ZaRZQr6hXj\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1569257569,\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mmXaE7SuPpmJm4keYBroySVkhaEW9nKJXc\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"from_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --to_account=\"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\" --from_account=\"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\" --amount=1.5 --outputs=2 --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"from_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011c627e57c603b0773da94821755027f31aa215acf00628a34bd61d913e3438e4000000006b483045022100e2dacb2fa0527d2f28d1d24eb68f29b77fe8f5a873b7a18b1b34fb94a803f8f302206375c73f76ef590e5ec0498050d9d0fd4bec8a28ec3ef057ad38ca304aaaa74b01210243bdf4a8e7c3d424a69b0e6d2ab3bd9de500b2e5bf210869a91f3f7f1d9d8437ffffffff03c0687804000000001976a91470292324a689e56fb7be3705bbf9342d02b00a6388acc0687804000000001976a91470292324a689e56fb7be3705bbf9342d02b00a6388ac6cb9fa02000000001976a91470292324a689e56fb7be3705bbf9342d02b00a6388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mfe2yWquHbZGuzZBcnM1h7ezpDpkXCTySN\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1571238737,\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\"\n }\n}"
},
{
"title": "Transfer all LBC to a specified account",
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000033bc34db55437b3c190d6a2050e7a2d8838d29ca0884b2b6e6b6ef1c7df6b4a98000000006b4830450221008318453201a309a91bcd68197c0f803b7fabe3d75910d2e2b036efa7fc1899bf02204e60c265a1d43fcde6bdc8f20e9a1e7e516b6a4482c4612629a92e6c7b5b309a012102192d0a6cf1bdd9121afdfa0175915f08a51abe904efb24c9fb15841b87667a1fffffffff3bc34db55437b3c190d6a2050e7a2d8838d29ca0884b2b6e6b6ef1c7df6b4a98010000006a47304402201890b9ec2eb3e5b80b2fa4ffdbd660287d19ac38d980b302e73fd536678ddaac02203459fe50bde06e9edcb9959fb9bdff1b952465275e180bde6d13e2fcd5ac11ca012102192d0a6cf1bdd9121afdfa0175915f08a51abe904efb24c9fb15841b87667a1fffffffff3bc34db55437b3c190d6a2050e7a2d8838d29ca0884b2b6e6b6ef1c7df6b4a98020000006b483045022100d09a8871c8937e133a731a3ade6e7f47abe08102f5782652e17453ea010d2df902207af2589d1287d7408476bcf6cdb6f5685dc5fd09f2d6a2b1f5c821d4647a73cb012103bd5b353d4c2c84b686ec4e40ab4a90bd3bbb85cebfeccf50f92df47696f78b09ffffffff015027eb0b000000001976a91415b3a52d08af6462e338897119a66f5868ff5aec88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1569257569,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257569,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mmXaE7SuPpmJm4keYBroySVkhaEW9nKJXc\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1569257569,\n \"txid\": \"984a6bdfc7f16e6b6e2b4b88a09cd238882d7a0e05a2d690c1b33754b54dc33b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhVhh3v1qx43icPgGYJBwT2gghqKRFfzN7\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"c4c66da7c7fa2f77fb19de3ae927504cd7064e9ba9c392f9a267597cc0231027\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"c4c66da7c7fa2f77fb19de3ae927504cd7064e9ba9c392f9a267597cc0231027\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
"lbrynet": "lbrynet account fund --from_account=\"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\" --everything --broadcast",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"everything\": true, \"broadcast\": true}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003257c5894457870433e4f3bed79c5bb5eedfac405fdb2a90aec75462eca481697000000006a47304402206748f3d21600d39d1278925611132f5d41fa58598ab30a563a4f8f73eef971a3022076fa2d3b2a5b3af56f2393ec96628194cc895a5760142de6783ef53a0a0d59d3012102147227bbe98f7702aeb098e386e4c9f118e37d4103901559287ec704fc3a9a8cffffffff257c5894457870433e4f3bed79c5bb5eedfac405fdb2a90aec75462eca481697010000006b483045022100dfc0b7ee1e7bc6cadacb57caebc8340bb391fd050ff96b5b607160cb390fa1e6022046d043e09abdf03e4ff9d3b99c8dac8575f5bbdda06d2026e0f5259169fb9126012102147227bbe98f7702aeb098e386e4c9f118e37d4103901559287ec704fc3a9a8cffffffff257c5894457870433e4f3bed79c5bb5eedfac405fdb2a90aec75462eca481697020000006a47304402206af09161e399be11455c5394d4d3fc13100151389cb970bee8b6efbc74afa75d022043dd968fcd41cc8e0d13d5a0d042fa4874fb57c81e9491912bcab2d3bf55b779012102147227bbe98f7702aeb098e386e4c9f118e37d4103901559287ec704fc3a9a8cffffffff015027eb0b000000001976a91413b1f79654e2e73cc9d6b8bfcc16fe98d0b7621f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1571238737,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238737,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1571238737,\n \"txid\": \"971648ca2e4675ec0aa9b2fd05c4faed5ebbc579ed3b4f3e4370784594587c25\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhK6L59USiby9g31qP2JpNm2QFjSvzMhU4\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"8091b20c9f0af24599c4e41f286649885ad367d32bfdbfea1206e589cc38c382\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"8091b20c9f0af24599c4e41f286649885ad367d32bfdbfea1206e589cc38c382\"\n }\n}"
}
]
},
@@ -596,30 +550,10 @@
"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 \"lbc_regtest\": [\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\": \"mpjpuqshHMBxRQRtfrQ3D4sScj2JS3RyGg\",\n \"is_default\": true,\n \"name\": \"Account #mpjpuqshHMBxRQRtfrQ3D4sScj2JS3RyGg\",\n \"preferences\": {\n \"theme\": \"dark\"\n },\n \"public_key\": \"tpubD6NzVbkrYhZ4XZTV6V4Jsa2c8JUrRTkPUXviok1RcphR64gbRe4L9YntcJ1qv8rq3qFC4WPenENZy5pjtWV5yYQaD3MJDUHgRQ2169V6p14\",\n \"satoshis\": 1000000000\n }\n ]\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"lbc_regtest\": [\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\": \"n3bEdKkGNM2C5MaXqiQqQVK1ouvBeLHFWr\",\n \"is_default\": true,\n \"name\": \"Account #n3bEdKkGNM2C5MaXqiQqQVK1ouvBeLHFWr\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XYigvZNaCGXztmz3j59qFZ7PfeRYYRhaLWWZeaFisLc8mTmNCfWsopnu3cc1Zywt9VkT8Eskk8BnAweBnX6w4uz3shGQENn\",\n \"satoshis\": 1000000000\n }\n ]\n }\n}"
}
]
},
{
"name": "account_lock",
"description": "Lock an unlocked account",
"arguments": [
{
"name": "account_id",
"type": "str",
"description": "id for the account to lock",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if account is locked, otherwise false",
"examples": []
},
{
"name": "account_max_address_gap",
"description": "Finds ranges of consecutive addresses that are unused and returns the length\nof the longest such range: for change and receiving address chains. This is\nuseful to figure out ideal values to set for 'receiving_gap' and 'change_gap'\naccount settings.",
@@ -661,16 +595,16 @@
"examples": [
{
"title": "Remove an account",
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"}}).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\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1569257536.747635,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPe2V9SJN7nLMebwticCtsiLJcx7sdckaP38qs3HRZWHZMbMVaCXAK4xCM4nHZzraKmsU1VLJMggzzELeqjVFZVHHHt4bKP36\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XVWwKx2iBk1mAyQemY5nHduQEduw32Nmsd6dfgF9gnBDmUdZg3TtLf2aSuQJDHgdGhFYFmUGtXA7mXSN7t4VitUf5S2Zsvt\",\n \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"}}' http://localhost:5279/",
"lbrynet": "lbrynet account remove mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"}}).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\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1571238704.7281725,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfGJvwZyd6WDNjkrqnr2LCHUWD7AWp4tURDpZSPqFoqy1FGM4arnuSqGvUL6TeMA6imGekHtX1QwEZFP29sGGMWenveG2qbv\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YjLiqDeDVusVJnNmxBDEmb5HVdCpELgsFi5L4neqzLasRP7BWXh4ysQLJ62Z5CggDHXeAmPkMNrsSBu6N75uzXxLaYTPDHz\",\n \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\"\n }\n}"
}
]
},
{
"name": "account_send",
"description": "Send the same number of credits to multiple addresses.",
"description": "Send the same number of credits to multiple addresses from a specific account (or default account).",
"arguments": [
{
"name": "account_id",
@@ -751,38 +685,12 @@
"examples": [
{
"title": "Modify maximum number of times a change address can be reused",
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\", \"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\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1569257536.9968722,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPe2V9SJN7nLMebwticCtsiLJcx7sdckaP38qs3HRZWHZMbMVaCXAK4xCM4nHZzraKmsU1VLJMggzzELeqjVFZVHHHt4bKP36\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XVWwKx2iBk1mAyQemY5nHduQEduw32Nmsd6dfgF9gnBDmUdZg3TtLf2aSuQJDHgdGhFYFmUGtXA7mXSN7t4VitUf5S2Zsvt\",\n \"seed\": \"sorry flee gown suffer spike describe exercise wool alpha copper monitor size\"\n }\n}"
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
"lbrynet": "lbrynet account set mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV --change_max_uses=10",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\", \"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\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1571238705.0105007,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfGJvwZyd6WDNjkrqnr2LCHUWD7AWp4tURDpZSPqFoqy1FGM4arnuSqGvUL6TeMA6imGekHtX1QwEZFP29sGGMWenveG2qbv\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YjLiqDeDVusVJnNmxBDEmb5HVdCpELgsFi5L4neqzLasRP7BWXh4ysQLJ62Z5CggDHXeAmPkMNrsSBu6N75uzXxLaYTPDHz\",\n \"seed\": \"drastic model curious weapon language crush wrong spy whisper labor elite never\"\n }\n}"
}
]
},
{
"name": "account_unlock",
"description": "Unlock an encrypted account",
"arguments": [
{
"name": "password",
"type": "str",
"description": "password to use for unlocking",
"is_required": true
},
{
"name": "account_id",
"type": "str",
"description": "id for the account to unlock, unlocks default account if not provided",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if account is unlocked, otherwise false",
"examples": []
}
]
},
@@ -816,9 +724,9 @@
"examples": [
{
"title": "Check if address is mine",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"msmeprZxgFfL1KuUrARTqbH3wFLeNMQ59j\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine msmeprZxgFfL1KuUrARTqbH3wFLeNMQ59j",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"msmeprZxgFfL1KuUrARTqbH3wFLeNMQ59j\"}}).json()",
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mfyjzur5kkyBg5YDhx4UiAabb2rx2xMsE3\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address is_mine mfyjzur5kkyBg5YDhx4UiAabb2rx2xMsE3",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mfyjzur5kkyBg5YDhx4UiAabb2rx2xMsE3\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -865,14 +773,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 {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mh3DYavDQy1HjjwZ4M5SvpWhjH8Mp2kzxZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4m2ijY3iNheH7D1fL9hmuR8UWq35TGe1EyibBCk7P8ZQydMSAbkg8Pnmp8EiiNxKXM8cRMx65u9aTyBJ2xcgDExG3mrcvmgo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhXfHBzEwXSWKBo51EwJYgzUt3Efxgcfhn\",\n \"pubkey\": \"tpubDA9GDAntyJu4Q4HUHsde1WRcXbgMgqV9SMy4WPobCcJFD86zc2xZbB1AmbduXVzLgmV4HiAKTGx7PpuA7664PAusBpJLjYVzSYtY9QBf2Xy\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhdMWKT6mow4hMXDRxry61rbrSMhsMtWMb\",\n \"pubkey\": \"tpubDA9GDAntyJu4KX2wCdBebMNduc3PczdrmTX76Whpf833Lb5Je67J1ErxNUkheg4or7XDjiowCGvyBi5KRaxXwug9gNLKmZy4paqPkPoKZxk\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhhf8ngREDKkkwRajFWwNxiXkCjLJJvTxb\",\n \"pubkey\": \"tpubDA9GDAntyJu4y4cHsQPTUzh3489Ag6idkVyCMJ93Aoo7XBBZFvckxAPHhDqHxDJnt2ismfMtJPMn1RfuyfhvaJm1YxMW2EixErUZX9xU77L\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhxqLov5QDNMBmehjWGdAY5cMznq8ddmZY\",\n \"pubkey\": \"tpubDA9GDAntyJu4c8eApp8CiFXXPzmiyeYxYJ95wub9gooM2pfSbseSQJGat32sJAboKYb54kawSJzGTFY74yeXmCJQv1TG3XSK9rxRxzRFTSk\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mioPgTrtovHJCHr2yv2N5AVRVd4qCodvoG\",\n \"pubkey\": \"tpubDA9GDAntyJu4dDtWkgAkc22vwBUJMgDwRGuZjfBwdAQ8KqzC9TZJ5UjEQSVRM74VHCHR3nzqWG6eA7jqoLhmfBQQbZnjtKYkWF2v4hcps9M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mjYXUu3nt8omp36T2xDgm2r9ZaRZQr6hXj\",\n \"pubkey\": \"tpubDA9GDAntyJu4NS5vfRcFe8ns88jnY8pkZfxBZWdSZkBCpvKtFAQXPZQYeaz5mTAx8ZQ4NiT9BvQPhCmNXxr7hCeP86pC6PvSSLJd6UBczxa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mkKKAS933HDkpeSdSZqAQdYYgW9iGtG7JH\",\n \"pubkey\": \"tpubDA9GDAntyJu4ozhrXc2NoPwskujYa4qYe2qmeC6uuSmhFcTJsTTAteMedxF58FRq4VnbPHFbVyiMFRJD2nzZuZsyohqVwjDFbG2Dhqsig1W\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mknTbMjvqnAv9fNjySws6k3goYNeXh1J3i\",\n \"pubkey\": \"tpubDA9GDAntyJu4HQG2pcos48Sr92bwezWAr6kSN85J6miZfeXwAmoDGUfXU9TaqK6BjumA8KU5EzbSvqn1Uqg6xbZ3K1Xxc3uQtSs7jbnBctS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mmMCeuzgtfnqLeraJ722EG95tqTc8E3Wdd\",\n \"pubkey\": \"tpubDA9GDAntyJu4F7ympoEe6cMs1BLPmQ1emwrH7nzKZGvEBghWKLYCKfVPiSGuvR2MrerWGDMfCfoqQGSEM3b4qp2JYWiPm5mEE5N8H4cDz8M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mpRjfbfHBPvJHnR4zHM42YHUQxkoLpAKj5\",\n \"pubkey\": \"tpubDA9GDAntyJu4yP9Xfw1EFKpB5TzHuKgFaJqDtzzWZfwHLop46tZx259YqiftMR44arby9LLxnRh8Fbra56Lcu1RmSKdbGCChVrvsL2fbTH2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqaXCZuvX77HucuDgiuSUkC14UMsdGtyZx\",\n \"pubkey\": \"tpubDA9GDAntyJu4jqGQ2KMNkxMsH79Y6ogpRhyVBxzag6RZUfaBqshU5TrSuUhT1petnnjQqLx8LJqGjsuyZHAS2Qvc38HGYuRbfbFrJb6gvnN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"pubkey\": \"tpubDA9GDAntyJu4UG7hmpsFoXacfoXLdgsGNTKdEzL4WxSewUKnMXgXeiAw1FGB89fkd4g8hqxcmBRPj717ZVVuiJMqQNe1m3PqdryQoLoAQgT\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqmkDpc9ThN7usQcKNUP7KetexXoDBTtFH\",\n \"pubkey\": \"tpubDA9GDAntyJu4MUgofZfyXXbgbzkba8tAa4GZuNECYkHwmd88qvrBkVxaLsKuoWQy94UaqNHCGgZLNsRoVPHMEb6Bp7aDT38QJYRzewvdc44\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqp16YnzyJKTo6LVCX84TFRQhYUbNen5oL\",\n \"pubkey\": \"tpubDA9GDAntyJu4VhLGgWVeDX3eCcaKgLQGBs36yuT1NYJgCkNQWarxqT1And66RbcrFfDUy2CL33NB8DUPUeppRYqWk7aMrQvzrFvM4K6FAAF\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mrNgBAWPKFa5MYEEdZbLzez8Vcqv9wbSR2\",\n \"pubkey\": \"tpubDA9GDAntyJu4TWs8RkfA7DAz5V5Ggh8jRGuAz5n1Goz2yBpEaU7fk1aS7NmKrcasu6bpMAA9bN8LvRHkJjyKfyDkcEQt15DFif5c8hdSe2d\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mrTcaNQy9UBPrzsNsssGwGjvqfgxK73mSw\",\n \"pubkey\": \"tpubDA9GDAntyJu4JmLwsYJvGiVDXHXNNyogLine truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfYNAfU3cTUGWwy4aG9MLnFaDF8VcceF5e\",\n \"pubkey\": \"tpubDA9GDAntyJu4K6z8Bsi95GPw5FWeyh1MMNxN7WLyhZSHRHAQ1eHWmTur1ULo7Gqa2iS1L9Rc2w2TLCXZsiN6tfX4xfkYhzRboirfSpJygNU\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfe2yWquHbZGuzZBcnM1h7ezpDpkXCTySN\",\n \"pubkey\": \"tpubDA9GDAntyJu4EvpC1MceQmRCKi8iYFdMU5pyB2HfXGuyBksrcS5qGhdPRxN5peuYKv77T4g9XePbaEHgbfxkzacfComAjRisbHA8qJgVX1h\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfwN3xEhEbjUTLMRx2sJd1FTmexU1rPu9s\",\n \"pubkey\": \"tpubDA9GDAntyJu4J6SvmJM5env2f124q5Y32CCUMA4KYt249iQJHTz1H4HkY2sLMUqssgBKU7BXPPbc7U2ZQYtXPvosRvzJMstsnnT36R3XS8R\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mhgKgpRQ9B8JhHYN4f77ejB3eJqAEHPYiQ\",\n \"pubkey\": \"tpubDA9GDAntyJu53Buf37KHfs7rKaekLy9QbuZwerEX6irDq1m7ojfxPW2QkJJDVCQYgKRmngv6otY3batqV2h8xQXGMsPeqreJJxdBPTAwUEL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mhqg6NA2M9T8dPwiuQcVuG61sQSBbSp9Ls\",\n \"pubkey\": \"tpubDA9GDAntyJu4NY6xbhXCVj1knLFWfjeNd8xxn5cRY3rzK1kiVJTiHpNztmXukKSf3Pu2Sc28x6WZ6hZrBxawK9njdP1siARKa64AjeEw7XY\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mixdDvkzVtMhHxP455y3U9BxPVUYpVqfGJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4MvKEP6pFaqQgqmjQ4iYq5D6a8SdnScHKpRUXDKWdxXNskP3nd8HrtCBJZPoTSSMvC4RayuvLaqKnqLPgaNukfbr73XARXCn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mkA1WgwFbgchsdEq2BKmYWeaQxL6FjCW45\",\n \"pubkey\": \"tpubDA9GDAntyJu4sc9ziqCDTS54EHH5ki9uJ1YfmjoR7zeJccgXtVm5yQxV2nA1Y6SS9HxFzBtDquSbKK8quyGGGSZWvEK1dQstRfzbGANi3UN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mkvJ8MD3DX7SsBbJVgsVWit7KSxkmNvP4m\",\n \"pubkey\": \"tpubDA9GDAntyJu4pz8ia68bFAEZ3dHR3CYVvtafJbCnpQWsB3SFCPBgfU9VdJQjnh7hkqk81KoQ87VLJyW3HydAfzUzscorstE3Fu3RrL6m8nu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mnJVfoJKGW5QwTAxAKUogiStGqGMi9HNy5\",\n \"pubkey\": \"tpubDA9GDAntyJu4RBBie6encrd8Y8A68DZ8FWfKVGCj8Be5PVkdVLyfV48vW1p8ee33qTcBtELUPi6g12JFfFbEg1Sw5JF5k8HGAp42w3We18X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mnUehAF1b4RfdyxmCLXj4jp7VU3DpiEgNb\",\n \"pubkey\": \"tpubDA9GDAntyJu4XHGJptXuRsUTHWwARWHqTbhddU8kA66V8yqs4nywt1HJbhaAySMWRra2nN5Ajmxf1egHqDZo1WRpAySbNh4UPkYshpwsFc8\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mpCcvL57WTbWJjFtygEVj3t8G4aphqZvT6\",\n \"pubkey\": \"tpubDA9GDAntyJu4LiJmctWWofyrehLxAM5aQ7TS9W5dufVszQDBejoZHpJVuRV4sdwzxZ2XAeNPafdscD3YfcNE923aexNx6gjCwM2PfQv1fJq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"pubkey\": \"tpubDA9GDAntyJu4GmAPiKBUWoGj6C2EMnmgtV6CbTgpsS9t2BZqVJqqaKvcbPoiSadXghaMddU4NMBzaGqverv2k8Y46ycHBafFzj5rz33ni4z\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"ms6a57pGmU4AYCKt47Coy9m8bZ6ANyBbY8\",\n \"pubkey\": \"tpubDA9GDAntyJu55r3BFjh4XXdzUc3AmBxNng6CYLm5H2Ktnq8QuKC4TKmGCrcnFhk9iCShyGXLLMrFHeezunFzRfUDNsrxTAevdojYEp2hDW2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mu56hCrA8M5BWCHhkmQrh7rqWkK7QRs16T\",\n \"pubkey\": \"tpubDA9GDAntyJu4vpqWb4x2iyLRshPjnTsatFwPDuzSnPrQV1uHCHWGNi8jsvRu7jnPcnLWQASh3amX3ezDwxeKX4DdYoXaUYzzpmPGkXb2RGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"muTpCvgtsoHyckenmY2xomphtAGH5kLEJS\",\n \"pubkey\": \"tpubDA9GDAntyJu4jR3pxJ5zGLzow77PCeNNzaTaFTGfCeQJN4pDqouPWsmagQ6MBUENszEBc8oo4RCRTH8j26Mas7d5p8SBS1sziWjfcx6YkpA\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"muXAwAWJ4ZmhRsce8AfDzLBBsS7Ji8UuHg\",\n \"pubkey\": \"tpubDA9GDAntyJu4UKVpFxLDPz4oLNzAM56fKrBHNjt9tDBgMYGGU9NGTXiMhtDTnuZcS4qaxzeDh1QkqitgX22sjBueJoaqBzXiDX6Da4BdhWa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mwtoiYVnswqRLUz7mmng3f8NPNXSN4AWxW\",\n \"pubkey\": \"tpubDA9GDAntyJu4dYBRhCysuYpELVPDMx3iLine truncated
},
{
"title": "List addresses in specified account",
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mh3DYavDQy1HjjwZ4M5SvpWhjH8Mp2kzxZ\",\n \"pubkey\": \"tpubDA9GDAntyJu4m2ijY3iNheH7D1fL9hmuR8UWq35TGe1EyibBCk7P8ZQydMSAbkg8Pnmp8EiiNxKXM8cRMx65u9aTyBJ2xcgDExG3mrcvmgo\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhXfHBzEwXSWKBo51EwJYgzUt3Efxgcfhn\",\n \"pubkey\": \"tpubDA9GDAntyJu4Q4HUHsde1WRcXbgMgqV9SMy4WPobCcJFD86zc2xZbB1AmbduXVzLgmV4HiAKTGx7PpuA7664PAusBpJLjYVzSYtY9QBf2Xy\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhdMWKT6mow4hMXDRxry61rbrSMhsMtWMb\",\n \"pubkey\": \"tpubDA9GDAntyJu4KX2wCdBebMNduc3PczdrmTX76Whpf833Lb5Je67J1ErxNUkheg4or7XDjiowCGvyBi5KRaxXwug9gNLKmZy4paqPkPoKZxk\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhhf8ngREDKkkwRajFWwNxiXkCjLJJvTxb\",\n \"pubkey\": \"tpubDA9GDAntyJu4y4cHsQPTUzh3489Ag6idkVyCMJ93Aoo7XBBZFvckxAPHhDqHxDJnt2ismfMtJPMn1RfuyfhvaJm1YxMW2EixErUZX9xU77L\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mhxqLov5QDNMBmehjWGdAY5cMznq8ddmZY\",\n \"pubkey\": \"tpubDA9GDAntyJu4c8eApp8CiFXXPzmiyeYxYJ95wub9gooM2pfSbseSQJGat32sJAboKYb54kawSJzGTFY74yeXmCJQv1TG3XSK9rxRxzRFTSk\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mioPgTrtovHJCHr2yv2N5AVRVd4qCodvoG\",\n \"pubkey\": \"tpubDA9GDAntyJu4dDtWkgAkc22vwBUJMgDwRGuZjfBwdAQ8KqzC9TZJ5UjEQSVRM74VHCHR3nzqWG6eA7jqoLhmfBQQbZnjtKYkWF2v4hcps9M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mjYXUu3nt8omp36T2xDgm2r9ZaRZQr6hXj\",\n \"pubkey\": \"tpubDA9GDAntyJu4NS5vfRcFe8ns88jnY8pkZfxBZWdSZkBCpvKtFAQXPZQYeaz5mTAx8ZQ4NiT9BvQPhCmNXxr7hCeP86pC6PvSSLJd6UBczxa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mkKKAS933HDkpeSdSZqAQdYYgW9iGtG7JH\",\n \"pubkey\": \"tpubDA9GDAntyJu4ozhrXc2NoPwskujYa4qYe2qmeC6uuSmhFcTJsTTAteMedxF58FRq4VnbPHFbVyiMFRJD2nzZuZsyohqVwjDFbG2Dhqsig1W\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mknTbMjvqnAv9fNjySws6k3goYNeXh1J3i\",\n \"pubkey\": \"tpubDA9GDAntyJu4HQG2pcos48Sr92bwezWAr6kSN85J6miZfeXwAmoDGUfXU9TaqK6BjumA8KU5EzbSvqn1Uqg6xbZ3K1Xxc3uQtSs7jbnBctS\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mmMCeuzgtfnqLeraJ722EG95tqTc8E3Wdd\",\n \"pubkey\": \"tpubDA9GDAntyJu4F7ympoEe6cMs1BLPmQ1emwrH7nzKZGvEBghWKLYCKfVPiSGuvR2MrerWGDMfCfoqQGSEM3b4qp2JYWiPm5mEE5N8H4cDz8M\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mpRjfbfHBPvJHnR4zHM42YHUQxkoLpAKj5\",\n \"pubkey\": \"tpubDA9GDAntyJu4yP9Xfw1EFKpB5TzHuKgFaJqDtzzWZfwHLop46tZx259YqiftMR44arby9LLxnRh8Fbra56Lcu1RmSKdbGCChVrvsL2fbTH2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqaXCZuvX77HucuDgiuSUkC14UMsdGtyZx\",\n \"pubkey\": \"tpubDA9GDAntyJu4jqGQ2KMNkxMsH79Y6ogpRhyVBxzag6RZUfaBqshU5TrSuUhT1petnnjQqLx8LJqGjsuyZHAS2Qvc38HGYuRbfbFrJb6gvnN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqfwTkyvQ4BZxnFevJCVxhWWmuU16irkw2\",\n \"pubkey\": \"tpubDA9GDAntyJu4UG7hmpsFoXacfoXLdgsGNTKdEzL4WxSewUKnMXgXeiAw1FGB89fkd4g8hqxcmBRPj717ZVVuiJMqQNe1m3PqdryQoLoAQgT\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqmkDpc9ThN7usQcKNUP7KetexXoDBTtFH\",\n \"pubkey\": \"tpubDA9GDAntyJu4MUgofZfyXXbgbzkba8tAa4GZuNECYkHwmd88qvrBkVxaLsKuoWQy94UaqNHCGgZLNsRoVPHMEb6Bp7aDT38QJYRzewvdc44\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mqp16YnzyJKTo6LVCX84TFRQhYUbNen5oL\",\n \"pubkey\": \"tpubDA9GDAntyJu4VhLGgWVeDX3eCcaKgLQGBs36yuT1NYJgCkNQWarxqT1And66RbcrFfDUy2CL33NB8DUPUeppRYqWk7aMrQvzrFvM4K6FAAF\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mrNgBAWPKFa5MYEEdZbLzez8Vcqv9wbSR2\",\n \"pubkey\": \"tpubDA9GDAntyJu4TWs8RkfA7DAz5V5Ggh8jRGuAz5n1Goz2yBpEaU7fk1aS7NmKrcasu6bpMAA9bN8LvRHkJjyKfyDkcEQt15DFif5c8hdSe2d\",\n \"used_times\": 0\n },\n {\n \"account\": \"mgKc9YXykCnz5Mi1fbEW6pFKsuzTAXkJjY\",\n \"address\": \"mrTcaNQy9UBPrzsNsssGwGjvqfgxK73mSw\",\n \"pubkey\": \"tpubDA9GDAntyJu4JmLwsYJvGiVDXHXNNyogLine truncated
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"}}' http://localhost:5279/",
"lbrynet": "lbrynet address list --account_id=\"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfYNAfU3cTUGWwy4aG9MLnFaDF8VcceF5e\",\n \"pubkey\": \"tpubDA9GDAntyJu4K6z8Bsi95GPw5FWeyh1MMNxN7WLyhZSHRHAQ1eHWmTur1ULo7Gqa2iS1L9Rc2w2TLCXZsiN6tfX4xfkYhzRboirfSpJygNU\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfe2yWquHbZGuzZBcnM1h7ezpDpkXCTySN\",\n \"pubkey\": \"tpubDA9GDAntyJu4EvpC1MceQmRCKi8iYFdMU5pyB2HfXGuyBksrcS5qGhdPRxN5peuYKv77T4g9XePbaEHgbfxkzacfComAjRisbHA8qJgVX1h\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mfwN3xEhEbjUTLMRx2sJd1FTmexU1rPu9s\",\n \"pubkey\": \"tpubDA9GDAntyJu4J6SvmJM5env2f124q5Y32CCUMA4KYt249iQJHTz1H4HkY2sLMUqssgBKU7BXPPbc7U2ZQYtXPvosRvzJMstsnnT36R3XS8R\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mhgKgpRQ9B8JhHYN4f77ejB3eJqAEHPYiQ\",\n \"pubkey\": \"tpubDA9GDAntyJu53Buf37KHfs7rKaekLy9QbuZwerEX6irDq1m7ojfxPW2QkJJDVCQYgKRmngv6otY3batqV2h8xQXGMsPeqreJJxdBPTAwUEL\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mhqg6NA2M9T8dPwiuQcVuG61sQSBbSp9Ls\",\n \"pubkey\": \"tpubDA9GDAntyJu4NY6xbhXCVj1knLFWfjeNd8xxn5cRY3rzK1kiVJTiHpNztmXukKSf3Pu2Sc28x6WZ6hZrBxawK9njdP1siARKa64AjeEw7XY\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mixdDvkzVtMhHxP455y3U9BxPVUYpVqfGJ\",\n \"pubkey\": \"tpubDA9GDAntyJu4MvKEP6pFaqQgqmjQ4iYq5D6a8SdnScHKpRUXDKWdxXNskP3nd8HrtCBJZPoTSSMvC4RayuvLaqKnqLPgaNukfbr73XARXCn\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mkA1WgwFbgchsdEq2BKmYWeaQxL6FjCW45\",\n \"pubkey\": \"tpubDA9GDAntyJu4sc9ziqCDTS54EHH5ki9uJ1YfmjoR7zeJccgXtVm5yQxV2nA1Y6SS9HxFzBtDquSbKK8quyGGGSZWvEK1dQstRfzbGANi3UN\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mkvJ8MD3DX7SsBbJVgsVWit7KSxkmNvP4m\",\n \"pubkey\": \"tpubDA9GDAntyJu4pz8ia68bFAEZ3dHR3CYVvtafJbCnpQWsB3SFCPBgfU9VdJQjnh7hkqk81KoQ87VLJyW3HydAfzUzscorstE3Fu3RrL6m8nu\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mnJVfoJKGW5QwTAxAKUogiStGqGMi9HNy5\",\n \"pubkey\": \"tpubDA9GDAntyJu4RBBie6encrd8Y8A68DZ8FWfKVGCj8Be5PVkdVLyfV48vW1p8ee33qTcBtELUPi6g12JFfFbEg1Sw5JF5k8HGAp42w3We18X\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mnUehAF1b4RfdyxmCLXj4jp7VU3DpiEgNb\",\n \"pubkey\": \"tpubDA9GDAntyJu4XHGJptXuRsUTHWwARWHqTbhddU8kA66V8yqs4nywt1HJbhaAySMWRra2nN5Ajmxf1egHqDZo1WRpAySbNh4UPkYshpwsFc8\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mpCcvL57WTbWJjFtygEVj3t8G4aphqZvT6\",\n \"pubkey\": \"tpubDA9GDAntyJu4LiJmctWWofyrehLxAM5aQ7TS9W5dufVszQDBejoZHpJVuRV4sdwzxZ2XAeNPafdscD3YfcNE923aexNx6gjCwM2PfQv1fJq\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mqk1FomiNA88HZrxNP7Gc79TJ8D3QoXRfw\",\n \"pubkey\": \"tpubDA9GDAntyJu4GmAPiKBUWoGj6C2EMnmgtV6CbTgpsS9t2BZqVJqqaKvcbPoiSadXghaMddU4NMBzaGqverv2k8Y46ycHBafFzj5rz33ni4z\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"ms6a57pGmU4AYCKt47Coy9m8bZ6ANyBbY8\",\n \"pubkey\": \"tpubDA9GDAntyJu55r3BFjh4XXdzUc3AmBxNng6CYLm5H2Ktnq8QuKC4TKmGCrcnFhk9iCShyGXLLMrFHeezunFzRfUDNsrxTAevdojYEp2hDW2\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mu56hCrA8M5BWCHhkmQrh7rqWkK7QRs16T\",\n \"pubkey\": \"tpubDA9GDAntyJu4vpqWb4x2iyLRshPjnTsatFwPDuzSnPrQV1uHCHWGNi8jsvRu7jnPcnLWQASh3amX3ezDwxeKX4DdYoXaUYzzpmPGkXb2RGD\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"muTpCvgtsoHyckenmY2xomphtAGH5kLEJS\",\n \"pubkey\": \"tpubDA9GDAntyJu4jR3pxJ5zGLzow77PCeNNzaTaFTGfCeQJN4pDqouPWsmagQ6MBUENszEBc8oo4RCRTH8j26Mas7d5p8SBS1sziWjfcx6YkpA\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"muXAwAWJ4ZmhRsce8AfDzLBBsS7Ji8UuHg\",\n \"pubkey\": \"tpubDA9GDAntyJu4UKVpFxLDPz4oLNzAM56fKrBHNjt9tDBgMYGGU9NGTXiMhtDTnuZcS4qaxzeDh1QkqitgX22sjBueJoaqBzXiDX6Da4BdhWa\",\n \"used_times\": 0\n },\n {\n \"account\": \"mhEEGvZLKogxRp6mHgbWjfKXmN9eFF7xnV\",\n \"address\": \"mwtoiYVnswqRLUz7mmng3f8NPNXSN4AWxW\",\n \"pubkey\": \"tpubDA9GDAntyJu4dYBRhCysuYpELVPDMx3iLine truncated
}
]
},
@@ -900,7 +808,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\": \"msmeprZxgFfL1KuUrARTqbH3wFLeNMQ59j\"\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mfyjzur5kkyBg5YDhx4UiAabb2rx2xMsE3\"\n}"
}
]
}
@@ -950,10 +858,10 @@
"examples": [
{
"title": "Delete a blob",
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete 0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"\n}"
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet blob delete 04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"\n}"
}
]
},
@@ -1031,7 +939,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 \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"084b3a361ef86bd694e1fd772a9b51d1c2fc1ca3ba80427669963d7d1f7a6e7f010bcd3aca0400dd19ce73fb639db834\",\n \"5014600663c933ac4740fc7283ab7953ed6ffce48291b2d7d49c67416ae24ef2fb35cf2138f5f514e009918dca49b516\",\n \"811232e591a3ba6ce8835b39425a26d164c06dece3084115f4cfc18c3b6e00c61c96116a05e293ad0f7f3889612045ef\"\n ]\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"dc724381cf9fe8f3e0a0a971345dd83ebe7e6e76089bc34c7b94bc3ab00daa23f8de7a7cc35c0f1ade6bbfdb269328d5\",\n \"776756ff093fa5d222076c94f4b0e167e1f189aaa063deb3700ac4ffcbb5d8f50888f02e32e462115305aa2c48520885\",\n \"e70b50e665ea448a5fd1e082c133528259b653b95c83b896e913ebba66daa0cdc63ffbd686bfe5621a8db21c9c9ff591\"\n ]\n}"
}
]
},
@@ -1112,10 +1020,10 @@
"examples": [
{
"title": "Abandon a channel claim",
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon a97186b2b68427e475452ebe9bcd9475be772d49",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e5651635521e54478bc33114823f05aa2bb8392990064f7116e46aad3b6f2df3000000006a47304402201870a23364df775eb87de3c1e8aee0b29db40a5ad5594313b9fadf230b4a12f2022058c07c2320f27df493df58107dadef6a0620536146228d2585b58b6e4d609a430121030de1caa208dfc96497239774573b6e09495211eeadcdb8eeae182449df5df28effffffff0134b7f505000000001976a914cf9252ceec86e2ed1e29b2c6084677f94718db6788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzSVTViGNgTirETKQguZJ2XXXBA8pU8irF\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"97f949a19bb776bb231219d0fa49d7a478788a4a3aaf0023c8bafa25f2c01768\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"97f949a19bb776bb231219d0fa49d7a478788a4a3aaf0023c8bafa25f2c01768\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet channel abandon 2b9f04f6fbbb1aaf58007e3a5167339f789c41d3",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012f48c527618951adc73e1347b06565d97d8a51ee2d169f21ab2ea21f9b763381000000006a473044022010d5d5a0382513e26981376da72e3a69b4c283af61602c9f6b2933e12cd93e5e0220341dd399bdc80cbd94b04f7db6163732a98420d3b18d5ee3181955deb3263d37012102c78c4b466b16d99ec2a0c38c236925b1fa4e73918bb740ba9c2dd17a11742259ffffffff0134b7f505000000001976a9143c2edd73c3f26e301dfe98820974e69aad8812ea88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mm1AyocQcxBmZUm8X4KN7w4yM8m96J9FY2\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"08d10283a51c0c520558b8ebf71f7b85fd1f4e75f9f0a94c7c5cec5101e106a9\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"08d10283a51c0c520558b8ebf71f7b85fd1f4e75f9f0a94c7c5cec5101e106a9\"\n }\n}"
}
]
},
@@ -1245,14 +1153,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\": \"010000000183055a4c89811b824f2b3df5e19d30e87520c54f9010f26f801f410e5ab89902010000006b4830450221008ba32309c99659f78c473c5423143ace5a0a695f635e15c39a4eac8e3c674b5a022066bc79ff2f009d772a3ed24fa4d4dd950dcb7f90595d3fb19cbadfd9e4acf85c012102db68f57dd3484b396c99a0a8b022cc59dc23be840cdf6ceddc9497f8d4c6b001ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b326d7576a9149210215b08374dda7ce8acedc1898685aeed07cf88acc462a029000000001976a9144d72fa0b9f5e2582016178d6d7e108f9822e13d788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1cCRBMAxWtrVzQJN9T8syLDRA131yKd8U\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257569,\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\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#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": null,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mnaU4YnkYxRt1uPikPW4gGEg2EVQiktq5f\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011c627e57c603b0773da94821755027f31aa215acf00628a34bd61d913e3438e4010000006a4730440220526501acbddf7b8193faf75f58bfd6fa2c5abf4d2e1f4f9c086cb21cc42884c80220383f4d9ed6b43cf8c2b7026359b798b007f9652c508fdd5eef51c7866f06a3890121039d0cd4ef1ba1be927fcf33368be83a3de89ba2039efd987087296da4c1e4e557ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec6d7576a914b149fb8f0354ef198b41d7dc59ed9a4c4065b37988acc462a029000000001976a9146a7a5af2adcb0e498acbc9c1580ba58c8423edf488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4BkgTZV2xNeusnQR7zDz4qNYsqMScMFpN\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238737,\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\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#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": null,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mqDxVnFJechdp4F4cVHKt5onNecc2dYGQP\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\"\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\": \"0100000001e5651635521e54478bc33114823f05aa2bb8392990064f7116e46aad3b6f2df3010000006a47304402207b98ad6a33c436f0273016c1a0cce2510f04cf151f5dd5026a15bdb771e113bc02203dbbb819e5ab16df41b851b9934abe2e41e1125ea4b129ef8eb7f387c817f1c001210253a945780e4b1c073d7956fb805b62089f3e03b8e322aa4c6770bb2350c2bcc1ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a034200042e95e156b3f353d8cb1b89a72928a7d70239faf4db01322acc2aa9cc8945db264d25b1132c3804630cfce3f79c4e248f09f77cae174b21d238f5e49389b0008c121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a91486692a9f6363a0c5bf84e33011403f70aa7e485a88ace221d305000000001976a914dff543e45fd598cc5bbd13303b1c4eeb4b51de2a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2mhUvRK1gyM3fenJZwiwe3f618wirt3xP\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msmeprZxgFfL1KuUrARTqbH3wFLeNMQ59j\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3d77cb372b7ae9a93929d7163ac24d3ccee7f85b\",\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#3d77cb372b7ae9a93929d7163ac24d3ccee7f85b\",\n \"timestamp\": null,\n \"txid\": \"b5855b69cbd3f9c0905844b42d175a749294eab9a0afb055b43be09860459006\",\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\": \"3056301006072a8648ce3d020106052b8104000a034200042e95e156b3f353d8cb1b89a72928a7d70239faf4db01322acc2aa9cc8945db264d25b1132c3804630cfce3f79c4e248f09f77cae174b21d238f5e49389b0008c\",\n \"public_key_id\": \"n3zbsKYmNzKUW1a1L1zrRvCwxRRv9CyESi\",\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\": \"n1w8oA5Pz1ZHMyUjWcgq8KvuiXCBqH7mcy\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"b5855b69cbd3f9c0905844b42d175a749294eab9a0afb055b43be09860459006\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"b5855b69cbd3f9c0905844b42d175a749294eab9a0afb055b43be09860459006\"\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012f48c527618951adc73e1347b06565d97d8a51ee2d169f21ab2ea21f9b763381010000006a4730440220096be41209cf2cf7a326416b44eeb7b90d2ee5e66ce2b6cf23c4c4e88d0bc32a02207f8511af071028d4d1c18b2c8d24da624a601705e103579a08dbe0ac79ffe9ca0121038b4b78c5608ac2c38a87dc75a65583ebec0710d86234047aefd80c58bbc47549ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004913516977130c11c007f3f03b989e285d7819e87ef0081db836ea77f4f6b30ae72e142d489fb0f24dceaed1b512e588de70186df44a0a0b2de895454a57d758f121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9148d669513928185cd6d120aff9f7867d34db8505f88ace221d305000000001976a914e86ef8191aa516e8a21723806345a0cd1d0f2ae888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvnQKeWXrBFsnman3ekbTYfM9M57TD6JnF\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtQcTeVvcERC4MfPcV4uqa5cxVD6wDnKW3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"781d79c6676a8c32f1a29c5841f0772e2c68e11a\",\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#781d79c6676a8c32f1a29c5841f0772e2c68e11a\",\n \"timestamp\": null,\n \"txid\": \"be18fe4749b0225be27839ebb6463fb3c8e42968bbf3f81c7c969c163ab1d0ab\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004913516977130c11c007f3f03b989e285d7819e87ef0081db836ea77f4f6b30ae72e142d489fb0f24dceaed1b512e588de70186df44a0a0b2de895454a57d758f\",\n \"public_key_id\": \"mtmCqZ6buBWvrSybGwujzooVaCb8tNeM5y\",\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\": \"n2hwzq3j937oBARJtLLWCagiq69Vu9ZuGi\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"be18fe4749b0225be27839ebb6463fb3c8e42968bbf3f81c7c969c163ab1d0ab\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"be18fe4749b0225be27839ebb6463fb3c8e42968bbf3f81c7c969c163ab1d0ab\"\n }\n}"
}
]
},
@@ -1344,14 +1252,14 @@
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
},
{
"title": "Paginate your channel claims",
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"lbrynet": "lbrynet channel list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\"\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\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
},
@@ -1458,7 +1366,7 @@
{
"name": "account_id",
"type": "str",
"description": "account to use for holding the transaction",
"description": "account in which to look for channel (default: all)",
"is_required": false
},
{
@@ -1508,10 +1416,10 @@
"examples": [
{
"title": "Update a channel claim",
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"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 a97186b2b68427e475452ebe9bcd9475be772d49 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"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\": \"01000000024afa8968a08182a280807edba82b6eafc89ca240ea7dc21e48d726f4e01f4418000000006a47304402201d3a2eef05b0a904c47040312aaa75af035383a264602b33342f58a6c1eae54d022077a2a60df78e5e80b0fb1f6f59b4fc3562333d2c3fa327cdb24faa8d20ee6dac0121030de1caa208dfc96497239774573b6e09495211eeadcdb8eeae182449df5df28effffffff271023c07c5967a2f992c3a99b4e06d74c5027e93ade19fb772ffac7a76dc6c4000000006a473044022021bcf9a6379c269f06d48d61262da20e5569061fa948f1c1f6e8623ff6e91c900220261bc22e56bfc79b65a048f8072d68419ff231278ca38571eb1a5de9bf137c58012102020138250008723cdab6c208879203cf57af20a66cd656a5e360572d05acbf67ffffffff0200e1f50500000000a6b708406368616e6e656c14492d77be7594cd9bbe2e4575e42784b6b28671a94c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32420b4e6577204368616e6e656c6d6d76a9149210215b08374dda7ce8acedc1898685aeed07cf88ac6ebeea0b000000001976a914e924841404b0c038765a0c54936ae4f24826301788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mhVhh3v1qx43icPgGYJBwT2gghqKRFfzN7\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1569257569,\n \"txid\": \"c4c66da7c7fa2f77fb19de3ae927504cd7064e9ba9c392f9a267597cc0231027\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\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#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": null,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n2mhUvRK1gyM3fenJZwiwe3f618wirt3xP\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\"\n }\n}"
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"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 2b9f04f6fbbb1aaf58007e3a5167339f789c41d3 --title=\"New Channel\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"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\": \"0100000002207a97258d57b51c955bb16de34d3fd6a88e04df6a6cb6741c8860e40e7a1c99000000006b483045022100ec88dc1cf42bd93120fc907f2bf2c2b1c90d20b29f15ac0da49fd1d94c07623502203f1b2a5f67f486b14c1c3ba06bcc4980c0576b077021ff60765adeb43c23e090012102c78c4b466b16d99ec2a0c38c236925b1fa4e73918bb740ba9c2dd17a11742259ffffffff82c338cc89e50612eabffd2bd367d35a884966281fe4c49945f20a9f0cb29180000000006b4830450221008e3eb18f2c5a2b6b8d9807bd6ac89c59e2d9ee9c98b0ba928bd263aead7570970220255d44758064c69593e1d6677af51aa95901d6438daf1bed21c386a87b5c3a180121020ae5fee00a2ea92d92c92ca8eacea85ea59bbc2fa6adc47a6093f13e23a50b22ffffffff0200e1f50500000000a6b708406368616e6e656c14d3419c789f3367513a7e0058af1abbfbf6049f2b4c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec420b4e6577204368616e6e656c6d6d76a914b149fb8f0354ef198b41d7dc59ed9a4c4065b37988ac6ebeea0b000000001976a914a775da52baa7e417481a5aa7e1765040b973a85288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"has_signing_key\": true,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mhK6L59USiby9g31qP2JpNm2QFjSvzMhU4\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1571238737,\n \"txid\": \"8091b20c9f0af24599c4e41f286649885ad367d32bfdbfea1206e589cc38c382\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\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#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": null,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mvnQKeWXrBFsnman3ekbTYfM9M57TD6JnF\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\"\n }\n}"
}
]
}
@@ -1556,14 +1464,14 @@
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
},
{
"title": "Paginate your claims",
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"lbrynet": "lbrynet claim list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\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}"
}
]
},
@@ -1694,7 +1602,7 @@
{
"name": "support_amount",
"type": "int",
"description": "limit by supports and tips recieved (supports equality constraints)",
"description": "limit by supports and tips received (supports equality constraints)",
"is_required": false
},
{
@@ -1843,14 +1751,14 @@
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --channel=@channel",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a/astream#e\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\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\": 1569257570,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"short_url\": \"lbry://astream#e\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\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\": 1569257569,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"short_url\": \"lbry://@channel#a\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#c\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\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\": 1571238738,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\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\": 1571238737,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\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\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
"lbrynet": "lbrynet claim search --name=\"astream\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a/astream#e\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\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\": 1569257570,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"short_url\": \"lbry://astream#e\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#a\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\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\": 1569257569,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"short_url\": \"lbry://@channel#a\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2/astream#c\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\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\": 1571238738,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\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#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"short_url\": \"lbry://astream#c\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#2\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\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\": 1571238737,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\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#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"short_url\": \"lbry://@channel#2\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
}
]
}
@@ -1992,7 +1900,7 @@
{
"name": "visible",
"type": "bool",
"description": "Select only Visisble Comments",
"description": "Select only Visible Comments",
"is_required": false
},
{
@@ -2091,9 +1999,9 @@
"examples": [
{
"title": "Delete a file",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"}}).json()",
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file delete --claim_id=\"c011186b47f0499392fdd22d73a2ec5426b8556f\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
}
]
@@ -2189,7 +2097,7 @@
{
"name": "comparison",
"type": "str",
"description": "logical comparision, (eq | ne | g | ge | l | le)",
"description": "logical comparison, (eq | ne | g | ge | l | le)",
"is_required": false
}
],
@@ -2200,14 +2108,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 {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"0e6b81fe73602d02ed07933b0206b959\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01492d77be7594cd9bbe2e4575e42784b6b28671a97feea119e096fecb7cb354773d7583f38083842dccac76f7b8ddd2be2fc1fb4474693226de36237515a582f1734eaa25c6968af898c3ed913144d0fbab1398b20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"dbea4542edea266956561fb9e0e13acfc63785d5777f33ea1a95c4e5979eac84e55dbf49e338b264b5fccb1c9f73e025\",\n \"stream_name\": \"tmp7rhvd_bl\",\n \"streaming_url\": \"http://localhost:5280/stream/0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"suggested_file_name\": \"tmp7rhvd_bl\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"written_bytes\": 0\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"e37c0dd6aced3f7ffc81bbaf3020c7f9268fdd96\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"886740828b916b381e866555eefd5095\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvRsX8iHAcN11xn8c7quz9dLnF2HVgzrUV\",\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\": \"1569257546\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpriatijmi.png\",\n \"sd_hash\": \"084b3a361ef86bd694e1fd772a9b51d1c2fc1ca3ba80427669963d7d1f7a6e7f010bcd3aca0400dd19ce73fb639db834\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/thumbnail.jpg\"\n },\n \"title\": \"Blank Image\"\n },\n \"mime_type\": \"image/png\",\n \"nout\": 0,\n \"outpoint\": \"3597b006e225b258925585d5e836f636ef211772d9bb13a97531b23437cfacfb:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01492d77be7594cd9bbe2e4575e42784b6b28671a9a63269cb7ec12a469485c87714ba0be91951c4ad898c3f273b11d4030629958fc076ff49005b33177ba9554aed703717573d859abcb0fce2ccde7595459e0cd20ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85Line truncated
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"0fed669177b7d4889715b0522ad6f103\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d3419c789f3367513a7e0058af1abbfbf6049f2b9792102b78fcfdc53716733ffce3fca52fdeb3971fd08970bf4d1c0e1c61e1c7409b65f9ae0326773cec1417748ca581c1cbb6ecaf6f892ac84d8350cadce0fe0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"ead8d80c803c7eea3c9d6f2575b6734c93af8d6ecbbf7b19458e564d1e7f5463ae71e638d7dfdc9f57e709482bdfec3d\",\n \"stream_name\": \"tmp5h1lifqx\",\n \"streaming_url\": \"http://localhost:5280/stream/04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"suggested_file_name\": \"tmp5h1lifqx\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"written_bytes\": 0\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"9c6953cf591f7a3da181bf219c2320143da4624f\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"70db0fefb7af8e5304b321dd53d8c343\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n1CmdQDFBA3TWqx86QkV18xXkSTVMxXw7a\",\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\": \"1571238714\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpvc8a6jnd.png\",\n \"sd_hash\": \"dc724381cf9fe8f3e0a0a971345dd83ebe7e6e76089bc34c7b94bc3ab00daa23f8de7a7cc35c0f1ade6bbfdb269328d5\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n \"thumbnail\": {\n \"url\": \"http://smallmedia.com/thumbnail.jpg\"\n },\n \"title\": \"Blank Image\"\n },\n \"mime_type\": \"image/png\",\n \"nout\": 0,\n \"outpoint\": \"6176280180cf3ce74cafbd1d81674ac1e58aadfc01d719af7556d3d745525081:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d3419c789f3367513a7e0058af1abbfbf6049f2b8d658916a8071989a0988f94d43906186d08f387a2ed6054842cd633eae0c2d53b5008fd900d2a0b754b710b786f3edcc872ccfadabc91ad279bb59fa62f72f00ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85Line truncated
},
{
"title": "List files matching a parameter",
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"0e6b81fe73602d02ed07933b0206b959\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01492d77be7594cd9bbe2e4575e42784b6b28671a97feea119e096fecb7cb354773d7583f38083842dccac76f7b8ddd2be2fc1fb4474693226de36237515a582f1734eaa25c6968af898c3ed913144d0fbab1398b20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"dbea4542edea266956561fb9e0e13acfc63785d5777f33ea1a95c4e5979eac84e55dbf49e338b264b5fccb1c9f73e025\",\n \"stream_name\": \"tmp7rhvd_bl\",\n \"streaming_url\": \"http://localhost:5280/stream/0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"suggested_file_name\": \"tmp7rhvd_bl\",\n \"timestamp\": 1569257570,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"written_bytes\": 0\n }\n ]\n}"
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"reverse\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet file list --claim_id=\"c011186b47f0499392fdd22d73a2ec5426b8556f\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"reverse\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"0fed669177b7d4889715b0522ad6f103\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d3419c789f3367513a7e0058af1abbfbf6049f2b9792102b78fcfdc53716733ffce3fca52fdeb3971fd08970bf4d1c0e1c61e1c7409b65f9ae0326773cec1417748ca581c1cbb6ecaf6f892ac84d8350cadce0fe0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"ead8d80c803c7eea3c9d6f2575b6734c93af8d6ecbbf7b19458e564d1e7f5463ae71e638d7dfdc9f57e709482bdfec3d\",\n \"stream_name\": \"tmp5h1lifqx\",\n \"streaming_url\": \"http://localhost:5280/stream/04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"suggested_file_name\": \"tmp5h1lifqx\",\n \"timestamp\": 1571238738,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"written_bytes\": 0\n }\n ]\n}"
}
]
},
@@ -2324,10 +2232,10 @@
"examples": [
{
"title": "Save a file to the downloads directory",
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"0e6b81fe73602d02ed07933b0206b959\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01492d77be7594cd9bbe2e4575e42784b6b28671a97feea119e096fecb7cb354773d7583f38083842dccac76f7b8ddd2be2fc1fb4474693226de36237515a582f1734eaa25c6968af898c3ed913144d0fbab1398b20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"dbea4542edea266956561fb9e0e13acfc63785d5777f33ea1a95c4e5979eac84e55dbf49e338b264b5fccb1c9f73e025\",\n \"stream_name\": \"tmp7rhvd_bl\",\n \"streaming_url\": \"http://localhost:5280/stream/0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"suggested_file_name\": \"tmp7rhvd_bl\",\n \"timestamp\": 1569257570,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"written_bytes\": 0\n }\n}"
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"}}' http://localhost:5279/",
"lbrynet": "lbrynet file save --sd_hash=\"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\"}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": 214,\n \"key\": \"0fed669177b7d4889715b0522ad6f103\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01d3419c789f3367513a7e0058af1abbfbf6049f2b9792102b78fcfdc53716733ffce3fca52fdeb3971fd08970bf4d1c0e1c61e1c7409b65f9ae0326773cec1417748ca581c1cbb6ecaf6f892ac84d8350cadce0fe0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"ead8d80c803c7eea3c9d6f2575b6734c93af8d6ecbbf7b19458e564d1e7f5463ae71e638d7dfdc9f57e709482bdfec3d\",\n \"stream_name\": \"tmp5h1lifqx\",\n \"streaming_url\": \"http://localhost:5280/stream/04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"suggested_file_name\": \"tmp5h1lifqx\",\n \"timestamp\": 1571238738,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"written_bytes\": 0\n }\n}"
}
]
},
@@ -2416,12 +2324,6 @@
"description": "key associated with value",
"is_required": false
},
{
"name": "account_id",
"type": "str",
"description": "id of the account containing value",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
@@ -2456,12 +2358,6 @@
"description": "key associated with value",
"is_required": true
},
{
"name": "account_id",
"type": "str",
"description": "id of the account containing value",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
@@ -2496,7 +2392,7 @@
"curl": "curl -d'{\"method\": \"settings_get\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet settings get",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"settings_get\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpfhl810yq\",\n \"download_dir\": \"/tmp/tmpfhl810yq\",\n \"download_timeout\": 30.0,\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmpfhl810yq\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmppl4ona5o\",\n \"download_dir\": \"/tmp/tmppl4ona5o\",\n \"download_timeout\": 30.0,\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmppl4ona5o\",\n \"wallets\": [\n \"default_wallet\"\n ]\n }\n}"
}
]
},
@@ -2571,10 +2467,10 @@
"examples": [
{
"title": "Abandon a stream claim",
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon ebed8d1668d259c06c1d8db114e9bb8a882e70e9",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010bc09b720e2d960d7eca46a5b74fe7b08b5d0de8684f7f20cf37625c4a59ea2e000000006a473044022064a998b994d5d288ddc3e4d0580ebbfd682900c73dfab3987a0fd61c9621102a0220777e6d15708c7ff756030b4e4c1ecbeb4b6771aba6a208822f2e67e67bc3667c0121028d899c7322e1a0337ed80fd89e477907ace8681af8c4e00dabb9e475509e0568ffffffff0134b7f505000000001976a9149493b0bcc0453c5a405a0551e7ab0c3d4c14e18688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mu4ZE9o3CezNDVotsueVxX7hVVpVuUBzGJ\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"8de7ce8b74745945f3e33267a9d815608d44342ae42e0b0a5db25cc42952fba0\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"8de7ce8b74745945f3e33267a9d815608d44342ae42e0b0a5db25cc42952fba0\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream abandon c011186b47f0499392fdd22d73a2ec5426b8556f",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001075623db119ddfde5a9a713320144d9e6cb9f6ad22578f6a162c2ff2a82127aa000000006a47304402205a17ce07692e4b2a8eae031e6e760a328a09613b52690351a0fe66a49fd2955402204305ddbc2ca8325a64fb2694ecb5023dcf185ac525ea1f95b30ff6bb4ff8861b0121037754fd75d8dd6527a6e6b63fb433384953c3b777e87d157100f6f524af3bbe10ffffffff0134b7f505000000001976a91493d12c125fe496432dc7878cf1fcbc4b8a6d724e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtzYCnjFV21bDA3fPzqM7pXJF2mTgunyqG\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"34cd040b4dcb8a5c661558247d8e474ee5fc5b46366397bf49b607d79e547094\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"34cd040b4dcb8a5c661558247d8e474ee5fc5b46366397bf49b607d79e547094\"\n }\n}"
}
]
},
@@ -2775,17 +2671,17 @@
"examples": [
{
"title": "Create a stream claim without metadata",
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp7rhvd_bl\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmp7rhvd_bl",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp7rhvd_bl\", \"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\": \"01000000014afa8968a08182a280807edba82b6eafc89ca240ea7dc21e48d726f4e01f4418010000006a473044022017f22271674514adc400ff24c190f4fde0039e8d5df190689ba4e9e49d78d37a02206718dbf513256879616cab84387f831d8f20958b24f09dec014725ef2ec4a905012102d072e76ac6e165453eb5ece14fc51cb00e21226c33da5458ddbcadd3257c031affffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd6d7576a9147142d39a6e6cf052dd45c9d1e49f8a92af96fec588ac38fb9423000000001976a914f29c638960ad798dbe75fbb1c38ebb54ceb0033988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mnaU4YnkYxRt1uPikPW4gGEg2EVQiktq5f\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257569,\n \"txid\": \"18441fe0f426d7481ec27dea40a29cc8af6e2ba8db7e8080a28281a06889fa4a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\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#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"timestamp\": null,\n \"txid\": \"af2cd1f9387802b514e0ee4cd2931b23c1a36d76e23438a7f384a9be0993de2a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3dmAZZyHBtSLE11WtvrGcDAc48uXGe494\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"af2cd1f9387802b514e0ee4cd2931b23c1a36d76e23438a7f384a9be0993de2a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"af2cd1f9387802b514e0ee4cd2931b23c1a36d76e23438a7f384a9be0993de2a\"\n }\n}"
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp5h1lifqx\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmp5h1lifqx",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp5h1lifqx\", \"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\": \"0100000001207a97258d57b51c955bb16de34d3fd6a88e04df6a6cb6741c8860e40e7a1c99010000006a47304402201f110f1b75e8edf7243c30a0c2db0e48f0b6e2ce8df3f63621eb0400e8cb53f602204da34a81b68aec6f0c290d405ea2faebc517f220357ca76c90fac1bf1fac3e84012103f72a2ba59a45d0a51b41845b2cf0e87a4652b2dc5e753dbcb7cb3b3278ccafebffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b6d7576a914212135387508b03786740b73da22090129803bb188ac38fb9423000000001976a914384d1c3f371fe24d9d8858cbf420dd0241ff062f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqDxVnFJechdp4F4cVHKt5onNecc2dYGQP\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238737,\n \"txid\": \"991c7a0ee460881c74b66c6adf048ea8d63f4de36db15b951cb5578d25977a20\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\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#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"timestamp\": null,\n \"txid\": \"2baef9fce2b326e018b0e79edd85adbdf8b8218a0ba30c8dde4a72d572217ac3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkeeWWvvasih8pxvgSEkA1c2rBd49axpTc\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"2baef9fce2b326e018b0e79edd85adbdf8b8218a0ba30c8dde4a72d572217ac3\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"2baef9fce2b326e018b0e79edd85adbdf8b8218a0ba30c8dde4a72d572217ac3\"\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/tmpriatijmi.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1569257546, \"channel_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpriatijmi.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=1569257546 --channel_id=\"a97186b2b68427e475452ebe9bcd9475be772d49\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpriatijmi.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1569257546, \"channel_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012ade9309bea984f3a73834e2766da3c1231b93d24ceee014b5027838f9d12caf010000006a4730440220401085db14328afbbb36b536276a7972410bbcfdc32dd05156373b5ba64559d1022012f3657c169df9a2279ff454e369d44f70fe38a5601c05267b9027835a6429d6012102f3b69a8ec5e6110451eabf77c28f323f81e2b631eeec5cdd2cbc24390a8a5402ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101492d77be7594cd9bbe2e4575e42784b6b28671a9a63269cb7ec12a469485c87714ba0be91951c4ad898c3f273b11d4030629958fc076ff49005b33177ba9554aed703717573d859abcb0fce2ccde7595459e0cd20ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7072696174696a6d692e706e6718632209696d6167652f706e673230084b3a361ef86bd694e1fd772a9b51d1c2fc1ca3ba80427669963d7d1f7a6e7f010bcd3aca0400dd19ce73fb639db834120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728caf0a3ec053222080112196fa393d247b5cafd376fd47e450a886ebb6e9c4918b846b276188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914a393d247b5cafd376fd47e450a886ebb6e9c491888acac5e7d1d000000001976a91462a9c478ed5b1f09a70dde7043dca9f1a942aa5988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3dmAZZyHBtSLE11WtvrGcDAc48uXGe494\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257570,\n \"txid\": \"af2cd1f9387802b514e0ee4cd2931b23c1a36d76e23438a7f384a9be0993de2a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvRsX8iHAcN11xn8c7quz9dLnF2HVgzrUV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"e37c0dd6aced3f7ffc81bbaf3020c7f9268fdd96\",\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#e37c0dd6aced3f7ffc81bbaf3020c7f9268fdd96\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"3597b006e225b258925585d5e836f636ef211772d9bb13a97531b23437cfacfb\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mvRsX8iHAcN11xn8c7quz9dLnF2HVgzrUV\",\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\": \"1569257546\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpriatijmi.png\",\n \"sd_hash\": \"084b3a361ef86bd694e1fd772a9b51d1c2fc1ca3ba80427669963d7d1f7a6e7f010bcd3aca0400dd19ce73fb639db834\",\n \"size\": \"99\"\n },\n \"streLine truncated
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpvc8a6jnd.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1571238714, \"channel_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpvc8a6jnd.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=1571238714 --channel_id=\"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpvc8a6jnd.png\", \"fee_currency\": \"LBC\", \"fee_amount\": \"0.3\", \"title\": \"Blank Image\", \"description\": \"A blank PNG that is 5x7.\", \"author\": \"Picaso\", \"tags\": [\"blank\", \"art\"], \"languages\": [\"en\"], \"locations\": [\"US:NH:Manchester\"], \"license\": \"Public Domain\", \"license_url\": \"http://public-domain.org\", \"thumbnail_url\": \"http://smallmedia.com/thumbnail.jpg\", \"release_time\": 1571238714, \"channel_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001c37a2172d5724ade8d0ca30b8a21b8f8bdad85dd9ee7b018e026b3e2fcf9ae2b010000006b483045022100a33077ec29c33231ac47a049770b75ecee1d78021d6ad54f1e2aad34ee45929002207f7797f5c6dd3951eecf9f96d9e0cf90a98d337fdebb72134071d071fad53bae012102ca6f62237a93eee2192504dec55482e23ffe87699abba1635208bc368ce7d2cfffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101d3419c789f3367513a7e0058af1abbfbf6049f2b8d658916a8071989a0988f94d43906186d08f387a2ed6054842cd633eae0c2d53b5008fd900d2a0b754b710b786f3edcc872ccfadabc91ad279bb59fa62f72f00ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7076633861366a6e642e706e6718632209696d6167652f706e673230dc724381cf9fe8f3e0a0a971345dd83ebe7e6e76089bc34c7b94bc3ab00daa23f8de7a7cc35c0f1ade6bbfdb269328d5120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728bae69ced053222080112196fd7f21fdd96ca7b622fbabaeb1930b734282fa4864708edb5188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914d7f21fdd96ca7b622fbabaeb1930b734282fa48688acac5e7d1d000000001976a914b5c5cd6a0ea0a56d809d39c65403568beff49ade88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mkeeWWvvasih8pxvgSEkA1c2rBd49axpTc\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238738,\n \"txid\": \"2baef9fce2b326e018b0e79edd85adbdf8b8218a0ba30c8dde4a72d572217ac3\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1CmdQDFBA3TWqx86QkV18xXkSTVMxXw7a\",\n \"amount\": \"1.0\",\n \"claim_id\": \"9c6953cf591f7a3da181bf219c2320143da4624f\",\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#9c6953cf591f7a3da181bf219c2320143da4624f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"6176280180cf3ce74cafbd1d81674ac1e58aadfc01d719af7556d3d745525081\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n1CmdQDFBA3TWqx86QkV18xXkSTVMxXw7a\",\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\": \"1571238714\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpvc8a6jnd.png\",\n \"sd_hash\": \"dc724381cf9fe8f3e0a0a971345dd83ebe7e6e76089bc34c7b94bc3ab00daa23f8de7a7cc35c0f1ade6bbfdb269328d5\",\n \"size\": \"99\"\n },\n \"strLine truncated
}
]
},
@@ -2825,14 +2721,14 @@
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
},
{
"title": "Paginate your stream claims",
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
"lbrynet": "lbrynet stream list --page=1 --page_size=20",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1569257570,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1571238738,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\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}"
}
]
},
@@ -3023,7 +2919,7 @@
{
"name": "account_id",
"type": "str",
"description": "account to use for holding the transaction",
"description": "account in which to look for stream (default: all)",
"is_required": false
},
{
@@ -3067,10 +2963,10 @@
"examples": [
{
"title": "Update a stream claim to add channel",
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update ebed8d1668d259c06c1d8db114e9bb8a882e70e9 --channel_id=\"a97186b2b68427e475452ebe9bcd9475be772d49\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\", \"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\": \"01000000022ade9309bea984f3a73834e2766da3c1231b93d24ceee014b5027838f9d12caf000000006a473044022027e0365d3d4b0aed04a3074cd51daae1861eb6c7ec58ed32fad8ea266ba77c6902205316f06134f2491f9c2b5dc19a805d67cd5fdfd25208cdb60de2eb2a213367ed0121028d899c7322e1a0337ed80fd89e477907ace8681af8c4e00dabb9e475509e0568ffffffff0690456098e03bb455b0afa0b9ea9492745a172db4445890c0f9d3cb695b85b5010000006b483045022100c63c2ccfc3a46c530fe254ffdbf249e84d83d101d14a8f319c0feba6faabd12c02207eec3b97f925b9e5395adb2a47200be1be51fb84c9b0654271e125974b02f66d01210297f88ed7e227c68071042f2d4e46e4bee85188621f03ca954b98c2afc26e9a20ffffffff0200e1f50500000000fd2301b7076173747265616d14e9702e888abbe914b18d1d6cc059d268168dedeb4ce801492d77be7594cd9bbe2e4575e42784b6b28671a97feea119e096fecb7cb354773d7583f38083842dccac76f7b8ddd2be2fc1fb4474693226de36237515a582f1734eaa25c6968af898c3ed913144d0fbab1398b20a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d7037726876645f626c180b22186170706c69636174696f6e2f6f637465742d73747265616d32300159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd6d6d76a9147142d39a6e6cf052dd45c9d1e49f8a92af96fec588ac32a0d205000000001976a9148f15a56ee0afb3a20ac1cb520d66213240a3ac3488ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"timestamp\": 1569257570,\n \"txid\": \"af2cd1f9387802b514e0ee4cd2931b23c1a36d76e23438a7f384a9be0993de2a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp7rhvd_bl\",\n \"sd_hash\": \"0159066fc2c35a8d5d44c2245d1ac1ce668b59879a17a232ba5c4585e8052eb70079567eb5963d86adf13dadf83489dd\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1w8oA5Pz1ZHMyUjWcgq8KvuiXCBqH7mcy\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1569257569,\n \"txid\": \"b5855b69cbd3f9c0905844b42d175a749294eab9a0afb055b43be09860459006\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqqphvUE5WQRK2ZbXq4nCxRHycZZL71ksV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\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#ebed8d1668d259c06c1d8db114e9bb8a882e70e9\",\n \"signing_channel\": {\n \"address\": \"mtqGGp9y6fAA7RnLWCgUxVBzLF1EKBMjX6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#a97186b2b68427e475452ebe9bcd9475be772d49\",\n \"timestamp\": 1569257569,\n \"txid\": \"f32d6f3bad6ae416714f06902939b82baa053f821431c38b47541e52351665e5\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004667f56e30911326632336e9649755f4182c79c24500e3d9f63dd766f86cee16e470b87ad90bd15fd698b128ea4e92a1a8b3a7d8fbdfc9d07ca578fb856e99b32\",\n \"public_key_id\": \"mzYaWmhuYfprZDR9EWSYb7JxhPDTFhRQgo\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"2eea594a5c6237cf207f4f68e80d5d8bb0e74fb7a546ca7e0d962d0e729bc00b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n Line truncated
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
"lbrynet": "lbrynet stream update c011186b47f0499392fdd22d73a2ec5426b8556f --channel_id=\"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\"",
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\", \"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\": \"0100000002c37a2172d5724ade8d0ca30b8a21b8f8bdad85dd9ee7b018e026b3e2fcf9ae2b000000006a473044022011286199290fc7f2b1dcd0f01a08513931ee81699e22039a2ae051df1743ef9a022049f5fd40b1ff44757899bf7bb4aaaf113e80c6849365db3dae0063181b1cb8530121037754fd75d8dd6527a6e6b63fb433384953c3b777e87d157100f6f524af3bbe10ffffffffabd0b13a169c967c1cf8f3bb6829e4c8b33f46b6eb3978e25b22b04947fe18be010000006a473044022073acb6b65279f15e0b7b8541c76e4f8bd6b16eb4c8cfb32f502dbb11b87fcdb302200aee950778e1d0bf564d2f6dcacbd79d5793bc266980699a80ea37df2514083d01210316bd5e87a8bbf2c7cae024e16b86d3b2015e2ce3429c76db8b8a66d45f64abc5ffffffff0200e1f50500000000fd2301b7076173747265616d146f55b82654eca2732dd2fd929349f0476b1811c04ce801d3419c789f3367513a7e0058af1abbfbf6049f2b9792102b78fcfdc53716733ffce3fca52fdeb3971fd08970bf4d1c0e1c61e1c7409b65f9ae0326773cec1417748ca581c1cbb6ecaf6f892ac84d8350cadce0fe0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703568316c69667178180b22186170706c69636174696f6e2f6f637465742d73747265616d323004e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b6d6d76a914212135387508b03786740b73da22090129803bb188ac32a0d205000000001976a9140de8b7add05eafd06a4af98b30f3ed220fa5ae0a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"timestamp\": 1571238738,\n \"txid\": \"2baef9fce2b326e018b0e79edd85adbdf8b8218a0ba30c8dde4a72d572217ac3\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp5h1lifqx\",\n \"sd_hash\": \"04e9db196a385f94d715879f730bc91851daad43e8d1fdbdd1d98409741b98c19e1700602f2abc1e1c9847cea42d286b\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n2hwzq3j937oBARJtLLWCagiq69Vu9ZuGi\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1571238737,\n \"txid\": \"be18fe4749b0225be27839ebb6463fb3c8e42968bbf3f81c7c969c163ab1d0ab\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miY8Ni6D11cwYEDZYYfdcKfyUwp4xCdws8\",\n \"amount\": \"1.0\",\n \"claim_id\": \"c011186b47f0499392fdd22d73a2ec5426b8556f\",\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#c011186b47f0499392fdd22d73a2ec5426b8556f\",\n \"signing_channel\": {\n \"address\": \"mwgNXQtcY3oWpQrtWZWLJRqLeTRCNVVCTe\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"has_signing_key\": true,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2b9f04f6fbbb1aaf58007e3a5167339f789c41d3\",\n \"timestamp\": 1571238737,\n \"txid\": \"8133769b1fa22eab219f162dee518a7dd96565b047133ec7ad51896127c5482f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c3c376e28a4da84d03a5cf9d0f5c43a200b156c3835bb8d0ab6a06bcce36540398550b51984b32a1352eee764f9320efce8086d04f628a19ae0eefc80033baec\",\n \"public_key_id\": \"mt1Qr1ftwmkeWG8KVuBiPgDkAzkxAkhvpY\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"aa2721a8f22f2c166a8f5722adf6b96c9e4d142033719a5adedf9d11db235607\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n Line truncated
}
]
}
@@ -3230,7 +3126,7 @@
"commands": [
{
"name": "sync_apply",
"description": "Apply incoming synchronization data, if provided, and then produce a sync hash and\nan encrypted wallet.",
"description": "Apply incoming synchronization data, if provided, and return a sync hash and update wallet data.\n\nWallet must be unlocked to perform this operation.\n\nIf \"encrypt-on-disk\" preference is True and supplied password is different from local password,\nor there is no local password (because local wallet was not encrypted), then the supplied password\nwill be used for local encryption (overwriting previous local encryption password).",
"arguments": [
{
"name": "password",
@@ -3244,17 +3140,17 @@
"description": "incoming sync data, if any",
"is_required": false
},
{
"name": "encrypt-password",
"type": "str",
"description": "password to encrypt outgoing data if different from the decrypt password, used during password changes",
"is_required": false
},
{
"name": "wallet_id",
"type": "str",
"description": "wallet being sync'ed",
"is_required": false
},
{
"name": "blocking",
"type": "bool",
"description": "wait until any new accounts have sync'ed",
"is_required": false
}
],
"returns": "(map) sync hash and data",
@@ -3315,7 +3211,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 {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2019-09-23 12:52\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1569257569,\n \"txid\": \"0299b85a0e411f806ff210904fc52075e8309de1f53d2b4f821b81894c5a0583\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-09-23 12:52\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1569257568,\n \"txid\": \"21d3e39f6018c55474383a42f67ddcf490baf80cc3563b5ecdc99082f9a5ef5d\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2019-10-16 11:12\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1571238737,\n \"txid\": \"e438343e911dd64ba32806f0ac15a21af32750752148a93d77b003c6577e621c\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-10-16 11:12\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1571238736,\n \"txid\": \"9ff0ec015c9fa14166a1895b471bb4d976c67bd36de52634bd076d8e3f4d2d2a\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
}
]
},
@@ -3409,6 +3305,32 @@
"returns": " {\n \"id\": \"wallet_id\",\n \"name\": \"optional wallet name\"\n }",
"examples": []
},
{
"name": "wallet_balance",
"description": "Return the balance of a wallet",
"arguments": [
{
"name": "wallet_id",
"type": "str",
"description": "balance for specific wallet",
"is_required": false
},
{
"name": "confirmations",
"type": "int",
"description": "Only include transactions with this many confirmed blocks.",
"is_required": false
},
{
"name": "reserved_subtotals",
"type": "bool",
"description": "Include detailed reserved balances on claims, tips and supports.",
"is_required": false
}
],
"returns": "(decimal) amount of lbry credits in wallet",
"examples": []
},
{
"name": "wallet_create",
"description": "Create a new wallet.",
@@ -3441,6 +3363,40 @@
"returns": " {\n \"id\": \"wallet_id\",\n \"name\": \"optional wallet name\"\n }",
"examples": []
},
{
"name": "wallet_decrypt",
"description": "Decrypt an encrypted wallet, this will remove the wallet password. The wallet must be unlocked to decrypt it",
"arguments": [
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is decrypted, otherwise false",
"examples": []
},
{
"name": "wallet_encrypt",
"description": "Encrypt an unencrypted wallet with a password",
"arguments": [
{
"name": "new_password",
"type": "str",
"description": "password to encrypt account",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is decrypted, otherwise false",
"examples": []
},
{
"name": "wallet_list",
"description": "List wallets.",
@@ -3463,6 +3419,20 @@
}
]
},
{
"name": "wallet_lock",
"description": "Lock an unlocked wallet",
"arguments": [
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is locked, otherwise false",
"examples": []
},
{
"name": "wallet_remove",
"description": "Remove an existing wallet.",
@@ -3476,6 +3446,72 @@
],
"returns": " {\n \"id\": \"wallet_id\",\n \"name\": \"optional wallet name\"\n }",
"examples": []
},
{
"name": "wallet_send",
"description": "Send the same number of credits to multiple addresses using all accounts in wallet to\nfund the transaction and the default account to receive any change.",
"arguments": [
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
},
{
"name": "change_account_id",
"type": "str",
"description": "account where change will go",
"is_required": false
},
{
"name": "funding_account_ids",
"type": "str",
"description": "accounts to fund the transaction",
"is_required": false
},
{
"name": "preview",
"type": "bool",
"description": "do not broadcast the transaction",
"is_required": false
}
],
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }",
"examples": []
},
{
"name": "wallet_status",
"description": "Status of wallet including encryption/lock state.",
"arguments": [
{
"name": "wallet_id",
"type": "str",
"description": "status of specific wallet",
"is_required": false
}
],
"returns": "Dictionary of wallet status information.",
"examples": []
},
{
"name": "wallet_unlock",
"description": "Unlock an encrypted wallet",
"arguments": [
{
"name": "password",
"type": "str",
"description": "password to use for unlocking",
"is_required": true
},
{
"name": "wallet_id",
"type": "str",
"description": "restrict operation to specific wallet",
"is_required": false
}
],
"returns": "(bool) true if wallet is unlocked, otherwise false",
"examples": []
}
]
}
+1 -1
View File
@@ -1,4 +1,4 @@
__name__ = "lbry"
__version__ = "0.42.1"
__version__ = "0.43.2"
version = tuple(__version__.split('.'))
+6 -9
View File
@@ -37,18 +37,14 @@ class BlobManager:
self.connection_manager = ConnectionManager(loop)
def _get_blob(self, blob_hash: str, length: typing.Optional[int] = None):
if self.config.save_blobs:
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
)
else:
if 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
)
return BlobBuffer(
self.loop, blob_hash, length, self.blob_completed, self.blob_dir
)
return BlobBuffer(
self.loop, blob_hash, length, self.blob_completed, self.blob_dir
)
def get_blob(self, blob_hash, length: typing.Optional[int] = None):
if blob_hash in self.blobs:
@@ -82,6 +78,7 @@ class BlobManager:
return {
item.name for item in os.scandir(self.blob_dir) if is_valid_blobhash(item.name)
}
in_blobfiles_dir = await self.loop.run_in_executor(None, get_files_in_blob_dir)
to_add = await self.storage.sync_missing_blobs(in_blobfiles_dir)
if to_add:
+2 -2
View File
@@ -67,7 +67,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
self.blob.set_length(blob_response.length)
elif blob_response and not blob_response.error and self.blob.blob_hash != blob_response.blob_hash:
# the server started sending a blob we didn't request
log.warning("%s started sending blob we didnt request %s instead of %s", self.peer_address,
log.warning("%s started sending blob we didn't request %s instead of %s", self.peer_address,
blob_response.blob_hash, self.blob.blob_hash)
return
if response.responses:
@@ -139,7 +139,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
log.warning("data rate rejected by %s:%i", self.peer_address, self.peer_port)
return self._blob_bytes_received, self.close()
if not blob_response or blob_response.error:
log.warning("blob cant be downloaded from %s:%i", self.peer_address, self.peer_port)
log.warning("blob can't be downloaded from %s:%i", self.peer_address, self.peer_port)
return self._blob_bytes_received, self.close()
if not blob_response.error and blob_response.blob_hash != self.blob.blob_hash:
log.warning("incoming blob hash mismatch from %s:%i", self.peer_address, self.peer_port)
+10 -12
View File
@@ -19,8 +19,6 @@ class ConnectionManager:
self.outgoing_connected: typing.Set[str] = set()
self.outgoing: typing.DefaultDict[str, int] = collections.defaultdict(int)
self._status = {}
self._total_sent = 0
self._total_received = 0
self._running = False
self._task: typing.Optional[asyncio.Task] = None
@@ -58,29 +56,29 @@ class ConnectionManager:
'outgoing_bps': {},
'total_incoming_mbs': 0.0,
'total_outgoing_mbs': 0.0,
'total_sent': self._total_sent,
'total_received': self._total_received,
'total_sent': 0,
'total_received': 0,
'time': self.loop.time()
}
while True:
last = self.loop.time()
await asyncio.sleep(1, loop=self.loop)
await asyncio.sleep(5, loop=self.loop)
self._status['incoming_bps'].clear()
self._status['outgoing_bps'].clear()
now = self.loop.time()
while self.outgoing:
k, v = self.outgoing.popitem()
self._status['outgoing_bps'][k] = v
self._status['outgoing_bps'][k] = v / (now - last)
while self.incoming:
k, v = self.incoming.popitem()
self._status['incoming_bps'][k] = v
now = self.loop.time()
self._status['incoming_bps'][k] = v / (now - last)
self._status['total_outgoing_mbs'] = int(sum(list(self._status['outgoing_bps'].values())
) / (now - last)) / 1000000.0
)) / 1000000.0
self._status['total_incoming_mbs'] = int(sum(list(self._status['incoming_bps'].values())
) / (now - last)) / 1000000.0
self._total_sent += sum(list(self._status['outgoing_bps'].values()))
self._total_received += sum(list(self._status['incoming_bps'].values()))
)) / 1000000.0
self._status['total_sent'] += sum(list(self._status['outgoing_bps'].values()))
self._status['total_received'] += sum(list(self._status['incoming_bps'].values()))
self._status['time'] = now
+5 -4
View File
@@ -4,13 +4,14 @@ import typing
import binascii
from lbry.utils import resolve_host
from lbry.dht import constants
from lbry.dht.peer import make_kademlia_peer
from lbry.dht.protocol.distance import Distance
from lbry.dht.protocol.iterative_find import IterativeNodeFinder, IterativeValueFinder
from lbry.dht.protocol.protocol import KademliaProtocol
from lbry.dht.peer import KademliaPeer
if typing.TYPE_CHECKING:
from lbry.dht.peer import PeerManager
from lbry.dht.peer import KademliaPeer
log = logging.getLogger(__name__)
@@ -36,7 +37,7 @@ class Node:
total_peers: typing.List['KademliaPeer'] = []
# add all peers in the routing table
total_peers.extend(self.protocol.routing_table.get_peers())
# add all the peers who have announed blobs to us
# add all the peers who have announced blobs to us
total_peers.extend(self.protocol.data_store.get_storing_contacts())
# get ids falling in the midpoint of each bucket that hasn't been recently updated
@@ -141,7 +142,7 @@ class Node:
if known_node_addresses:
peers = [
KademliaPeer(self.loop, address, udp_port=port)
make_kademlia_peer(None, address, port)
for (address, port) in known_node_addresses
]
while True:
@@ -232,7 +233,7 @@ class Node:
if not peer.udp_port:
udp_port_to_try = peer.tcp_port
if not peer.udp_port:
peer.update_udp_port(udp_port_to_try)
peer = make_kademlia_peer(peer.node_id, peer.address, udp_port_to_try, peer.tcp_port)
self.loop.create_task(ping(peer))
else:
log.debug("skip bad peer %s:%i for %s", peer.address, peer.tcp_port, blob_hash)
+28 -46
View File
@@ -3,6 +3,7 @@ import asyncio
import logging
import ipaddress
from binascii import hexlify
from dataclasses import dataclass, field
from functools import lru_cache
from lbry.dht import constants
@@ -11,6 +12,13 @@ from lbry.dht.serialization.datagram import make_compact_address, make_compact_i
log = logging.getLogger(__name__)
@lru_cache(1024)
def make_kademlia_peer(node_id: typing.Optional[bytes], address: typing.Optional[str],
udp_port: typing.Optional[int] = None,
tcp_port: typing.Optional[int] = None) -> 'KademliaPeer':
return KademliaPeer(address, node_id, udp_port, tcp_port=tcp_port)
def is_valid_ipv4(address):
try:
ip = ipaddress.ip_address(address)
@@ -81,10 +89,6 @@ class PeerManager:
self._node_id_mapping[(address, udp_port)] = node_id
self._node_id_reverse_mapping[node_id] = (address, udp_port)
@lru_cache(maxsize=400)
def get_kademlia_peer(self, node_id: bytes, address: str, udp_port: int) -> 'KademliaPeer':
return KademliaPeer(self._loop, address, node_id, udp_port)
def prune(self): # TODO: periodically call this
now = self._loop.time()
to_pop = []
@@ -108,14 +112,16 @@ class PeerManager:
delay = self._loop.time() - constants.check_refresh_interval
# fixme: find a way to re-enable that without breaking other parts
#if node_id not in self._node_id_reverse_mapping or (address, udp_port) not in self._node_id_mapping:
# if node_id not in self._node_id_reverse_mapping or (address, udp_port) not in self._node_id_mapping:
# return
#addr_tup = (address, udp_port)
#if self._node_id_reverse_mapping[node_id] != addr_tup or self._node_id_mapping[addr_tup] != node_id:
# addr_tup = (address, udp_port)
# if self._node_id_reverse_mapping[node_id] != addr_tup or self._node_id_mapping[addr_tup] != node_id:
# return
previous_failure, most_recent_failure = self._rpc_failures.get((address, udp_port), (None, None))
last_requested = self._last_requested.get((address, udp_port))
last_replied = self._last_replied.get((address, udp_port))
if node_id is None:
return None
if most_recent_failure and last_replied:
if delay < last_replied > most_recent_failure:
return True
@@ -135,47 +141,31 @@ class PeerManager:
def decode_tcp_peer_from_compact_address(self, compact_address: bytes) -> 'KademliaPeer':
node_id, address, tcp_port = decode_compact_address(compact_address)
return KademliaPeer(self._loop, address, node_id, tcp_port=tcp_port)
return make_kademlia_peer(node_id, address, udp_port=None, tcp_port=tcp_port)
@dataclass(unsafe_hash=True)
class KademliaPeer:
__slots__ = [
'loop',
'_node_id',
'address',
'udp_port',
'tcp_port',
'protocol_version',
]
address: str = field(hash=True)
_node_id: typing.Optional[bytes] = field(hash=True)
udp_port: typing.Optional[int] = field(hash=True)
tcp_port: typing.Optional[int] = field(compare=False, hash=False)
protocol_version: typing.Optional[int] = field(default=1, compare=False, hash=False)
def __init__(self, loop: asyncio.AbstractEventLoop, address: str, node_id: typing.Optional[bytes] = None,
udp_port: typing.Optional[int] = None, tcp_port: typing.Optional[int] = None):
if node_id is not None:
if not len(node_id) == constants.hash_length:
raise ValueError("invalid node_id: {}".format(hexlify(node_id).decode()))
if udp_port is not None and not 0 <= udp_port <= 65536:
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 tcp_port and not 0 <= tcp_port <= 65536:
if self.tcp_port is not None and not 1 <= self.tcp_port <= 65535:
raise ValueError("invalid tcp port")
if not is_valid_ipv4(address):
raise ValueError("invalid ip address")
self.loop = loop
self._node_id = node_id
self.address = address
self.udp_port = udp_port
self.tcp_port = tcp_port
self.protocol_version = 1
if not is_valid_ipv4(self.address):
raise ValueError(f"invalid ip address: '{self.address}'")
def update_tcp_port(self, tcp_port: int):
self.tcp_port = tcp_port
def update_udp_port(self, udp_port: int):
self.udp_port = udp_port
def set_id(self, node_id):
if not self._node_id:
self._node_id = node_id
@property
def node_id(self) -> bytes:
return self._node_id
@@ -188,11 +178,3 @@ class KademliaPeer:
def compact_ip(self):
return make_compact_ip(self.address)
def __eq__(self, other):
if not isinstance(other, KademliaPeer):
raise TypeError("invalid type to compare with Peer: %s" % str(type(other)))
return (self.node_id, self.address, self.udp_port) == (other.node_id, other.address, other.udp_port)
def __hash__(self):
return hash((self.node_id, self.address, self.udp_port))
+2 -1
View File
@@ -7,6 +7,7 @@ import logging
from lbry.dht import constants
from lbry.dht.error import RemoteException, TransportNotConnected
from lbry.dht.protocol.distance import Distance
from lbry.dht.peer import make_kademlia_peer
from typing import TYPE_CHECKING
if TYPE_CHECKING:
@@ -150,7 +151,7 @@ class IterativeFinder:
self._add_active(peer)
for contact_triple in response.get_close_triples():
node_id, address, udp_port = contact_triple
self._add_active(self.peer_manager.get_kademlia_peer(node_id, address, udp_port))
self._add_active(make_kademlia_peer(node_id, address, udp_port))
self.check_result_ready(response)
async def _send_probe(self, peer: 'KademliaPeer'):
+18 -33
View File
@@ -15,6 +15,7 @@ from lbry.dht.serialization.datagram import RESPONSE_TYPE, ERROR_TYPE, PAGE_KEY
from lbry.dht.error import RemoteException, TransportNotConnected
from lbry.dht.protocol.routing_table import TreeRoutingTable
from lbry.dht.protocol.data_store import DictDataStore
from lbry.dht.peer import make_kademlia_peer
if typing.TYPE_CHECKING:
from lbry.dht.peer import PeerManager, KademliaPeer
@@ -322,6 +323,9 @@ class KademliaProtocol(DatagramProtocol):
return args, {}
async def _add_peer(self, peer: 'KademliaPeer'):
if not peer.node_id:
log.warning("Tried adding a peer with no node id!")
return False
for p in self.routing_table.get_peers():
if (p.address, p.udp_port) == (peer.address, peer.udp_port) and p.node_id != peer.node_id:
self.routing_table.remove_peer(p)
@@ -447,7 +451,7 @@ class KademliaProtocol(DatagramProtocol):
try:
peer = self.routing_table.get_peer(request_datagram.node_id)
except IndexError:
peer = self.peer_manager.get_kademlia_peer(request_datagram.node_id, address[0], address[1])
peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
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
@@ -494,8 +498,7 @@ class KademliaProtocol(DatagramProtocol):
elif response_datagram.node_id == self.node_id:
df.set_exception(RemoteException("incoming message is from our node id"))
return
peer.set_id(response_datagram.node_id)
peer.update_udp_port(address[1])
peer = make_kademlia_peer(response_datagram.node_id, address[0], address[1])
self.peer_manager.report_last_replied(address[0], address[1])
self.peer_manager.update_contact_triple(peer.node_id, address[0], address[1])
if not df.cancelled():
@@ -529,7 +532,7 @@ class KademliaProtocol(DatagramProtocol):
elif error_datagram.response not in old_protocol_errors:
log.warning(error_msg)
else:
log.warning("known dht protocol backwards compatibility error with %s:%i (lbrynet v%s)",
log.debug("known dht protocol backwards compatibility error with %s:%i (lbrynet v%s)",
peer.address, peer.udp_port, old_protocol_errors[error_datagram.response])
df.set_exception(remote_exception)
return
@@ -539,7 +542,7 @@ class KademliaProtocol(DatagramProtocol):
f"pending request: {str(remote_exception)}"
log.warning(msg)
else:
log.warning("known dht protocol backwards compatibility error with %s:%i (lbrynet v%s)",
log.debug("known dht protocol backwards compatibility error with %s:%i (lbrynet v%s)",
address[0], address[1], old_protocol_errors[error_datagram.response])
def datagram_received(self, datagram: bytes, address: typing.Tuple[str, int]) -> None:
@@ -643,7 +646,8 @@ class KademliaProtocol(DatagramProtocol):
return False
return True
async def store_to_peer(self, hash_value: bytes, peer: 'KademliaPeer') -> typing.Tuple[bytes, bool]:
async def store_to_peer(self, hash_value: bytes, peer: 'KademliaPeer',
retry: bool = True) -> typing.Tuple[bytes, bool]:
async def __store():
res = await self.get_rpc_peer(peer).store(hash_value)
if res != b"OK":
@@ -655,34 +659,15 @@ class KademliaProtocol(DatagramProtocol):
return await __store()
except asyncio.TimeoutError:
log.debug("Timeout while storing blob_hash %s at %s", binascii.hexlify(hash_value).decode()[:8], peer)
return peer.node_id, False
except ValueError as err:
log.error("Unexpected response: %s" % err)
return peer.node_id, False
except RemoteException as err:
if 'Invalid token' in str(err):
self.peer_manager.clear_token(peer.node_id)
try:
return await __store()
except (ValueError, asyncio.TimeoutError, RemoteException):
return peer.node_id, False
else:
if 'Invalid token' not in str(err):
log.exception("Unexpected error while storing blob_hash")
return peer.node_id, False
def _write(self, data: bytes, address: typing.Tuple[str, int]):
if self.transport:
try:
self.transport.sendto(data, address)
except OSError as err:
if err.errno == socket.EWOULDBLOCK:
# i'm scared this may swallow important errors, but i get a million of these
# on Linux and it doesn't seem to affect anything -grin
log.warning("Can't send data to dht: EWOULDBLOCK")
# elif err.errno == socket.ENETUNREACH:
# # this should probably try to retransmit when the network connection is back
# log.error("Network is unreachable")
else:
log.error("DHT socket error sending %i bytes to %s:%i - %s (code %i)",
len(data), address[0], address[1], str(err), err.errno)
raise err
else:
raise TransportNotConnected()
return peer.node_id, False
self.peer_manager.clear_token(peer.node_id)
if not retry:
return peer.node_id, False
return await self.store_to_peer(hash_value, peer, retry=False)
+13 -8
View File
@@ -189,7 +189,7 @@ def get_argument_parser():
)
start.add_argument(
'--verbose', nargs="*",
help=('Enable debug output. Optionally specify loggers for which debug output '
help=('Enable debug output for lbry logger and event loop. Optionally specify loggers for which debug output '
'should selectively be applied.')
)
Config.contribute_to_argparse(start)
@@ -221,7 +221,7 @@ def ensure_directory_exists(path: str):
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
def run_daemon(args: list, conf: Config):
def setup_logging(args: argparse.Namespace, conf: Config, loop: asyncio.AbstractEventLoop):
default_formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s")
file_handler = logging.handlers.RotatingFileHandler(
conf.log_file_path, maxBytes=2097152, backupCount=5
@@ -240,19 +240,24 @@ def run_daemon(args: list, conf: Config):
logging.getLogger('aioupnp').setLevel(logging.WARNING)
logging.getLogger('aiohttp').setLevel(logging.CRITICAL)
loop = asyncio.get_event_loop()
if args.verbose:
log.setLevel(logging.DEBUG)
log.setLevel(logging.INFO)
if args.verbose is not None:
loop.set_debug(True)
else:
log.setLevel(logging.INFO)
if len(args.verbose) > 0:
for module in args.verbose:
logging.getLogger(module).setLevel(logging.DEBUG)
else:
log.setLevel(logging.DEBUG)
if conf.share_usage_data:
loggly_handler = get_loggly_handler()
loggly_handler.setLevel(logging.ERROR)
log.addHandler(loggly_handler)
def run_daemon(args: argparse.Namespace, conf: Config):
loop = asyncio.get_event_loop()
setup_logging(args, conf, loop)
daemon = Daemon(conf)
def __exit():
-2
View File
@@ -252,8 +252,6 @@ class WalletComponent(Component):
'blocks': max(local_height, 0),
'blocks_behind': max(remote_height - local_height, 0),
'best_blockhash': best_hash,
'is_encrypted': self.wallet_manager.use_encryption,
'is_locked': not self.wallet_manager.is_wallet_unlocked,
}
async def start(self):
+320 -232
View File
@@ -16,13 +16,14 @@ from traceback import format_exc
from aiohttp import web
from functools import wraps, partial
from google.protobuf.message import DecodeError
from torba.client.wallet import Wallet
from torba.client.wallet import Wallet, ENCRYPT_ON_DISK
from torba.client.baseaccount import SingleKey, HierarchicalDeterministic
from lbry import utils
from lbry.conf import Config, Setting
from lbry.blob.blob_file import is_valid_blobhash, BlobBuffer
from lbry.blob_exchange.downloader import download_blob
from lbry.dht.peer import make_kademlia_peer
from lbry.error import DownloadSDTimeout, ComponentsNotStarted
from lbry.error import NullFundsError, NegativeFundsError, ComponentStartConditionNotMet
from lbry.extras import system_info
@@ -37,11 +38,10 @@ from lbry.extras.daemon import comment_client
from lbry.extras.daemon.undecorated import undecorated
from lbry.wallet.transaction import Transaction, Output, Input
from lbry.wallet.account import Account as LBCAccount
from lbry.wallet.dewies import dewies_to_lbc, lbc_to_dewies
from lbry.wallet.dewies import dewies_to_lbc, lbc_to_dewies, dict_values_to_lbc
from lbry.schema.claim import Claim
from lbry.schema.url import URL
if typing.TYPE_CHECKING:
from lbry.blob.blob_manager import BlobManager
from lbry.dht.node import Node
@@ -72,7 +72,9 @@ def requires(*components, **conditions):
raise ComponentsNotStarted("the following required components have not yet started: "
"%s" % json.dumps(components))
return fn(*args, **kwargs)
return _inner
return _wrap
@@ -81,6 +83,7 @@ def deprecated(new_command=None):
f.new_command = new_command
f._deprecated = True
return f
return _deprecated_wrapper
@@ -124,13 +127,13 @@ async def maybe_paginate(get_records: Callable, get_record_count: Callable,
page: Optional[int], page_size: Optional[int], **constraints):
if None not in (page, page_size):
constraints.update({
"offset": page_size * (page-1),
"offset": page_size * (page - 1),
"limit": page_size
})
total_items = await get_record_count(**constraints)
return {
"items": await get_records(**constraints),
"total_pages": int((total_items + (page_size-1)) / page_size),
"total_pages": int((total_items + (page_size - 1)) / page_size),
"total_items": total_items,
"page": page, "page_size": page_size
}
@@ -142,7 +145,6 @@ def sort_claim_results(claims):
DHT_HAS_CONTACTS = "dht_has_contacts"
WALLET_IS_UNLOCKED = "wallet_is_unlocked"
class DHTHasContacts(RequiredCondition):
@@ -155,16 +157,6 @@ class DHTHasContacts(RequiredCondition):
return len(component.contacts) > 0
class WalletIsUnlocked(RequiredCondition):
name = WALLET_IS_UNLOCKED
component = WALLET_COMPONENT
message = "your wallet is locked"
@staticmethod
def evaluate(component):
return not component.check_locked()
class JSONRPCError:
# http://www.jsonrpc.org/specification#error_object
CODE_PARSE_ERROR = -32700 # Invalid JSON. Error while parsing the JSON text.
@@ -208,7 +200,7 @@ class JSONRPCError:
for i, t in enumerate(trace_lines):
if "--- <exception caught here> ---" in t:
if len(trace_lines) > i + 1:
self.traceback = [j for j in trace_lines[i+1:] if j]
self.traceback = [j for j in trace_lines[i + 1:] if j]
break
def to_dict(self):
@@ -338,7 +330,7 @@ class Daemon(metaclass=JSONRPCServerType):
name, = name_parts
elif len(name_parts) == 2:
group, name = name_parts
assert group in api['groups'],\
assert group in api['groups'], \
f"Group {group} does not have doc string for command {full_name}."
else:
raise NameError(f'Could not parse method name: {jsonrpc_method}')
@@ -589,7 +581,9 @@ class Daemon(metaclass=JSONRPCServerType):
except Exception as e: # pylint: disable=broad-except
log.exception("error handling api request")
return JSONRPCError(
str(e), JSONRPCError.CODE_APPLICATION_ERROR, format_exc()
f"Error calling {function_name} with args {args}\n" + str(e),
JSONRPCError.CODE_APPLICATION_ERROR,
format_exc()
)
def _verify_method_is_callable(self, function_path):
@@ -621,7 +615,7 @@ class Daemon(metaclass=JSONRPCServerType):
missing_required_params = [
required_param
for required_param in argspec.args[len(args_tup)+1:-num_optional_params]
for required_param in argspec.args[len(args_tup) + 1:-num_optional_params]
if required_param not in args_dict
]
if len(missing_required_params):
@@ -912,13 +906,12 @@ class Daemon(metaclass=JSONRPCServerType):
for resolved_uri in resolved:
results[resolved_uri] = resolved[resolved_uri] if resolved[resolved_uri] is not None else \
{"error": f"{resolved_uri} did not resolve to a claim"}
{"error": f"{resolved_uri} did not resolve to a claim"}
return results
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
STREAM_MANAGER_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
STREAM_MANAGER_COMPONENT)
async def jsonrpc_get(self, uri, file_name=None, download_directory=None, timeout=None, save_file=None):
"""
Download stream from a LBRY name.
@@ -994,7 +987,7 @@ class Daemon(metaclass=JSONRPCServerType):
Preferences management.
"""
def jsonrpc_preference_get(self, key=None, account_id=None, wallet_id=None):
def jsonrpc_preference_get(self, key=None, wallet_id=None):
"""
Get preference value for key or all values if not key is passed in.
@@ -1003,21 +996,19 @@ class Daemon(metaclass=JSONRPCServerType):
Options:
--key=<key> : (str) key associated with value
--account_id=<account_id> : (str) id of the account containing value
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(dict) Dictionary of preference(s)
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
if key:
if key in account.preferences:
return {key: account.preferences[key]}
if key in wallet.preferences:
return {key: wallet.preferences[key]}
return
return account.preferences
return wallet.preferences.to_dict_without_ts()
def jsonrpc_preference_set(self, key, value, account_id=None, wallet_id=None):
def jsonrpc_preference_set(self, key, value, wallet_id=None):
"""
Set preferences
@@ -1027,18 +1018,15 @@ class Daemon(metaclass=JSONRPCServerType):
Options:
--key=<key> : (str) key associated with value
--value=<key> : (str) key associated with value
--account_id=<account_id> : (str) id of the account containing value
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(dict) Dictionary with key/value of new preference
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
if value and isinstance(value, str) and value[0] in ('[', '{'):
value = json.loads(value)
account.preferences[key] = value
account.modified_on = time.time()
wallet.preferences[key] = value
wallet.save()
return {key: value}
@@ -1141,6 +1129,169 @@ class Daemon(metaclass=JSONRPCServerType):
self.wallet_manager.wallets.remove(wallet)
return wallet
@requires("wallet")
async def jsonrpc_wallet_balance(self, wallet_id=None, confirmations=0, reserved_subtotals=False):
"""
Return the balance of a wallet
Usage:
wallet_balance [--wallet_id=<wallet_id>] [--confirmations=<confirmations>] [--reserved_subtotals]
Options:
--wallet_id=<wallet_id> : (str) balance for specific wallet
--confirmations=<confirmations> : (int) Only include transactions with this many
confirmed blocks.
--reserved_subtotals : (bool) Include detailed reserved balances on
claims, tips and supports.
Returns:
(decimal) amount of lbry credits in wallet
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
balance = await self.ledger.get_detailed_balance(
accounts=wallet.accounts, confirmations=confirmations,
reserved_subtotals=reserved_subtotals
)
return dict_values_to_lbc(balance)
def jsonrpc_wallet_status(self, wallet_id=None):
"""
Status of wallet including encryption/lock state.
Usage:
wallet_status [<wallet_id> | --wallet_id=<wallet_id>]
Options:
--wallet_id=<wallet_id> : (str) status of specific wallet
Returns:
Dictionary of wallet status information.
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return {'is_encrypted': wallet.is_encrypted, 'is_locked': wallet.is_locked}
@requires(WALLET_COMPONENT)
def jsonrpc_wallet_unlock(self, password, wallet_id=None):
"""
Unlock an encrypted wallet
Usage:
wallet_unlock (<password> | --password=<password>) [--wallet_id=<wallet_id>]
Options:
--password=<password> : (str) password to use for unlocking
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is unlocked, otherwise false
"""
return self.wallet_manager.get_wallet_or_default(wallet_id).unlock(password)
@requires(WALLET_COMPONENT)
def jsonrpc_wallet_lock(self, wallet_id=None):
"""
Lock an unlocked wallet
Usage:
wallet_lock [--wallet_id=<wallet_id>]
Options:
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is locked, otherwise false
"""
return self.wallet_manager.get_wallet_or_default(wallet_id).lock()
@requires(WALLET_COMPONENT)
def jsonrpc_wallet_decrypt(self, wallet_id=None):
"""
Decrypt an encrypted wallet, this will remove the wallet password. The wallet must be unlocked to decrypt it
Usage:
wallet_decrypt [--wallet_id=<wallet_id>]
Options:
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is decrypted, otherwise false
"""
return self.wallet_manager.get_wallet_or_default(wallet_id).decrypt()
@requires(WALLET_COMPONENT)
def jsonrpc_wallet_encrypt(self, new_password, wallet_id=None):
"""
Encrypt an unencrypted wallet with a password
Usage:
wallet_encrypt (<new_password> | --new_password=<new_password>)
[--wallet_id=<wallet_id>]
Options:
--new_password=<new_password> : (str) password to encrypt account
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is decrypted, otherwise false
"""
return self.wallet_manager.get_wallet_or_default(wallet_id).encrypt(new_password)
@requires(WALLET_COMPONENT)
async def jsonrpc_wallet_send(
self, amount, addresses, wallet_id=None,
change_account_id=None, funding_account_ids=None, preview=False):
"""
Send the same number of credits to multiple addresses using all accounts in wallet to
fund the transaction and the default account to receive any change.
Usage:
wallet_send <amount> <addresses>... [--wallet_id=<wallet_id>] [--preview]
[--change_account_id=None] [--funding_account_ids=<funding_account_ids>...]
Options:
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--change_account_id=<wallet_id> : (str) account where change will go
--funding_account_ids=<funding_account_ids> : (str) accounts to fund the transaction
--preview : (bool) do not broadcast the transaction
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
account = wallet.get_account_or_default(change_account_id)
accounts = wallet.get_accounts_or_all(funding_account_ids)
amount = self.get_dewies_or_error("amount", amount)
if not amount:
raise NullFundsError
if amount < 0:
raise NegativeFundsError()
if addresses and not isinstance(addresses, list):
addresses = [addresses]
outputs = []
for address in addresses:
self.valid_address_or_error(address)
outputs.append(
Output.pay_pubkey_hash(
amount, self.ledger.address_to_hash160(address)
)
)
tx = await Transaction.create(
[], outputs, accounts, account
)
if not preview:
await self.ledger.broadcast(tx)
await self.analytics_manager.send_credits_sent()
else:
await self.ledger.release_tx(tx)
return tx
ACCOUNT_DOC = """
Create, modify and inspect wallet accounts.
"""
@@ -1200,7 +1351,10 @@ class Daemon(metaclass=JSONRPCServerType):
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
return await account.get_granular_balances(confirmations=confirmations, reserved_subtotals=reserved_subtotals)
balance = await account.get_detailed_balance(
confirmations=confirmations, reserved_subtotals=reserved_subtotals
)
return dict_values_to_lbc(balance)
@requires("wallet")
async def jsonrpc_account_add(
@@ -1337,7 +1491,7 @@ class Daemon(metaclass=JSONRPCServerType):
account.name = new_name
change_made = True
if default:
if default and wallet.default_account != account:
wallet.accounts.remove(account)
wallet.accounts.insert(0, account)
change_made = True
@@ -1348,94 +1502,6 @@ class Daemon(metaclass=JSONRPCServerType):
return account
@requires(WALLET_COMPONENT)
def jsonrpc_account_unlock(self, password, account_id=None, wallet_id=None):
"""
Unlock an encrypted account
Usage:
account_unlock (<password> | --password=<password>)
[<account_id> | --account_id=<account_id>]
[--wallet_id=<wallet_id>]
Options:
--password=<password> : (str) password to use for unlocking
--account_id=<account_id> : (str) id for the account to unlock, unlocks default account
if not provided
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if account is unlocked, otherwise false
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return self.wallet_manager.unlock_account(
password, wallet.get_account_or_default(account_id)
)
@requires(WALLET_COMPONENT)
def jsonrpc_account_lock(self, account_id=None, wallet_id=None):
"""
Lock an unlocked account
Usage:
account_lock [<account_id> | --account_id=<account_id>] [--wallet_id=<wallet_id>]
Options:
--account_id=<account_id> : (str) id for the account to lock
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if account is locked, otherwise false
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return self.wallet_manager.lock_account(
wallet.get_account_or_default(account_id)
)
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
def jsonrpc_account_decrypt(self, account_id=None, wallet_id=None):
"""
Decrypt an encrypted account, this will remove the wallet password. The account must be unlocked to decrypt it
Usage:
account_decrypt [<account_id> | --account_id=<account_id>] [--wallet_id=<wallet_id>]
Options:
--account_id=<account_id> : (str) id for the account to decrypt
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is decrypted, otherwise false
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return self.wallet_manager.decrypt_account(
wallet.get_account_or_default(account_id)
)
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
def jsonrpc_account_encrypt(self, new_password, account_id=None, wallet_id=None):
"""
Encrypt an unencrypted account with a password
Usage:
account_encrypt (<new_password> | --new_password=<new_password>)
[<account_id> | --account_id=<account_id>]
[--wallet_id=<wallet_id>]
Options:
--new_password=<new_password> : (str) password to encrypt account
--account_id=<account_id> : (str) id for the account to encrypt, encrypts
default account if not provided
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
Returns:
(bool) true if wallet is decrypted, otherwise false
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return self.wallet_manager.encrypt_account(
new_password, wallet.get_account_or_default(account_id)
)
@requires("wallet")
def jsonrpc_account_max_address_gap(self, account_id, wallet_id=None):
"""
@@ -1498,10 +1564,10 @@ class Daemon(metaclass=JSONRPCServerType):
outputs=outputs, broadcast=broadcast
)
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
async def jsonrpc_account_send(self, amount, addresses, account_id=None, wallet_id=None, preview=False):
@requires(WALLET_COMPONENT)
def jsonrpc_account_send(self, amount, addresses, account_id=None, wallet_id=None, preview=False):
"""
Send the same number of credits to multiple addresses.
Send the same number of credits to multiple addresses from a specific account (or default account).
Usage:
account_send <amount> <addresses>... [--account_id=<account_id>] [--wallet_id=<wallet_id>] [--preview]
@@ -1513,39 +1579,12 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
amount = self.get_dewies_or_error("amount", amount)
if not amount:
raise NullFundsError
if amount < 0:
raise NegativeFundsError()
if addresses and not isinstance(addresses, list):
addresses = [addresses]
outputs = []
for address in addresses:
self.valid_address_or_error(address)
outputs.append(
Output.pay_pubkey_hash(
amount, self.ledger.address_to_hash160(address)
)
)
tx = await Transaction.create(
[], outputs, [account], account
return self.jsonrpc_wallet_send(
amount=amount, addresses=addresses, wallet_id=wallet_id,
change_account_id=account_id, funding_account_ids=[account_id] if account_id else [],
preview=preview
)
if not preview:
await self.ledger.broadcast(tx)
await self.analytics_manager.send_credits_sent()
else:
await account.ledger.release_tx(tx)
return tx
SYNC_DOC = """
Wallet synchronization.
"""
@@ -1568,46 +1607,48 @@ class Daemon(metaclass=JSONRPCServerType):
return hexlify(wallet.hash).decode()
@requires("wallet")
def jsonrpc_sync_apply(self, password, data=None, encrypt_password=None, wallet_id=None):
async def jsonrpc_sync_apply(self, password, data=None, wallet_id=None, blocking=False):
"""
Apply incoming synchronization data, if provided, and then produce a sync hash and
an encrypted wallet.
Apply incoming synchronization data, if provided, and return a sync hash and update wallet data.
Wallet must be unlocked to perform this operation.
If "encrypt-on-disk" preference is True and supplied password is different from local password,
or there is no local password (because local wallet was not encrypted), then the supplied password
will be used for local encryption (overwriting previous local encryption password).
Usage:
sync_apply <password> [--data=<data>] [--encrypt-password=<encrypt_password>]
[--wallet_id=<wallet_id>]
sync_apply <password> [--data=<data>] [--wallet_id=<wallet_id>] [--blocking]
Options:
--password=<password> : (str) password to decrypt incoming and encrypt outgoing data
--data=<data> : (str) incoming sync data, if any
--encrypt-password=<encrypt_password> : (str) password to encrypt outgoing data if different
from the decrypt password, used during password changes
--wallet_id=<wallet_id> : (str) wallet being sync'ed
--blocking : (bool) wait until any new accounts have sync'ed
Returns:
(map) sync hash and data
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
wallet_changed = False
if data is not None:
decrypted_data = Wallet.unpack(password, data)
for account_data in decrypted_data['accounts']:
_, _, pubkey = LBCAccount.keys_from_dict(self.ledger, account_data)
account_id = pubkey.address
local_match = None
for local_account in wallet.accounts:
if account_id == local_account.id:
local_match = local_account
break
if local_match is not None:
local_match.apply(account_data)
added_accounts = wallet.merge(self.wallet_manager, password, data)
if added_accounts and self.ledger.network.is_connected:
if blocking:
await asyncio.wait([
a.ledger.subscribe_account(a) for a in added_accounts
])
else:
new_account = LBCAccount.from_dict(self.ledger, wallet, account_data)
if self.ledger.network.is_connected:
for new_account in added_accounts:
asyncio.create_task(self.ledger.subscribe_account(new_account))
wallet_changed = True
if wallet.preferences.get(ENCRYPT_ON_DISK, False) and password != wallet.encryption_password:
wallet.encryption_password = password
wallet_changed = True
if wallet_changed:
wallet.save()
encrypted = wallet.pack(encrypt_password or password)
encrypted = wallet.pack(password)
return {
'hash': self.jsonrpc_sync_hash(wallet_id),
'data': encrypted.decode()
@@ -1726,7 +1767,7 @@ class Daemon(metaclass=JSONRPCServerType):
--blobs_in_stream<blobs_in_stream> : (int) get file with matching blobs in stream
--blobs_remaining=<blobs_remaining> : (int) amount of remaining blobs to download
--sort=<sort_by> : (str) field to sort by (one of the above filter fields)
--comparison=<comparison> : (str) logical comparision, (eq | ne | g | ge | l | le)
--comparison=<comparison> : (str) logical comparison, (eq | ne | g | ge | l | le)
Returns: {List[File]}
"""
@@ -1975,7 +2016,7 @@ class Daemon(metaclass=JSONRPCServerType):
a release time the publish time is used instead
(supports equality constraints)
--amount=<amount> : (int) limit by claim value (supports equality constraints)
--support_amount=<support_amount>: (int) limit by supports and tips recieved (supports
--support_amount=<support_amount>: (int) limit by supports and tips received (supports
equality constraints)
--effective_amount=<effective_amount>: (int) limit by total value (initial claim value plus
all tips and supports received), this amount is
@@ -2032,11 +2073,11 @@ class Daemon(metaclass=JSONRPCServerType):
if kwargs.pop('invalid_channel_signature', False):
kwargs['signature_valid'] = 0
page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', 10)), 50)
kwargs.update({'offset': page_size * (page_num-1), 'limit': page_size})
kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size})
txos, offset, total = await self.ledger.claim_search(**kwargs)
result = {"items": txos, "page": page_num, "page_size": page_size}
if not kwargs.pop('no_totals', False):
result['total_pages'] = int((total + (page_size-1)) / page_size)
result['total_pages'] = int((total + (page_size - 1)) / page_size)
result['total_items'] = total
return result
@@ -2048,7 +2089,7 @@ class Daemon(metaclass=JSONRPCServerType):
def jsonrpc_channel_new(self):
""" deprecated """
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_create(
self, name, bid, allow_duplicate_name=False, account_id=None, wallet_id=None,
claim_address=None, funding_account_ids=None, preview=False, blocking=False, **kwargs):
@@ -2128,6 +2169,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
account = wallet.get_account_or_default(account_id)
funding_accounts = wallet.get_accounts_or_all(funding_account_ids)
self.valid_channel_name_or_error(name)
@@ -2164,7 +2206,7 @@ class Daemon(metaclass=JSONRPCServerType):
return tx
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_update(
self, claim_id, bid=None, account_id=None, wallet_id=None, claim_address=None,
funding_account_ids=None, new_signing_key=False, preview=False,
@@ -2239,7 +2281,7 @@ class Daemon(metaclass=JSONRPCServerType):
--clear_locations : (bool) clear existing locations (prior to adding new ones)
--thumbnail_url=<thumbnail_url>: (str) thumbnail url
--cover_url=<cover_url> : (str) url of cover image
--account_id=<account_id> : (str) account to use for holding the transaction
--account_id=<account_id> : (str) account in which to look for channel (default: all)
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
--claim_address=<claim_address>: (str) address where the channel is sent
@@ -2254,15 +2296,22 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
funding_accounts = wallet.get_accounts_or_all(funding_account_ids)
if account_id:
account = wallet.get_account_or_error(account_id)
accounts = [account]
else:
account = wallet.default_account
accounts = wallet.accounts
existing_channels = await self.ledger.get_claims(
wallet=wallet, accounts=[account] if account_id else wallet.accounts, claim_id=claim_id
wallet=wallet, accounts=accounts, claim_id=claim_id
)
if len(existing_channels) != 1:
account_ids = ', '.join(f"'{account.id}'" for account in accounts)
raise Exception(
f"Can't find the channel '{claim_id}' in account '{account.id}'."
f"Can't find the channel '{claim_id}' in account(s) {account_ids}."
)
old_txo = existing_channels[0]
if not old_txo.claim.is_channel:
@@ -2312,7 +2361,7 @@ class Daemon(metaclass=JSONRPCServerType):
return tx
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_channel_abandon(
self, claim_id=None, txid=None, nout=None, account_id=None, wallet_id=None,
preview=False, blocking=True):
@@ -2337,12 +2386,22 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
if account_id:
account = wallet.get_account_or_error(account_id)
accounts = [account]
else:
account = wallet.default_account
accounts = wallet.accounts
if txid is not None and nout is not None:
claims = await account.get_claims(**{'txo.txid': txid, 'txo.position': nout})
claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, **{'txo.txid': txid, 'txo.position': nout}
)
elif claim_id is not None:
claims = await account.get_claims(claim_id=claim_id)
claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, claim_id=claim_id
)
else:
raise Exception('Must specify claim_id, or txid and nout')
@@ -2485,8 +2544,7 @@ class Daemon(metaclass=JSONRPCServerType):
Create, update, abandon, list and inspect your stream claims.
"""
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT)
async def jsonrpc_publish(self, name, **kwargs):
"""
Create or replace a stream claim at a given name (use 'stream create/update' for more control).
@@ -2582,8 +2640,13 @@ class Daemon(metaclass=JSONRPCServerType):
log.info("publishing: name: %s params: %s", name, kwargs)
self.valid_stream_name_or_error(name)
wallet = self.wallet_manager.get_wallet_or_default(kwargs.get('wallet_id'))
account = wallet.get_account_or_default(kwargs.get('account_id'))
claims = await account.get_claims(claim_name=name)
if kwargs.get('account_id'):
accounts = [wallet.get_account_or_error(kwargs.get('account_id'))]
else:
accounts = wallet.accounts
claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, claim_name=name
)
if len(claims) == 0:
if 'bid' not in kwargs:
raise Exception("'bid' is a required argument for new publishes.")
@@ -2598,8 +2661,7 @@ class Daemon(metaclass=JSONRPCServerType):
f"to update a specific stream claim."
)
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT)
async def jsonrpc_stream_create(
self, name, bid, file_path, allow_duplicate_name=False,
channel_id=None, channel_name=None, channel_account_id=None,
@@ -2700,6 +2762,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
self.valid_stream_name_or_error(name)
account = wallet.get_account_or_default(account_id)
funding_accounts = wallet.get_accounts_or_all(funding_account_ids)
@@ -2717,7 +2780,7 @@ class Daemon(metaclass=JSONRPCServerType):
)
claim = Claim()
claim.stream.update(file_path=file_path, sd_hash='0'*96, **kwargs)
claim.stream.update(file_path=file_path, sd_hash='0' * 96, **kwargs)
tx = await Transaction.claim_create(
name, claim, amount, claim_address, funding_accounts, funding_accounts[0], channel
)
@@ -2745,8 +2808,7 @@ class Daemon(metaclass=JSONRPCServerType):
return tx
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT, STREAM_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT)
async def jsonrpc_stream_update(
self, claim_id, bid=None, file_path=None,
channel_id=None, channel_name=None, channel_account_id=None, clear_channel=False,
@@ -2845,7 +2907,7 @@ class Daemon(metaclass=JSONRPCServerType):
--clear_channel : (bool) remove channel signature
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
for channel certificates, defaults to all accounts.
--account_id=<account_id> : (str) account to use for holding the transaction
--account_id=<account_id> : (str) account in which to look for stream (default: all)
--wallet_id=<wallet_id> : (str) restrict operation to specific wallet
--funding_account_ids=<funding_account_ids>: (list) ids of accounts to fund this transaction
--claim_address=<claim_address>: (str) address where the claim is sent to, if not specified
@@ -2860,13 +2922,22 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
funding_accounts = wallet.get_accounts_or_all(funding_account_ids)
if account_id:
account = wallet.get_account_or_error(account_id)
accounts = [account]
else:
account = wallet.default_account
accounts = wallet.accounts
existing_claims = await account.get_claims(claim_id=claim_id)
existing_claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, claim_id=claim_id
)
if len(existing_claims) != 1:
account_ids = ', '.join(f"'{account.id}'" for account in accounts)
raise Exception(
f"Can't find the claim '{claim_id}' in account '{account.id}'."
f"Can't find the stream '{claim_id}' in account(s) {account_ids}."
)
old_txo = existing_claims[0]
if not old_txo.claim.is_stream:
@@ -2945,7 +3016,7 @@ class Daemon(metaclass=JSONRPCServerType):
return tx
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_stream_abandon(
self, claim_id=None, txid=None, nout=None, account_id=None, wallet_id=None,
preview=False, blocking=False):
@@ -2970,12 +3041,22 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
account = wallet.get_account_or_default(account_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
if account_id:
account = wallet.get_account_or_error(account_id)
accounts = [account]
else:
account = wallet.default_account
accounts = wallet.accounts
if txid is not None and nout is not None:
claims = await account.get_claims(**{'txo.txid': txid, 'txo.position': nout})
claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, **{'txo.txid': txid, 'txo.position': nout}
)
elif claim_id is not None:
claims = await account.get_claims(claim_id=claim_id)
claims = await self.ledger.get_claims(
wallet=wallet, accounts=accounts, claim_id=claim_id
)
else:
raise Exception('Must specify claim_id, or txid and nout')
@@ -2983,14 +3064,14 @@ class Daemon(metaclass=JSONRPCServerType):
raise Exception('No claim found for the specified claim_id or txid:nout')
tx = await Transaction.create(
[Input.spend(txo) for txo in claims], [], [account], account
[Input.spend(txo) for txo in claims], [], accounts, account
)
if not preview:
await self.broadcast_or_release(tx, blocking)
await self.analytics_manager.send_claim_action('abandon')
else:
await account.ledger.release_tx(tx)
await self.ledger.release_tx(tx)
return tx
@@ -3022,8 +3103,7 @@ class Daemon(metaclass=JSONRPCServerType):
return maybe_paginate(streams, stream_count, page, page_size)
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT,
DHT_COMPONENT, DATABASE_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
DHT_COMPONENT, DATABASE_COMPONENT)
def jsonrpc_stream_cost_estimate(self, uri):
"""
Get estimated cost for a lbry stream
@@ -3044,7 +3124,7 @@ class Daemon(metaclass=JSONRPCServerType):
Create, list and abandon all types of supports.
"""
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_support_create(
self, claim_id, amount, tip=False, account_id=None, wallet_id=None, funding_account_ids=None,
preview=False, blocking=False):
@@ -3069,6 +3149,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
funding_accounts = wallet.get_accounts_or_all(funding_account_ids)
amount = self.get_dewies_or_error("amount", amount)
claim = await self.ledger.get_claim_by_claim_id(claim_id)
@@ -3124,7 +3205,7 @@ class Daemon(metaclass=JSONRPCServerType):
support_count = partial(self.ledger.get_support_count, wallet=wallet, accounts=wallet.accounts)
return maybe_paginate(supports, support_count, page, page_size)
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT)
async def jsonrpc_support_abandon(
self, claim_id=None, txid=None, nout=None, keep=None,
account_id=None, wallet_id=None, preview=False, blocking=False):
@@ -3149,18 +3230,23 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Transaction}
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
assert not wallet.is_locked, "Cannot spend funds with locked wallet, unlock first."
if account_id:
account = self.get_account_or_error(account_id)
funding_accounts = [account]
get_supports = account.get_supports
account = wallet.get_account_or_error(account_id)
accounts = [account]
else:
funding_accounts = self.ledger.accounts
get_supports = self.ledger.get_supports
account = wallet.default_account
accounts = wallet.accounts
if txid is not None and nout is not None:
supports = await get_supports(**{'txo.txid': txid, 'txo.position': nout})
supports = await self.ledger.get_supports(
wallet=wallet, accounts=accounts, **{'txo.txid': txid, 'txo.position': nout}
)
elif claim_id is not None:
supports = await get_supports(claim_id=claim_id)
supports = await self.ledger.get_supports(
wallet=wallet, accounts=accounts, claim_id=claim_id
)
else:
raise Exception('Must specify claim_id, or txid and nout')
@@ -3181,7 +3267,7 @@ class Daemon(metaclass=JSONRPCServerType):
]
tx = await Transaction.create(
[Input.spend(txo) for txo in supports], outputs, funding_accounts, funding_accounts[0]
[Input.spend(txo) for txo in supports], outputs, accounts, account
)
if not preview:
@@ -3316,7 +3402,7 @@ class Daemon(metaclass=JSONRPCServerType):
return maybe_paginate(utxos, utxo_count, page, page_size)
@requires(WALLET_COMPONENT)
def jsonrpc_utxo_release(self, account_id=None, wallet_id=None):
async def jsonrpc_utxo_release(self, account_id=None, wallet_id=None):
"""
When spending a UTXO it is locally locked to prevent double spends;
occasionally this can result in a UTXO being locked which ultimately
@@ -3335,14 +3421,17 @@ class Daemon(metaclass=JSONRPCServerType):
None
"""
wallet = self.wallet_manager.get_wallet_or_default(wallet_id)
return wallet.get_account_or_default(account_id).release_all_outputs()
if account_id is not None:
await wallet.get_account_or_error(account_id).release_all_outputs()
else:
for account in wallet.accounts:
await account.release_all_outputs()
BLOB_DOC = """
Blob management.
"""
@requires(WALLET_COMPONENT, DHT_COMPONENT, BLOB_COMPONENT,
conditions=[WALLET_IS_UNLOCKED])
@requires(WALLET_COMPONENT, DHT_COMPONENT, BLOB_COMPONENT)
async def jsonrpc_blob_get(self, blob_hash, timeout=None, read=False):
"""
Download and return a blob
@@ -3614,8 +3703,7 @@ class Daemon(metaclass=JSONRPCServerType):
"""
peer = None
if node_id and address and port:
peer = self.component_manager.peer_manager.get_kademlia_peer(unhexlify(node_id), address,
udp_port=int(port))
peer = make_kademlia_peer(unhexlify(node_id), address, udp_port=int(port))
try:
return await self.dht_node.protocol.get_rpc_peer(peer).ping()
except asyncio.TimeoutError:
@@ -3695,7 +3783,7 @@ class Daemon(metaclass=JSONRPCServerType):
--is_channel_signature_valid : (bool) Only include comments with valid signatures.
[Warning: Paginated total size will not change, even
if list reduces]
--visible : (bool) Select only Visisble Comments
--visible : (bool) Select only Visible Comments
--hidden : (bool) Select only Hidden Comments
Returns:
+11 -4
View File
@@ -3,6 +3,7 @@ from aiohttp.client_exceptions import ClientError
import json
import logging.handlers
import traceback
import aiohttp
from lbry import utils, __version__
@@ -42,6 +43,8 @@ class HTTPSLogglyHandler(logging.Handler):
self.url = "https://logs-01.loggly.com/inputs/{token}/tag/{tag}".format(
token=utils.deobfuscate(loggly_token), tag='lbrynet-' + __version__
)
self._loop = asyncio.get_event_loop()
self._session = aiohttp.ClientSession()
def get_full_message(self, record):
if record.exc_info:
@@ -49,13 +52,17 @@ class HTTPSLogglyHandler(logging.Handler):
else:
return record.getMessage()
async def _emit(self, record):
async def _emit(self, record, retry=True):
data = self.format(record).encode()
try:
async with utils.aiohttp_request('post', self.url, data=self.format(record).encode(),
cookies=self.cookies) as response:
async with self._session.post(self.url, data=data,
cookies=self.cookies) as response:
self.cookies.update(response.cookies)
except ClientError:
pass
if self._loop.is_running() and retry:
await self._session.close()
self._session = aiohttp.ClientSession()
return await self._emit(record, retry=False)
def emit(self, record):
asyncio.ensure_future(self._emit(record))
+2
View File
@@ -146,6 +146,8 @@ types_map = {
'.midi': ('audio/midi', 'audio'),
'.mkv': ('video/x-matroska', 'video'),
'.mobi': ('application/x-mobipocket-ebook', 'document'),
'.oga': ('audio/ogg', 'audio'),
'.ogv': ('video/ogg', 'video'),
'.pct': ('image/pict', 'image'),
'.pic': ('image/pict', 'image'),
'.pict': ('image/pict', 'image'),
+2 -2
View File
@@ -71,7 +71,7 @@ class StreamDescriptor:
self.sd_hash = sd_hash
@property
def length(self):
def length(self) -> int:
return len(self.as_json())
def get_stream_hash(self) -> str:
@@ -114,7 +114,7 @@ class StreamDescriptor:
])
).encode()
def calculate_old_sort_sd_hash(self):
def calculate_old_sort_sd_hash(self) -> str:
h = get_lbry_hash_obj()
h.update(self.old_sort_json())
return h.hexdigest()
+3 -2
View File
@@ -2,11 +2,12 @@ import asyncio
import typing
import logging
import binascii
from lbry.dht.peer import make_kademlia_peer
from lbry.error import DownloadSDTimeout
from lbry.utils import resolve_host, lru_cache_concurrent
from lbry.stream.descriptor import StreamDescriptor
from lbry.blob_exchange.downloader import BlobDownloader
from lbry.dht.peer import KademliaPeer
if typing.TYPE_CHECKING:
from lbry.conf import Config
from lbry.dht.node import Node
@@ -50,7 +51,7 @@ class StreamDownloader:
def _delayed_add_fixed_peers():
self.added_fixed_peers = True
self.peer_queue.put_nowait([
KademliaPeer(self.loop, address=address, tcp_port=port + 1)
make_kademlia_peer(None, address, None, tcp_port=port + 1)
for address, port in addresses
])
+12 -4
View File
@@ -11,6 +11,8 @@ from lbry.stream.downloader import StreamDownloader
from lbry.stream.descriptor import StreamDescriptor
from lbry.stream.reflector.client import StreamReflectorClient
from lbry.extras.daemon.storage import StoredStreamClaim
from lbry.blob import MAX_BLOB_SIZE
if typing.TYPE_CHECKING:
from lbry.conf import Config
from lbry.schema.claim import Claim
@@ -215,6 +217,9 @@ class ManagedStream:
async def create(cls, loop: asyncio.AbstractEventLoop, config: 'Config', blob_manager: 'BlobManager',
file_path: str, key: typing.Optional[bytes] = None,
iv_generator: typing.Optional[typing.Generator[bytes, None, None]] = None) -> 'ManagedStream':
"""
Generate a stream from a file and save it to the db
"""
descriptor = await StreamDescriptor.create_stream(
loop, blob_manager.blob_dir, file_path, key=key, iv_generator=iv_generator,
blob_completed_callback=blob_manager.blob_completed
@@ -289,13 +294,13 @@ class ManagedStream:
await response.prepare(request)
self.streaming_responses.append((request, response))
self.streaming.set()
wrote = 0
try:
wrote = 0
async for blob_info, decrypted in self._aiter_read_stream(skip_blobs, connection_id=self.STREAMING_ID):
if not wrote:
decrypted = decrypted[first_blob_start_offset:]
if (blob_info.blob_num == len(self.descriptor.blobs) - 2) or (len(decrypted) + wrote >= size):
decrypted += (b'\x00' * (size - len(decrypted) - wrote - (skip_blobs * 2097151)))
decrypted += (b'\x00' * (size - len(decrypted) - wrote - (skip_blobs * (MAX_BLOB_SIZE - 1))))
log.debug("sending browser final blob (%i/%i)", blob_info.blob_num + 1,
len(self.descriptor.blobs) - 1)
await response.write_eof(decrypted)
@@ -308,6 +313,9 @@ class ManagedStream:
if response._eof_sent:
break
return response
except ConnectionResetError:
log.warning("connection was reset after sending browser %i blob bytes", wrote)
raise asyncio.CancelledError("range request transport was reset")
finally:
response.force_close()
if (request, response) in self.streaming_responses:
@@ -483,8 +491,8 @@ class ManagedStream:
if end >= size:
raise HTTPRequestRangeNotSatisfiable()
skip_blobs = start // 2097150
skip = skip_blobs * 2097151
skip_blobs = start // (MAX_BLOB_SIZE - 2) # -2 because ... dont remember
skip = skip_blobs * (MAX_BLOB_SIZE - 1) # -1 because
skip_first_blob = start - skip
start = skip_first_blob + skip
final_size = end - start + 1
+1 -1
View File
@@ -442,7 +442,7 @@ class StreamManager:
except asyncio.TimeoutError:
error = DownloadDataTimeout(stream.sd_hash)
raise error
except Exception as err: # forgive data timeout, dont delete stream
except Exception as err: # forgive data timeout, don't delete stream
error = err
raise
finally:
+3 -3
View File
@@ -151,11 +151,11 @@ class CommandTestCase(IntegrationTestCase):
wallet_node.manager.old_db = daemon.storage
return daemon
async def confirm_tx(self, txid):
async def confirm_tx(self, txid, ledger=None):
""" Wait for tx to be in mempool, then generate a block, wait for tx to be in a block. """
await self.on_transaction_id(txid)
await self.on_transaction_id(txid, ledger)
await self.generate(1)
await self.on_transaction_id(txid)
await self.on_transaction_id(txid, ledger)
return txid
async def on_transaction_dict(self, tx):
+2 -2
View File
@@ -19,7 +19,6 @@ import collections
from lbry.schema.claim import Claim
from lbry.cryptoutils import get_lbry_hash_obj
log = logging.getLogger(__name__)
@@ -192,7 +191,8 @@ async def resolve_host(url: str, port: int, proto: str) -> str:
return (await loop.getaddrinfo(
url, port,
proto=socket.IPPROTO_TCP if proto == 'tcp' else socket.IPPROTO_UDP,
type=socket.SOCK_STREAM if proto == 'tcp' else socket.SOCK_DGRAM
type=socket.SOCK_STREAM if proto == 'tcp' else socket.SOCK_DGRAM,
family=socket.AF_INET
))[0][4][0]
+12 -20
View File
@@ -5,7 +5,6 @@ from hashlib import sha256
from string import hexdigits
import ecdsa
from lbry.wallet.dewies import dewies_to_lbc
from lbry.wallet.constants import TXO_TYPES
from torba.client.baseaccount import BaseAccount, HierarchicalDeterministic
@@ -28,19 +27,17 @@ class Account(BaseAccount):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.channel_keys = {}
self.preferences = {}
@property
def hash(self) -> bytes:
h = sha256(json.dumps(self.to_dict(False)).encode())
h = sha256(json.dumps(self.to_dict(include_channel_keys=False)).encode())
for cert in sorted(self.channel_keys.keys()):
h.update(cert.encode())
return h.digest()
def apply(self, d: dict):
super().apply(d)
def merge(self, d: dict):
super().merge(d)
self.channel_keys.update(d.get('certificates', {}))
self.preferences.update(d.get('preferences', {}))
def add_channel_private_key(self, private_key):
public_key_bytes = private_key.get_verifying_key().to_der()
@@ -80,7 +77,7 @@ class Account(BaseAccount):
constraints.update({'txo_type': 0})
return super().get_balance(confirmations, **constraints)
async def get_granular_balances(self, confirmations=0, reserved_subtotals=False):
async def get_detailed_balance(self, confirmations=0, reserved_subtotals=False):
tips_balance, supports_balance, claims_balance = 0, 0, 0
get_total_balance = partial(self.get_balance, confirmations=confirmations, include_claims=True)
total = await get_total_balance()
@@ -100,13 +97,13 @@ class Account(BaseAccount):
confirmations=confirmations, include_claims=True, txo_type__gt=0
)
return {
'total': dewies_to_lbc(total),
'available': dewies_to_lbc(total - reserved),
'reserved': dewies_to_lbc(reserved),
'total': total,
'available': total - reserved,
'reserved': reserved,
'reserved_subtotals': {
'claims': dewies_to_lbc(claims_balance),
'supports': dewies_to_lbc(supports_balance),
'tips': dewies_to_lbc(tips_balance)
'claims': claims_balance,
'supports': supports_balance,
'tips': tips_balance
} if reserved_subtotals else None
}
@@ -120,22 +117,17 @@ class Account(BaseAccount):
def from_dict(cls, ledger, wallet, d: dict) -> 'Account':
account = super().from_dict(ledger, wallet, d)
account.channel_keys = d.get('certificates', {})
account.preferences = d.get('preferences', {})
return account
def to_dict(self, include_channel_keys=True, include_preferences=True):
d = super().to_dict()
def to_dict(self, encrypt_password: str = None, include_channel_keys: bool = True):
d = super().to_dict(encrypt_password)
if include_channel_keys:
d['certificates'] = self.channel_keys
if include_preferences and self.preferences:
d['preferences'] = self.preferences
return d
async def get_details(self, **kwargs):
details = await super().get_details(**kwargs)
details['certificates'] = len(self.channel_keys)
if self.preferences:
details['preferences'] = self.preferences
return details
def get_transaction_history(self, **constraints):
+9
View File
@@ -31,3 +31,12 @@ def lbc_to_dewies(lbc: str) -> int:
def dewies_to_lbc(dewies) -> str:
return satoshis_to_coins(dewies)
def dict_values_to_lbc(d):
for key, value in d.items():
if isinstance(value, int):
d[key] = dewies_to_lbc(value)
elif isinstance(value, dict):
dict_values_to_lbc(value)
return d
+17
View File
@@ -244,6 +244,23 @@ class MainNetLedger(BaseLedger):
def get_transaction_history_count(self, **constraints):
return self.db.get_transaction_count(**constraints)
@staticmethod
async def get_detailed_balance(accounts, confirmations=0, reserved_subtotals=False):
result = {}
for account in accounts:
balance = await account.get_detailed_balance(confirmations, reserved_subtotals)
if result:
for key, value in balance.items():
if key == 'reserved_subtotals':
if value is not None:
for subkey, subvalue in value.items():
result['reserved_subtotals'][subkey] += subvalue
else:
result[key] += value
else:
result = balance
return result
class TestNetLedger(MainNetLedger):
network_name = 'testnet'
+5 -39
View File
@@ -5,6 +5,7 @@ from binascii import unhexlify
from torba.client.basemanager import BaseWalletManager
from torba.client.wallet import ENCRYPT_ON_DISK
from torba.rpc.jsonrpc import CodeMessageError
from lbry.wallet.ledger import MainNetLedger
@@ -26,42 +27,8 @@ class LbryWalletManager(BaseWalletManager):
def db(self) -> WalletDatabase:
return self.ledger.db
@property
def use_encryption(self):
return self.default_account.serialize_encrypted
@property
def is_wallet_unlocked(self):
return not self.default_account.encrypted
def check_locked(self):
return self.default_account.encrypted
def decrypt_account(self, account):
assert account.password is not None, "account is not unlocked"
assert not account.encrypted, "account is not unlocked"
account.serialize_encrypted = False
self.save()
return not account.encrypted and not account.serialize_encrypted
def encrypt_account(self, password, account):
assert not account.encrypted, "account is already encrypted"
account.encrypt(password)
account.serialize_encrypted = True
self.save()
self.unlock_account(password, account)
return account.serialize_encrypted
def unlock_account(self, password, account):
assert account.encrypted, "account is not locked"
account.decrypt(password)
return not account.encrypted
def lock_account(self, account):
assert account.password is not None, "account is already locked"
assert not account.encrypted and account.serialize_encrypted, "account is not encrypted"
account.encrypt(account.password)
return account.encrypted
return self.default_wallet.is_locked
@staticmethod
def migrate_lbryum_to_torba(path):
@@ -155,6 +122,9 @@ class LbryWalletManager(BaseWalletManager):
log.info('Wallet at %s is empty, generating a default account.', default_wallet.id)
default_wallet.generate_account(ledger)
default_wallet.save()
if default_wallet.is_locked and default_wallet.preferences.get(ENCRYPT_ON_DISK) is None:
default_wallet.preferences[ENCRYPT_ON_DISK] = True
default_wallet.save()
if receiving_addresses or change_addresses:
if not os.path.exists(ledger.path):
os.mkdir(ledger.path)
@@ -210,7 +180,3 @@ class LbryWalletManager(BaseWalletManager):
tx = self.ledger.transaction_class(unhexlify(raw))
await self.ledger.maybe_verify_transaction(tx, height)
return tx
def save(self):
for wallet in self.wallets:
wallet.save()
+1 -1
View File
@@ -79,7 +79,7 @@ class LBC(Coin):
@classmethod
def address_from_script(cls, script):
'''Given a pk_script, return the adddress it pays to, or None.'''
'''Given a pk_script, return the address it pays to, or None.'''
return ScriptPubKey.pay_to(cls.address_handlers, script)
@classmethod
+12 -8
View File
@@ -1,7 +1,11 @@
from math import sqrt
TRENDING_WINDOW = 134 # number of blocks in ~6hr period (21600 seconds / 161 seconds per block)
TRENDING_DATA_POINTS = 7 # WINDOW * DATA_POINTS = ~1 week worth of trending data
# TRENDING_WINDOW is the number of blocks in ~6hr period (21600 seconds / 161 seconds per block)
TRENDING_WINDOW = 134
# TRENDING_DATA_POINTS says how many samples to use for the trending algorithm
# i.e. only consider claims from the most recent (TRENDING_WINDOW * TRENDING_DATA_POINTS) blocks
TRENDING_DATA_POINTS = 7
CREATE_TREND_TABLE = """
create table if not exists trend (
@@ -26,7 +30,7 @@ class ZScore:
if self.last is not None:
self.count += 1
self.total += self.last
self.power += self.last**2
self.power += self.last ** 2
self.last = value
@property
@@ -35,7 +39,7 @@ class ZScore:
@property
def standard_deviation(self):
return sqrt((self.power / self.count) - self.mean**2)
return sqrt((self.power / self.count) - self.mean ** 2)
def finalize(self):
if self.count == 0:
@@ -47,19 +51,19 @@ def register_trending_functions(connection):
connection.create_aggregate("zscore", 1, ZScore)
def calculate_trending(db, height, is_first_sync, final_height):
def calculate_trending(db, height, final_height):
# don't start tracking until we're at the end of initial sync
if is_first_sync and height < (final_height - (TRENDING_WINDOW*TRENDING_DATA_POINTS)):
if height < (final_height - (TRENDING_WINDOW * TRENDING_DATA_POINTS)):
return
if height % TRENDING_WINDOW != 0:
return
db.execute(f"""
DELETE FROM trend WHERE height < {height-(TRENDING_WINDOW*TRENDING_DATA_POINTS)}
DELETE FROM trend WHERE height < {height - (TRENDING_WINDOW * TRENDING_DATA_POINTS)}
""")
start = (height-TRENDING_WINDOW)+1
start = (height - TRENDING_WINDOW) + 1
db.execute(f"""
INSERT OR IGNORE INTO trend (claim_hash, height, amount)
SELECT claim_hash, {start}, COALESCE(
+1 -1
View File
@@ -699,7 +699,7 @@ class SQLDB:
update_claims, delete_claim_hashes, affected_channels, forward_timer=True)
r(self.insert_supports, insert_supports)
r(self.update_claimtrie, height, recalculate_claim_hashes, deleted_claim_names, forward_timer=True)
r(calculate_trending, self.db, height, self.main.first_sync, daemon_height)
r(calculate_trending, self.db, height, daemon_height)
class LBRYDB(DB):
+2 -2
View File
@@ -141,9 +141,9 @@ def release(args):
type_label = get_label(pr, 'type')
if area_labels and type_label:
for area_name in area_labels:
for incompat in get_backwards_incompatible(pr.body):
for incompat in get_backwards_incompatible(pr.body or ""):
incompats.append(f' * [{area_name}] {incompat.strip()} ({pr.html_url})')
for release_text in get_release_text(pr.body):
for release_text in get_release_text(pr.body or ""):
release_texts.append(f'{release_text.strip()} ({pr.html_url})')
if type_label != 'fixup':
area = areas.setdefault(area_name, [])
+2 -2
View File
@@ -58,7 +58,7 @@ async def main(cmd_args=None):
start = time.perf_counter()
kwargs = {
'page': page,
# 'claim_type': 'stream',
'claim_type': 'stream',
'order_by': ['trending_global', 'trending_mixed'],
'no_totals': True
}
@@ -153,7 +153,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--allow_fees", action='store_true')
parser.add_argument("--exit_on_error", action='store_true')
parser.add_argument("--stall_download_timeout", default=0, type=int)
parser.add_argument("--stall_download_timeout", default=5, type=int)
parser.add_argument("--keep_files", action='store_true')
parser.add_argument("--head_blob_only", action='store_true')
parser.add_argument("--download_pages", type=int, default=10)
@@ -507,6 +507,22 @@ class ChannelCommands(CommandTestCase):
# second wallet should be able to update now
await daemon2.jsonrpc_channel_update(claim_id, bid='0.5')
async def test_channel_update_across_accounts(self):
account2 = await self.daemon.jsonrpc_account_create('second account')
channel = await self.out(self.channel_create('@spam', '1.0', account_id=account2.id))
# channel not in account1
with self.assertRaisesRegex(Exception, "Can't find the channel"):
await self.channel_update(self.get_claim_id(channel), bid='2.0', account_id=self.account.id)
# channel is in account2
await self.channel_update(self.get_claim_id(channel), bid='2.0', account_id=account2.id)
result = await self.out(self.daemon.jsonrpc_channel_list())
self.assertEqual(result[0]['amount'], '2.0')
# check all accounts for channel
await self.channel_update(self.get_claim_id(channel), bid='3.0')
result = await self.out(self.daemon.jsonrpc_channel_list())
self.assertEqual(result[0]['amount'], '3.0')
await self.channel_abandon(self.get_claim_id(channel))
class StreamCommands(ClaimTestCase):
@@ -564,6 +580,22 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(len(tx['outputs']), 1) # no change
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 2)
async def test_stream_update_and_abandon_across_accounts(self):
account2 = await self.daemon.jsonrpc_account_create('second account')
stream = await self.out(self.stream_create('spam', '1.0', account_id=account2.id))
# stream not in account1
with self.assertRaisesRegex(Exception, "Can't find the stream"):
await self.stream_update(self.get_claim_id(stream), bid='2.0', account_id=self.account.id)
# stream is in account2
await self.stream_update(self.get_claim_id(stream), bid='2.0', account_id=account2.id)
result = await self.out(self.daemon.jsonrpc_stream_list())
self.assertEqual(result[0]['amount'], '2.0')
# check all accounts for stream
await self.stream_update(self.get_claim_id(stream), bid='3.0')
result = await self.out(self.daemon.jsonrpc_stream_list())
self.assertEqual(result[0]['amount'], '3.0')
await self.stream_abandon(self.get_claim_id(stream))
async def test_publishing_checks_all_accounts_for_channel(self):
account1_id, account1 = self.account.id, self.account
new_account = await self.out(self.daemon.jsonrpc_account_create('second account'))
+26
View File
@@ -1,4 +1,6 @@
import contextlib
import asyncio
import logging
from io import StringIO
from torba.testcase import AsyncioTestCase
@@ -37,3 +39,27 @@ class CLIIntegrationTest(AsyncioTestCase):
cli.main(["--api", "localhost:5299", "status"])
actual_output = actual_output.getvalue()
self.assertIn("connection_status", actual_output)
def test_setup_logging(self):
def setup(argv):
parser = cli.get_argument_parser()
args, command_args = parser.parse_known_args(argv)
loop = asyncio.get_event_loop()
conf = Config.create_from_arguments(args)
cli.setup_logging(args, conf, loop)
setup(["start"])
self.assertTrue(logging.getLogger("lbry").isEnabledFor(logging.INFO))
self.assertFalse(logging.getLogger("lbry").isEnabledFor(logging.DEBUG))
setup(["start", "--verbose"])
self.assertTrue(logging.getLogger("lbry").isEnabledFor(logging.DEBUG))
self.assertTrue(logging.getLogger("lbry").isEnabledFor(logging.INFO))
self.assertFalse(logging.getLogger("torba").isEnabledFor(logging.DEBUG))
setup(["start", "--verbose", "lbry.extras", "lbry.wallet", "torba.client"])
self.assertTrue(logging.getLogger("lbry.extras").isEnabledFor(logging.DEBUG))
self.assertTrue(logging.getLogger("lbry.wallet").isEnabledFor(logging.DEBUG))
self.assertTrue(logging.getLogger("torba.client").isEnabledFor(logging.DEBUG))
self.assertFalse(logging.getLogger("lbry").isEnabledFor(logging.DEBUG))
self.assertFalse(logging.getLogger("torba").isEnabledFor(logging.DEBUG))
+5 -5
View File
@@ -3,7 +3,7 @@ from binascii import hexlify
from lbry.dht import constants
from lbry.dht.node import Node
from lbry.dht.peer import PeerManager, KademliaPeer
from lbry.dht.peer import PeerManager, make_kademlia_peer
from torba.testcase import AsyncioTestCase
@@ -39,7 +39,7 @@ class DHTIntegrationTest(AsyncioTestCase):
bad_peers = []
for candidate in self.nodes[1:10]:
address, port, node_id = candidate.protocol.external_ip, candidate.protocol.udp_port, candidate.protocol.node_id
peer = KademliaPeer(self.loop, address, node_id, port)
peer = make_kademlia_peer(node_id, address, udp_port=port)
bad_peers.append(peer)
node.protocol.add_peer(peer)
candidate.stop()
@@ -70,7 +70,7 @@ class DHTIntegrationTest(AsyncioTestCase):
await asyncio.sleep(.1)
timeout -= 1
if not timeout:
self.fail("node didnt join back after 2 seconds")
self.fail("node didn't join back after 2 seconds")
async def test_announce_no_peers(self):
await self.setup_network(1)
@@ -100,9 +100,9 @@ class DHTIntegrationTest(AsyncioTestCase):
await self.setup_network(2, seed_nodes=2)
node1, node2 = self.nodes
node2.stop()
# forcefully make it a bad peer but dont remove it from routing table
# forcefully make it a bad peer but don't remove it from routing table
address, port, node_id = node2.protocol.external_ip, node2.protocol.udp_port, node2.protocol.node_id
peer = KademliaPeer(self.loop, address, node_id, port)
peer = make_kademlia_peer(node_id, address, udp_port=port)
self.assertTrue(node1.protocol.peer_manager.peer_is_good(peer))
node1.protocol.peer_manager.report_failure(node2.protocol.external_ip, node2.protocol.udp_port)
node1.protocol.peer_manager.report_failure(node2.protocol.external_ip, node2.protocol.udp_port)
+2 -2
View File
@@ -98,7 +98,7 @@ class FileCommands(CommandTestCase):
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2, save_file=True)
self.assertIn('error', resp)
self.assertEqual('Failed to download data blobs for sd hash %s within timeout' % sd_hash, resp['error'])
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'), "data timeout didnt create a file")
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'), "data timeout didn't create a file")
await self.server.blob_manager.delete_blobs([sd_hash])
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2, save_file=True)
self.assertIn('error', resp)
@@ -118,7 +118,7 @@ class FileCommands(CommandTestCase):
handle.write(b'some other stuff was there instead')
self.daemon.stream_manager.stop()
await self.daemon.stream_manager.start()
await asyncio.wait_for(self.wait_files_to_complete(), timeout=5) # if this hangs, file didnt get set completed
await asyncio.wait_for(self.wait_files_to_complete(), timeout=5) # if this hangs, file didn't get set completed
# check that internal state got through up to the file list API
stream = self.daemon.stream_manager.get_stream_by_stream_hash(file_info['stream_hash'])
file_info = self.sout(self.daemon.jsonrpc_file_list()[0])
@@ -178,7 +178,7 @@ class ResolveCommand(BaseResolveTestCase):
channel = (await self.channel_create('@abc', '1.0'))['outputs'][0]
orphan_claim_id = self.get_claim_id(orphan_claim)
# Original channel doesnt exists anymore, so the signature is invalid. For invalid signatures, resolution is
# Original channel doesn't exists anymore, so the signature is invalid. For invalid signatures, resolution is
# only possible outside a channel
response = await self.resolve('lbry://@abc/on-channel-claim')
self.assertEqual(response, {
+1 -1
View File
@@ -413,7 +413,7 @@ class RangeRequestsLRUCache(CommandTestCase):
self.server.stop_server()
# running with cache size 0 gets through without errors without
# this since the server doesnt stop immediately
# this since the server doesn't stop immediately
await asyncio.sleep(1, loop=self.loop)
await self._request_stream()
-114
View File
@@ -1,114 +0,0 @@
from unittest import mock
from torba.orchstr8.node import WalletNode, SPVNode
from torba.testcase import AsyncioTestCase
from lbry.conf import Config
from lbry.wallet import LbryWalletManager, RegTestLedger
from lbry.extras.daemon.Daemon import Daemon
from lbry.extras.daemon.Components import WalletComponent
from lbry.extras.daemon.Components import (
DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
UPNP_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT
)
from lbry.extras.daemon.ComponentManager import ComponentManager
class AccountSynchronization(AsyncioTestCase):
async def asyncSetUp(self):
self.wallet_node = WalletNode(LbryWalletManager, RegTestLedger)
await self.wallet_node.start(
SPVNode(None),
"carbon smart garage balance margin twelve chest sword toast envelope bottom stomach absent",
False
)
self.account = self.wallet_node.account
conf = Config()
conf.data_dir = self.wallet_node.data_path
conf.wallet_dir = self.wallet_node.data_path
conf.download_dir = self.wallet_node.data_path
conf.share_usage_data = False
conf.use_upnp = False
conf.reflect_streams = False
conf.blockchain_name = 'lbrycrd_regtest'
conf.lbryum_servers = [('localhost', 50001)]
conf.reflector_servers = []
conf.known_dht_nodes = []
def wallet_maker(component_manager):
self.wallet_component = WalletComponent(component_manager)
self.wallet_component.wallet_manager = self.wallet_node.manager
self.wallet_component._running = True
return self.wallet_component
conf.components_to_skip = [
DHT_COMPONENT, UPNP_COMPONENT, HASH_ANNOUNCER_COMPONENT,
PEER_PROTOCOL_SERVER_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT
]
self.daemon = Daemon(conf, ComponentManager(
conf, skip_components=conf.components_to_skip, wallet=wallet_maker
))
await self.daemon.initialize()
async def asyncTearDown(self):
self.wallet_component._running = False
await self.daemon.stop(shutdown_runner=False)
@mock.patch('time.time', mock.Mock(return_value=12345))
def test_sync(self):
starting_hash = '69afcd60a300f47933917d77ef011beeeb4decfafebbda91c144c84282c6814f'
self.account.modified_on = 123.456
self.assertEqual(self.daemon.jsonrpc_sync_hash(), starting_hash)
self.assertEqual(self.daemon.jsonrpc_sync_apply('password')['hash'], starting_hash)
self.assertFalse(self.account.channel_keys)
hash_w_cert = '974721f42dab42657b5911b7caf4af98ce4d3879eea6ac23d50c1d79bc5020ef'
add_cert = (
'czo4MTkyOjE2OjE6qs3JRvS/bhX8p1JD68sqyA2Qhx3EVTqskhqEAwtfAUfUsQqeJ1rtMdRf40vkGKnpt4NT0b'
'XEqb5O+lba4nkLF7vZENhc2zuOrjobCPVbiVHNwOfH56Ayrh1ts5LMcnl5+Mk1BUyGCwXcqEg2KiUkd3YZpiHQ'
'T7WfcODcU6l7IRivb8iawCebZJx9waVyQoqEDKwZUY1i5HA0VLC+s5cV7it1AWbewiyWOQtZdEPzNY44oXLJex'
'SirElQqDqNZyl3Hjy8YqacBbSYoejIRnmXpC9y25keP6hep3f9i1K2HDNwhwns1W1vhuzuO2Gy9+a0JlVm5mwc'
'N2pqO4tCZr6tE3aym2FaSAunOi7QYVFMI6arb9Gvn9P+T+WRiFYfzwDFVR+j5ZPmUDXxHisy5OF163jH61wbBY'
'pPienjlVtDOxoZmA8+AwWXKRdINsRcull9pu7EVCq5yQmrmxoPbLxNh5pRGrBB0JwCCOMIf+KPwS+7Z6dDbiwO'
'2NUpk8USJMTmXmFDCr2B0PJiG6Od2dD2oGN0F7aYZvUuKbqj8eDrJMe/zLbhq47jUjkJFCvtxUioo63ORk1pzH'
'S0/X4/6/95PRSMaXm4DcZ9BdyxR2E/AKc8UN6AL5rrn6quXkC6R3ZhKgN3Si2S9y6EGFsL7dgzX331U08ZviLj'
'NsrG0EKUnf+TGQ42MqnLQBOiO/ZoAwleOzNZnCYOQQ14Mm8y17xUpmdWRDiRKpAOJU22jKnxtqQ='
)
self.daemon.jsonrpc_sync_apply('password', data=add_cert)
self.assertEqual(self.daemon.jsonrpc_sync_hash(), hash_w_cert)
self.assertEqual(self.account.channel_keys, {'abcdefg1234:0': '---PRIVATE KEY---'})
# applying the same diff is idempotent
self.daemon.jsonrpc_sync_apply('password', data=add_cert)
self.assertEqual(self.daemon.jsonrpc_sync_hash(), hash_w_cert)
self.assertEqual(self.account.channel_keys, {'abcdefg1234:0': '---PRIVATE KEY---'})
@mock.patch('time.time', mock.Mock(return_value=12345))
def test_account_preferences_syncing(self):
starting_hash = '69afcd60a300f47933917d77ef011beeeb4decfafebbda91c144c84282c6814f'
self.account.modified_on = 123.456
self.assertEqual(self.daemon.jsonrpc_sync_hash(), starting_hash)
self.assertEqual(self.daemon.jsonrpc_sync_apply('password')['hash'], starting_hash)
self.assertFalse(self.daemon.jsonrpc_preference_get())
hash_w_pref = '2fe43f0b2f8bbf1fbb55537f862d8bcb0823791019a7151c848bd5f5bd32d336'
add_pref = (
'czo4MTkyOjE2OjE6Jgn3nAGrfYP2usMA4KQ/73+YHAwMyiGdSWuxCmgZKlpwSpnfQv8R7R0tum/n2oTSBQxjdL'
'OlTW+tv/G5L2GfQ5op3xaT89gN+F/JJnvf3cdWvYH7Nc+uTUMb7cKhJP7hQvFW5bb1Y3jX3EBBY00Jkqyj9RCR'
'XPtbLVu71KbVRvCAR/oAnMEsgD+ITsC3WkXMwE3BS2LjJDQmeqbH4YXNdcjJN/JzQ6fxOmr3Uk1GqnpuhFsta8'
'H14ViRilq1pLKOSZIN80rrm5cKq45nFO5kFeoqBCEaal4u2/OkX9nOnpQlO3E95wD8hkCmZ3i20aSte6nqwqXx'
'ZKVRZqR2a0TjwVWB8kPXPA2ewKvPILaj190bXPl8EVu+TAnTCQwMgytinYjtcKNZmMz3ENJyI2mCANwpWlX7xl'
'y/J+qLi5b9N+agghTxggs5rVJ/hkaue7GS542dXDrwMrw9nwGqNw3dS/lcU+1wRUQ0fnHwb/85XbbwyO2aDj2i'
'DFNkdyLyUIiIUvB1JfWAnWqX3vQcL1REK1ePgUei7dCHJ3WyWdsRx3cVXzlK8yOPkf0N6d3AKrZQWVebwDC7Nd'
'eL4sDW8AkaXuBIrbuZw6XUHd6WI0NvU/q10j2qMm0YoXSu+dExou1/1THwx5g86MxcX5nwodKUEVCOTzKMyrLz'
'CRsitH/+dAXhZNRp/FbnDCGBMyD3MOYCjZvAFbCZUasoRwqponxILw=='
)
self.daemon.jsonrpc_sync_apply('password', data=add_pref)
self.assertEqual(self.daemon.jsonrpc_sync_hash(), hash_w_pref)
self.assertEqual(self.daemon.jsonrpc_preference_get(), {"fruit": ["apple", "orange"]})
self.daemon.jsonrpc_preference_set("fruit", ["peach", "apricot"])
self.assertEqual(self.daemon.jsonrpc_preference_get(), {"fruit": ["peach", "apricot"]})
self.assertNotEqual(self.daemon.jsonrpc_sync_hash(), hash_w_pref)
@@ -38,34 +38,42 @@ class TransactionCommandsTestCase(CommandTestCase):
await self.assertBalance(self.account, '11.0')
async def test_granular_balances(self):
account_balance = self.daemon.jsonrpc_account_balance
account2 = await self.daemon.jsonrpc_account_create("Tip-er")
self.assertEqual(await account_balance(reserved_subtotals=False), {
account_balance = self.daemon.jsonrpc_account_balance
wallet_balance = self.daemon.jsonrpc_wallet_balance
expected = {
'total': '10.0',
'available': '10.0',
'reserved': '0.0',
'reserved_subtotals': None
})
}
self.assertEqual(await account_balance(reserved_subtotals=False), expected)
self.assertEqual(await wallet_balance(reserved_subtotals=False), expected)
self.assertEqual(await account_balance(reserved_subtotals=True), {
expected = {
'total': '10.0',
'available': '10.0',
'reserved': '0.0',
'reserved_subtotals': {'claims': '0.0', 'supports': '0.0', 'tips': '0.0'}
})
}
self.assertEqual(await account_balance(reserved_subtotals=True), expected)
self.assertEqual(await wallet_balance(reserved_subtotals=True), expected)
# claim with update + supporting our own claim
stream1 = await self.stream_create('granularity', '3.0')
await self.stream_update(self.get_claim_id(stream1), data=b'news', bid='1.0')
await self.support_create(self.get_claim_id(stream1), '2.0')
self.assertEqual(await account_balance(reserved_subtotals=True), {
expected = {
'total': '9.977534',
'available': '6.977534',
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
}
self.assertEqual(await account_balance(reserved_subtotals=True), expected)
self.assertEqual(await wallet_balance(reserved_subtotals=True), expected)
account2 = await self.daemon.jsonrpc_account_create("Tip-er")
address2 = await self.daemon.jsonrpc_address_unused(account2.id)
# send lbc to someone else
@@ -77,6 +85,12 @@ class TransactionCommandsTestCase(CommandTestCase):
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
self.assertEqual(await wallet_balance(reserved_subtotals=True), {
'total': '9.97741',
'available': '6.97741',
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
# tip received
support1 = await self.support_create(
@@ -88,6 +102,12 @@ class TransactionCommandsTestCase(CommandTestCase):
'reserved': '3.3',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.3'}
})
self.assertEqual(await wallet_balance(reserved_subtotals=True), {
'total': '9.977268',
'available': '6.677268',
'reserved': '3.3',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.3'}
})
# tip claimed
tx = await self.daemon.jsonrpc_support_abandon(txid=support1['txid'], nout=0)
@@ -98,6 +118,12 @@ class TransactionCommandsTestCase(CommandTestCase):
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
self.assertEqual(await wallet_balance(reserved_subtotals=True), {
'total': '9.977161',
'available': '6.977161',
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
stream2 = await self.stream_create(
'granularity-is-cool', '0.1', account_id=account2.id, funding_account_ids=[account2.id]
@@ -105,10 +131,17 @@ class TransactionCommandsTestCase(CommandTestCase):
# tip another claim
await self.support_create(
self.get_claim_id(stream2), '0.2', tip=True, funding_account_ids=[self.account.id])
self.get_claim_id(stream2), '0.2', tip=True, funding_account_ids=[self.account.id]
)
self.assertEqual(await account_balance(reserved_subtotals=True), {
'total': '9.077157',
'available': '6.077157',
'reserved': '3.0',
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
})
self.assertEqual(await wallet_balance(reserved_subtotals=True), {
'total': '9.938908',
'available': '6.638908',
'reserved': '3.3',
'reserved_subtotals': {'claims': '1.1', 'supports': '2.0', 'tips': '0.2'}
})
@@ -0,0 +1,159 @@
import asyncio
import json
from lbry.testcase import CommandTestCase
from torba.client.wallet import ENCRYPT_ON_DISK
class WalletEncryptionAndSynchronization(CommandTestCase):
SEED = (
"carbon smart garage balance margin twelve chest "
"sword toast envelope bottom stomach absent"
)
async def asyncSetUp(self):
await super().asyncSetUp()
self.daemon2 = await self.add_daemon(
seed="chest sword toast envelope bottom stomach absent "
"carbon smart garage balance margin twelve"
)
address = (await self.daemon2.wallet_manager.default_account.receiving.get_addresses(limit=1, only_usable=True))[0]
sendtxid = await self.blockchain.send_to_address(address, 1)
await self.confirm_tx(sendtxid, self.daemon2.ledger)
def assertWalletEncrypted(self, wallet_path, encrypted):
wallet = json.load(open(wallet_path))
self.assertEqual(wallet['accounts'][0]['private_key'][1:4] != 'prv', encrypted)
async def test_sync(self):
daemon, daemon2 = self.daemon, self.daemon2
# Preferences
self.assertFalse(daemon.jsonrpc_preference_get())
self.assertFalse(daemon2.jsonrpc_preference_get())
daemon.jsonrpc_preference_set("fruit", '["peach", "apricot"]')
daemon.jsonrpc_preference_set("one", "1")
daemon.jsonrpc_preference_set("conflict", "1")
daemon2.jsonrpc_preference_set("another", "A")
await asyncio.sleep(1)
# these preferences will win after merge since they are "newer"
daemon2.jsonrpc_preference_set("two", "2")
daemon2.jsonrpc_preference_set("conflict", "2")
daemon.jsonrpc_preference_set("another", "B")
self.assertDictEqual(daemon.jsonrpc_preference_get(), {
"one": "1", "conflict": "1", "another": "B", "fruit": ["peach", "apricot"]
})
self.assertDictEqual(daemon2.jsonrpc_preference_get(), {
"two": "2", "conflict": "2", "another": "A"
})
self.assertEqual(len((await daemon.jsonrpc_account_list())['lbc_regtest']), 1)
data = await daemon2.jsonrpc_sync_apply('password')
await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
self.assertEqual(len((await daemon.jsonrpc_account_list())['lbc_regtest']), 2)
self.assertDictEqual(
# "two" key added and "conflict" value changed to "2"
daemon.jsonrpc_preference_get(),
{"one": "1", "two": "2", "conflict": "2", "another": "B", "fruit": ["peach", "apricot"]}
)
# Channel Certificate
channel = await daemon2.jsonrpc_channel_create('@foo', '0.1')
await self.confirm_tx(channel.id, self.daemon2.ledger)
# both daemons will have the channel but only one has the cert so far
self.assertEqual(len(await daemon.jsonrpc_channel_list()), 1)
self.assertEqual(len(daemon.wallet_manager.default_wallet.accounts[1].channel_keys), 0)
self.assertEqual(len(await daemon2.jsonrpc_channel_list()), 1)
self.assertEqual(len(daemon2.wallet_manager.default_account.channel_keys), 1)
data = await daemon2.jsonrpc_sync_apply('password')
await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
# both daemons have the cert after sync'ing
self.assertEqual(
daemon2.wallet_manager.default_account.channel_keys,
daemon.wallet_manager.default_wallet.accounts[1].channel_keys
)
async def test_encryption_and_locking(self):
daemon = self.daemon
wallet = daemon.wallet_manager.default_wallet
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': False})
self.assertIsNone(daemon.jsonrpc_preference_get(ENCRYPT_ON_DISK))
self.assertWalletEncrypted(wallet.storage.path, False)
# can't lock an unencrypted account
with self.assertRaisesRegex(AssertionError, "Cannot lock an unencrypted wallet, encrypt first."):
daemon.jsonrpc_wallet_lock()
# safe to call unlock and decrypt, they are no-ops at this point
daemon.jsonrpc_wallet_unlock('password') # already unlocked
daemon.jsonrpc_wallet_decrypt() # already not encrypted
daemon.jsonrpc_wallet_encrypt('password')
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': True})
self.assertEqual(daemon.jsonrpc_preference_get(ENCRYPT_ON_DISK), {'encrypt-on-disk': True})
self.assertWalletEncrypted(wallet.storage.path, True)
daemon.jsonrpc_wallet_lock()
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': True, 'is_encrypted': True})
# can't sign transactions with locked wallet
with self.assertRaises(AssertionError):
await daemon.jsonrpc_channel_create('@foo', '1.0')
daemon.jsonrpc_wallet_unlock('password')
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': True})
await daemon.jsonrpc_channel_create('@foo', '1.0')
daemon.jsonrpc_wallet_decrypt()
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': False})
self.assertEqual(daemon.jsonrpc_preference_get(ENCRYPT_ON_DISK), {'encrypt-on-disk': False})
self.assertWalletEncrypted(wallet.storage.path, False)
async def test_sync_with_encryption_and_password_change(self):
daemon, daemon2 = self.daemon, self.daemon2
wallet, wallet2 = daemon.wallet_manager.default_wallet, daemon2.wallet_manager.default_wallet
self.assertEqual(wallet2.encryption_password, None)
self.assertEqual(wallet2.encryption_password, None)
daemon.jsonrpc_wallet_encrypt('password')
self.assertEqual(wallet.encryption_password, 'password')
data = await daemon2.jsonrpc_sync_apply('password2')
# sync_apply doesn't save password if encrypt-on-disk is False
self.assertEqual(wallet2.encryption_password, None)
# need to use new password2 in sync_apply
with self.assertRaises(ValueError): # wrong password
await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
await daemon.jsonrpc_sync_apply('password2', data=data['data'], blocking=True)
# sync_apply with new password2 also sets it as new local password
self.assertEqual(wallet.encryption_password, 'password2')
self.assertEqual(daemon.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': True})
self.assertEqual(daemon.jsonrpc_preference_get(ENCRYPT_ON_DISK), {'encrypt-on-disk': True})
self.assertWalletEncrypted(wallet.storage.path, True)
# check new password is active
daemon.jsonrpc_wallet_lock()
self.assertFalse(daemon.jsonrpc_wallet_unlock('password'))
self.assertTrue(daemon.jsonrpc_wallet_unlock('password2'))
# propagate disk encryption to daemon2
data = await daemon.jsonrpc_sync_apply('password3')
# sync_apply (even with no data) on wallet with encrypt-on-disk updates local password
self.assertEqual(wallet.encryption_password, 'password3')
self.assertEqual(wallet2.encryption_password, None)
await daemon2.jsonrpc_sync_apply('password3', data=data['data'], blocking=True)
# the other device got new password and on disk encryption
self.assertEqual(wallet2.encryption_password, 'password3')
self.assertEqual(daemon2.jsonrpc_wallet_status(), {'is_locked': False, 'is_encrypted': True})
self.assertEqual(daemon2.jsonrpc_preference_get(ENCRYPT_ON_DISK), {'encrypt-on-disk': True})
self.assertWalletEncrypted(wallet2.storage.path, True)
daemon2.jsonrpc_wallet_lock()
self.assertTrue(daemon2.jsonrpc_wallet_unlock('password3'))
@@ -55,7 +55,7 @@ class TestHeadersComponent(CommandTestCase):
async def test_cant_reach_host(self):
HeadersComponent.HEADERS_URL = 'notthere/'
os.unlink(self.headers_component.headers.path)
# test is that this doesnt raise
# test is that this doesn't raise
await self.headers_component.start()
self.assertTrue(self.component_manager.get_components_status()['blockchain_headers'])
self.assertEqual(await self.headers_component.get_status(), {})
@@ -12,7 +12,8 @@ from lbry.extras.daemon.storage import SQLiteStorage
from lbry.blob.blob_manager import BlobManager
from lbry.blob_exchange.server import BlobServer, BlobServerProtocol
from lbry.blob_exchange.client import request_blob
from lbry.dht.peer import KademliaPeer, PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
# import logging
# logging.getLogger("lbry").setLevel(logging.DEBUG)
@@ -43,7 +44,7 @@ class BlobExchangeTestBase(AsyncioTestCase):
self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite"))
self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config)
self.client_peer_manager = PeerManager(self.loop)
self.server_from_client = KademliaPeer(self.loop, "127.0.0.1", b'1' * 48, tcp_port=33333)
self.server_from_client = make_kademlia_peer(b'1' * 48, "127.0.0.1", tcp_port=33333)
await self.client_storage.open()
await self.server_storage.open()
@@ -102,7 +103,7 @@ class TestBlobExchange(BlobExchangeTestBase):
second_client_blob_manager = BlobManager(
self.loop, second_client_dir, second_client_storage, second_client_conf
)
server_from_second_client = KademliaPeer(self.loop, "127.0.0.1", b'1' * 48, tcp_port=33333)
server_from_second_client = make_kademlia_peer(b'1' * 48, "127.0.0.1", tcp_port=33333)
await second_client_storage.open()
await second_client_blob_manager.setup()
@@ -193,7 +194,7 @@ class TestBlobExchange(BlobExchangeTestBase):
second_client_blob_manager = BlobManager(
self.loop, second_client_dir, second_client_storage, second_client_conf
)
server_from_second_client = KademliaPeer(self.loop, "127.0.0.1", b'1' * 48, tcp_port=33333)
server_from_second_client = make_kademlia_peer(b'1' * 48, "127.0.0.1", tcp_port=33333)
await second_client_storage.open()
await second_client_blob_manager.setup()
@@ -1,7 +1,7 @@
import asyncio
from unittest import mock, TestCase
from lbry.dht.protocol.data_store import DictDataStore
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
class DataStoreTests(TestCase):
@@ -13,7 +13,7 @@ class DataStoreTests(TestCase):
def _test_add_peer_to_blob(self, blob=b'2' * 48, node_id=b'1' * 48, address='1.2.3.4', tcp_port=3333,
udp_port=4444):
peer = self.peer_manager.get_kademlia_peer(node_id, address, udp_port)
peer = make_kademlia_peer(node_id, address, udp_port)
peer.update_tcp_port(tcp_port)
before = self.data_store.get_peers_for_blob(blob)
self.data_store.add_peer_to_blob(peer, blob)
+7 -7
View File
@@ -2,7 +2,7 @@ import struct
import asyncio
from lbry.utils import generate_id
from lbry.dht.protocol.routing_table import KBucket
from lbry.dht.peer import PeerManager, KademliaPeer
from lbry.dht.peer import PeerManager, make_kademlia_peer
from lbry.dht import constants
from torba.testcase import AsyncioTestCase
@@ -29,8 +29,8 @@ class TestKBucket(AsyncioTestCase):
self.kbucket = KBucket(self.peer_manager, 0, 2**constants.hash_bits, generate_id())
def test_add_peer(self):
peer = KademliaPeer(None, '1.2.3.4', constants.generate_id(2), udp_port=4444)
peer_update2 = KademliaPeer(None, '1.2.3.4', constants.generate_id(2), udp_port=4445)
peer = make_kademlia_peer(constants.generate_id(2), "1.2.3.4", udp_port=4444)
peer_update2 = make_kademlia_peer(constants.generate_id(2), "1.2.3.4", udp_port=4445)
self.assertListEqual([], self.kbucket.peers)
@@ -59,12 +59,12 @@ class TestKBucket(AsyncioTestCase):
# Test if contacts can be added to empty list
# Add k contacts to bucket
for i in range(constants.k):
peer = self.peer_manager.get_kademlia_peer(generate_id(), next(self.address_generator), 4444)
peer = make_kademlia_peer(generate_id(), next(self.address_generator), 4444)
self.assertTrue(self.kbucket.add_peer(peer))
self.assertEqual(peer, self.kbucket.peers[i])
# Test if contact is not added to full list
peer = self.peer_manager.get_kademlia_peer(generate_id(), next(self.address_generator), 4444)
peer = make_kademlia_peer(generate_id(), next(self.address_generator), 4444)
self.assertFalse(self.kbucket.add_peer(peer))
# Test if an existing contact is updated correctly if added again
@@ -125,13 +125,13 @@ class TestKBucket(AsyncioTestCase):
def test_remove_peer(self):
# try remove contact from empty list
peer = self.peer_manager.get_kademlia_peer(generate_id(), next(self.address_generator), 4444)
peer = make_kademlia_peer(generate_id(), next(self.address_generator), 4444)
self.assertRaises(ValueError, self.kbucket.remove_peer, peer)
added = []
# Add couple contacts
for i in range(constants.k-2):
peer = self.peer_manager.get_kademlia_peer(generate_id(), next(self.address_generator), 4444)
peer = make_kademlia_peer(generate_id(), next(self.address_generator), 4444)
self.assertTrue(self.kbucket.add_peer(peer))
added.append(peer)
+10 -10
View File
@@ -5,7 +5,7 @@ from tests import dht_mocks
from lbry.dht.serialization.bencoding import bencode, bdecode
from lbry.dht import constants
from lbry.dht.protocol.protocol import KademliaProtocol
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
class TestProtocol(AsyncioTestCase):
@@ -22,7 +22,7 @@ class TestProtocol(AsyncioTestCase):
await loop.create_datagram_endpoint(lambda: peer1, ('1.2.3.4', 4444))
await loop.create_datagram_endpoint(lambda: peer2, ('1.2.3.5', 4444))
peer = peer2.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
peer = make_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
result = await peer2.get_rpc_peer(peer).ping()
self.assertEqual(result, b'pong')
peer1.stop()
@@ -43,7 +43,7 @@ class TestProtocol(AsyncioTestCase):
await loop.create_datagram_endpoint(lambda: peer1, ('1.2.3.4', 4444))
await loop.create_datagram_endpoint(lambda: peer2, ('1.2.3.5', 4444))
peer = peer2.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
peer = make_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
self.assertEqual(None, peer2.peer_manager.get_node_token(peer.node_id))
await peer2.get_rpc_peer(peer).find_value(b'1' * 48)
self.assertNotEqual(None, peer2.peer_manager.get_node_token(peer.node_id))
@@ -65,12 +65,12 @@ class TestProtocol(AsyncioTestCase):
await loop.create_datagram_endpoint(lambda: peer1, ('1.2.3.4', 4444))
await loop.create_datagram_endpoint(lambda: peer2, ('1.2.3.5', 4444))
peer = peer2.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
peer2_from_peer1 = peer1.peer_manager.get_kademlia_peer(
peer = make_kademlia_peer(node_id1, '1.2.3.4', udp_port=4444)
peer2_from_peer1 = make_kademlia_peer(
peer2.node_id, peer2.external_ip, udp_port=peer2.udp_port
)
peer2_from_peer1.update_tcp_port(3333)
peer3 = peer1.peer_manager.get_kademlia_peer(
peer3 = make_kademlia_peer(
constants.generate_id(), '1.2.3.6', udp_port=4444
)
store_result = await peer2.store_to_peer(b'2' * 48, peer)
@@ -103,7 +103,7 @@ class TestProtocol(AsyncioTestCase):
)
await self.loop.create_datagram_endpoint(lambda: proto, (address, 4444))
proto.start()
return proto, other_peer.peer_manager.get_kademlia_peer(node_id, address, udp_port=udp_port)
return proto, make_kademlia_peer(node_id, address, udp_port=udp_port)
async def test_add_peer_after_handle_request(self):
with dht_mocks.mock_network_loop(self.loop):
@@ -129,7 +129,7 @@ class TestProtocol(AsyncioTestCase):
peer1.routing_table.remove_peer(peer_2_from_peer_1)
# peers not known by be good/bad should be enqueued to maybe-ping
peer1_from_peer3 = peer3.get_rpc_peer(peer3.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', 4444))
peer1_from_peer3 = peer3.get_rpc_peer(make_kademlia_peer(node_id1, '1.2.3.4', 4444))
self.assertEqual(0, len(peer1.ping_queue._pending_contacts))
pong = await peer1_from_peer3.ping()
self.assertEqual(b'pong', pong)
@@ -137,7 +137,7 @@ class TestProtocol(AsyncioTestCase):
peer1.ping_queue._pending_contacts.clear()
# peers who are already good should be added
peer1_from_peer4 = peer4.get_rpc_peer(peer4.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', 4444))
peer1_from_peer4 = peer4.get_rpc_peer(make_kademlia_peer(node_id1, '1.2.3.4', 4444))
peer1.peer_manager.update_contact_triple(node_id4,'1.2.3.7', 4444)
peer1.peer_manager.report_last_replied('1.2.3.7', 4444)
self.assertEqual(0, len(peer1.ping_queue._pending_contacts))
@@ -149,7 +149,7 @@ class TestProtocol(AsyncioTestCase):
peer1.routing_table.buckets[0].peers.clear()
# peers who are known to be bad recently should not be added or maybe-pinged
peer1_from_peer4 = peer4.get_rpc_peer(peer4.peer_manager.get_kademlia_peer(node_id1, '1.2.3.4', 4444))
peer1_from_peer4 = peer4.get_rpc_peer(make_kademlia_peer(node_id1, '1.2.3.4', 4444))
peer1.peer_manager.update_contact_triple(node_id4,'1.2.3.7', 4444)
peer1.peer_manager.report_failure('1.2.3.7', 4444)
peer1.peer_manager.report_failure('1.2.3.7', 4444)
@@ -3,8 +3,7 @@ from torba.testcase import AsyncioTestCase
from tests import dht_mocks
from lbry.dht import constants
from lbry.dht.node import Node
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
expected_ranges = [
(
@@ -29,6 +28,7 @@ expected_ranges = [
)
]
class TestRouting(AsyncioTestCase):
async def test_fill_one_bucket(self):
loop = asyncio.get_event_loop()
@@ -53,7 +53,7 @@ class TestRouting(AsyncioTestCase):
for i in range(1, len(peer_addresses)):
self.assertEqual(len(node_1.protocol.routing_table.get_peers()), contact_cnt)
node = nodes[i]
peer = node_1.protocol.peer_manager.get_kademlia_peer(
peer = make_kademlia_peer(
node.protocol.node_id, node.protocol.external_ip,
udp_port=node.protocol.udp_port
)
@@ -66,6 +66,16 @@ class TestRouting(AsyncioTestCase):
for node in nodes.values():
node.protocol.stop()
async def test_cant_add_peer_without_a_node_id_gracefully(self):
loop = asyncio.get_event_loop()
node = Node(loop, PeerManager(loop), constants.generate_id(), 4444, 4444, 3333, '1.2.3.4')
bad_peer = make_kademlia_peer(None, '1.2.3.4', 5555)
with self.assertLogs(level='WARNING') as logged:
self.assertFalse(await node.protocol._add_peer(bad_peer))
self.assertEqual(1, len(logged.output))
self.assertTrue(logged.output[0].endswith('Tried adding a peer with no node id!'))
async def test_split_buckets(self):
loop = asyncio.get_event_loop()
peer_addresses = [
@@ -81,7 +91,7 @@ class TestRouting(AsyncioTestCase):
node_1 = nodes[0]
for i in range(1, len(peer_addresses)):
node = nodes[i]
peer = node_1.protocol.peer_manager.get_kademlia_peer(
peer = make_kademlia_peer(
node.protocol.node_id, node.protocol.external_ip,
udp_port=node.protocol.udp_port
)
+5 -5
View File
@@ -8,7 +8,7 @@ from tests import dht_mocks
from lbry.conf import Config
from lbry.dht import constants
from lbry.dht.node import Node
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
from lbry.dht.blob_announcer import BlobAnnouncer
from lbry.extras.daemon.storage import SQLiteStorage
@@ -35,7 +35,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
self.nodes.update({len(self.nodes): n})
if add_to_routing_table:
self.node.protocol.add_peer(
self.peer_manager.get_kademlia_peer(
make_kademlia_peer(
n.protocol.node_id, n.protocol.external_ip, n.protocol.udp_port
)
)
@@ -67,7 +67,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
await self.add_peer(node_id, address, False)
last_node = self.nodes[len(self.nodes) - 1]
peer = last_node.protocol.get_rpc_peer(
last_node.protocol.peer_manager.get_kademlia_peer(
make_kademlia_peer(
previous_last_node.protocol.node_id, previous_last_node.protocol.external_ip,
previous_last_node.protocol.udp_port
)
@@ -129,12 +129,12 @@ class TestBlobAnnouncer(AsyncioTestCase):
announced_to = self.nodes[0]
for i in range(1, peer_count):
node = self.nodes[i]
kad_peer = announced_to.protocol.peer_manager.get_kademlia_peer(
kad_peer = make_kademlia_peer(
node.protocol.node_id, node.protocol.external_ip, node.protocol.udp_port
)
await announced_to.protocol._add_peer(kad_peer)
peer = node.protocol.get_rpc_peer(
node.protocol.peer_manager.get_kademlia_peer(
make_kademlia_peer(
announced_to.protocol.node_id,
announced_to.protocol.external_ip,
announced_to.protocol.udp_port
+2 -2
View File
@@ -4,7 +4,7 @@ from torba.testcase import AsyncioTestCase
from tests import dht_mocks
from lbry.dht import constants
from lbry.dht.node import Node
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
class TestNodePingQueueDiscover(AsyncioTestCase):
@@ -42,7 +42,7 @@ class TestNodePingQueueDiscover(AsyncioTestCase):
for i in range(1, len(peer_addresses)):
node = nodes[i]
assert node.protocol.node_id != node_1.protocol.node_id
peer = node_1.protocol.peer_manager.get_kademlia_peer(
peer = make_kademlia_peer(
node.protocol.node_id, node.protocol.external_ip, udp_port=node.protocol.udp_port
)
futs.append(node_1.protocol.get_rpc_peer(peer).ping())
+19 -9
View File
@@ -1,7 +1,7 @@
import asyncio
import unittest
from lbry.utils import generate_id
from lbry.dht.peer import PeerManager
from lbry.dht.peer import PeerManager, make_kademlia_peer
from torba.testcase import AsyncioTestCase
@@ -10,20 +10,30 @@ class PeerTest(AsyncioTestCase):
self.loop = asyncio.get_event_loop()
self.peer_manager = PeerManager(self.loop)
self.node_ids = [generate_id(), generate_id(), generate_id()]
self.first_contact = self.peer_manager.get_kademlia_peer(self.node_ids[1], '127.0.0.1', udp_port=1000)
self.second_contact = self.peer_manager.get_kademlia_peer(self.node_ids[0], '192.168.0.1', udp_port=1000)
self.first_contact = make_kademlia_peer(self.node_ids[1], '127.0.0.1', udp_port=1000)
self.second_contact = make_kademlia_peer(self.node_ids[0], '192.168.0.1', udp_port=1000)
def test_peer_is_good_unknown_peer(self):
# Scenario: peer replied, but caller doesn't know the node_id.
# Outcome: We can't say it's good or bad.
# (yes, we COULD tell the node id, but not here. It would be
# a side effect and the caller is responsible to discover it)
peer = make_kademlia_peer(None, '1.2.3.4', 4444)
self.peer_manager.report_last_requested('1.2.3.4', 4444)
self.peer_manager.report_last_replied('1.2.3.4', 4444)
self.assertIsNone(self.peer_manager.peer_is_good(peer))
def test_make_contact_error_cases(self):
self.assertRaises(ValueError, self.peer_manager.get_kademlia_peer, self.node_ids[1], '192.168.1.20', 100000)
self.assertRaises(ValueError, self.peer_manager.get_kademlia_peer, self.node_ids[1], '192.168.1.20.1', 1000)
self.assertRaises(ValueError, self.peer_manager.get_kademlia_peer, self.node_ids[1], 'this is not an ip', 1000)
self.assertRaises(ValueError, self.peer_manager.get_kademlia_peer, self.node_ids[1], '192.168.1.20', -1000)
self.assertRaises(ValueError, self.peer_manager.get_kademlia_peer, b'not valid node id', '192.168.1.20', 1000)
self.assertRaises(ValueError, make_kademlia_peer, self.node_ids[1], '192.168.1.20', 100000)
self.assertRaises(ValueError, make_kademlia_peer, self.node_ids[1], '192.168.1.20.1', 1000)
self.assertRaises(ValueError, make_kademlia_peer, self.node_ids[1], 'this is not an ip', 1000)
self.assertRaises(ValueError, make_kademlia_peer, self.node_ids[1], '192.168.1.20', -1000)
self.assertRaises(ValueError, make_kademlia_peer, b'not valid node id', '192.168.1.20', 1000)
def test_boolean(self):
self.assertNotEqual(self.first_contact, self.second_contact)
self.assertEqual(
self.second_contact, self.peer_manager.get_kademlia_peer(self.node_ids[0], '192.168.0.1', udp_port=1000)
self.second_contact, make_kademlia_peer(self.node_ids[0], '192.168.0.1', udp_port=1000)
)
def test_compact_ip(self):
@@ -7,8 +7,7 @@ from lbry.blob.blob_file import MAX_BLOB_SIZE
from lbry.blob_exchange.serialization import BlobResponse
from lbry.blob_exchange.server import BlobServerProtocol
from lbry.dht.node import Node
from lbry.dht.peer import KademliaPeer
from lbry.extras.daemon.storage import StoredStreamClaim
from lbry.dht.peer import make_kademlia_peer
from lbry.stream.managed_stream import ManagedStream
from lbry.stream.descriptor import StreamDescriptor
from tests.unit.blob_exchange.test_transfer_blob import BlobExchangeTestBase
@@ -95,7 +94,7 @@ class TestManagedStream(BlobExchangeTestBase):
mock_node = mock.Mock(spec=Node)
q = asyncio.Queue()
bad_peer = KademliaPeer(self.loop, "127.0.0.1", b'2' * 48, tcp_port=3334)
bad_peer = make_kademlia_peer(b'2' * 48, "127.0.0.1", tcp_port=3334)
def _mock_accumulate_peers(q1, q2):
async def _task():
@@ -126,5 +126,5 @@ class TestRecoverOldStreamDescriptors(AsyncioTestCase):
loop, tmp_dir, blob
)
self.assertFalse(blob.file_exists)
# fixme: this is an emergency PR, plase move this to blob_file tests later
# fixme: this is an emergency PR, please move this to blob_file tests later
self.assertIsNone(blob.length)
+1
View File
@@ -11,6 +11,7 @@ ignore_missing_imports = True
[pylint]
ignore=words,server,workbench,rpc
max-parents=10
max-args=10
max-line-length=110
good-names=T,t,n,i,j,k,x,y,s,f,d,h,c,e,op,db,tx,io,cachedproperty,log,id
@@ -18,7 +18,7 @@ class NetworkTests(IntegrationTestCase):
self.assertEqual(self.ledger.network.remote_height, initial_height + 1)
async def test_server_features(self):
self.assertEqual({
self.assertDictEqual({
'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
'hash_function': 'sha256',
'hosts': {},
@@ -37,7 +37,7 @@ class NetworkTests(IntegrationTestCase):
'DAILY_FEE': '42'})
await self.conductor.spv_node.start(self.conductor.blockchain_node)
await self.ledger.network.on_connected.first
self.assertEqual({
self.assertDictEqual({
'genesis_hash': self.conductor.spv_node.coin_class.GENESIS_HASH,
'hash_function': 'sha256',
'hosts': {},
@@ -100,7 +100,7 @@ class ReconnectTests(IntegrationTestCase):
# * goes to pick some water outside... * time passes by and another donation comes in
sendtxid = await self.blockchain.send_to_address(address1, 42)
await self.blockchain.generate(1)
# (this is just so the test doesnt hang forever if it doesnt reconnect)
# (this is just so the test doesn't hang forever if it doesn't reconnect)
if not self.ledger.network.is_connected:
await asyncio.wait_for(self.ledger.network.on_connected.first, timeout=1.0)
# omg, the burned cable still works! torba is fire proof!
@@ -162,7 +162,7 @@ class ServerPickingTestCase(AsyncioTestCase):
asyncio.ensure_future(network.start())
await asyncio.wait_for(network.on_connected.first, timeout=1)
self.assertTrue(network.is_connected)
self.assertEqual(network.client.server, ('127.0.0.1', 1337))
self.assertTupleEqual(network.client.server, ('127.0.0.1', 1337))
self.assertTrue(all([not session.is_closing() for session in network.session_pool.available_sessions]))
# ensure we are connected to all of them after a while
await asyncio.sleep(1)
@@ -148,7 +148,7 @@ class BasicTransactionTests(IntegrationTestCase):
return summary
self.conductor.spv_node.server.mempool.transaction_summaries = random_summary
# 10 unconfirmed txs, all from blockchain wallet
sends = list(self.blockchain.send_to_address(address, 10) for _ in range(10))
sends = [self.blockchain.send_to_address(address, 10) for _ in range(10)]
# use batching to reduce issues with send_to_address on cli
for batch in range(0, len(sends), 10):
txids = await asyncio.gather(*sends[batch:batch + 10])
+20 -30
View File
@@ -47,7 +47,7 @@ class TestHierarchicalDeterministicAccount(AsyncioTestCase):
async with self.account.receiving.address_generator_lock:
await self.account.receiving._generate_keys(0, 200)
records = await self.account.receiving.get_address_records()
self.assertEqual(201, len(records))
self.assertEqual(len(records), 201)
async def test_ensure_address_gap(self):
account = self.account
@@ -59,7 +59,7 @@ class TestHierarchicalDeterministicAccount(AsyncioTestCase):
await account.receiving._generate_keys(0, 3)
await account.receiving._generate_keys(8, 11)
records = await account.receiving.get_address_records()
self.assertEqual(
self.assertListEqual(
[r['pubkey'].n for r in records],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
)
@@ -68,7 +68,7 @@ class TestHierarchicalDeterministicAccount(AsyncioTestCase):
new_keys = await account.receiving.ensure_address_gap()
self.assertEqual(len(new_keys), 8)
records = await account.receiving.get_address_records()
self.assertEqual(
self.assertListEqual(
[r['pubkey'].n for r in records],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
)
@@ -178,7 +178,7 @@ class TestHierarchicalDeterministicAccount(AsyncioTestCase):
account_data['ledger'] = 'btc_mainnet'
self.assertDictEqual(account_data, account.to_dict())
def test_apply_diff(self):
def test_merge_diff(self):
account_data = {
'name': 'My Account',
'modified_on': 123.456,
@@ -213,13 +213,13 @@ class TestHierarchicalDeterministicAccount(AsyncioTestCase):
account_data['address_generator']['receiving']['gap'] = 8
account_data['address_generator']['receiving']['maximum_uses_per_address'] = 9
account.apply(account_data)
account.merge(account_data)
# no change because modified_on is not newer
self.assertEqual(account.name, 'My Account')
account_data['modified_on'] = 200.00
account.apply(account_data)
account.merge(account_data)
self.assertEqual(account.name, 'Changed Name')
self.assertEqual(account.change.gap, 6)
self.assertEqual(account.change.maximum_uses_per_address, 7)
@@ -272,7 +272,7 @@ class TestSingleKeyAccount(AsyncioTestCase):
self.assertIsInstance(account.receiving, SingleKey)
addresses = await account.receiving.get_addresses()
self.assertEqual(addresses, [])
self.assertListEqual(addresses, [])
# we have 12, but default gap is 20
new_keys = await account.receiving.ensure_address_gap()
@@ -280,7 +280,7 @@ class TestSingleKeyAccount(AsyncioTestCase):
self.assertEqual(new_keys[0], account.public_key.address)
records = await account.receiving.get_address_records()
pubkey = records[0].pop('pubkey')
self.assertEqual(records, [{
self.assertListEqual(records, [{
'chain': 0,
'account': account.public_key.address,
'address': account.public_key.address,
@@ -435,14 +435,14 @@ class AccountEncryptionTests(AsyncioTestCase):
def test_encrypt_wallet(self):
account = self.ledger.account_class.from_dict(self.ledger, Wallet(), self.unencrypted_account)
account.private_key_encryption_init_vector = self.init_vector
account.seed_encryption_init_vector = self.init_vector
account.init_vectors = {
'seed': self.init_vector,
'private_key': self.init_vector
}
self.assertFalse(account.serialize_encrypted)
self.assertFalse(account.encrypted)
self.assertIsNotNone(account.private_key)
account.encrypt(self.password)
self.assertFalse(account.serialize_encrypted)
self.assertTrue(account.encrypted)
self.assertEqual(account.seed, self.encrypted_account['seed'])
self.assertEqual(account.private_key_string, self.encrypted_account['private_key'])
@@ -451,42 +451,32 @@ class AccountEncryptionTests(AsyncioTestCase):
self.assertEqual(account.to_dict()['seed'], self.encrypted_account['seed'])
self.assertEqual(account.to_dict()['private_key'], self.encrypted_account['private_key'])
account.serialize_encrypted = True
account.decrypt(self.password)
self.assertEqual(account.private_key_encryption_init_vector, self.init_vector)
self.assertEqual(account.seed_encryption_init_vector, self.init_vector)
self.assertEqual(account.init_vectors['private_key'], self.init_vector)
self.assertEqual(account.init_vectors['seed'], self.init_vector)
self.assertEqual(account.seed, self.unencrypted_account['seed'])
self.assertEqual(account.private_key.extended_key_string(), self.unencrypted_account['private_key'])
self.assertEqual(account.to_dict()['seed'], self.encrypted_account['seed'])
self.assertEqual(account.to_dict()['private_key'], self.encrypted_account['private_key'])
self.assertEqual(account.to_dict(encrypt_password=self.password)['seed'], self.encrypted_account['seed'])
self.assertEqual(account.to_dict(encrypt_password=self.password)['private_key'], self.encrypted_account['private_key'])
self.assertFalse(account.encrypted)
self.assertTrue(account.serialize_encrypted)
account.serialize_encrypted = False
self.assertEqual(account.to_dict()['seed'], self.unencrypted_account['seed'])
self.assertEqual(account.to_dict()['private_key'], self.unencrypted_account['private_key'])
def test_decrypt_wallet(self):
account = self.ledger.account_class.from_dict(self.ledger, Wallet(), self.encrypted_account)
self.assertTrue(account.encrypted)
self.assertTrue(account.serialize_encrypted)
account.decrypt(self.password)
self.assertEqual(account.private_key_encryption_init_vector, self.init_vector)
self.assertEqual(account.seed_encryption_init_vector, self.init_vector)
self.assertEqual(account.init_vectors['private_key'], self.init_vector)
self.assertEqual(account.init_vectors['seed'], self.init_vector)
self.assertFalse(account.encrypted)
self.assertTrue(account.serialize_encrypted)
self.assertEqual(account.seed, self.unencrypted_account['seed'])
self.assertEqual(account.private_key.extended_key_string(), self.unencrypted_account['private_key'])
self.assertEqual(account.to_dict()['seed'], self.encrypted_account['seed'])
self.assertEqual(account.to_dict()['private_key'], self.encrypted_account['private_key'])
account.serialize_encrypted = False
self.assertEqual(account.to_dict(encrypt_password=self.password)['seed'], self.encrypted_account['seed'])
self.assertEqual(account.to_dict(encrypt_password=self.password)['private_key'], self.encrypted_account['private_key'])
self.assertEqual(account.to_dict()['seed'], self.unencrypted_account['seed'])
self.assertEqual(account.to_dict()['private_key'], self.unencrypted_account['private_key'])
@@ -37,13 +37,13 @@ class BaseSelectionTestCase(AsyncioTestCase):
class TestCoinSelectionTests(BaseSelectionTestCase):
def test_empty_coins(self):
self.assertEqual(CoinSelector(0, 0).select([]), [])
self.assertListEqual(CoinSelector(0, 0).select([]), [])
def test_skip_binary_search_if_total_not_enough(self):
fee = utxo(CENT).get_estimator(self.ledger).fee
big_pool = self.estimates(utxo(CENT+fee) for _ in range(100))
selector = CoinSelector(101 * CENT, 0)
self.assertEqual(selector.select(big_pool), [])
self.assertListEqual(selector.select(big_pool), [])
self.assertEqual(selector.tries, 0) # Never tried.
# check happy path
selector = CoinSelector(100 * CENT, 0)
@@ -59,7 +59,7 @@ class TestCoinSelectionTests(BaseSelectionTestCase):
)
selector = CoinSelector(CENT, 0)
match = selector.select(utxo_pool)
self.assertEqual([CENT + fee], [c.txo.amount for c in match])
self.assertListEqual([CENT + fee], [c.txo.amount for c in match])
self.assertTrue(selector.exact_match)
def test_random_draw(self):
@@ -70,7 +70,7 @@ class TestCoinSelectionTests(BaseSelectionTestCase):
)
selector = CoinSelector(CENT, 0, '\x00')
match = selector.select(utxo_pool)
self.assertEqual([2 * CENT], [c.txo.amount for c in match])
self.assertListEqual([2 * CENT], [c.txo.amount for c in match])
self.assertFalse(selector.exact_match)
def test_pick(self):
@@ -83,7 +83,7 @@ class TestCoinSelectionTests(BaseSelectionTestCase):
)
selector = CoinSelector(3*CENT, 0)
match = selector.select(utxo_pool)
self.assertEqual([5*CENT], [c.txo.amount for c in match])
self.assertListEqual([5*CENT], [c.txo.amount for c in match])
def test_confirmed_strategies(self):
utxo_pool = self.estimates(
@@ -94,14 +94,14 @@ class TestCoinSelectionTests(BaseSelectionTestCase):
)
match = CoinSelector(20*CENT, 0).select(utxo_pool, "only_confirmed")
self.assertEqual([5, 5], [c.txo.tx_ref.height for c in match])
self.assertListEqual([5, 5], [c.txo.tx_ref.height for c in match])
match = CoinSelector(25*CENT, 0).select(utxo_pool, "only_confirmed")
self.assertEqual([], [c.txo.tx_ref.height for c in match])
self.assertListEqual([], [c.txo.tx_ref.height for c in match])
match = CoinSelector(20*CENT, 0).select(utxo_pool, "prefer_confirmed")
self.assertEqual([5, 5], [c.txo.tx_ref.height for c in match])
self.assertListEqual([5, 5], [c.txo.tx_ref.height for c in match])
match = CoinSelector(25*CENT, 0, '\x00').select(utxo_pool, "prefer_confirmed")
self.assertEqual([5, 0, -2], [c.txo.tx_ref.height for c in match])
self.assertListEqual([5, 0, -2], [c.txo.tx_ref.height for c in match])
class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
@@ -136,20 +136,20 @@ class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
)
# Select 1 Cent
self.assertEqual([1 * CENT], search(utxo_pool, 1 * CENT, 0.5 * CENT))
self.assertListEqual([1 * CENT], search(utxo_pool, 1 * CENT, 0.5 * CENT))
# Select 2 Cent
self.assertEqual([2 * CENT], search(utxo_pool, 2 * CENT, 0.5 * CENT))
self.assertListEqual([2 * CENT], search(utxo_pool, 2 * CENT, 0.5 * CENT))
# Select 5 Cent
self.assertEqual([3 * CENT, 2 * CENT], search(utxo_pool, 5 * CENT, 0.5 * CENT))
self.assertListEqual([3 * CENT, 2 * CENT], search(utxo_pool, 5 * CENT, 0.5 * CENT))
# Select 11 Cent, not possible
self.assertEqual([], search(utxo_pool, 11 * CENT, 0.5 * CENT))
self.assertListEqual([], search(utxo_pool, 11 * CENT, 0.5 * CENT))
# Select 10 Cent
utxo_pool += self.estimates(utxo(5 * CENT))
self.assertEqual(
self.assertListEqual(
[4 * CENT, 3 * CENT, 2 * CENT, 1 * CENT],
search(utxo_pool, 10 * CENT, 0.5 * CENT)
)
@@ -157,18 +157,18 @@ class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
# Negative effective value
# Select 10 Cent but have 1 Cent not be possible because too small
# TODO: bitcoin has [5, 3, 2]
self.assertEqual(
self.assertListEqual(
[4 * CENT, 3 * CENT, 2 * CENT, 1 * CENT],
search(utxo_pool, 10 * CENT, 5000)
)
# Select 0.25 Cent, not possible
self.assertEqual(search(utxo_pool, 0.25 * CENT, 0.5 * CENT), [])
self.assertListEqual(search(utxo_pool, 0.25 * CENT, 0.5 * CENT), [])
# Iteration exhaustion test
utxo_pool, target = self.make_hard_case(17)
selector = CoinSelector(target, 0)
self.assertEqual(selector.select(utxo_pool, 'branch_and_bound'), [])
self.assertListEqual(selector.select(utxo_pool, 'branch_and_bound'), [])
self.assertEqual(selector.tries, MAXIMUM_TRIES) # Should exhaust
utxo_pool, target = self.make_hard_case(14)
self.assertIsNotNone(search(utxo_pool, target, 0)) # Should not exhaust
@@ -181,7 +181,7 @@ class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
utxo(7 * CENT),
utxo(2 * CENT)
] + [utxo(5 * CENT)]*50000)
self.assertEqual(
self.assertListEqual(
[7 * CENT, 7 * CENT, 7 * CENT, 7 * CENT, 2 * CENT],
search(utxo_pool, 30 * CENT, 5000)
)
@@ -189,4 +189,4 @@ class TestOfficialBitcoinCoinSelectionTests(BaseSelectionTestCase):
# Select 1 Cent with pool of only greater than 5 Cent
utxo_pool = self.estimates(utxo(i * CENT) for i in range(5, 21))
for _ in range(100):
self.assertEqual(search(utxo_pool, 1 * CENT, 2 * CENT), [])
self.assertListEqual(search(utxo_pool, 1 * CENT, 2 * CENT), [])
+36 -36
View File
@@ -60,17 +60,17 @@ class TestAIOSQLite(AsyncioTestCase):
class TestQueryBuilder(unittest.TestCase):
def test_dot(self):
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.position': 18}),
('txo.position = :txo_position0', {'txo_position0': 18})
)
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.position#6': 18}),
('txo.position = :txo_position6', {'txo_position6': 18})
)
def test_any(self):
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({
'ages__any': {
'txo.age__gt': 18,
@@ -84,41 +84,41 @@ class TestQueryBuilder(unittest.TestCase):
)
def test_in(self):
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.age__in#2': [18, 38]}),
('txo.age IN (:txo_age__in2_0, :txo_age__in2_1)', {
'txo_age__in2_0': 18,
'txo_age__in2_1': 38
})
)
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.name__in': ('abc123', 'def456')}),
('txo.name IN (:txo_name__in0_0, :txo_name__in0_1)', {
'txo_name__in0_0': 'abc123',
'txo_name__in0_1': 'def456'
})
)
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.age__in': 'SELECT age from ages_table'}),
('txo.age IN (SELECT age from ages_table)', {})
)
def test_not_in(self):
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.age__not_in': [18, 38]}),
('txo.age NOT IN (:txo_age__not_in0_0, :txo_age__not_in0_1)', {
'txo_age__not_in0_0': 18,
'txo_age__not_in0_1': 38
})
)
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.name__not_in': ('abc123', 'def456')}),
('txo.name NOT IN (:txo_name__not_in0_0, :txo_name__not_in0_1)', {
'txo_name__not_in0_0': 'abc123',
'txo_name__not_in0_1': 'def456'
})
)
self.assertEqual(
self.assertTupleEqual(
constraints_to_sql({'txo.age__not_in': 'SELECT age from ages_table'}),
('txo.age NOT IN (SELECT age from ages_table)', {})
)
@@ -128,11 +128,11 @@ class TestQueryBuilder(unittest.TestCase):
constraints_to_sql({'ages__in': 9})
def test_query(self):
self.assertEqual(
self.assertTupleEqual(
query("select * from foo"),
("select * from foo", {})
)
self.assertEqual(
self.assertTupleEqual(
query(
"select * from foo",
a__not='b', b__in='select * from blah where c=:$c',
@@ -146,11 +146,11 @@ class TestQueryBuilder(unittest.TestCase):
)
def test_query_order_by(self):
self.assertEqual(
self.assertTupleEqual(
query("select * from foo", order_by='foo'),
("select * from foo ORDER BY foo", {})
)
self.assertEqual(
self.assertTupleEqual(
query("select * from foo", order_by=['foo', 'bar']),
("select * from foo ORDER BY foo, bar", {})
)
@@ -158,15 +158,15 @@ class TestQueryBuilder(unittest.TestCase):
query("select * from foo", order_by={'foo': 'bar'})
def test_query_limit_offset(self):
self.assertEqual(
self.assertTupleEqual(
query("select * from foo", limit=10),
("select * from foo LIMIT 10", {})
)
self.assertEqual(
self.assertTupleEqual(
query("select * from foo", offset=10),
("select * from foo OFFSET 10", {})
)
self.assertEqual(
self.assertTupleEqual(
query("select * from foo", limit=20, offset=10),
("select * from foo LIMIT 20 OFFSET 10", {})
)
@@ -188,7 +188,7 @@ class TestQueryBuilder(unittest.TestCase):
"(one LIKE 'o' OR two = 2) AND "
"a0 = 3 AND a00 = 1 AND a00a = 2 AND a00aa = 4 "
"AND ahash = X'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9' "
"ORDER BY b LIMIT 10",
"ORDER BY b LIMIT 10"
)
@@ -264,7 +264,7 @@ class TestQueries(AsyncioTestCase):
for height in range(1, 1200):
tx = await self.create_tx_from_txo(tx.outputs[0], account, height=height)
variable_limit = self.ledger.db.MAX_QUERY_VARIABLES
for limit in range(variable_limit-2, variable_limit+2):
for limit in range(variable_limit - 2, variable_limit + 2):
txs = await self.ledger.get_transactions(
accounts=self.wallet.accounts, limit=limit, order_by='height asc')
self.assertEqual(len(txs), limit)
@@ -286,7 +286,7 @@ class TestQueries(AsyncioTestCase):
self.assertEqual(0, await self.ledger.db.get_transaction_count(accounts=[account1, account2, account3]))
self.assertEqual(0, await self.ledger.db.get_utxo_count())
self.assertEqual([], await self.ledger.db.get_utxos())
self.assertListEqual([], await self.ledger.db.get_utxos())
self.assertEqual(0, await self.ledger.db.get_txo_count())
self.assertEqual(0, await self.ledger.db.get_balance(wallet=wallet1))
self.assertEqual(0, await self.ledger.db.get_balance(wallet=wallet2))
@@ -337,18 +337,18 @@ class TestQueries(AsyncioTestCase):
self.assertEqual(10**8, await self.ledger.db.get_balance(accounts=[account3]))
txs = await self.ledger.db.get_transactions(accounts=[account1, account2])
self.assertEqual([tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
self.assertEqual([3, 2, 1], [tx.height for tx in txs])
self.assertListEqual([tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
self.assertListEqual([3, 2, 1], [tx.height for tx in txs])
txs = await self.ledger.db.get_transactions(wallet=wallet1, accounts=wallet1.accounts)
self.assertEqual([tx2.id, tx1.id], [tx.id for tx in txs])
self.assertListEqual([tx2.id, tx1.id], [tx.id for tx in txs])
self.assertEqual(txs[0].inputs[0].is_my_account, True)
self.assertEqual(txs[0].outputs[0].is_my_account, False)
self.assertEqual(txs[1].inputs[0].is_my_account, False)
self.assertEqual(txs[1].outputs[0].is_my_account, True)
txs = await self.ledger.db.get_transactions(wallet=wallet2, accounts=[account2])
self.assertEqual([tx3.id, tx2.id], [tx.id for tx in txs])
self.assertListEqual([tx3.id, tx2.id], [tx.id for tx in txs])
self.assertEqual(txs[0].inputs[0].is_my_account, True)
self.assertEqual(txs[0].outputs[0].is_my_account, False)
self.assertEqual(txs[1].inputs[0].is_my_account, False)
@@ -369,11 +369,11 @@ class TestQueries(AsyncioTestCase):
# height 0 sorted to the top with the rest in descending order
tx4 = await self.create_tx_from_nothing(account1, 0)
txos = await self.ledger.db.get_txos()
self.assertEqual([0, 2, 2, 1], [txo.tx_ref.height for txo in txos])
self.assertEqual([tx4.id, tx2.id, tx2b.id, tx1.id], [txo.tx_ref.id for txo in txos])
self.assertListEqual([0, 2, 2, 1], [txo.tx_ref.height for txo in txos])
self.assertListEqual([tx4.id, tx2.id, tx2b.id, tx1.id], [txo.tx_ref.id for txo in txos])
txs = await self.ledger.db.get_transactions(accounts=[account1, account2])
self.assertEqual([0, 3, 2, 1], [tx.height for tx in txs])
self.assertEqual([tx4.id, tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
self.assertListEqual([0, 3, 2, 1], [tx.height for tx in txs])
self.assertListEqual([tx4.id, tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
class TestUpgrade(AsyncioTestCase):
@@ -415,10 +415,10 @@ class TestUpgrade(AsyncioTestCase):
# initial open, pre-version enabled db
self.ledger.db.SCHEMA_VERSION = None
self.assertEqual(self.get_tables(), [])
self.assertListEqual(self.get_tables(), [])
await self.ledger.db.open()
self.assertEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo'])
self.assertEqual(self.get_addresses(), [])
self.assertListEqual(self.get_addresses(), [])
self.add_address('address1')
await self.ledger.db.close()
@@ -426,18 +426,18 @@ class TestUpgrade(AsyncioTestCase):
self.ledger.db.SCHEMA_VERSION = '1.0'
await self.ledger.db.open()
self.assertEqual(self.get_version(), '1.0')
self.assertEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertEqual(self.get_addresses(), []) # address1 deleted during version upgrade
self.assertListEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertListEqual(self.get_addresses(), []) # address1 deleted during version upgrade
self.add_address('address2')
await self.ledger.db.close()
# nothing changes
self.assertEqual(self.get_version(), '1.0')
self.assertEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertListEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
await self.ledger.db.open()
self.assertEqual(self.get_version(), '1.0')
self.assertEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertEqual(self.get_addresses(), ['address2'])
self.assertListEqual(self.get_tables(), ['account_address', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertListEqual(self.get_addresses(), ['address2'])
await self.ledger.db.close()
# upgrade version, database reset
@@ -447,8 +447,8 @@ class TestUpgrade(AsyncioTestCase):
"""
await self.ledger.db.open()
self.assertEqual(self.get_version(), '1.1')
self.assertEqual(self.get_tables(), ['account_address', 'foo', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertEqual(self.get_addresses(), []) # all tables got reset
self.assertListEqual(self.get_tables(), ['account_address', 'foo', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
self.assertListEqual(self.get_addresses(), []) # all tables got reset
await self.ledger.db.close()
+1 -1
View File
@@ -23,7 +23,7 @@ class TestAESEncryptDecrypt(TestCase):
'ZmZmZmZmZmZmZmZmZmZmZjlrKptoKD+MFwDxcg3XtCD9qz8UWhEhq/TVJT5+Mtp2a8sE'
'CaO6WQj7fYsWGu2Hvbc0qYqxdN0HeTsiO+cZRo3eJISgr3F+rXFYi5oSBlD2'
)
self.assertEqual(
self.assertTupleEqual(
aes_decrypt(self.password, self.expected),
(self.message, b'f' * 16)
)
@@ -35,7 +35,7 @@ class BasicHeadersTests(BitcoinHeadersTestCase):
async def test_serialization(self):
h = await self.get_headers()
self.assertEqual(h[0], {
self.assertDictEqual(h[0], {
'bits': 486604799,
'block_height': 0,
'merkle_root': b'4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b',
@@ -44,7 +44,7 @@ class BasicHeadersTests(BitcoinHeadersTestCase):
'timestamp': 1231006505,
'version': 1
})
self.assertEqual(h[self.RETARGET_BLOCK-1], {
self.assertDictEqual(h[self.RETARGET_BLOCK-1], {
'bits': 486604799,
'block_height': 32255,
'merkle_root': b'89b4f223789e40b5b475af6483bb05bceda54059e17d2053334b358f6bb310ac',
@@ -53,7 +53,7 @@ class BasicHeadersTests(BitcoinHeadersTestCase):
'timestamp': 1262152739,
'version': 1
})
self.assertEqual(h[self.RETARGET_BLOCK], {
self.assertDictEqual(h[self.RETARGET_BLOCK], {
'bits': 486594666,
'block_height': 32256,
'merkle_root': b'64b5e5f5a262f47af443a0120609206a3305877693edfe03e994f20a024ab627',
@@ -62,7 +62,7 @@ class BasicHeadersTests(BitcoinHeadersTestCase):
'timestamp': 1262153464,
'version': 1
})
self.assertEqual(h[self.RETARGET_BLOCK+1], {
self.assertDictEqual(h[self.RETARGET_BLOCK+1], {
'bits': 486594666,
'block_height': 32257,
'merkle_root': b'4d1488981f08b3037878193297dbac701a2054e0f803d4424fe6a4d763d62334',
+6 -6
View File
@@ -90,8 +90,8 @@ class TestSynchronization(LedgerTestCase):
'abcd03': hexlify(get_transaction(get_output(3)).raw),
})
await self.ledger.update_history(address, '')
self.assertEqual(self.ledger.network.get_history_called, [address])
self.assertEqual(self.ledger.network.get_transaction_called, ['abcd01', 'abcd02', 'abcd03'])
self.assertListEqual(self.ledger.network.get_history_called, [address])
self.assertListEqual(self.ledger.network.get_transaction_called, ['abcd01', 'abcd02', 'abcd03'])
address_details = await self.ledger.db.get_address(address=address)
self.assertEqual(
@@ -104,16 +104,16 @@ class TestSynchronization(LedgerTestCase):
self.ledger.network.get_history_called = []
self.ledger.network.get_transaction_called = []
await self.ledger.update_history(address, '')
self.assertEqual(self.ledger.network.get_history_called, [address])
self.assertEqual(self.ledger.network.get_transaction_called, [])
self.assertListEqual(self.ledger.network.get_history_called, [address])
self.assertListEqual(self.ledger.network.get_transaction_called, [])
self.ledger.network.history.append({'tx_hash': 'abcd04', 'height': 3})
self.ledger.network.transaction['abcd04'] = hexlify(get_transaction(get_output(4)).raw)
self.ledger.network.get_history_called = []
self.ledger.network.get_transaction_called = []
await self.ledger.update_history(address, '')
self.assertEqual(self.ledger.network.get_history_called, [address])
self.assertEqual(self.ledger.network.get_transaction_called, ['abcd04'])
self.assertListEqual(self.ledger.network.get_history_called, [address])
self.assertListEqual(self.ledger.network.get_transaction_called, ['abcd04'])
address_details = await self.ledger.db.get_address(address=address)
self.assertEqual(
address_details['history'],
+12 -12
View File
@@ -24,14 +24,14 @@ def parse(opcodes, source):
class TestScriptTemplates(unittest.TestCase):
def test_push_data(self):
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_SINGLE('script_hash'),),
(b'abcdef',)
), {
'script_hash': b'abcdef'
}
)
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_SINGLE('first'), PUSH_INTEGER('rating')),
(b'Satoshi', (1000).to_bytes(2, 'little'))
), {
@@ -39,7 +39,7 @@ class TestScriptTemplates(unittest.TestCase):
'rating': 1000,
}
)
self.assertEqual(parse(
self.assertDictEqual(parse(
(OP_HASH160, PUSH_SINGLE('script_hash'), OP_EQUAL),
(OP_HASH160, b'abcdef', OP_EQUAL)
), {
@@ -48,21 +48,21 @@ class TestScriptTemplates(unittest.TestCase):
)
def test_push_data_many(self):
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_MANY('names'),),
(b'amit',)
), {
'names': [b'amit']
}
)
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_MANY('names'),),
(b'jeremy', b'amit', b'victor')
), {
'names': [b'jeremy', b'amit', b'victor']
}
)
self.assertEqual(parse(
self.assertDictEqual(parse(
(OP_HASH160, PUSH_MANY('names'), OP_EQUAL),
(OP_HASH160, b'grin', b'jack', OP_EQUAL)
), {
@@ -71,7 +71,7 @@ class TestScriptTemplates(unittest.TestCase):
)
def test_push_data_mixed(self):
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_SINGLE('CEO'), PUSH_MANY('Devs'), PUSH_SINGLE('CTO'), PUSH_SINGLE('State')),
(b'jeremy', b'lex', b'amit', b'victor', b'jack', b'grin', b'NH')
), {
@@ -83,7 +83,7 @@ class TestScriptTemplates(unittest.TestCase):
)
def test_push_data_many_separated(self):
self.assertEqual(parse(
self.assertDictEqual(parse(
(PUSH_MANY('Chiefs'), OP_HASH160, PUSH_MANY('Devs')),
(b'jeremy', b'grin', OP_HASH160, b'lex', b'jack')
), {
@@ -135,16 +135,16 @@ class TestRedeemScriptHash(unittest.TestCase):
)
subscript1 = src1.values['script']
self.assertEqual(src1.template.name, 'script_hash')
self.assertEqual([hexlify(v) for v in src1.values['signatures']], sigs)
self.assertEqual([hexlify(p) for p in subscript1.values['pubkeys']], pubkeys)
self.assertListEqual([hexlify(v) for v in src1.values['signatures']], sigs)
self.assertListEqual([hexlify(p) for p in subscript1.values['pubkeys']], pubkeys)
self.assertEqual(subscript1.values['signatures_count'], len(sigs))
self.assertEqual(subscript1.values['pubkeys_count'], len(pubkeys))
# now we test that it will round trip
src2 = BaseInputScript(src1.source)
subscript2 = src2.values['script']
self.assertEqual(src2.template.name, 'script_hash')
self.assertEqual([hexlify(v) for v in src2.values['signatures']], sigs)
self.assertEqual([hexlify(p) for p in subscript2.values['pubkeys']], pubkeys)
self.assertListEqual([hexlify(v) for v in src2.values['signatures']], sigs)
self.assertListEqual([hexlify(p) for p in subscript2.values['pubkeys']], pubkeys)
self.assertEqual(subscript2.values['signatures_count'], len(sigs))
self.assertEqual(subscript2.values['pubkeys_count'], len(pubkeys))
return hexlify(src1.source)
@@ -9,7 +9,7 @@ class StreamControllerTestCase(AsyncioTestCase):
controller.stream.listen(on_data=events.append)
controller.add("yo")
controller.add("yo")
self.assertEqual(events, ["yo", "yo"])
self.assertListEqual(events, ["yo", "yo"])
def test_unique_events(self):
events = []
@@ -17,4 +17,4 @@ class StreamControllerTestCase(AsyncioTestCase):
controller.stream.listen(on_data=events.append)
controller.add("yo")
controller.add("yo")
self.assertEqual(events, ["yo"])
self.assertListEqual(events, ["yo"])
@@ -294,9 +294,9 @@ class TransactionIOBalancing(AsyncioTestCase):
[self.txo(3)] # outputs
)
# best UTXO match is 5 (as UTXO 3 will be short 0.02 to cover fees)
self.assertEqual(self.inputs(tx), [5])
self.assertListEqual(self.inputs(tx), [5])
# a change of 1.98 is added to reach balance
self.assertEqual(self.outputs(tx), [3, 1.98])
self.assertListEqual(self.outputs(tx), [3, 1.98])
await self.ledger.release_outputs(utxos)
@@ -306,8 +306,8 @@ class TransactionIOBalancing(AsyncioTestCase):
[self.txo(2.98)] # outputs
)
# best UTXO match is 3 and no change is needed
self.assertEqual(self.inputs(tx), [3])
self.assertEqual(self.outputs(tx), [2.98])
self.assertListEqual(self.inputs(tx), [3])
self.assertListEqual(self.outputs(tx), [2.98])
await self.ledger.release_outputs(utxos)
@@ -317,9 +317,9 @@ class TransactionIOBalancing(AsyncioTestCase):
[self.txo(11)] # outputs
)
# additional input is chosen (UTXO 3)
self.assertEqual([10, 3], self.inputs(tx))
self.assertListEqual([10, 3], self.inputs(tx))
# change is now needed to consume extra input
self.assertEqual([11, 1.96], self.outputs(tx))
self.assertListEqual([11, 1.96], self.outputs(tx))
await self.ledger.release_outputs(utxos)
@@ -328,9 +328,9 @@ class TransactionIOBalancing(AsyncioTestCase):
[self.txi(self.txo(10))], # inputs
[] # outputs
)
self.assertEqual([10], self.inputs(tx))
self.assertListEqual([10], self.inputs(tx))
# missing change added to consume the amount
self.assertEqual([9.98], self.outputs(tx))
self.assertListEqual([9.98], self.outputs(tx))
await self.ledger.release_outputs(utxos)
@@ -340,6 +340,6 @@ class TransactionIOBalancing(AsyncioTestCase):
[] # outputs
)
# UTXO 1 is added to cover some of the fee
self.assertEqual([0.01, 1], self.inputs(tx))
self.assertListEqual([0.01, 1], self.inputs(tx))
# change is now needed to consume extra input
self.assertEqual([0.97], self.outputs(tx))
self.assertListEqual([0.97], self.outputs(tx))
+64 -3
View File
@@ -1,12 +1,13 @@
import tempfile
from binascii import hexlify
from unittest import TestCase, mock
from torba.testcase import AsyncioTestCase
from torba.coin.bitcoinsegwit import MainNetLedger as BTCLedger
from torba.coin.bitcoincash import MainNetLedger as BCHLedger
from torba.client.basemanager import BaseWalletManager
from torba.client.wallet import Wallet, WalletStorage
from torba.client.wallet import Wallet, WalletStorage, TimestampedPreferences
class TestWalletCreation(AsyncioTestCase):
@@ -20,7 +21,7 @@ class TestWalletCreation(AsyncioTestCase):
def test_create_wallet_and_accounts(self):
wallet = Wallet()
self.assertEqual(wallet.name, 'Wallet')
self.assertEqual(wallet.accounts, [])
self.assertListEqual(wallet.accounts, [])
account1 = wallet.generate_account(self.btc_ledger)
wallet.generate_account(self.btc_ledger)
@@ -32,6 +33,7 @@ class TestWalletCreation(AsyncioTestCase):
wallet_dict = {
'version': 1,
'name': 'Main Wallet',
'preferences': {},
'accounts': [
{
'name': 'An Account',
@@ -60,7 +62,7 @@ class TestWalletCreation(AsyncioTestCase):
wallet = Wallet.from_storage(storage, self.manager)
self.assertEqual(wallet.name, 'Main Wallet')
self.assertEqual(
hexlify(wallet.hash), b'9f462b8dd802eb8c913e54f09a09827ebc14abbc13f33baa90d8aec5ae920fc7'
hexlify(wallet.hash), b'1bd61fbe18875cb7828c466022af576104ed861c8a1fdb1dadf5e39417a68483'
)
self.assertEqual(len(wallet.accounts), 1)
account = wallet.default_account
@@ -91,3 +93,62 @@ class TestWalletCreation(AsyncioTestCase):
wallet = Wallet.from_storage(wallet_storage, manager)
self.assertEqual(account.public_key.address, wallet.default_account.public_key.address)
def test_merge(self):
wallet1 = Wallet()
wallet1.preferences['one'] = 1
wallet1.preferences['conflict'] = 1
wallet1.generate_account(self.btc_ledger)
wallet2 = Wallet()
wallet2.preferences['two'] = 2
wallet2.preferences['conflict'] = 2 # will be more recent
wallet2.generate_account(self.btc_ledger)
self.assertEqual(len(wallet1.accounts), 1)
self.assertEqual(wallet1.preferences, {'one': 1, 'conflict': 1})
added = wallet1.merge(self.manager, 'password', wallet2.pack('password'))
self.assertEqual(added[0].id, wallet2.default_account.id)
self.assertEqual(len(wallet1.accounts), 2)
self.assertEqual(wallet1.accounts[1].id, wallet2.default_account.id)
self.assertEqual(wallet1.preferences, {'one': 1, 'two': 2, 'conflict': 2})
class TestTimestampedPreferences(TestCase):
def test_init(self):
p = TimestampedPreferences()
p['one'] = 1
p2 = TimestampedPreferences(p.data)
self.assertEqual(p2['one'], 1)
def test_hash(self):
p = TimestampedPreferences()
self.assertEqual(
hexlify(p.hash), b'44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a'
)
with mock.patch('time.time', mock.Mock(return_value=12345)):
p['one'] = 1
self.assertEqual(
hexlify(p.hash), b'c9e82bf4cb099dd0125f78fa381b21a8131af601917eb531e1f5f980f8f3da66'
)
def test_merge(self):
p1 = TimestampedPreferences()
p2 = TimestampedPreferences()
with mock.patch('time.time', mock.Mock(return_value=10)):
p1['one'] = 1
p1['conflict'] = 1
with mock.patch('time.time', mock.Mock(return_value=20)):
p2['two'] = 2
p2['conflict'] = 2
# conflict in p2 overrides conflict in p1
p1.merge(p2.data)
self.assertEqual(p1, {'one': 1, 'two': 2, 'conflict': 2})
# have a newer conflict in p1 so it is not overridden this time
with mock.patch('time.time', mock.Mock(return_value=21)):
p1['conflict'] = 1
p1.merge(p2.data)
self.assertEqual(p1, {'one': 1, 'two': 2, 'conflict': 1})
+29 -27
View File
@@ -1,3 +1,4 @@
import os
import json
import time
import asyncio
@@ -42,7 +43,7 @@ class AddressManager:
d['change'] = change_dict
return d
def apply(self, d: dict):
def merge(self, d: dict):
pass
def to_dict_instance(self) -> Optional[dict]:
@@ -101,7 +102,7 @@ class HierarchicalDeterministic(AddressManager):
cls(account, 1, **d.get('change', {'gap': 6, 'maximum_uses_per_address': 1}))
)
def apply(self, d: dict):
def merge(self, d: dict):
self.gap = d.get('gap', self.gap)
self.maximum_uses_per_address = d.get('maximum_uses_per_address', self.maximum_uses_per_address)
@@ -221,12 +222,8 @@ class BaseAccount:
self.seed = seed
self.modified_on = modified_on
self.private_key_string = private_key_string
self.password: Optional[str] = None
self.private_key_encryption_init_vector: Optional[bytes] = None
self.seed_encryption_init_vector: Optional[bytes] = None
self.init_vectors: Dict[str, bytes] = {}
self.encrypted = encrypted
self.serialize_encrypted = encrypted
self.private_key = private_key
self.public_key = public_key
generator_name = address_generator.get('name', HierarchicalDeterministic.name)
@@ -236,6 +233,12 @@ class BaseAccount:
ledger.add_account(self)
wallet.add_account(self)
def get_init_vector(self, key) -> Optional[bytes]:
init_vector = self.init_vectors.get(key, None)
if init_vector is None:
init_vector = self.init_vectors[key] = os.urandom(16)
return init_vector
@classmethod
def generate(cls, ledger: 'baseledger.BaseLedger', wallet: 'basewallet.Wallet',
name: str = None, address_generator: dict = None):
@@ -289,28 +292,27 @@ class BaseAccount:
modified_on=d.get('modified_on', time.time())
)
def to_dict(self):
def to_dict(self, encrypt_password: str = None):
private_key_string, seed = self.private_key_string, self.seed
if not self.encrypted and self.private_key:
private_key_string = self.private_key.extended_key_string()
if not self.encrypted and self.serialize_encrypted:
assert None not in [self.seed_encryption_init_vector, self.private_key_encryption_init_vector]
if not self.encrypted and encrypt_password:
private_key_string = aes_encrypt(
self.password, private_key_string, self.private_key_encryption_init_vector
encrypt_password, private_key_string, self.get_init_vector('private_key')
)
seed = aes_encrypt(self.password, self.seed, self.seed_encryption_init_vector)
seed = aes_encrypt(encrypt_password, self.seed, self.get_init_vector('seed'))
return {
'ledger': self.ledger.get_id(),
'name': self.name,
'seed': seed,
'encrypted': self.serialize_encrypted,
'encrypted': bool(self.encrypted or encrypt_password),
'private_key': private_key_string,
'public_key': self.public_key.extended_key_string(),
'address_generator': self.address_generator.to_dict(self.receiving, self.change),
'modified_on': self.modified_on
}
def apply(self, d: dict):
def merge(self, d: dict):
if d.get('modified_on', 0) > self.modified_on:
self.name = d['name']
self.modified_on = d.get('modified_on', time.time())
@@ -318,10 +320,11 @@ class BaseAccount:
for chain_name in ('change', 'receiving'):
if chain_name in d['address_generator']:
chain_object = getattr(self, chain_name)
chain_object.apply(d['address_generator'][chain_name])
chain_object.merge(d['address_generator'][chain_name])
@property
def hash(self) -> bytes:
assert not self.encrypted, "Cannot hash an encrypted account."
return sha256(json.dumps(self.to_dict()).encode())
async def get_details(self, show_seed=False, **kwargs):
@@ -339,42 +342,41 @@ class BaseAccount:
details['seed'] = self.seed
return details
def decrypt(self, password: str) -> None:
def decrypt(self, password: str) -> bool:
assert self.encrypted, "Key is not encrypted."
try:
seed, seed_iv = aes_decrypt(password, self.seed)
pk_string, pk_iv = aes_decrypt(password, self.private_key_string)
except ValueError: # failed to remove padding, password is wrong
return
return False
try:
Mnemonic().mnemonic_decode(seed)
except IndexError: # failed to decode the seed, this either means it decrypted and is invalid
# or that we hit an edge case where an incorrect password gave valid padding
return
return False
try:
private_key = from_extended_key_string(
self.ledger, pk_string
)
except (TypeError, ValueError):
return
return False
self.seed = seed
self.seed_encryption_init_vector = seed_iv
self.private_key = private_key
self.private_key_encryption_init_vector = pk_iv
self.password = password
self.init_vectors['seed'] = seed_iv
self.init_vectors['private_key'] = pk_iv
self.encrypted = False
return True
def encrypt(self, password: str) -> None:
def encrypt(self, password: str) -> bool:
assert not self.encrypted, "Key is already encrypted."
assert isinstance(self.private_key, PrivateKey)
self.seed = aes_encrypt(password, self.seed, self.seed_encryption_init_vector)
self.seed = aes_encrypt(password, self.seed, self.get_init_vector('seed'))
self.private_key_string = aes_encrypt(
password, self.private_key.extended_key_string(), self.private_key_encryption_init_vector
password, self.private_key.extended_key_string(), self.get_init_vector('private_key')
)
self.private_key = None
self.password = None
self.encrypted = True
return True
async def ensure_address_gap(self):
addresses = []
+1 -1
View File
@@ -544,7 +544,7 @@ class BaseLedger(metaclass=LedgerRegistry):
return None
def broadcast(self, tx):
# broadcast cant be a retriable call yet
# broadcast can't be a retriable call yet
return self.network.broadcast(hexlify(tx.raw).decode())
async def wait(self, tx: basetransaction.BaseTransaction, height=-1, timeout=None):
+2 -2
View File
@@ -73,7 +73,7 @@ class ClientSession(BaseClientSession):
return reply
except (RPCError, ProtocolError) as e:
if str(e).find('.*no such .*transaction.*'):
# shouldnt the server return none instead?
# shouldn't the server return none instead?
return None
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
*self.server, *e.args)
@@ -256,7 +256,7 @@ class BaseNetwork:
try:
return await self.rpc('blockchain.address.subscribe', [address], True)
except asyncio.TimeoutError:
# abort and cancel, we cant lose a subscription, it will happen again on reconnect
# abort and cancel, we can't lose a subscription, it will happen again on reconnect
if self.client:
self.client.abort()
raise asyncio.CancelledError()
+130 -3
View File
@@ -1,9 +1,12 @@
import os
import time
import stat
import json
import zlib
import typing
import logging
from typing import List, Sequence, MutableSequence, Optional
from collections import UserDict
from hashlib import sha256
from operator import attrgetter
from torba.client.hash import better_aes_encrypt, better_aes_decrypt
@@ -12,6 +15,46 @@ if typing.TYPE_CHECKING:
from torba.client import basemanager, baseaccount, baseledger
log = logging.getLogger(__name__)
ENCRYPT_ON_DISK = 'encrypt-on-disk'
class TimestampedPreferences(UserDict):
def __init__(self, d: dict = None):
super().__init__()
if d is not None:
self.data = d.copy()
def __getitem__(self, key):
return self.data[key]['value']
def __setitem__(self, key, value):
self.data[key] = {
'value': value,
'ts': time.time()
}
def __repr__(self):
return repr(self.to_dict_without_ts())
def to_dict_without_ts(self):
return {
key: value['value'] for key, value in self.data.items()
}
@property
def hash(self):
return sha256(json.dumps(self.data).encode()).digest()
def merge(self, other: dict):
for key, value in other.items():
if key in self.data and value['ts'] < self.data[key]['ts']:
continue
self.data[key] = value
class Wallet:
""" The primary role of Wallet is to encapsulate a collection
of accounts (seed/private keys) and the spending rules / settings
@@ -19,11 +62,16 @@ class Wallet:
by physical files on the filesystem.
"""
preferences: TimestampedPreferences
encryption_password: Optional[str]
def __init__(self, name: str = 'Wallet', accounts: MutableSequence['baseaccount.BaseAccount'] = None,
storage: 'WalletStorage' = None) -> None:
storage: 'WalletStorage' = None, preferences: dict = None) -> None:
self.name = name
self.accounts = accounts or []
self.storage = storage or WalletStorage()
self.preferences = TimestampedPreferences(preferences or {})
self.encryption_password = None
@property
def id(self):
@@ -75,6 +123,7 @@ class Wallet:
json_dict = storage.read()
wallet = cls(
name=json_dict.get('name', 'Wallet'),
preferences=json_dict.get('preferences', {}),
storage=storage
)
account_dicts: Sequence[dict] = json_dict.get('accounts', [])
@@ -83,24 +132,40 @@ class Wallet:
ledger.account_class.from_dict(ledger, wallet, account_dict)
return wallet
def to_dict(self):
def to_dict(self, encrypt_password: str = None):
return {
'version': WalletStorage.LATEST_VERSION,
'name': self.name,
'accounts': [a.to_dict() for a in self.accounts]
'preferences': self.preferences.data,
'accounts': [a.to_dict(encrypt_password) for a in self.accounts]
}
def save(self):
if self.preferences.get(ENCRYPT_ON_DISK, False):
if self.encryption_password:
self.storage.write(self.to_dict(encrypt_password=self.encryption_password))
return
else:
log.warning(
"Disk encryption requested but no password available for encryption. "
"Saving wallet in an unencrypted state."
)
self.storage.write(self.to_dict())
@property
def hash(self) -> bytes:
h = sha256()
if self.preferences.get(ENCRYPT_ON_DISK, False):
assert self.encryption_password, \
"Encryption is enabled but no password is available, cannot generate hash."
h.update(self.encryption_password.encode())
h.update(self.preferences.hash)
for account in sorted(self.accounts, key=attrgetter('id')):
h.update(account.hash)
return h.digest()
def pack(self, password):
assert not self.is_locked, "Cannot pack a wallet with locked/encrypted accounts."
new_data = json.dumps(self.to_dict())
new_data_compressed = zlib.compress(new_data.encode())
return better_aes_encrypt(password, new_data_compressed)
@@ -111,6 +176,67 @@ class Wallet:
decompressed = zlib.decompress(decrypted)
return json.loads(decompressed)
def merge(self, manager: 'basemanager.BaseWalletManager',
password: str, data: str) -> List['baseaccount.BaseAccount']:
assert not self.is_locked, "Cannot sync apply on a locked wallet."
added_accounts = []
decrypted_data = self.unpack(password, data)
self.preferences.merge(decrypted_data.get('preferences', {}))
for account_dict in decrypted_data['accounts']:
ledger = manager.get_or_create_ledger(account_dict['ledger'])
_, _, pubkey = ledger.account_class.keys_from_dict(ledger, account_dict)
account_id = pubkey.address
local_match = None
for local_account in self.accounts:
if account_id == local_account.id:
local_match = local_account
break
if local_match is not None:
local_match.merge(account_dict)
else:
new_account = ledger.account_class.from_dict(ledger, self, account_dict)
added_accounts.append(new_account)
return added_accounts
@property
def is_locked(self) -> bool:
for account in self.accounts:
if account.encrypted:
return True
return False
def unlock(self, password):
self.encryption_password = password
for account in self.accounts:
if account.encrypted:
if not account.decrypt(password):
return False
return True
def lock(self):
assert self.encryption_password is not None, "Cannot lock an unencrypted wallet, encrypt first."
for account in self.accounts:
if not account.encrypted:
account.encrypt(self.encryption_password)
return True
@property
def is_encrypted(self) -> bool:
return self.is_locked or self.preferences.get(ENCRYPT_ON_DISK, False)
def decrypt(self):
assert not self.is_locked, "Cannot decrypt a locked wallet, unlock first."
self.preferences[ENCRYPT_ON_DISK] = False
self.save()
return True
def encrypt(self, password):
assert not self.is_locked, "Cannot re-encrypt a locked wallet, unlock first."
self.encryption_password = password
self.preferences[ENCRYPT_ON_DISK] = True
self.save()
return True
class WalletStorage:
@@ -121,6 +247,7 @@ class WalletStorage:
self._default = default or {
'version': self.LATEST_VERSION,
'name': 'My Wallet',
'preferences': {},
'accounts': []
}
+11 -8
View File
@@ -68,7 +68,7 @@ def set_logging(ledger_module, level, handler=None):
class Conductor:
def __init__(self, ledger_module=None, manager_module=None, verbosity=logging.WARNING,
enable_segwit=False):
enable_segwit=False, seed=None):
self.ledger_module = ledger_module or get_ledger_from_environment()
self.manager_module = manager_module or get_manager_from_environment()
self.spv_module = get_spvserver_from_ledger(self.ledger_module)
@@ -76,7 +76,9 @@ class Conductor:
self.blockchain_node = get_blockchain_node_from_ledger(self.ledger_module)
self.blockchain_node.segwit_enabled = enable_segwit
self.spv_node = SPVNode(self.spv_module)
self.wallet_node = WalletNode(self.manager_module, self.ledger_module.RegTestLedger)
self.wallet_node = WalletNode(
self.manager_module, self.ledger_module.RegTestLedger, default_seed=seed
)
set_logging(self.ledger_module, verbosity)
@@ -138,7 +140,7 @@ class Conductor:
class WalletNode:
def __init__(self, manager_class: Type[BaseWalletManager], ledger_class: Type[BaseLedger],
verbose: bool = False, port: int = 5280) -> None:
verbose: bool = False, port: int = 5280, default_seed: str = None) -> None:
self.manager_class = manager_class
self.ledger_class = ledger_class
self.verbose = verbose
@@ -148,6 +150,7 @@ class WalletNode:
self.account: Optional[BaseAccount] = None
self.data_path: Optional[str] = None
self.port = port
self.default_seed = default_seed
async def start(self, spv_node: 'SPVNode', seed=None, connect=True):
self.data_path = tempfile.mkdtemp()
@@ -168,14 +171,14 @@ class WalletNode:
})
self.ledger = self.manager.ledgers[self.ledger_class]
self.wallet = self.manager.default_wallet
if seed is None and self.wallet is not None:
self.wallet.generate_account(self.ledger)
elif self.wallet is not None:
if not self.wallet:
raise ValueError('Wallet is required.')
if seed or self.default_seed:
self.ledger.account_class.from_dict(
self.ledger, self.wallet, {'seed': seed}
self.ledger, self.wallet, {'seed': seed or self.default_seed}
)
else:
raise ValueError('Wallet is required.')
self.wallet.generate_account(self.ledger)
self.account = self.wallet.default_account
if connect:
await self.manager.start()
+1 -1
View File
@@ -37,7 +37,7 @@ class FramerBase(object):
"""Abstract base class for a framer.
A framer breaks an incoming byte stream into protocol messages,
buffering if necesary. It also frames outgoing messages into
buffering if necessary. It also frames outgoing messages into
a byte stream.
"""
+1 -1
View File
@@ -513,7 +513,7 @@ class JSONRPCv2(JSONRPC):
class JSONRPCLoose(JSONRPC):
"""A relaxed versin of JSON RPC."""
"""A relaxed version of JSON RPC."""
# Don't be so loose we accept any old message ID
_message_id = JSONRPCv2._message_id
+1 -1
View File
@@ -93,7 +93,7 @@ class SessionBase(asyncio.Protocol):
# Set when a connection is made
self._address = None
self._proxy_address = None
# For logger.debug messsages
# For logger.debug messages
self.verbosity = 0
# Cleared when the send socket is full
self._can_send = Event()
+1 -1
View File
@@ -117,7 +117,7 @@ class Daemon:
async def _send(self, payload, processor):
"""Send a payload to be converted to JSON.
Handles temporary connection issues. Daemon reponse errors
Handles temporary connection issues. Daemon response errors
are raise through DaemonError.
"""
def log_error(error):
+1 -1
View File
@@ -228,7 +228,7 @@ class History:
def _compact_hashX(self, hashX, hist_map, hist_list,
write_items, keys_to_delete):
"""Compres history for a hashX. hist_list is an ordered list of
"""Compress history for a hashX. hist_list is an ordered list of
the histories to be compressed."""
# History entries (tx numbers) are 4 bytes each. Distribute
# over rows of up to 50KB in size. A fixed row size means
+3 -3
View File
@@ -385,7 +385,7 @@ class SessionManager:
return "peer '{}' added".format(real_name)
async def rpc_disconnect(self, session_ids):
"""Disconnect sesssions.
"""Disconnect sessions.
session_ids: array of session IDs
"""
@@ -397,7 +397,7 @@ class SessionManager:
return await self._for_each_session(session_ids, close)
async def rpc_log(self, session_ids):
"""Toggle logging of sesssions.
"""Toggle logging of sessions.
session_ids: array of session IDs
"""
@@ -414,7 +414,7 @@ class SessionManager:
try:
self.daemon.set_url(daemon_url)
except Exception as e:
raise RPCError(BAD_REQUEST, f'an error occured: {e!r}')
raise RPCError(BAD_REQUEST, f'an error occurred: {e!r}')
return f'now using daemon at {self.daemon.logged_url()}'
async def rpc_stop(self):
+1 -1
View File
@@ -457,7 +457,7 @@ class TxInputTokenPay(TxInput):
self.script[1] == self.OP_ANON_MARKER)
def is_generation(self):
# Transactions comming in from stealth addresses are seen by
# Transactions coming in from stealth addresses are seen by
# the blockchain as newly minted coins. The reverse, where coins
# are sent TO a stealth address, are seen by the blockchain as
# a coin burn.
+2 -1
View File
@@ -183,6 +183,7 @@ class AdvanceTimeTestCase(AsyncioTestCase):
class IntegrationTestCase(AsyncioTestCase):
SEED = None
LEDGER = None
MANAGER = None
ENABLE_SEGWIT = False
@@ -201,7 +202,7 @@ class IntegrationTestCase(AsyncioTestCase):
async def asyncSetUp(self):
self.conductor = Conductor(
ledger_module=self.LEDGER, manager_module=self.MANAGER, verbosity=self.VERBOSITY,
enable_segwit=self.ENABLE_SEGWIT
enable_segwit=self.ENABLE_SEGWIT, seed=self.SEED
)
await self.conductor.start_blockchain()
self.addCleanup(self.conductor.stop_blockchain)