Compare commits
121
Commits
v0.37.0rc2
...
misc_fixes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27afc759ff | ||
|
|
7abb28cb3e | ||
|
|
7d2f592bb5 | ||
|
|
1a182bc9bd | ||
|
|
324cbdcdb2 | ||
|
|
6c0c0ee322 | ||
|
|
1e54271d8a | ||
|
|
54b9ed6cb2 | ||
|
|
558a02d187 | ||
|
|
3567b331c0 | ||
|
|
9e4cf3c995 | ||
|
|
db1d547b19 | ||
|
|
c31efd780b | ||
|
|
7cdb7987e3 | ||
|
|
ec07037e88 | ||
|
|
9bb7b0571e | ||
|
|
d98162a118 | ||
|
|
c5ae59bff7 | ||
|
|
efbf2f49a9 | ||
|
|
77c69f661d | ||
|
|
2e09d2adfa | ||
|
|
8620a0e424 | ||
|
|
e2c123456b | ||
|
|
c9be79f062 | ||
|
|
a2a1ef34ab | ||
|
|
761a2b235c | ||
|
|
3ca2fee592 | ||
|
|
a480b2d25f | ||
|
|
d7032b12d7 | ||
|
|
84381ff76c | ||
|
|
007dd43861 | ||
|
|
1bc4e4b702 | ||
|
|
b91f27219d | ||
|
|
dc4560cc9a | ||
|
|
84b471d486 | ||
|
|
c6a3c05a0c | ||
|
|
dd665a758d | ||
|
|
32dc1297ec | ||
|
|
bef244ba77 | ||
|
|
3c231d6215 | ||
|
|
a212cf6ba4 | ||
|
|
bc060f1378 | ||
|
|
22c701fd50 | ||
|
|
4f0e8fce6e | ||
|
|
f642cfe9dd | ||
|
|
24e073680b | ||
|
|
b2f63a1545 | ||
|
|
f506b3e6d4 | ||
|
|
f7412514b3 | ||
|
|
bd6a609b30 | ||
|
|
4e32b69d1d | ||
|
|
1116c7f29e | ||
|
|
d80c671cf2 | ||
|
|
14b12cbea2 | ||
|
|
1f7feafb67 | ||
|
|
cbe689ea7f | ||
|
|
9099ee2e8e | ||
|
|
b134e0c9c9 | ||
|
|
f8c0e80cfc | ||
|
|
1f266ebdad | ||
|
|
b09e1f8825 | ||
|
|
c496278a5b | ||
|
|
cacc65d45e | ||
|
|
2247b354b3 | ||
|
|
43111f0497 | ||
|
|
6c142b4477 | ||
|
|
e8683a24bd | ||
|
|
a4d17d1705 | ||
|
|
a030e13548 | ||
|
|
32b8601c38 | ||
|
|
f5bd28bfdb | ||
|
|
6cbbe23c7c | ||
|
|
d7c2e4e9b3 | ||
|
|
d61ddbb950 | ||
|
|
cf7bb6a391 | ||
|
|
68d7328918 | ||
|
|
ff2985cc80 | ||
|
|
ac69fcbc5f | ||
|
|
609cf42868 | ||
|
|
e43b29fcd1 | ||
|
|
6594b7c50c | ||
|
|
971f2a1cef | ||
|
|
fc88261cc6 | ||
|
|
895b3992c9 | ||
|
|
41951d8ec2 | ||
|
|
ae2121c5c4 | ||
|
|
771fe935f4 | ||
|
|
60f7766cf7 | ||
|
|
63bd983012 | ||
|
|
7ffce1040c | ||
|
|
ac6835fa60 | ||
|
|
3cf5c536c0 | ||
|
|
85cc1a4763 | ||
|
|
180cfcfb72 | ||
|
|
864c1dd901 | ||
|
|
aeaa7ba986 | ||
|
|
b8325c1f89 | ||
|
|
a36936b5ff | ||
|
|
7cf245a0e9 | ||
|
|
9f83cce574 | ||
|
|
30b113d64a | ||
|
|
ccd2023d37 | ||
|
|
3127cd11cf | ||
|
|
6e483cba8d | ||
|
|
46c03c0cb2 | ||
|
|
c2ca0a9467 | ||
|
|
b350e74aca | ||
|
|
de9473f75a | ||
|
|
bfc107fdb3 | ||
|
|
6a2efa54ab | ||
|
|
72f0e1ca14 | ||
|
|
9a1262d557 | ||
|
|
706a8e52dc | ||
|
|
f3c8776878 | ||
|
|
539ea04039 | ||
|
|
8f96b07559 | ||
|
|
0a1e97fe23 | ||
|
|
da637b9c0e | ||
|
|
3618de1227 | ||
|
|
3cb8a63bf9 | ||
|
|
bad99de5b3 |
No files matched your search
+237
-241
@@ -2,34 +2,6 @@
|
||||
"main": {
|
||||
"doc": "Ungrouped commands.",
|
||||
"commands": [
|
||||
{
|
||||
"name": "block_show",
|
||||
"description": "Get contents of a block",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "blockhash",
|
||||
"type": "str",
|
||||
"description": "hash of the block to look up",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "int",
|
||||
"description": "height of the block to look up",
|
||||
"is_required": true
|
||||
}
|
||||
],
|
||||
"returns": "(dict) Requested block",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Show contents of the first block.",
|
||||
"curl": "curl -d'{\"method\": \"block_show\", \"params\": {\"height\": 1}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet block_show --height=1",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"block_show\", \"params\": {\"height\": 1}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"bits\": \"207fffff\",\n \"chainwork\": \"0000000000000000000000000000000000000000000000000000000000000004\",\n \"confirmations\": 206,\n \"difficulty\": 3.051711610163642e-05,\n \"hash\": \"e6ed94405aaeec0ef5234d08d49a997271648050e1133cea0224129f181effa5\",\n \"height\": 1,\n \"mediantime\": 1556160358,\n \"merkleroot\": \"1fa654bd3dce42b06f8e5eb6d4891ec5091fea344c4800ffa1a993c16dd55cf3\",\n \"nameclaimroot\": \"0000000000000000000000000000000000000000000000000000000000000001\",\n \"nextblockhash\": \"9067efa5bb4675717cc010b4d52670eec39d5907141f5fb6f39853dc93fe0f6d\",\n \"nonce\": 0,\n \"previousblockhash\": \"6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556\",\n \"size\": 211,\n \"target\": \"7fffff0000000000000000000000000000000000000000000000000000000000\",\n \"time\": 1556160358,\n \"tx\": [\n \"1fa654bd3dce42b06f8e5eb6d4891ec5091fea344c4800ffa1a993c16dd55cf3\"\n ],\n \"version\": 536870912,\n \"versionHex\": \"20000000\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "get",
|
||||
"description": "Download stream from a LBRY name.",
|
||||
@@ -46,6 +18,12 @@
|
||||
"description": "specified name for the downloaded file, overrides the stream file name",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "download_directory",
|
||||
"type": "str",
|
||||
"description": "full path to the directory to download into",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "int",
|
||||
@@ -63,16 +41,16 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get a file",
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"save_file\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"save_file\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 0,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 1,\n \"channel_claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_name\": \"astream\",\n \"completed\": false,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": \"tmpijqc8tzz\",\n \"key\": \"50f032917f91ddf1ebe187c01dabc1e0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"6c9f97927167b99574c08f556a091bfc02257cb348459c86c01e91ea43565d2965425fb307f1e1b7a165d6ad47804463\",\n \"stream_name\": \"tmpijqc8tzz\",\n \"suggested_file_name\": \"tmpijqc8tzz\",\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"written_bytes\": null\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"}}).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\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmppe9osroo\",\n \"download_path\": \"/tmp/tmppe9osroo/tmpfmcqxqr9\",\n \"file_name\": \"tmpfmcqxqr9\",\n \"height\": 214,\n \"key\": \"de672c28f2060f41575f08bd9aab2cb8\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"65b6982a8fddae13c12390608c58a18f1368bcb73f53b31990d4be093827f3f1945eec69b84f1ca2996a1f070a3cd7f3\",\n \"stream_name\": \"tmpfmcqxqr9\",\n \"suggested_file_name\": \"tmpfmcqxqr9\",\n \"timestamp\": 1557412291,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"written_bytes\": 11\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "publish",
|
||||
"description": "Create or update a stream claim at a given name (use 'stream create/update' for more control).",
|
||||
"description": "Create or replace a stream claim at a given name (use 'stream create/update' for more control).",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "name",
|
||||
@@ -128,36 +106,18 @@
|
||||
"description": "author of the publication. The usage for this field is not the same as for channels. The author field is used to credit an author who is not the publisher and is not represented by the channel. For example, a pdf file of 'The Odyssey' has an author of 'Homer' but may by published to a channel such as '@classics', or to no channel at all",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_tags",
|
||||
"type": "bool",
|
||||
"description": "clear existing tags (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "list",
|
||||
"description": "add content tags",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_languages",
|
||||
"type": "bool",
|
||||
"description": "clear existing languages (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "languages",
|
||||
"type": "list",
|
||||
"description": "languages used by the channel, using RFC 5646 format, eg: for English `--languages=en` for Spanish (Spain) `--languages=es-ES` for Spanish (Mexican) `--languages=es-MX` for Chinese (Simplified) `--languages=zh-Hans` for Chinese (Traditional) `--languages=zh-Hant`",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_locations",
|
||||
"type": "bool",
|
||||
"description": "clear existing locations (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "locations",
|
||||
"type": "list",
|
||||
@@ -247,10 +207,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Publish a file",
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpvw03l1fk\", \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpvw03l1fk",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpvw03l1fk\", \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e2d8b96dc144bd510952f955c39609813e38ababb4bd69ce37007b4f381fc759010000006b4830450221008cb8bea984259005cb0385f4776b1f7f4efe4900ca6cc9daf1d70db2586d3d1a02207a0ce152d23fc817d802b9cbbefb490cf50c5dd3fa9432c19fdf0af395b248c901210379a2244f1db62e8279365d95a44a6b790ac3755673d90e0b170a9225a4dbb024ffffffff0200e1f50500000000adb50c612d6e65772d73747265616d4c82000a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70767730336c31666b180b22186170706c69636174696f6e2f6f637465742d73747265616d323038ee3f97b00c53bbbbc0d4605cd027cf67f269db1b4edb464a6765ec141951e1eeb03394d989a62f5b82ab8766e09c816d7576a9149f8a9a9174450506616605b7f0cea201af4e44ba88ace0b46217000000001976a914deb1cbeb8fe3afb244d7fdac5bdefd726591d46388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mq1y9qSzp7FfZLvMmihfio7edYAp7YiKL6\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"59c71f384f7b0037ce69bdb4abab383e810996c355f9520951bd44c16db9d8e2\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mv4Xmv1AhskDzZM3Qjkayg3yLTfR5vpnfc\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0c179328bc178a63e3507f3eac2e9b49688e3a78\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#0c179328bc178a63e3507f3eac2e9b49688e3a78\",\n \"txid\": \"32f5c23bf22233ab4fff7e75d33e4089a88c6125ab4b24dcc9b2766add53252c\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpvw03l1fk\",\n \"sd_hash\": \"38ee3f97b00c53bbbbc0d4605cd027cf67f269db1b4edb464a6765ec141951e1eeb03394d989a62f5b82ab8766e09c81\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n1pTJAMjfs38q2LejgAB2ZJQoA3QRVF2Ho\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"32f5c23bf22233ab4fff7e75d33e4089a88c6125ab4b24dcc9b2766add53252c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"32f5c23bf22233ab4fff7e75d33e4089a88c6125ab4b24dcc9b2766add53252c\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzyae0q0y\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpzyae0q0y",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzyae0q0y\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001d7f8c932dde56ae69417f75de96abe606aa537e35f627bec962ef1218c6a92c8010000006b483045022100d0f33199022e2cbc91caa20aaa50779c2a70e58e345f685b7c79c5fcbe462ba50220462fc04149319ce1b36d137e52e1a8e6ca719091f859554372fee5a34a47a66d0121037ad50cdfa11808327c70f57e94b7c2462492a0b14da955eeed83ebce84494d7affffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a79616530713079180b22186170706c69636174696f6e2f6f637465742d73747265616d3230168ea3c6b9a41509af29bb6b0d2c3c000d52d0b77c3f85c327b83ceb996300e113f82f240e20e18bc253f0a800100fb86d7576a9148cd833cc0b92c8955e6a3977bb991a275444ec5e88ace0b46217000000001976a9147ce9d453a27810ecc9e2ec216b50316f3e8f220e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msv3BiuJ4RHWEbdYE665DaxxGQbmTjtPW2\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412291,\n \"txid\": \"c8926a8c21f12e96ec7b625fe337a56a60be6ae95df71794e66ae5dd32c9f8d7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtMftuq8irZSZGMqRV4kbv558i2THU94hW\",\n \"amount\": \"1.0\",\n \"claim_id\": \"f1d4b94f0a1a6cbda837d67a2714bba180ea8e9c\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#f1d4b94f0a1a6cbda837d67a2714bba180ea8e9c\",\n \"timestamp\": null,\n \"txid\": \"70c642a80f01d3cc1e77e6a8961fbfbdc40461ad017f0a58eccd192b7a404636\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzyae0q0y\",\n \"sd_hash\": \"168ea3c6b9a41509af29bb6b0d2c3c000d52d0b77c3f85c327b83ceb996300e113f82f240e20e18bc253f0a800100fb8\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mruSCbKo6azmjoYfnd1Br48qyQa4FTVUE8\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"70c642a80f01d3cc1e77e6a8961fbfbdc40461ad017f0a58eccd192b7a404636\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"70c642a80f01d3cc1e77e6a8961fbfbdc40461ad017f0a58eccd192b7a404636\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -265,14 +225,14 @@
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "Dictionary of results, keyed by url\n '<url>': {\n If a resolution error occurs:\n 'error': Error message\n\n If the url resolves to a channel or a claim in a channel:\n 'certificate': {\n 'address': (str) claim address,\n 'amount': (float) claim amount,\n 'effective_amount': (float) claim amount including supports,\n 'claim_id': (str) claim id,\n 'claim_sequence': (int) claim sequence number (or -1 if unknown),\n 'decoded_claim': (bool) whether or not the claim value was decoded,\n 'height': (int) claim height,\n 'depth': (int) claim depth,\n 'has_signature': (bool) included if decoded_claim\n 'name': (str) claim name,\n 'permanent_url': (str) permanent url of the certificate claim,\n 'supports: (list) list of supports [{'txid': (str) txid,\n 'nout': (int) nout,\n 'amount': (float) amount}],\n 'txid': (str) claim txid,\n 'nout': (str) claim nout,\n 'signature_is_valid': (bool), included if has_signature,\n 'value': ClaimDict if decoded, otherwise hex string\n }\n\n If the url resolves to a channel:\n 'claims_in_channel': (int) number of claims in the channel,\n\n If the url resolves to a claim:\n 'claim': {\n 'address': (str) claim address,\n 'amount': (float) claim amount,\n 'effective_amount': (float) claim amount including supports,\n 'claim_id': (str) claim id,\n 'claim_sequence': (int) claim sequence number (or -1 if unknown),\n 'decoded_claim': (bool) whether or not the claim value was decoded,\n 'height': (int) claim height,\n 'depth': (int) claim depth,\n 'has_signature': (bool) included if decoded_claim\n 'name': (str) claim name,\n 'permanent_url': (str) permanent url of the claim,\n 'channel_name': (str) channel name if claim is in a channel\n 'supports: (list) list of supports [{'txid': (str) txid,\n 'nout': (int) nout,\n 'amount': (float) amount}]\n 'txid': (str) claim txid,\n 'nout': (str) claim nout,\n 'signature_is_valid': (bool), included if has_signature,\n 'value': ClaimDict if decoded, otherwise hex string\n }\n }",
|
||||
"returns": "Dictionary of results, keyed by url\n '<url>': {\n If a resolution error occurs:\n 'error': Error message\n\n If the url resolves to a channel or a claim in a channel:\n 'certificate': {\n 'address': (str) claim address,\n 'amount': (float) claim amount,\n 'effective_amount': (float) claim amount including supports,\n 'claim_id': (str) claim id,\n 'claim_sequence': (int) claim sequence number (or -1 if unknown),\n 'decoded_claim': (bool) whether or not the claim value was decoded,\n 'height': (int) claim height,\n 'confirmations': (int) claim depth,\n 'timestamp': (int) timestamp of the block that included this claim tx,\n 'has_signature': (bool) included if decoded_claim\n 'name': (str) claim name,\n 'permanent_url': (str) permanent url of the certificate claim,\n 'supports: (list) list of supports [{'txid': (str) txid,\n 'nout': (int) nout,\n 'amount': (float) amount}],\n 'txid': (str) claim txid,\n 'nout': (str) claim nout,\n 'signature_is_valid': (bool), included if has_signature,\n 'value': ClaimDict if decoded, otherwise hex string\n }\n\n If the url resolves to a channel:\n 'claims_in_channel': (int) number of claims in the channel,\n\n If the url resolves to a claim:\n 'claim': {\n 'address': (str) claim address,\n 'amount': (float) claim amount,\n 'effective_amount': (float) claim amount including supports,\n 'claim_id': (str) claim id,\n 'claim_sequence': (int) claim sequence number (or -1 if unknown),\n 'decoded_claim': (bool) whether or not the claim value was decoded,\n 'height': (int) claim height,\n 'depth': (int) claim depth,\n 'has_signature': (bool) included if decoded_claim\n 'name': (str) claim name,\n 'permanent_url': (str) permanent url of the claim,\n 'channel_name': (str) channel name if claim is in a channel\n 'supports: (list) list of supports [{'txid': (str) txid,\n 'nout': (int) nout,\n 'amount': (float) amount}]\n 'txid': (str) claim txid,\n 'nout': (str) claim nout,\n 'signature_is_valid': (bool), included if has_signature,\n 'value': ClaimDict if decoded, otherwise hex string\n }\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Resolve a claim",
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\": {\n \"certificate\": {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_sequence\": -1,\n \"decoded_claim\": true,\n \"depth\": 7,\n \"effective_amount\": \"1.0\",\n \"has_signature\": false,\n \"height\": 210,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"protobuf\": \"00125a0a583056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b420b4e6577204368616e6e656c\",\n \"supports\": [],\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"valid_at_height\": 210,\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"claim\": {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_sequence\": -1,\n \"decoded_claim\": true,\n \"depth\": 3,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n }\n },\n \"claims_in_channel\": 0\n }\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\": {\n \"certificate\": {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_sequence\": -1,\n \"confirmations\": 7,\n \"decoded_claim\": true,\n \"effective_amount\": \"1.0\",\n \"has_signature\": false,\n \"height\": 210,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"protobuf\": \"00125a0a583056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46420b4e6577204368616e6e656c\",\n \"supports\": [],\n \"timestamp\": 1557412290,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"valid_at_height\": 210,\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"claim\": {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_sequence\": -1,\n \"confirmations\": 3,\n \"decoded_claim\": true,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n }\n },\n \"claims_in_channel\": 0\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -294,7 +254,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 \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"2M4Cs1sUcu9pzFoHp6TzBLLLQPaqCve9iRfEohQX4xqMa3P4TxBDdFFrhhtvyDJPGX\",\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\": \"d60eab23842e6e2c5a6c441669df96b116895bd47b21213a2c7860f93f01de50\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"2Aw32Z949cPi5dj1K8LfW3AnAyy2MnsUYFMHDbBj97fWWA9oP4YLviNc17x953kwoV\",\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\": \"e9bf8976351ca1f215a0c26463b371aedff0752d0a046090da58f0d50f76d710\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -316,7 +276,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.37.0rc1\",\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.2\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"ubuntu:GNOME\",\n \"distro\": {\n \"codename\": \"bionic\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"18.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"18\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.37.0rc5\",\n \"os_release\": \"4.15.15-041515-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.15.15-041515-generic-x86_64-with-debian-buster-sid\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.0\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -364,10 +324,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Add an account from seed",
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\", \"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\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1556160361.5103474,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPddGW6HMy4w2PS6Qn9SmNX149peKepsaNFaxu393oMGkKFeGrbTC6v5psKw97ocE16fvFLJGYPrZ3sm9KxwFXoAxLh23KkwW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4X6JHyw2ZULgW17viJmxH6Jew7AMxF9Nm65DffXsPXmNBRkuJa7oWVgm7vdmfFUvjswbpo7SCyQhYwViFpq2s6XWEc81xURg\",\n \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"concert caution silent security delay egg bus category bean double bargain lunch\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\", \"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\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1557412257.1639874,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPeSga9d4YgRVnsaZW25naWk1zDAaHRntf4zT3dQJKttbge4SfANdGPPkqYGUL8TAwqVnXYiSUAS3HqU4V31K27obgU8JtsRQ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XuiN3Gj95q9uSc5SBQyV63cmVgcar4h3uUhpFo7v5PDYpBGmnjWU6AvPJGsDfhFGhQeZreu9Yj73qRHgUbTPvoeGp5zqWwL\",\n \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -399,9 +359,9 @@
|
||||
},
|
||||
{
|
||||
"title": "Get balance for specific account by id",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"2.0\"\n}"
|
||||
}
|
||||
]
|
||||
@@ -430,7 +390,7 @@
|
||||
"curl": "curl -d'{\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account create \"generated account\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1556160361.3380778,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPddGW6HMy4w2PS6Qn9SmNX149peKepsaNFaxu393oMGkKFeGrbTC6v5psKw97ocE16fvFLJGYPrZ3sm9KxwFXoAxLh23KkwW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4X6JHyw2ZULgW17viJmxH6Jew7AMxF9Nm65DffXsPXmNBRkuJa7oWVgm7vdmfFUvjswbpo7SCyQhYwViFpq2s6XWEc81xURg\",\n \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\"\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\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1557412257.0474465,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPeSga9d4YgRVnsaZW25naWk1zDAaHRntf4zT3dQJKttbge4SfANdGPPkqYGUL8TAwqVnXYiSUAS3HqU4V31K27obgU8JtsRQ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XuiN3Gj95q9uSc5SBQyV63cmVgcar4h3uUhpFo7v5PDYpBGmnjWU6AvPJGsDfhFGhQeZreu9Yj73qRHgUbTPvoeGp5zqWwL\",\n \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -513,24 +473,24 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Transfer 2 LBC from default account to specific account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001fce5779455e4345f7540e4a26aab1961b297a29ffcbf0c030ae405103f13ebc2010000006b483045022100ad9dd93a1cec2c3cf7c5052605eee18a9d443b840ca276242ad633c472a8eca702204b72aea266a8f80b456d041218a9a623653768e226372d2499fd2a5bf83799e2012103ac3e6208080585758ec2cae538229a798402bda47306e3c6f63daddeb187fcd5ffffffff0200c2eb0b000000001976a914b9f0f85772ba5d7128ffb43c9674c6cab3f8586288ac90d7ae2f000000001976a914d5553d50fd3a39e01b82de6d7b4f74083786bb9388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvw92gKVSRvTBcF9mKbwiaSBjTfyFFQ9T2\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"c2eb133f1005e40a030cbffc9fa297b26119ab6aa2e440755f34e4559477e5fc\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxU7ySLSwzSmCkKvjhAvfs2UCZDSnmBice\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mzxxLTbb3Qsc3bGmrn8MJkDw4mno7s8J9H\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b06f630c6b29be941ceb4f1fb4357e1b804ed618943bd9d4e77cbf16e3393195000000006a47304402201df99b64f2287a581f910988d875053424a2a6703f0e94edf1c347af283ad41502207e5d24ca551492df3f2026bbdd8ef9b67d1fb942fff5bcb4e03eb5a2bc74567c012103a9394113d9e2fccb7d4a81031a667c676ebd35014fdf2cede3b8034a8b68668bffffffff0200c2eb0b000000001976a91424076ae8e5d1812aed9085683d93090e8cbfee9e88ac90d7ae2f000000001976a914a9889d05d4a60dd24d61f475baa6a02d238b7ffd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mjJRfy3fpDc1QqpSKfExmdhcTXyossEqTp\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1557412289,\n \"txid\": \"953139e316bf7ce7d4d93b9418d64e801b7e35b41f4feb1c94be296b0c636fb0\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mvyN9Y5pUWo4XTok2fAJYHmrhiKMUPqivB\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Spread LBC between multiple addresses",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"from_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\" --from_account=\"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"from_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001c620032f73cb0576a490b0b9586689f53aba9e365abc5ffc4020176b29c14572000000006b483045022100a75c897909f7e9268ae7a6496c440abc0f5f2772a00d95a8aa3d50ab0cffbdb1022025e3261623d81f93b5bd96e43d5b50a0ca30a99e2d8e1dc837f425696bc46dce01210327e201108b4b7f5510324b106ea5bec7e56f9c453ed7edb7133b4d195a44149affffffff03c0687804000000001976a914722a9ffd5ce11cf4ee6ad0638105c66fbc9c8d1688acc0687804000000001976a914722a9ffd5ce11cf4ee6ad0638105c66fbc9c8d1688ac6cb9fa02000000001976a914981a3d2357e3dad2a8fa99ffec65fe4b700e9e3988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxU7ySLSwzSmCkKvjhAvfs2UCZDSnmBice\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqvcPZFNjaXbYrTS3FdNmV82RyW3fgZc4t\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqvcPZFNjaXbYrTS3FdNmV82RyW3fgZc4t\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"muPCSKNBSMw9v4A8p991TrQMjzD1hSU5ub\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"from_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\" --from_account=\"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"from_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ea490e9b788fe3d86e39f1ddd26017a4a46a07815280bff285990901958bf096000000006a473044022001401269e53f0fe7c03ffc8cfcaf45a24857ae794c4608e4addbf4bab6a57907022061ae8c55a3c913159abecf3038dd52fe5def995cc9eeca1b05f3ea5d7e60b411012102503f19a6af2d83f0f6e0a0d1208245ada4829b69e3540ce46b3b42e1a2854f6dffffffff03c0687804000000001976a91424076ae8e5d1812aed9085683d93090e8cbfee9e88acc0687804000000001976a91424076ae8e5d1812aed9085683d93090e8cbfee9e88ac6cb9fa02000000001976a91424076ae8e5d1812aed9085683d93090e8cbfee9e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1557412290,\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Transfer all LBC to a specified account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000376f69d6e4aa026d0b21f69f24f0eeae2d9eead7d2a21c24175e2236f68b46065020000006a473044022013b4b1b8ecffc58fadee7175885c0e06ea6e27f01b53d08392e62121f7a994dd02204010573e4f842e05bb22104b1560cae296ef08d8d341b18b7262528c69cde474012103b9be4bc50a153ba83b55e415d898119ebfc3ea9429f0ced5cd1e777cb1c5e983ffffffff76f69d6e4aa026d0b21f69f24f0eeae2d9eead7d2a21c24175e2236f68b46065000000006a47304402205b90116b6cfbc1642ba198140fe0b7dc4033deca1167abe6059e848415e6719902207fdf59b9c200943bf73ea3b95739f18ece1c021a6ec1e12bb6f1a3dd47102bf401210298bc70cb23e2906eaedd552f5c70e23212b78ac0f94b5722fa5fb0cc43b20059ffffffff76f69d6e4aa026d0b21f69f24f0eeae2d9eead7d2a21c24175e2236f68b46065010000006b483045022100cc1ac3fed46aab6ea6d0c90692bbac28d6ad4bbff00eecfdf10470c08d25375d02202d552d5b157bb8fe088e796b1d7763fc57096b1d796c39d624016a1a8dc9607601210298bc70cb23e2906eaedd552f5c70e23212b78ac0f94b5722fa5fb0cc43b20059ffffffff015027eb0b000000001976a914ef89ef92f99d633a091fb618dc9c357734edb6f888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muPCSKNBSMw9v4A8p991TrQMjzD1hSU5ub\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqvcPZFNjaXbYrTS3FdNmV82RyW3fgZc4t\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mqvcPZFNjaXbYrTS3FdNmV82RyW3fgZc4t\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"6560b4686f23e27541c2212a7dadeed9e2ea0e4ff2691fb2d026a04a6e9df676\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3MX2rLSXYR5WSX72qfEUBiuPve8JuANi6\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"txid\": \"7daf5d1f13d6039cf32436cca746c94ca979f8bdb94c5ae7631d651abdba2d00\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"7daf5d1f13d6039cf32436cca746c94ca979f8bdb94c5ae7631d651abdba2d00\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003715b2ad2a2e81604c90899369460b5d0805c4d93318fbfd89cb3a832ae8c42d4000000006b4830450221009eac41c57796e11bef3fb42dca572e421927c38beffffcc1ecdb8a33c940b09e0220072dde889627cbe1a8d2199d9958a1f9bf2070f9a1e72bc82466a720ee5fab58012102503f19a6af2d83f0f6e0a0d1208245ada4829b69e3540ce46b3b42e1a2854f6dffffffff715b2ad2a2e81604c90899369460b5d0805c4d93318fbfd89cb3a832ae8c42d4010000006b483045022100a6d6075c3e0cca3fff08cfdac4655fb849e101fbc47ec74aa995a51eb6023b6d022062206ae3641f2c0e60d783eec1429299866da1c38f25b9174a67095ed8da726f012102503f19a6af2d83f0f6e0a0d1208245ada4829b69e3540ce46b3b42e1a2854f6dffffffff715b2ad2a2e81604c90899369460b5d0805c4d93318fbfd89cb3a832ae8c42d4020000006b483045022100eaf594ddab83fd806147c9a9f0cb729c1b3c91f2a8cb425a9c92affb744a490602206adf92a18f5b46ef0b7af7e5acd0655011259066278b11e7405ef729878a5feb012102503f19a6af2d83f0f6e0a0d1208245ada4829b69e3540ce46b3b42e1a2854f6dffffffff015027eb0b000000001976a914f6e8134b423b2b5052396954d35477fb9f0637b988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1557412290,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412290,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1557412290,\n \"txid\": \"d4428cae32a8b39cd8bf8f31934d5c80d0b56094369908c90416e8a2d22a5b71\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n42UY87hnpSR9fbacE6WCJDc8cyfHVa4a1\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"a3378429d2d818d2ed85196ef9c8224e120c76f5674f3a577079242abd7fa7b7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"a3378429d2d818d2ed85196ef9c8224e120c76f5674f3a577079242abd7fa7b7\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -570,7 +530,7 @@
|
||||
"curl": "curl -d'{\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"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\": \"mvPLJgakTiEdfNEzc2ioockabza3mpUYWY\",\n \"is_default\": true,\n \"name\": \"Account #mvPLJgakTiEdfNEzc2ioockabza3mpUYWY\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YMob2BAjfXmJJ7ucfVpGqpQiiy35WJWrFyAWQPL9aN3Wha16joF5XRpxcRYyBKeXWzyJ4DzFWJAxQwr5Y1uF9MwB4ATPdXi\",\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\": \"mnNeA4p7qkBSFti1texZcMaij5XP4TTLRs\",\n \"is_default\": true,\n \"name\": \"Account #mnNeA4p7qkBSFti1texZcMaij5XP4TTLRs\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WMwJZ78QVYU65ofkdQWhLwzvEm9R8gBPAVaUqFdoje93iUzpf2oGFBntAV7hi8YsVLK4gSa2JC9JS5ZR2ZJc9qaWEswouus\",\n \"satoshis\": 1000000000\n }\n ]\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -617,10 +577,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Remove an account",
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}).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\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1556160361.3380778,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPddGW6HMy4w2PS6Qn9SmNX149peKepsaNFaxu393oMGkKFeGrbTC6v5psKw97ocE16fvFLJGYPrZ3sm9KxwFXoAxLh23KkwW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4X6JHyw2ZULgW17viJmxH6Jew7AMxF9Nm65DffXsPXmNBRkuJa7oWVgm7vdmfFUvjswbpo7SCyQhYwViFpq2s6XWEc81xURg\",\n \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}).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\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1557412257.0474465,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPeSga9d4YgRVnsaZW25naWk1zDAaHRntf4zT3dQJKttbge4SfANdGPPkqYGUL8TAwqVnXYiSUAS3HqU4V31K27obgU8JtsRQ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XuiN3Gj95q9uSc5SBQyV63cmVgcar4h3uUhpFo7v5PDYpBGmnjWU6AvPJGsDfhFGhQeZreu9Yj73qRHgUbTPvoeGp5zqWwL\",\n \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -695,10 +655,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Modify maximum number of times a change address can be reused",
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\", \"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\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1556160361.5737526,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPddGW6HMy4w2PS6Qn9SmNX149peKepsaNFaxu393oMGkKFeGrbTC6v5psKw97ocE16fvFLJGYPrZ3sm9KxwFXoAxLh23KkwW\",\n \"public_key\": \"tpubD6NzVbkrYhZ4X6JHyw2ZULgW17viJmxH6Jew7AMxF9Nm65DffXsPXmNBRkuJa7oWVgm7vdmfFUvjswbpo7SCyQhYwViFpq2s6XWEc81xURg\",\n \"seed\": \"aisle absorb powder another bargain vivid error ostrich opera keen edit comfort\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\", \"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\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1557412257.2121701,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPeSga9d4YgRVnsaZW25naWk1zDAaHRntf4zT3dQJKttbge4SfANdGPPkqYGUL8TAwqVnXYiSUAS3HqU4V31K27obgU8JtsRQ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XuiN3Gj95q9uSc5SBQyV63cmVgcar4h3uUhpFo7v5PDYpBGmnjWU6AvPJGsDfhFGhQeZreu9Yj73qRHgUbTPvoeGp5zqWwL\",\n \"seed\": \"concert caution silent security delay egg bus category bean double bargain lunch\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -748,9 +708,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Check if address is mine",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mzKs9PtfKz1cKBSNPT8qVBMZ7r1LqLXVUb\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mzKs9PtfKz1cKBSNPT8qVBMZ7r1LqLXVUb",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mzKs9PtfKz1cKBSNPT8qVBMZ7r1LqLXVUb\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mruESV2uxBZioC97PDsbuqjGKRCkviYRos\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mruESV2uxBZioC97PDsbuqjGKRCkviYRos",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mruESV2uxBZioC97PDsbuqjGKRCkviYRos\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -785,14 +745,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 \"miLfme8Kcesj3rRDb4ChytWyUg7AZXGR1V\",\n \"n3MX2rLSXYR5WSX72qfEUBiuPve8JuANi6\",\n \"n2kvhQKzn2kjMbkiGKrLNXhStfJFTWGAVG\",\n \"mzxxLTbb3Qsc3bGmrn8MJkDw4mno7s8J9H\",\n \"mq1y9qSzp7FfZLvMmihfio7edYAp7YiKL6\",\n \"n3PQGct81tBiyrsQAq2Tf4pMt4sJjUje29\",\n \"mvw92gKVSRvTBcF9mKbwiaSBjTfyFFQ9T2\",\n \"ms96QzbQunqP1VsAHm5xHkaunkbCYycRDd\",\n \"mzKs9PtfKz1cKBSNPT8qVBMZ7r1LqLXVUb\",\n \"mvGcV5j6PJPzB9GfEzbRsfs5iRwbbxkUZ7\",\n \"muU6jogvLreWHGwPqbPn9KuTwxXpkrPmrP\",\n \"moSm3vPzvRDbh2JotyGHgf8KYwC3nrUhv4\",\n \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"mv4Xmv1AhskDzZM3Qjkayg3yLTfR5vpnfc\",\n \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"n2Qo7qcHp8JeoAMxxNZgkKBaMRQfinoiCQ\",\n \"mhWJWmX6KwDkgc9T3b6GrfE6Avfxh6icDv\",\n \"n13BBQEHEiJ5eCAnAHUfCyuzRnFPgAyYHn\",\n \"mkyJc9mJvEziLthYpvzFYBwopDU12UEDnw\",\n \"mpectx3oMpcQHshJWKX4ebtYiaQ6t4Simy\",\n \"mvPwdcwej5xwjqKK4Eh7fKABAaFcNcCKE7\",\n \"myGG9szYEvd1MUZMmghMBWAtZGYBEtDokv\",\n \"moNVgkTTmB2dJC2F7YG3GmKxi6AJyDUqoU\",\n \"mmNm2kw8PHyMt87ktUwnudEAgyo6cupmy9\",\n \"mp2ik59jEdjfkDSnpYVo898NPC1GxPTZc3\",\n \"n1UDDLHxpwffcBdhyvvdhUMcHXoX7f2pSJ\",\n \"n1HeNhsqb5DJgeghnUKNodRJjRihjDFHTL\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mjJRfy3fpDc1QqpSKfExmdhcTXyossEqTp\",\n \"n3fKziJ6gTJXNMFD5uTT2SzsCm35BUqBMC\",\n \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"myA5CAex5LcxzWfsLytgzyMxSJcNQqsKHt\",\n \"mpcGVMt4WM16pUaEbQz77wNuwajDCG75EN\",\n \"miGb9wRahD39Hs4ZaQ9CFQuBkttwmLwTZs\",\n \"mybA14ZrM1TF8sxDcHLiY31bMztURhxxY3\",\n \"myhdrdTx5ZmfKaVcg4QgYiub2EBYPnkywQ\",\n \"mruESV2uxBZioC97PDsbuqjGKRCkviYRos\",\n \"mjbUc8iTY9yqsTsNNhKH9iehJrNvEoGZwq\",\n \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"mtMftuq8irZSZGMqRV4kbv558i2THU94hW\",\n \"mxwcZA9JejJ4qdLreAMcurk1LyFVYxB8MF\",\n \"moZXCin3xSUiUhDUtbMMg3pvcXWmpXJ8Ah\",\n \"mwVdTBKHwRVY1EDGTnrPDx6EVvsKMTRTg7\",\n \"mref6paiwNMQzTCgxM7BokGNqtFbUrTqdd\",\n \"mpgHxbSf9AMGqtg7tKFW9urQ2DdBxjtGAN\",\n \"mpoDuuAwpWSQFjmdfVD8DDo8bfJQhcvHVF\",\n \"mnENyzt7Lg7RbS9h8VX9GHWXrGcCKtg3U5\",\n \"mohQDtnEwVVqFJ155RDUtDYFvCmpzMAMSv\",\n \"miZ926v6sAnfowtQ52L42Sy9JDe7xPKN7P\",\n \"mqL999ZnSc6rAWKYzekqgAHRM2JYQwPWAW\",\n \"mvyN9Y5pUWo4XTok2fAJYHmrhiKMUPqivB\",\n \"msv3BiuJ4RHWEbdYE665DaxxGQbmTjtPW2\",\n \"miSnDhW4U5DDhjvUpZkGqeVXWYbe37yaRS\",\n \"mmd1DmjigWXF11iiqTT2MgVrh86i2USVMf\",\n \"micK9zMw8jAoyeL7csPp2aB2sYW4fHXH4J\"\n ]\n}"
|
||||
},
|
||||
{
|
||||
"title": "List addresses in specified account",
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mwatzKbhDsE2n8rmdDH3oY6JFQvfLb6D3L\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"muPCSKNBSMw9v4A8p991TrQMjzD1hSU5ub\",\n \"mxU7ySLSwzSmCkKvjhAvfs2UCZDSnmBice\",\n \"miNSfBimNaxGgoF1sYZXDzst1ma6ZiYbeY\",\n \"mwf4KLTWnjoAkmbgTUFdmWWBRpVSNorAeJ\",\n \"miQW9yZ5UVnBYsLN5RumrKHKPHxW1WY51N\",\n \"mqvcPZFNjaXbYrTS3FdNmV82RyW3fgZc4t\",\n \"miTNoFgCqLYaESsJxQcf9TPHYCHqVaxbmK\",\n \"miqcvnHMVBWp1eexGUDnqjVEygZPvMLZ5R\",\n \"mpBJ4FzodSGdePzp7r7fbpEF7t1kSnjVib\",\n \"mgWwdn92ADjUmoQChW3hPCA2oQUcYV7pRs\",\n \"n42nxJGpyk7DCcf8ViN5KvU7yfiD34nZ8t\",\n \"n2LnwCSVsDyzkuKKGfXxJ8dtEvcCPVEZ4g\",\n \"n1YVjTmZmCnSDedrycHbR9sxk4nvfa7kgp\",\n \"mkhhRHGH2Lgi7c4zxTT6N1sbKwhzS8XtoH\",\n \"mwr9ZShrzznXXJD3sDC5fMMeGTzZiHdyoq\",\n \"mrb1wLfDTE646M4quvaDSNXXZshZyvvT5R\",\n \"mpKpiScKrXBBvFArG8yZtTd16J9JydSywQ\",\n \"muewpDBKV3RuxyJ6GeBEdjEJZMAHRg7oLb\",\n \"miDoLySiEbSDJ2LAsnckrsTbSgBYkJiwMu\",\n \"mhDPJA9EjbpgvTTVcRZwCLeMFgn6DCCivz\",\n \"mnC4nDuJProsQGKjBJcAKm3r26iJXN2wbL\",\n \"mowoDiEHtstBQAitRVKEaBVDa9xK5qetJH\",\n \"mynkfP6cpcxesMrA1DShUGCVFG5Xnj6cHm\",\n \"mt5a8oQRSAaE2Ge4ieQZwm8LAmu64mtgya\",\n \"n3xJVTzcip8aRNHQv65ZAjUhKcfUa4tbs8\",\n \"moLgijvkXh82t9WAiwzK1s5ueMEtnNyPkf\"\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mfeYAtr97JTR3wPYQMafz4sqxVw9sKxnnF\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mnAJ3Uit18ZLhzeDNxtZFSPW8pyAZ1s3b1\",\n \"mioTWLxbBBkwBxzGVtfAhgJcfyXqfAVkVF\",\n \"mwA5FJ3C8dgzEzkdaLsTuvVTNSkSRVV9Hz\",\n \"mh6BL728vsFYzMD5coxFXmLpKxgYKWJsxk\",\n \"n2jHfxeNm8W4EbdhD3jFBiAmbHdgnQppAY\",\n \"mx5D2R8x54kXyKkPZRmed57fDFrLGTs16M\",\n \"mnTUtc4N5G8ktZaQEasckeLtnYvHY2zfps\",\n \"mnKJyfbHmY7tPqdaCfuxZAzRt7zMh3zvo1\",\n \"myGFZQj1XzsjEpyFV5qcecNs6eHRDbd9e9\",\n \"mpoFsBE3p85BS6NLhZyU7fYgK8FFFNiRo2\",\n \"mrKDmuenR5D8L8FuSu5gBn6QGxk2Y91dF2\",\n \"mxrTiTua6oPYjH9CoW9FvP6kMj2HA2qPNf\",\n \"mtnMjFABczz6WAuGHTf8gmCE6A4ZMey1jz\",\n \"mgCMxT5m14Y5buhQN5KTGp7u1fFgLzbmU5\",\n \"mvQKoAUe89VWi7yHWdn8yhFmKk7Q2dC7Pk\",\n \"mjJLJmpb5AvjubuQxooaqxRwRwfWhCrXvC\",\n \"n1sAHnV9Jn7ummJhPrwMaBiYDURx8fFFRi\",\n \"mtonAnGVr5HEv17UGcstLmXC5whqJv8UuM\",\n \"mqUgc6Xp2qFyGQgxytRYMDXGmaUderJ4iU\",\n \"mpaGuh2UMrvM8ehcvSdHdEPpKzSmmAoez4\",\n \"mnoTc3oBdzUa42UuDLm9MQzCgmfko8EV9U\",\n \"msP6swJtRWxSk5gv5bwXa1tQSm8VpaMyta\",\n \"n1JAGuN5UxbuW5SbWsGVC5jTURWtSSSdde\",\n \"mk58t3DXcPepvpo7c8QvoW35L6vJMq3EYS\",\n \"mj4QmYHJKFgDq65H4J26CcmTryBtmKYGnW\",\n \"n1fnnx3YFazDuz2hd5AUAvenkGnZXk9syN\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -814,7 +774,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\": \"mzKs9PtfKz1cKBSNPT8qVBMZ7r1LqLXVUb\"\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mruESV2uxBZioC97PDsbuqjGKRCkviYRos\"\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -864,10 +824,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a blob",
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"eb0cd79cbc507234d0453435ca8a4247da8cfb120904bf947956e15eea3557d3a4224c574ae71918c12329c2fc87f2c2\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete eb0cd79cbc507234d0453435ca8a4247da8cfb120904bf947956e15eea3557d3a4224c574ae71918c12329c2fc87f2c2",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"eb0cd79cbc507234d0453435ca8a4247da8cfb120904bf947956e15eea3557d3a4224c574ae71918c12329c2fc87f2c2\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted eb0cd79cbc507234d0453435ca8a4247da8cfb120904bf947956e15eea3557d3a4224c574ae71918c12329c2fc87f2c2\"\n}"
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"e53d7a88c1d5e8ae309ed3fe326bd71aa29f8f969c2dc657f600ac4166725ff879b081599b12e5368e1ecd292fa5e310\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete e53d7a88c1d5e8ae309ed3fe326bd71aa29f8f969c2dc657f600ac4166725ff879b081599b12e5368e1ecd292fa5e310",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"e53d7a88c1d5e8ae309ed3fe326bd71aa29f8f969c2dc657f600ac4166725ff879b081599b12e5368e1ecd292fa5e310\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted e53d7a88c1d5e8ae309ed3fe326bd71aa29f8f969c2dc657f600ac4166725ff879b081599b12e5368e1ecd292fa5e310\"\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -945,7 +905,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 \"eb0cd79cbc507234d0453435ca8a4247da8cfb120904bf947956e15eea3557d3a4224c574ae71918c12329c2fc87f2c2\",\n \"824b5010c15fa64a8c43fc626f4f6ab50b384f38daf9f32524ea2a3f531537b3bd3c9fb56992b7de95fc09de90d81934\",\n \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"e53d7a88c1d5e8ae309ed3fe326bd71aa29f8f969c2dc657f600ac4166725ff879b081599b12e5368e1ecd292fa5e310\",\n \"135a9740f563155af8fb9b2f31c7a942e6c955aca13b86caf6e879af966e850a5efb5401ff7b6b69f9e531d31bf4f081\",\n \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"2217e7fc6e556852849910b734b428604fd3704cab831d71a44149622a9285067d961f7cb720bbe151139ce5a832ae25\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1020,10 +980,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon 2f26f642e714ec67e851138f0292178a3aa1f689",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011cf444ee97a78ca07b179246404bd0f6604741b572ffdc9206edcc357ca05ee4000000006b483045022100c6fe9a7d469f744bda1f52e4656ade7e0bb8da88dfc97d9413fdc0234156bbe40220644ffcef6de9e4bf0a43cfa94b6c11f64a7c938691eee8abcd7c5739287db68f0121026d30bd565be6d0916684a2a51253f593d0911e45714bd568d0022c6f403e395dffffffff0134b7f505000000001976a91489610b9904bd88687557d27256e816a69927d47988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mt3M8AGq2mrjePVM1aHXkm6cVxJjrs2zYc\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"txid\": \"cd9da5728dddbf32785148a04f2ee7c7c768478e3113980c398f335690f6b4d3\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"cd9da5728dddbf32785148a04f2ee7c7c768478e3113980c398f335690f6b4d3\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon 3f6710c07d83e45e0434983d62b6b29530794121",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012e623434c3ef9e6c0305fade6e8b1028fde34963746f25025771d28bb2cf9b47000000006b483045022100a8587da6a1f1ac023e83fe02babd02452f0d82877ac1e998dbd7f1c94bc181b1022058eaf1c53497bb85cce8fc4d221ba11b932ef4bda80ac9a758470546ad5ab9e701210356872df7d60c6022803123324524702308a57d453cd77de9a57185fc67d045aaffffffff0134b7f505000000001976a91422edc806fbf7009d40a85f930333927485ffb45688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mihe7uzo2CeWPAdCpPPwh7MkLwH53NoYHs\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"6a0a4765ae298fb8ce5fd45f56e5d0d823cf551a65d53766fc71cb89646c3a02\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"6a0a4765ae298fb8ce5fd45f56e5d0d823cf551a65d53766fc71cb89646c3a02\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1037,18 +997,18 @@
|
||||
"description": "name of the channel prefixed with '@'",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "allow_duplicate_name",
|
||||
"type": "bool",
|
||||
"description": "create new channel even if one already exists with given name. default: false.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "bid",
|
||||
"type": "decimal",
|
||||
"description": "amount to back the claim",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "allow_duplicate_name",
|
||||
"type": "bool",
|
||||
"description": "create new channel even if one already exists with given name. default: false.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "str",
|
||||
@@ -1061,6 +1021,18 @@
|
||||
"description": "description of the publication",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "str",
|
||||
"description": "email of channel owner",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "website_url",
|
||||
"type": "str",
|
||||
"description": "website url",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "featured",
|
||||
"type": "list",
|
||||
@@ -1085,18 +1057,6 @@
|
||||
"description": "locations of the channel, consisting of 2 letter `country` code and a `state`, `city` and a postal `code` along with a `latitude` and `longitude`. for JSON RPC: pass a dictionary with aforementioned attributes as keys, eg: ... \"locations\": [{'country': 'US', 'state': 'NH'}] ... for command line: pass a colon delimited list with values in the following order: \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\" making sure to include colon for blank values, for example to provide only the city: ... --locations=\"::Manchester\" with all values set: ... --locations=\"US:NH:Manchester:03101:42.990605:-71.460989\" optionally, you can just pass the \"LATITUDE:LONGITUDE\": ... --locations=\"42.990605:-71.460989\" finally, you can also pass JSON string of dictionary on the command line as you would via JSON RPC ... --locations=\"{'country': 'US', 'state': 'NH'}\"",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "str",
|
||||
"description": "email of channel owner",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "website_url",
|
||||
"type": "str",
|
||||
"description": "website url",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "thumbnail_url",
|
||||
"type": "str",
|
||||
@@ -1135,14 +1095,14 @@
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"preview\": 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\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001c620032f73cb0576a490b0b9586689f53aba9e365abc5ffc4020176b29c14572010000006b483045022100b07a348481bebbf847aefe73069283e2f5be901c1a38bad57b61e4b02ac80286022046a71e8f4dd7e6a772fe1f7cfa9c871492a36892f88e77a82ddf54e5f2a11a48012103b714e3e7ee20904d3b8a068d35fb03afc933ea4bedb9c26181d2935322f0284cffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b6d7576a9145bae7eafa7111f2dc29790c6f7d9908ae78038a788acc462a029000000001976a914a64b57f436c6f9bd30d654942fc954731ffac12188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzxxLTbb3Qsc3bGmrn8MJkDw4mno7s8J9H\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mvgEirtKfdXjqykJsqU2uzzDaZqc3Tv9Ep\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ea490e9b788fe3d86e39f1ddd26017a4a46a07815280bff285990901958bf096010000006a47304402201ddaf5c437e4d4de5de8d95da2eb46bddd3b3534cf6a4eb13f60a6abd6a2dfd5022026ae5018f82db4ca984f598f9afd571eb9a6ad7344c6fdb207a45665f7ac9501012102365c65f8694b4fb51051c8646320b6eedb1f75b08e59710315665668133f80deffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d466d7576a91491bb608a97377923f480cb50987ec466f97ae2e088acc462a029000000001976a914f6e8134b423b2b5052396954d35477fb9f0637b988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvyN9Y5pUWo4XTok2fAJYHmrhiKMUPqivB\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412290,\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": null,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n42UY87hnpSR9fbacE6WCJDc8cyfHVa4a1\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\"\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\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"website_url\": \"http://smallmedia.com\", \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"preview\": false}}' http://localhost:5279/",
|
||||
"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\", \"preview\": 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\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"website_url\": \"http://smallmedia.com\", \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000011cf444ee97a78ca07b179246404bd0f6604741b572ffdc9206edcc357ca05ee4010000006a473044022016ccd66475e47509c05abdc869bf0e46de46f9462885dfc3dd9b984fc9a4f64102203fe1f4a9b94ad6f893a653c78166103503ac1dc06fea63b281f20631d4cd6d8f0121030ae1d09e5ecb6bfc36ceea6740db6c76789c8c5d02621e089422a603efe48504ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004e9f8d9d067c06ee1324fd832d9570dac44a230160237c4685da28c3010251908a6a41b30b58da5cdb360f770d5c1845ddcb1330da4bd4e20122ee82ca87536a9121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914d6219ff6374c76958df6366ed31a826b2ea9b71088ace221d305000000001976a914838828e4588b868cae5100d1973329b5fe66db5d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgQP1ChNgpcG9xVRBnysXCVvn5t5CfVbqX\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n13BBQEHEiJ5eCAnAHUfCyuzRnFPgAyYHn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"fd89a6b5e5f2f8323f626cfdf81111b3cac688de\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#fd89a6b5e5f2f8323f626cfdf81111b3cac688de\",\n \"txid\": \"a5813ad4da2f7207da15fcc3d9e07fe9d56a9640a09626a63fa0afa340bf9d47\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004e9f8d9d067c06ee1324fd832d9570dac44a230160237c4685da28c3010251908a6a41b30b58da5cdb360f770d5c1845ddcb1330da4bd4e20122ee82ca87536a9\",\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\": \"msWRvjBEstA5sdWiwFiTNFpU8T8h4DZvMg\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"a5813ad4da2f7207da15fcc3d9e07fe9d56a9640a09626a63fa0afa340bf9d47\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"a5813ad4da2f7207da15fcc3d9e07fe9d56a9640a09626a63fa0afa340bf9d47\"\n }\n}"
|
||||
"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\", \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012e623434c3ef9e6c0305fade6e8b1028fde34963746f25025771d28bb2cf9b47010000006a47304402207cc90fd6f98c1cf0d1ec4e306d34d91a772deee7df74512ce74e80e55d0761ab0220040c3b4c5205a19579f81a80b00fae3a3aa5210b12bd9ce093014ff614b3cf7b0121024e7978a5afa717e117ce4ce7c2a746872fdf51f5000a1929aab16b0dbadd09cfffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a0342000427e280bc4603d321e21866526bd8356241a60bb685f80e8850999c09cb4fd02d4682610a1db0b490fca59053ccae1405b0e56fd537129d1674afe5b1ad19f518121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9142cbb784d8075dc6da01c74007d125b6d577a515788ace221d305000000001976a914a0011029dbc52632024beb82ce65e35e618c8ddd88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"miZ926v6sAnfowtQ52L42Sy9JDe7xPKN7P\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412290,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mjbUc8iTY9yqsTsNNhKH9iehJrNvEoGZwq\",\n \"amount\": \"1.0\",\n \"claim_id\": \"d5b2bf1bdb558fb989addf7404cc1459a78bcf8e\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#d5b2bf1bdb558fb989addf7404cc1459a78bcf8e\",\n \"timestamp\": null,\n \"txid\": \"6add0aeef9de275b1fde43517fc7bdac32bb92c1f52783ad155e585f79b90a72\",\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\": \"3056301006072a8648ce3d020106052b8104000a0342000427e280bc4603d321e21866526bd8356241a60bb685f80e8850999c09cb4fd02d4682610a1db0b490fca59053ccae1405b0e56fd537129d1674afe5b1ad19f518\",\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\": \"mv6ygcdKPPGwnT1QvJWdE8SUjuaGUH2G4n\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"6add0aeef9de275b1fde43517fc7bdac32bb92c1f52783ad155e585f79b90a72\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"6add0aeef9de275b1fde43517fc7bdac32bb92c1f52783ad155e585f79b90a72\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1204,14 +1164,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\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\"\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\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1243,54 +1203,6 @@
|
||||
"description": "description of the publication",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_featured",
|
||||
"type": "bool",
|
||||
"description": "clear existing featured content (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "featured",
|
||||
"type": "list",
|
||||
"description": "claim_ids of featured content in channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_tags",
|
||||
"type": "bool",
|
||||
"description": "clear existing tags (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "list",
|
||||
"description": "add content tags",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_languages",
|
||||
"type": "bool",
|
||||
"description": "clear existing languages (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "languages",
|
||||
"type": "list",
|
||||
"description": "languages used by the channel, using RFC 5646 format, eg: for English `--languages=en` for Spanish (Spain) `--languages=es-ES` for Spanish (Mexican) `--languages=es-MX` for Chinese (Simplified) `--languages=zh-Hans` for Chinese (Traditional) `--languages=zh-Hant`",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_locations",
|
||||
"type": "bool",
|
||||
"description": "clear existing locations (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "locations",
|
||||
"type": "list",
|
||||
"description": "locations of the channel, consisting of 2 letter `country` code and a `state`, `city` and a postal `code` along with a `latitude` and `longitude`. for JSON RPC: pass a dictionary with aforementioned attributes as keys, eg: ... \"locations\": [{'country': 'US', 'state': 'NH'}] ... for command line: pass a colon delimited list with values in the following order: \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\" making sure to include colon for blank values, for example to provide only the city: ... --locations=\"::Manchester\" with all values set: ... --locations=\"US:NH:Manchester:03101:42.990605:-71.460989\" optionally, you can just pass the \"LATITUDE:LONGITUDE\": ... --locations=\"42.990605:-71.460989\" finally, you can also pass JSON string of dictionary on the command line as you would via JSON RPC ... --locations=\"{'country': 'US', 'state': 'NH'}\"",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "str",
|
||||
@@ -1303,6 +1215,54 @@
|
||||
"description": "website url",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "featured",
|
||||
"type": "list",
|
||||
"description": "claim_ids of featured content in channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_featured",
|
||||
"type": "bool",
|
||||
"description": "clear existing featured content (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "list",
|
||||
"description": "add content tags",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_tags",
|
||||
"type": "bool",
|
||||
"description": "clear existing tags (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "languages",
|
||||
"type": "list",
|
||||
"description": "languages used by the channel, using RFC 5646 format, eg: for English `--languages=en` for Spanish (Spain) `--languages=es-ES` for Spanish (Mexican) `--languages=es-MX` for Chinese (Simplified) `--languages=zh-Hans` for Chinese (Traditional) `--languages=zh-Hant`",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_languages",
|
||||
"type": "bool",
|
||||
"description": "clear existing languages (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "locations",
|
||||
"type": "list",
|
||||
"description": "locations of the channel, consisting of 2 letter `country` code and a `state`, `city` and a postal `code` along with a `latitude` and `longitude`. for JSON RPC: pass a dictionary with aforementioned attributes as keys, eg: ... \"locations\": [{'country': 'US', 'state': 'NH'}] ... for command line: pass a colon delimited list with values in the following order: \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\" making sure to include colon for blank values, for example to provide only the city: ... --locations=\"::Manchester\" with all values set: ... --locations=\"US:NH:Manchester:03101:42.990605:-71.460989\" optionally, you can just pass the \"LATITUDE:LONGITUDE\": ... --locations=\"42.990605:-71.460989\" finally, you can also pass JSON string of dictionary on the command line as you would via JSON RPC ... --locations=\"{'country': 'US', 'state': 'NH'}\"",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_locations",
|
||||
"type": "bool",
|
||||
"description": "clear existing locations (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "thumbnail_url",
|
||||
"type": "str",
|
||||
@@ -1338,16 +1298,22 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "replace",
|
||||
"type": "bool",
|
||||
"description": "instead of modifying specific values on the channel, this will clear all existing values and only save passed in values, useful for form submissions where all values are always set",
|
||||
"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": [
|
||||
{
|
||||
"title": "Update a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update 2f26f642e714ec67e851138f0292178a3aa1f689 --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002fd414cdb6ac39ab2ff51f325a6b37b18da888fc06d18bf07842caa54cca1da5a000000006a473044022048bd24536022270b96d6fef1d46b58faabc0a65e9dbe296ceb4b448fef6543aa02202cf267159e529942836004a2935ec74495997f44be6aa6d58a82facbb00889110121026d30bd565be6d0916684a2a51253f593d0911e45714bd568d0022c6f403e395dffffffff002dbabd1a651d63e75a4cb9bdf879a94cc946a7cc3624f39c03d6131f5daf7d000000006b483045022100efb11687e5823c07f4d2146ba96daae5108f1bca5ce7cc377cbcfee32e54b04702206cb8a8dc0fd0d83ffd7b95e9c5dc326a1ef56c2041c2b042d989a142d4a2ddbc01210393ebe46a164020f6842b0ea9643762f70b8b16e039c46a5b1fd73b027b225ac7ffffffff0200e1f50500000000a6b708406368616e6e656c1489f6a13a8a1792028f1351e867ec14e742f6262f4c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b420b4e6577204368616e6e656c6d6d76a9145bae7eafa7111f2dc29790c6f7d9908ae78038a788ac6ebeea0b000000001976a91409b9d728cf244ed13fc76d71556a3842352b324988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n3MX2rLSXYR5WSX72qfEUBiuPve8JuANi6\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"txid\": \"7daf5d1f13d6039cf32436cca746c94ca979f8bdb94c5ae7631d651abdba2d00\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mgQP1ChNgpcG9xVRBnysXCVvn5t5CfVbqX\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update 3f6710c07d83e45e0434983d62b6b29530794121 --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002be13d83c27342eba2dd5f7ec09b9b4fc86fa1885a3a269c26b174699e53185f8000000006b483045022100960ca95f03525474e75d2648171edf82471a91b687d6573953dd2f65af7d341502201ec36a31b49127f83d311bec01330cac8688db14e04395f36da6b651c149ccda01210356872df7d60c6022803123324524702308a57d453cd77de9a57185fc67d045aaffffffffb7a77fbd2a247970573a4f67f5760c124e22c8f96e1985edd218d8d2298437a3000000006b48304502210085d8e789ecc0533f12399c12eb22cf7e611090d3aa08d03b55ee9e965597740c022053492e3c5fd1812d35c6c1ddf99a7fed5c27d8bcb463e1175d161555391f74e40121034f42fe5f87754a38a9e4ff74c92641e5b7cce0cb1fac01f7b42ea3209ef5443cffffffff0200e1f50500000000a6b708406368616e6e656c142141793095b2b6623d9834045ee4837dc010673f4c6a00125a0a583056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46420b4e6577204368616e6e656c6d6d76a91491bb608a97377923f480cb50987ec466f97ae2e088ac6ebeea0b000000001976a9142152297b3b1a61303c5958bc1640c9c382e85d6688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n42UY87hnpSR9fbacE6WCJDc8cyfHVa4a1\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1557412290,\n \"txid\": \"a3378429d2d818d2ed85196ef9c8224e120c76f5674f3a577079242abd7fa7b7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": null,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"miZ926v6sAnfowtQ52L42Sy9JDe7xPKN7P\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1386,20 +1352,20 @@
|
||||
"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\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\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\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mosipdHy8aBXddSGF9PSpz6Zyg8NwgW8xz\",\n \"amount\": \"1.0\",\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"txid\": \"e45ea07c35cced0692dcff72b5414760f6d04b404692177ba08ca797ee44f41c\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mtoWk4QmGYMGsw89PJ8QKQuHQmaTTDPrUA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#3f6710c07d83e45e0434983d62b6b29530794121\",\n \"timestamp\": 1557412290,\n \"txid\": \"479bcfb28bd2715702256f746349e3fd28108b6edefa05036c9eefc33434622e\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "claim_search",
|
||||
"description": "Search for stream and channel claims on the blockchain.\n\nUse --channel_id=<channel_id> to list all stream claims in a channel.",
|
||||
"description": "Search for stream and channel claims on the blockchain.\n\nUse --channel_id=<channel_id> or --channel_name=<channel_name> to list all stream claims in a channel.",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "name",
|
||||
@@ -1431,6 +1397,12 @@
|
||||
"description": "limit search to specific channel claim id (returns stream claims)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_name",
|
||||
"type": "str",
|
||||
"description": "limit search to specific channel name (returns stream claims)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "winning",
|
||||
"type": "bool",
|
||||
@@ -1454,17 +1426,17 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Search for all claims in channel",
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"winning\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim search --channel_id=\"2f26f642e714ec67e851138f0292178a3aa1f689\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"winning\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"absolute_channel_position\": 0,\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_sequence\": -1,\n \"decoded_claim\": true,\n \"depth\": 1,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n }\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_pages\": 1\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"winning\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim search --channel_id=\"3f6710c07d83e45e0434983d62b6b29530794121\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"winning\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"absolute_channel_position\": 0,\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_sequence\": -1,\n \"confirmations\": 1,\n \"decoded_claim\": true,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n }\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_pages\": 1\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Search for claims matching a name",
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"winning\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim search --name=\"astream\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"winning\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_sequence\": -1,\n \"decoded_claim\": true,\n \"depth\": 1,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n }\n }\n ],\n \"page\": 1,\n \"page_size\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_sequence\": -1,\n \"confirmations\": 1,\n \"decoded_claim\": true,\n \"effective_amount\": \"1.0\",\n \"has_signature\": true,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"signature_is_valid\": true,\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"supports\": [],\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"valid_at_height\": 214,\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n }\n }\n ],\n \"page\": 1,\n \"page_size\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1611,9 +1583,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a file",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -1720,14 +1692,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\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"content_fee\": null,\n \"download_directory\": \"/tmp\",\n \"download_path\": \"/tmp/tmpijqc8tzz\",\n \"file_name\": \"tmpijqc8tzz\",\n \"key\": \"50f032917f91ddf1ebe187c01dabc1e0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6c9f97927167b99574c08f556a091bfc02257cb348459c86c01e91ea43565d2965425fb307f1e1b7a165d6ad47804463\",\n \"stream_name\": \"tmpijqc8tzz\",\n \"suggested_file_name\": \"tmpijqc8tzz\",\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"written_bytes\": null\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"d9cdd5362f8f8fb52e43b10e93484bbc41f8d6fc\",\n \"claim_name\": \"blank-image\",\n \"completed\": true,\n \"content_fee\": null,\n \"download_directory\": \"/tmp\",\n \"download_path\": \"/tmp/tmpdeso7k9u.png\",\n \"file_name\": \"tmpdeso7k9u.png\",\n \"key\": \"0e90d7f89bb65922ee135f3fcd45ad8f\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhWJWmX6KwDkgc9T3b6GrfE6Avfxh6icDv\",\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\": \"1556160370\",\n \"source\": {\n \"hash\": \"06003bbee8aece0543ed9d9cecc48be1d996cfeff9837a1aed1d961caeda82af\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpdeso7k9u.png\",\n \"sd_hash\": \"824b5010c15fa64a8c43fc626f4f6ab50b384f38daf9f32524ea2a3f531537b3bd3c9fb56992b7de95fc09de90d81934\",\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\": \"59c71f384f7b0037ce69bdb4abab383e810996c355f9520951bd44c16db9d8e2:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f8129298dcadbdb838cacd03b5040bbab8f6f2ef522360f36d9ecff10c0559d4ad317e64200669a477bd0c9098e508b123b624c4e50f624f0b8e8f7218754f1690ad5010a720a2006003bbee8aece0543ed9d9cecc48be1d996cfeff9837a1aed1d961caeda82af120f746d706465736f376b39752e706e6718632209696d6167652f706e673230824b5010c15fa64a8c43fc626f4f6ab50b384f38daf9f32524ea2a3f531537b3bd3c9fb56992b7de95fc09de90d81934120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728f2be84e6053222080112196f15d0b6b8a44ad63177f367f1d72b62675e86337b859e4351188087a70e520408051007420b426cLine 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\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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\": \"de672c28f2060f41575f08bd9aab2cb8\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"65b6982a8fddae13c12390608c58a18f1368bcb73f53b31990d4be093827f3f1945eec69b84f1ca2996a1f070a3cd7f3\",\n \"stream_name\": \"tmpfmcqxqr9\",\n \"suggested_file_name\": \"tmpfmcqxqr9\",\n \"timestamp\": 1557412291,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"written_bytes\": null\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"cce9db7375721826197b998d2425809892bbdc93\",\n \"claim_name\": \"blank-image\",\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\": \"532aced13a8b5f9c63d7e95879f3d251\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n3fKziJ6gTJXNMFD5uTT2SzsCm35BUqBMC\",\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\": \"1557412265\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp61vr1_8a.png\",\n \"sd_hash\": \"135a9740f563155af8fb9b2f31c7a942e6c955aca13b86caf6e879af966e850a5efb5401ff7b6b69f9e531d31bf4f081\",\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\": \"c8926a8c21f12e96ec7b625fe337a56a60be6ae95df71794e66ae5dd32c9f8d7:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673fe1cd9b2bb7577c6eec2b6b13aa37b7723c785934ba1598e25e4274d2d03dde331b6915f66ef5da0d8a288c4e5de567284a6ef557617f49467f83f77a33e4791a0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7036317672315f38612e706e6718632209696d6167652f706e673230135a9740f563155af8fb9b2f31c7a942e6c955aca13b86caf6e879af966e850a5efb5401ff7b6b69f9e531d31bf4f0Line truncated
|
||||
},
|
||||
{
|
||||
"title": "List files matching a parameter",
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"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\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"content_fee\": null,\n \"download_directory\": \"/tmp\",\n \"download_path\": \"/tmp/tmpijqc8tzz\",\n \"file_name\": \"tmpijqc8tzz\",\n \"key\": \"50f032917f91ddf1ebe187c01dabc1e0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"6c9f97927167b99574c08f556a091bfc02257cb348459c86c01e91ea43565d2965425fb307f1e1b7a165d6ad47804463\",\n \"stream_name\": \"tmpijqc8tzz\",\n \"suggested_file_name\": \"tmpijqc8tzz\",\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"written_bytes\": null\n }\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"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\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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\": \"de672c28f2060f41575f08bd9aab2cb8\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"65b6982a8fddae13c12390608c58a18f1368bcb73f53b31990d4be093827f3f1945eec69b84f1ca2996a1f070a3cd7f3\",\n \"stream_name\": \"tmpfmcqxqr9\",\n \"suggested_file_name\": \"tmpfmcqxqr9\",\n \"timestamp\": 1557412291,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"written_bytes\": null\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1844,10 +1816,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Save a file to the downloads directory",
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blobs_completed\": 0,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 1,\n \"channel_claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_name\": \"astream\",\n \"completed\": false,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmp9705fxu6\",\n \"download_path\": \"/tmp/tmp9705fxu6/tmpijqc8tzz\",\n \"file_name\": \"tmpijqc8tzz\",\n \"key\": \"50f032917f91ddf1ebe187c01dabc1e0\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"6c9f97927167b99574c08f556a091bfc02257cb348459c86c01e91ea43565d2965425fb307f1e1b7a165d6ad47804463\",\n \"stream_name\": \"tmpijqc8tzz\",\n \"suggested_file_name\": \"tmpijqc8tzz\",\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"written_bytes\": null\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\"}}).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\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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\": \"de672c28f2060f41575f08bd9aab2cb8\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"65b6982a8fddae13c12390608c58a18f1368bcb73f53b31990d4be093827f3f1945eec69b84f1ca2996a1f070a3cd7f3\",\n \"stream_name\": \"tmpfmcqxqr9\",\n \"suggested_file_name\": \"tmpfmcqxqr9\",\n \"timestamp\": 1557412291,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"written_bytes\": null\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1937,7 +1909,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 \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"comment_server\": \"http://comments.lbry.com:2903/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/tmp9705fxu6\",\n \"download_dir\": \"/tmp/tmp9705fxu6\",\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\": 8,\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\": 2.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 \"tcp_port\": 3333,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmp9705fxu6\"\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 \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"comment_server\": \"http://comments.lbry.com:2903/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/jack/.lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmppe9osroo\",\n \"download_dir\": \"/tmp/tmppe9osroo\",\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\": 8,\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\": 2.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 \"tcp_port\": 3333,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmppe9osroo\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1998,10 +1970,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a stream claim",
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon 34d175feca7258e7d7d3ba6f7f419d9aabfd35ff",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010a181ae6fa52d9c4b3ee69f7b3ec4b04ac7fdad713365362fc4da61ecdc1788e000000006a473044022049e571698777f69dd875198e3d0c40098822adc9bc5bf5847c4260172710359002205c20eac960ee445f320a0e67d753b5789cb609149300394d73cd355aacd203a8012103e0ee5cca0f1987a00919c3ed3dea8ab8fb43c8746bb4e2d2e981679198ae82bfffffffff0134b7f505000000001976a914279a237f4cb56453043e2013a47f3ed092f703f888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mj8MJH3EFKDHdFUwGj7wMQxdhYcZkNFGLV\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"txid\": \"bfdd87230f1592400e3d77f2eba4de0248676df5422c68acbace593419a06b3a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"bfdd87230f1592400e3d77f2eba4de0248676df5422c68acbace593419a06b3a\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon ed10be11aef6501957c61077a1a8d0ae2ee69a9a",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000016bfeb1c5a9f6ba9993982efcf6b3d263af20959caa96ca2f3e119cdb2a9bb5a9000000006b483045022100ce0d0e3c393ca028471d656bc8f0cf98128d6c4ac191b72d1729a8ad1d29fc6402201803d1e5f6b571786abc3ed99f69b44d7002d3fffb91ef188f4462511adf94da012103ee840c67b3bf07f9be296c33298dc25fa4cc10759079fe0b490030f5c0ed243bffffffff0134b7f505000000001976a914201e4da198f796d551193a574289f1a57b8ef8ef88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miSnDhW4U5DDhjvUpZkGqeVXWYbe37yaRS\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f6baccc6e166ffc59cb21ac6e6f3de44d817095c485881ece50e6bd7b0ca4180\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"f6baccc6e166ffc59cb21ac6e6f3de44d817095c485881ece50e6bd7b0ca4180\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2029,12 +2001,6 @@
|
||||
"description": "name of the content (can only consist of a-z A-Z 0-9 and -(dash))",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "allow_duplicate_name",
|
||||
"type": "bool",
|
||||
"description": "create new claim even if one already exists with given name. default: false.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "bid",
|
||||
"type": "decimal",
|
||||
@@ -2047,6 +2013,12 @@
|
||||
"description": "path to file to be associated with name.",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "allow_duplicate_name",
|
||||
"type": "bool",
|
||||
"description": "create new claim even if one already exists with given name. default: false.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "fee_currency",
|
||||
"type": "string",
|
||||
@@ -2149,6 +2121,12 @@
|
||||
"description": "claim id of the publisher channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_name",
|
||||
"type": "str",
|
||||
"description": "name of the publisher channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_account_id",
|
||||
"type": "str",
|
||||
@@ -2178,17 +2156,17 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Create a stream claim without metadata",
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpijqc8tzz\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpijqc8tzz",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpijqc8tzz\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001fd414cdb6ac39ab2ff51f325a6b37b18da888fc06d18bf07842caa54cca1da5a010000006a47304402203efe40a497095efb2a29e3befee6e8d49564ff9acc66a64591802c5d1f06d8e80220500f1551bc66c250cde7355f8da6d8a3d7aa5b8775d86d2e8650e088cc874bef0121024708927ebb6c0c41d0a8cd127b935d1f71a1a32a3d589429af2bf475770addafffffffff0200e1f50500000000a8b5076173747265616d4c82000a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff9966d7576a914daa8f107c07e0abfd538cbd3fa67b5c0de9ba6fe88ac38fb9423000000001976a914ff319080c42eb927ad7fbc1d713ab35ed81086d088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvgEirtKfdXjqykJsqU2uzzDaZqc3Tv9Ep\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"5adaa1cc54aa2c8407bf186dc08f88da187bb3a625f351ffb29ac36adb4c41fd\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"txid\": \"d63c442efa8ca321b858b184f1c453dd5a2e0cf0cec8152643ffccf0fd751851\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n4nHymd6aSD3LidEyibxacKgLeKR5QRrD7\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"d63c442efa8ca321b858b184f1c453dd5a2e0cf0cec8152643ffccf0fd751851\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"d63c442efa8ca321b858b184f1c453dd5a2e0cf0cec8152643ffccf0fd751851\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpfmcqxqr9\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpfmcqxqr9",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpfmcqxqr9\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001be13d83c27342eba2dd5f7ec09b9b4fc86fa1885a3a269c26b174699e53185f8010000006b4830450221009276471c41cb424518112603ca931b5555c48378966363a73425c746475c7b8b02207f1267c3b65260369b86a8a428764006888ca3b9e1f5be94d141697f5ac144070121034f42fe5f87754a38a9e4ff74c92641e5b7cce0cb1fac01f7b42ea3209ef5443cffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa6d7576a9143c2e372b4add56043ac276a706e1bb2750339e0188ac38fb9423000000001976a914799309e5d6680b2cc6cad9de3ff681c77ac5145b88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n42UY87hnpSR9fbacE6WCJDc8cyfHVa4a1\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412290,\n \"txid\": \"f88531e59946176bc269a2a38518fa86fcb4b909ecf7d52dba2e34273cd813be\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"timestamp\": null,\n \"txid\": \"ad78dfa585175ec1a1f97f051f809eecd47d18f7bc8bd6986146f5077cae3f8e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mrbnCh2Z3Tqo3JqW8YZefRLk8zv7P7fVvA\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"ad78dfa585175ec1a1f97f051f809eecd47d18f7bc8bd6986146f5077cae3f8e\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"ad78dfa585175ec1a1f97f051f809eecd47d18f7bc8bd6986146f5077cae3f8e\"\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/tmpdeso7k9u.png\", \"tags\": [\"blank\", \"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\": 1556160370, \"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpdeso7k9u.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=1556160370 --channel_id=\"2f26f642e714ec67e851138f0292178a3aa1f689\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpdeso7k9u.png\", \"tags\": [\"blank\", \"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\": 1556160370, \"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001511875fdf0ccff432615c8cef00c2e5add53c4f184b158b821a38cfa2e443cd6010000006a47304402206e3adaf0428a0b28c5a07d16f8a745174720d08258f2d9096f389694a45ed4d1022011389feffc9ebe51623bee15d400cf12dd501b9cd222b1bca61ca9073466c3670121032f75f32292ccdbb7dccd10aaf00118d3e41f212626b2e2c7afc36a2a1e31c8a3ffffffff0200e1f50500000000fdcb01b50b626c616e6b2d696d6167654da0010189f6a13a8a1792028f1351e867ec14e742f6262f8129298dcadbdb838cacd03b5040bbab8f6f2ef522360f36d9ecff10c0559d4ad317e64200669a477bd0c9098e508b123b624c4e50f624f0b8e8f7218754f1690ad5010a720a2006003bbee8aece0543ed9d9cecc48be1d996cfeff9837a1aed1d961caeda82af120f746d706465736f376b39752e706e6718632209696d6167652f706e673230824b5010c15fa64a8c43fc626f4f6ab50b384f38daf9f32524ea2a3f531537b3bd3c9fb56992b7de95fc09de90d81934120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728f2be84e6053222080112196f15d0b6b8a44ad63177f367f1d72b62675e86337b859e4351188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a91415d0b6b8a44ad63177f367f1d72b62675e86337b88acac5e7d1d000000001976a9146835e95366e018d61b965b5e16061038617299c388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4nHymd6aSD3LidEyibxacKgLeKR5QRrD7\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"d63c442efa8ca321b858b184f1c453dd5a2e0cf0cec8152643ffccf0fd751851\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhWJWmX6KwDkgc9T3b6GrfE6Avfxh6icDv\",\n \"amount\": \"1.0\",\n \"claim_id\": \"d9cdd5362f8f8fb52e43b10e93484bbc41f8d6fc\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#d9cdd5362f8f8fb52e43b10e93484bbc41f8d6fc\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"59c71f384f7b0037ce69bdb4abab383e810996c355f9520951bd44c16db9d8e2\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhWJWmX6KwDkgc9T3b6GrfE6Avfxh6icDv\",\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\": \"1556160370\",\n \"source\": {\n \"hash\": \"06003bbee8aece0543ed9d9cecc48be1d996cfeff9837a1aed1d961caeda82af\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpdeso7k9u.png\",\n \"sd_hash\": \"824b5010c15fa64a8c43fc626f4f6ab50b384f38daf9f32524ea2a3f531537b3bd3c9fb56992b7de95fc09de90d81934\",\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 \"value_type\": \"stream\"\n },\n {\n \"address\": \"mq1y9qSzp7FfZLvMmihfio7edYAp7YiKL6\",\n \"amount\": \"4.947555\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"59c71f384f7b0037ce69bdb4abab383e810996c355f9520951bd44c16db9d8e2\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"5.969662\",\n \"total_output\": \"5.947555\",\n \"txid\": \"59c71f384f7b0037ce69bdb4abab383e810996c355f9520951bd44c16db9d8e2\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp61vr1_8a.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\": 1557412265, \"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmp61vr1_8a.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=1557412265 --channel_id=\"3f6710c07d83e45e0434983d62b6b29530794121\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp61vr1_8a.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\": 1557412265, \"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000018e3fae7c07f5466198d68bbcf7187dd4ec9e801f057ff9a1c15e1785a5df78ad010000006b483045022100a4c76abe1d8d8108612e41c4aa16adb14cca338c5a9d9aaa05ae54a8ed5c72bb0220308cf38219d9f7e893a418a3b857c8c541e2178e74be666938cee245fe27e5640121024992dc4c1592aed07c4bf9f0a29df780e1c804d1a7e8b4d4532940bfd3a60721ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101012141793095b2b6623d9834045ee4837dc010673fe1cd9b2bb7577c6eec2b6b13aa37b7723c785934ba1598e25e4274d2d03dde331b6915f66ef5da0d8a288c4e5de567284a6ef557617f49467f83f77a33e4791a0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d7036317672315f38612e706e6718632209696d6167652f706e673230135a9740f563155af8fb9b2f31c7a942e6c955aca13b86caf6e879af966e850a5efb5401ff7b6b69f9e531d31bf4f081120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728a9f3d0e6053222080112196ff2e835c499324eba9344a2525e0ff67b8696acd823cc406b188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914f2e835c499324eba9344a2525e0ff67b8696acd888acac5e7d1d000000001976a91487ff28c16efc769df297e43ab5d6f7a51833e2ab88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mrbnCh2Z3Tqo3JqW8YZefRLk8zv7P7fVvA\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412291,\n \"txid\": \"ad78dfa585175ec1a1f97f051f809eecd47d18f7bc8bd6986146f5077cae3f8e\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3fKziJ6gTJXNMFD5uTT2SzsCm35BUqBMC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cce9db7375721826197b998d2425809892bbdc93\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#cce9db7375721826197b998d2425809892bbdc93\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": null,\n \"txid\": \"c8926a8c21f12e96ec7b625fe337a56a60be6ae95df71794e66ae5dd32c9f8d7\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n3fKziJ6gTJXNMFD5uTT2SzsCm35BUqBMC\",\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\": \"1557412265\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp61vr1_8a.png\",\n \"sd_hash\": \"135a9740f563155af8fb9b2f31c7a942e6c955aca13b86caf6e879af966e850a5efb5401ff7b6b69f9e531d31bf4f081\",\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 \"value_type\": \"stream\"\n },\n {\n \"address\": \"msv3BiuJ4RHWEbdYE665DaxxGQbmTjtPW2\",\n \"amount\": \"4.947555\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"c8926a8c21f12e96ec7b625fe337a56a60be6ae95df71794e66ae5dd32c9f8d7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"5.969662\",\n \"total_output\": \"5.947555\",\n \"txid\": \"c8926a8c21f12e96ec7b625fe337a56a60be6ae95df71794Line truncated
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2222,14 +2200,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\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\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\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\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 \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": 1557412291,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2291,6 +2269,12 @@
|
||||
"description": "address where to send fee payments, will use value from --claim_address if not provided",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_fee",
|
||||
"type": "bool",
|
||||
"description": "clear previously set fee",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "str",
|
||||
@@ -2309,12 +2293,6 @@
|
||||
"description": "author of the publication. The usage for this field is not the same as for channels. The author field is used to credit an author who is not the publisher and is not represented by the channel. For example, a pdf file of 'The Odyssey' has an author of 'Homer' but may by published to a channel such as '@classics', or to no channel at all",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_tags",
|
||||
"type": "bool",
|
||||
"description": "clear existing tags (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "list",
|
||||
@@ -2322,9 +2300,9 @@
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_languages",
|
||||
"name": "clear_tags",
|
||||
"type": "bool",
|
||||
"description": "clear existing languages (prior to adding new ones)",
|
||||
"description": "clear existing tags (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
@@ -2334,9 +2312,9 @@
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_locations",
|
||||
"name": "clear_languages",
|
||||
"type": "bool",
|
||||
"description": "clear existing locations (prior to adding new ones)",
|
||||
"description": "clear existing languages (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
@@ -2345,6 +2323,12 @@
|
||||
"description": "locations relevant to the stream, consisting of 2 letter `country` code and a `state`, `city` and a postal `code` along with a `latitude` and `longitude`. for JSON RPC: pass a dictionary with aforementioned attributes as keys, eg: ... \"locations\": [{'country': 'US', 'state': 'NH'}] ... for command line: pass a colon delimited list with values in the following order: \"COUNTRY:STATE:CITY:CODE:LATITUDE:LONGITUDE\" making sure to include colon for blank values, for example to provide only the city: ... --locations=\"::Manchester\" with all values set: ... --locations=\"US:NH:Manchester:03101:42.990605:-71.460989\" optionally, you can just pass the \"LATITUDE:LONGITUDE\": ... --locations=\"42.990605:-71.460989\" finally, you can also pass JSON string of dictionary on the command line as you would via JSON RPC ... --locations=\"{'country': 'US', 'state': 'NH'}\"",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_locations",
|
||||
"type": "bool",
|
||||
"description": "clear existing locations (prior to adding new ones)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "license",
|
||||
"type": "str",
|
||||
@@ -2393,6 +2377,12 @@
|
||||
"description": "claim id of the publisher channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_name",
|
||||
"type": "str",
|
||||
"description": "name of the publisher channel",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "clear_channel",
|
||||
"type": "bool",
|
||||
@@ -2422,16 +2412,22 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "replace",
|
||||
"type": "bool",
|
||||
"description": "instead of modifying specific values on the stream, this will clear all existing values and only save passed in values, useful for form submissions where all values are always set",
|
||||
"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": [
|
||||
{
|
||||
"title": "Update a stream claim to add channel",
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update 34d175feca7258e7d7d3ba6f7f419d9aabfd35ff --channel_id=\"2f26f642e714ec67e851138f0292178a3aa1f689\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\", \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002511875fdf0ccff432615c8cef00c2e5add53c4f184b158b821a38cfa2e443cd6000000006a473044022074fe6fca4311075a38b5ce6eb617dfca6710caafd8318364bba31d330f2bc73b02200869950181827b3e49559c18139e98e4ec68c7503a6e001d196fad6ee0c79d93012103e0ee5cca0f1987a00919c3ed3dea8ab8fb43c8746bb4e2d2e981679198ae82bfffffffff479dbf40a3afa03fa62696a040966ad5e97fe0d9c3fc15da07722fdad43a81a5010000006b483045022100808c86e510149bda373d0ca06dc7495796a6d913f117a257e9f6d10d20d663df02207e7b9333ed2347ef3706f96469bf1019427a9877fac003023069cbf0b7be74560121039a7b2cb896311c8daaef939ae24aac58b8ff294a8d583f6761b07269a9edfaf5ffffffff0200e1f50500000000fd1101b7076173747265616d14ff35fdab9a9d417f6fbad3d7e75872cafe75d1344cd60189f6a13a8a1792028f1351e867ec14e742f6262f885c6464a4d279e296cee4d7258da7ecf73a03759ee804bed23c68c6f0beeca0f36e0ce3961fc3eab94fdfca276326f5eb082df78be0a2803c02e5de891674790a7f0a7d0a20b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9120b746d70696a716338747a7a180b22186170706c69636174696f6e2f6f637465742d73747265616d32304daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff9966d6d76a914daa8f107c07e0abfd538cbd3fa67b5c0de9ba6fe88acb6a3d205000000001976a9141ef66c84015aef899071ce0b01c83eed261a763588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"txid\": \"d63c442efa8ca321b858b184f1c453dd5a2e0cf0cec8152643ffccf0fd751851\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"msWRvjBEstA5sdWiwFiTNFpU8T8h4DZvMg\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"txid\": \"a5813ad4da2f7207da15fcc3d9e07fe9d56a9640a09626a63fa0afa340bf9d47\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1T7z8qddRM3573H4xkLze9xL2kNYa1DQs\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#34d175feca7258e7d7d3ba6f7f419d9aabfd35ff\",\n \"signing_channel\": {\n \"claim_id\": \"2f26f642e714ec67e851138f0292178a3aa1f689\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004c398b273c2e197f2b18836aa41550767d64ec473d507125a903c7f99dc59ca8e08d43515d73b8f03fb66ec5b5f7305f23ca9bce72cb250dccdf97207329b3e5b\",\n \"title\": \"New Channel\"\n }\n },\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpijqc8tzz\",\n \"sd_hash\": \"4daf03c3bf49d66b2067cc00ef80902a0e8b4d101382a9008c1401e3ee9f98c34e0dd3bebe198492648fb8ec86aff996\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"miLfme8Kcesj3rRDb4ChytWyUg7AZXGR1V\",\n \"amount\": \"0.9769055\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000323\",\n \"total_input\": \"1.9772285\",\n \"total_output\": \"1.9769055\",\n \"txid\": \"8e78c1cd1ea64dfc62533613d7da7fac044becb3f769eeb3c4d952fae61a180a\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update ed10be11aef6501957c61077a1a8d0ae2ee69a9a --channel_id=\"3f6710c07d83e45e0434983d62b6b29530794121\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000028e3fae7c07f5466198d68bbcf7187dd4ec9e801f057ff9a1c15e1785a5df78ad000000006a47304402202023c676b2bd9e303bf9857f94c45beb55b68ed42409b3fd257d94f6f25d2ec00220452a9064f2908deec9e8060babf128dff66188a78e92ae6237f9fee0e2f431ac012103ee840c67b3bf07f9be296c33298dc25fa4cc10759079fe0b490030f5c0ed243bffffffff720ab9795f585e15ad8327f5c192bb32acbdc77f5143de1f5b27def9ee0add6a010000006a473044022073e4f0819fa1338bc63f19810741500734fcf4f8b527b907963adaae769a4f7d02204e34e00e71c83c9a46a67ca340512ec41ec90266c0383af5c1dbd9896b7b87ab012103d581ddc113506f32d8b215d97316f3df4559ff4b161fdfbecf29ebcc689a3827ffffffff0200e1f50500000000fd2301b7076173747265616d149a9ae62eaed0a8a17710c6571950f6ae11be10ed4ce8012141793095b2b6623d9834045ee4837dc010673f69741f82a15c92d092bc923e9d31c39d8367e5b29c9159efa878c5a4556fc742cde21b4046ca582e62c72b134fbb4fc78ec968cf172bf646f0da28f9ea5778a80a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70666d637178717239180b22186170706c69636174696f6e2f6f637465742d73747265616d3230564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa6d6d76a9143c2e372b4add56043ac276a706e1bb2750339e0188ac32a0d205000000001976a91460dbfd055c18945c66046497c015fb7d9f95b98788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"timestamp\": 1557412291,\n \"txid\": \"ad78dfa585175ec1a1f97f051f809eecd47d18f7bc8bd6986146f5077cae3f8e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mv6ygcdKPPGwnT1QvJWdE8SUjuaGUH2G4n\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1557412290,\n \"txid\": \"6add0aeef9de275b1fde43517fc7bdac32bb92c1f52783ad155e585f79b90a72\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mm1ACg1WdL9cunAY9q9kuDSokVPMWEMTB3\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#ed10be11aef6501957c61077a1a8d0ae2ee69a9a\",\n \"signing_channel\": {\n \"claim_id\": \"3f6710c07d83e45e0434983d62b6b29530794121\",\n \"name\": \"@channel\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000445e2d150380e5ac43f5bd01da23ab1f2900bee84671d223a8d30065d80d1ddba9d1d6424d171d34328d34135ba1eadc7d7dbfe603d6f15d0d484b45958361d46\",\n \"title\": \"New Channel\"\n }\n },\n \"timestamp\": null,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpfmcqxqr9\",\n \"sd_hash\": \"564fb55561e9f6c0b2ecd932fc784573124f33e81ddd72579c48e2a27360c5f64d243330c40842617bc9a7d29963e4aa\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpM6hXeP4zjRPrLeHh26dxdngnvS7AfceT\",\n \"amount\": \"0.9768965\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"a9b59b2adb9c113e2fca96aa9c9520af63d2b3f6fc2e989399baf6a9c5b1fe6b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000332\",\n \"total_input\": \"1.9772285\",\n \"total_output\": \"1.9768965\",\n \"txid\": \"a9b59bLine truncated
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2627,7 +2623,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-04-24 22:46\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1556160394,\n \"txid\": \"7245c1296b172040fc5fbc5a369eba3af5896658b9b090a47605cb732f0320c6\",\n \"update_info\": [],\n \"value\": \"-2.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-04-24 22:46\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1556160393,\n \"txid\": \"c2eb133f1005e40a030cbffc9fa297b26119ab6aa2e440755f34e4559477e5fc\",\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-05-09 10:31\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1557412290,\n \"txid\": \"96f08b9501099985f2bf805281076aa4a41760d2ddf1396ed8e38f789b0e49ea\",\n \"update_info\": [],\n \"value\": \"-2.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-05-09 10:31\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1557412289,\n \"txid\": \"953139e316bf7ce7d4d93b9418d64e801b7e35b41f4feb1c94be296b0c636fb0\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
__name__ = "lbrynet"
|
||||
__version__ = "0.37.0rc2"
|
||||
__version__ = "0.37.0rc6"
|
||||
version = tuple(__version__.split('.'))
|
||||
|
||||
@@ -201,7 +201,7 @@ class AbstractBlob:
|
||||
|
||||
def get_blob_writer(self, peer_address: typing.Optional[str] = None,
|
||||
peer_port: typing.Optional[int] = None) -> HashBlobWriter:
|
||||
if (peer_address, peer_port) in self.writers:
|
||||
if (peer_address, peer_port) in self.writers and not self.writers[(peer_address, peer_port)].closed():
|
||||
raise OSError(f"attempted to download blob twice from {peer_address}:{peer_port}")
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
writer = HashBlobWriter(self.blob_hash, self.get_length, fut)
|
||||
|
||||
@@ -2,6 +2,13 @@ import typing
|
||||
|
||||
|
||||
class BlobInfo:
|
||||
__slots__ = [
|
||||
'blob_hash',
|
||||
'blob_num',
|
||||
'length',
|
||||
'iv',
|
||||
]
|
||||
|
||||
def __init__(self, blob_num: int, length: int, iv: str, blob_hash: typing.Optional[str] = None):
|
||||
self.blob_hash = blob_hash
|
||||
self.blob_num = blob_num
|
||||
|
||||
@@ -4,6 +4,7 @@ import typing
|
||||
import binascii
|
||||
from lbrynet.error import InvalidBlobHashError, InvalidDataError
|
||||
from lbrynet.blob_exchange.serialization import BlobResponse, BlobRequest
|
||||
from lbrynet.utils import cache_concurrent
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbrynet.blob.blob_file import AbstractBlob
|
||||
from lbrynet.blob.writer import HashBlobWriter
|
||||
@@ -23,9 +24,12 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.blob: typing.Optional['AbstractBlob'] = None
|
||||
|
||||
self._blob_bytes_received = 0
|
||||
self._response_fut: asyncio.Future = None
|
||||
self._response_fut: typing.Optional[asyncio.Future] = None
|
||||
self.buf = b''
|
||||
|
||||
# this is here to handle the race when the downloader is closed right as response_fut gets a result
|
||||
self.closed = asyncio.Event(loop=self.loop)
|
||||
|
||||
def data_received(self, data: bytes):
|
||||
log.debug("%s:%d -- got %s bytes -- %s bytes on buffer -- %s blob bytes received",
|
||||
self.peer_address, self.peer_port, len(data), len(self.buf), self._blob_bytes_received)
|
||||
@@ -35,6 +39,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
if self._response_fut and not self._response_fut.done():
|
||||
self._response_fut.cancel()
|
||||
return
|
||||
if not self._response_fut:
|
||||
log.warning("Protocol received data before expected, probable race on keep alive. Closing transport.")
|
||||
return self.close()
|
||||
if self._blob_bytes_received and not self.writer.closed():
|
||||
return self._write(data)
|
||||
|
||||
@@ -86,6 +93,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
:return: download success (bool), keep connection (bool)
|
||||
"""
|
||||
request = BlobRequest.make_request_for_blob_hash(self.blob.blob_hash)
|
||||
blob_hash = self.blob.blob_hash
|
||||
try:
|
||||
msg = request.serialize()
|
||||
log.debug("send request to %s:%i -> %s", self.peer_address, self.peer_port, msg.decode())
|
||||
@@ -94,6 +102,10 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
availability_response = response.get_availability_response()
|
||||
price_response = response.get_price_response()
|
||||
blob_response = response.get_blob_response()
|
||||
if self.closed.is_set():
|
||||
msg = f"cancelled blob request for {blob_hash} immediately after we got a response"
|
||||
log.warning(msg)
|
||||
raise asyncio.CancelledError(msg)
|
||||
if (not blob_response or blob_response.error) and\
|
||||
(not availability_response or not availability_response.available_blobs):
|
||||
log.warning("%s not in availability response from %s:%i", self.blob.blob_hash, self.peer_address,
|
||||
@@ -132,6 +144,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
return self._blob_bytes_received, self.close()
|
||||
|
||||
def close(self):
|
||||
self.closed.set()
|
||||
if self._response_fut and not self._response_fut.done():
|
||||
self._response_fut.cancel()
|
||||
if self.writer and not self.writer.closed():
|
||||
@@ -145,6 +158,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.buf = b''
|
||||
|
||||
async def download_blob(self, blob: 'AbstractBlob') -> typing.Tuple[int, typing.Optional[asyncio.Transport]]:
|
||||
self.closed.clear()
|
||||
blob_hash = blob.blob_hash
|
||||
if blob.get_is_verified() or not blob.is_writeable():
|
||||
return 0, self.transport
|
||||
@@ -155,8 +169,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
return await self._download_blob()
|
||||
except OSError as e:
|
||||
# i'm not sure how to fix this race condition - jack
|
||||
log.exception("race happened downloading %s from %s:%i", blob_hash, self.peer_address, self.peer_port)
|
||||
return self._blob_bytes_received, self.transport
|
||||
log.warning("race happened downloading %s from %s:%i", blob_hash, self.peer_address, self.peer_port)
|
||||
# return self._blob_bytes_received, self.transport
|
||||
raise
|
||||
except asyncio.TimeoutError:
|
||||
if self._response_fut and not self._response_fut.done():
|
||||
self._response_fut.cancel()
|
||||
@@ -165,6 +180,10 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
except asyncio.CancelledError:
|
||||
self.close()
|
||||
raise
|
||||
finally:
|
||||
if self.writer and not self.writer.closed():
|
||||
self.writer.close_handle()
|
||||
self.writer = None
|
||||
|
||||
def connection_made(self, transport: asyncio.Transport):
|
||||
self.transport = transport
|
||||
@@ -177,9 +196,10 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.close()
|
||||
|
||||
|
||||
@cache_concurrent
|
||||
async def request_blob(loop: asyncio.BaseEventLoop, blob: 'AbstractBlob', address: str, tcp_port: int,
|
||||
peer_connect_timeout: float, blob_download_timeout: float,
|
||||
connected_transport: asyncio.Transport = None)\
|
||||
connected_transport: asyncio.Transport = None, connection_id: int = 0)\
|
||||
-> typing.Tuple[int, typing.Optional[asyncio.Transport]]:
|
||||
"""
|
||||
Returns [<downloaded blob>, <keep connection>]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import asyncio
|
||||
import typing
|
||||
import logging
|
||||
from lbrynet.utils import drain_tasks, cache_concurrent
|
||||
from lbrynet.utils import cache_concurrent
|
||||
from lbrynet.blob_exchange.client import request_blob
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbrynet.conf import Config
|
||||
@@ -14,7 +14,8 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BlobDownloader:
|
||||
BAN_TIME = 10.0 # fixme: when connection manager gets implemented, move it out from here
|
||||
BAN_FACTOR = 2.0 # fixme: when connection manager gets implemented, move it out from here
|
||||
BAN_CAP = 30.0*60.0 # maximum time a node remains banned before being retried
|
||||
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
peer_queue: asyncio.Queue):
|
||||
@@ -25,21 +26,16 @@ class BlobDownloader:
|
||||
self.active_connections: typing.Dict['KademliaPeer', asyncio.Task] = {} # active request_blob calls
|
||||
self.ignored: typing.Dict['KademliaPeer', int] = {}
|
||||
self.scores: typing.Dict['KademliaPeer', int] = {}
|
||||
self.failures: typing.Dict['KademliaPeer', int] = {}
|
||||
self.connections: typing.Dict['KademliaPeer', asyncio.Transport] = {}
|
||||
self.time_since_last_blob = loop.time()
|
||||
self.is_running = asyncio.Event(loop=self.loop)
|
||||
|
||||
def should_race_continue(self, blob: 'AbstractBlob'):
|
||||
if len(self.active_connections) >= self.config.max_connections_per_download:
|
||||
return False
|
||||
# if a peer won 3 or more blob races and is active as a downloader, stop the race so bandwidth improves
|
||||
# the safe net side is that any failure will reset the peer score, triggering the race back
|
||||
# TODO: this is a good idea for low bandwidth, but doesnt play nice on high bandwidth
|
||||
# for peer, task in self.active_connections.items():
|
||||
# if self.scores.get(peer, 0) >= 0 and self.rounds_won.get(peer, 0) >= 3 and not task.done():
|
||||
# return False
|
||||
return not (blob.get_is_verified() or not blob.is_writeable())
|
||||
|
||||
async def request_blob_from_peer(self, blob: 'AbstractBlob', peer: 'KademliaPeer'):
|
||||
async def request_blob_from_peer(self, blob: 'AbstractBlob', peer: 'KademliaPeer', connection_id: int = 0):
|
||||
if blob.get_is_verified():
|
||||
return
|
||||
self.scores[peer] = self.scores.get(peer, 0) - 1 # starts losing score, to account for cancelled ones
|
||||
@@ -47,98 +43,74 @@ class BlobDownloader:
|
||||
start = self.loop.time()
|
||||
bytes_received, transport = await request_blob(
|
||||
self.loop, blob, peer.address, peer.tcp_port, self.config.peer_connect_timeout,
|
||||
self.config.blob_download_timeout, connected_transport=transport
|
||||
self.config.blob_download_timeout, connected_transport=transport, connection_id=connection_id
|
||||
)
|
||||
if bytes_received == blob.get_length():
|
||||
self.time_since_last_blob = self.loop.time()
|
||||
if not transport and peer not in self.ignored:
|
||||
self.ignored[peer] = self.loop.time()
|
||||
log.debug("drop peer %s:%i", peer.address, peer.tcp_port)
|
||||
self.failures[peer] = self.failures.get(peer, 0) + 1
|
||||
if peer in self.connections:
|
||||
del self.connections[peer]
|
||||
elif transport:
|
||||
log.debug("keep peer %s:%i", peer.address, peer.tcp_port)
|
||||
self.failures[peer] = 0
|
||||
self.connections[peer] = transport
|
||||
rough_speed = (bytes_received / (self.loop.time() - start)) if bytes_received else 0
|
||||
self.scores[peer] = rough_speed
|
||||
elapsed = self.loop.time() - start
|
||||
self.scores[peer] = bytes_received / elapsed if bytes_received and elapsed else 0
|
||||
|
||||
async def new_peer_or_finished(self, blob: 'AbstractBlob'):
|
||||
async def get_and_re_add_peers():
|
||||
try:
|
||||
new_peers = await asyncio.wait_for(self.peer_queue.get(), timeout=1.0)
|
||||
self.peer_queue.put_nowait(new_peers)
|
||||
except asyncio.TimeoutError:
|
||||
pass
|
||||
tasks = [self.loop.create_task(get_and_re_add_peers()), self.loop.create_task(blob.verified.wait())]
|
||||
active_tasks = list(self.active_connections.values())
|
||||
try:
|
||||
await asyncio.wait(tasks + active_tasks, loop=self.loop, return_when='FIRST_COMPLETED')
|
||||
finally:
|
||||
drain_tasks(tasks)
|
||||
async def new_peer_or_finished(self):
|
||||
active_tasks = list(self.active_connections.values()) + [asyncio.sleep(1)]
|
||||
await asyncio.wait(active_tasks, loop=self.loop, return_when='FIRST_COMPLETED')
|
||||
|
||||
def cleanup_active(self):
|
||||
to_remove = [peer for (peer, task) in self.active_connections.items() if task.done()]
|
||||
for peer in to_remove:
|
||||
del self.active_connections[peer]
|
||||
self.clearbanned()
|
||||
|
||||
def clearbanned(self):
|
||||
now = self.loop.time()
|
||||
if now - self.time_since_last_blob > 60.0:
|
||||
return
|
||||
forgiven = [banned_peer for banned_peer, when in self.ignored.items() if now - when > self.BAN_TIME]
|
||||
self.peer_queue.put_nowait(forgiven)
|
||||
for banned_peer in forgiven:
|
||||
self.ignored.pop(banned_peer)
|
||||
self.ignored = dict((
|
||||
(peer, when) for (peer, when) in self.ignored.items()
|
||||
if (now - when) < min(self.BAN_CAP, (self.failures.get(peer, 0) ** self.BAN_FACTOR))
|
||||
))
|
||||
|
||||
@cache_concurrent
|
||||
async def download_blob(self, blob_hash: str, length: typing.Optional[int] = None) -> 'AbstractBlob':
|
||||
async def download_blob(self, blob_hash: str, length: typing.Optional[int] = None,
|
||||
connection_id: int = 0) -> 'AbstractBlob':
|
||||
blob = self.blob_manager.get_blob(blob_hash, length)
|
||||
if blob.get_is_verified():
|
||||
return blob
|
||||
self.is_running.set()
|
||||
try:
|
||||
while not blob.get_is_verified():
|
||||
batch: typing.List['KademliaPeer'] = []
|
||||
while not blob.get_is_verified() and self.is_running.is_set():
|
||||
batch: typing.Set['KademliaPeer'] = set()
|
||||
while not self.peer_queue.empty():
|
||||
batch.extend(self.peer_queue.get_nowait())
|
||||
batch.sort(key=lambda p: self.scores.get(p, 0), reverse=True)
|
||||
batch.update(self.peer_queue.get_nowait())
|
||||
if batch:
|
||||
self.peer_queue.put_nowait(list(batch))
|
||||
log.debug(
|
||||
"running, %d peers, %d ignored, %d active",
|
||||
len(batch), len(self.ignored), len(self.active_connections)
|
||||
)
|
||||
for peer in batch:
|
||||
for peer in sorted(batch, key=lambda peer: self.scores.get(peer, 0), reverse=True):
|
||||
if not self.should_race_continue(blob):
|
||||
break
|
||||
if peer not in self.active_connections and peer not in self.ignored:
|
||||
log.debug("request %s from %s:%i", blob_hash[:8], peer.address, peer.tcp_port)
|
||||
t = self.loop.create_task(self.request_blob_from_peer(blob, peer))
|
||||
t = self.loop.create_task(self.request_blob_from_peer(blob, peer, connection_id))
|
||||
self.active_connections[peer] = t
|
||||
await self.new_peer_or_finished(blob)
|
||||
await self.new_peer_or_finished()
|
||||
self.cleanup_active()
|
||||
if batch:
|
||||
to_re_add = list(set(batch).difference(self.ignored))
|
||||
if to_re_add:
|
||||
self.peer_queue.put_nowait(to_re_add)
|
||||
else:
|
||||
self.clearbanned()
|
||||
else:
|
||||
self.clearbanned()
|
||||
blob.close()
|
||||
log.debug("downloaded %s", blob_hash[:8])
|
||||
return blob
|
||||
finally:
|
||||
re_add = set()
|
||||
while self.active_connections:
|
||||
peer, t = self.active_connections.popitem()
|
||||
t.cancel()
|
||||
re_add.add(peer)
|
||||
re_add = re_add.difference(self.ignored)
|
||||
if re_add:
|
||||
self.peer_queue.put_nowait(list(re_add))
|
||||
blob.close()
|
||||
|
||||
def close(self):
|
||||
self.scores.clear()
|
||||
self.ignored.clear()
|
||||
self.is_running.clear()
|
||||
for transport in self.connections.values():
|
||||
transport.close()
|
||||
|
||||
|
||||
+2
-2
@@ -480,7 +480,7 @@ class Config(CLIConfig):
|
||||
# protocol timeouts
|
||||
download_timeout = Float("Cumulative timeout for a stream to begin downloading before giving up", 30.0)
|
||||
blob_download_timeout = Float("Timeout to download a blob from a peer", 30.0)
|
||||
peer_connect_timeout = Float("Timeout to establish a TCP connection to a peer", 2.0)
|
||||
peer_connect_timeout = Float("Timeout to establish a TCP connection to a peer", 3.0)
|
||||
node_rpc_timeout = Float("Timeout when making a DHT request", constants.rpc_timeout)
|
||||
|
||||
# blob announcement and download
|
||||
@@ -495,7 +495,7 @@ class Config(CLIConfig):
|
||||
previous_names=['concurrent_announcers']
|
||||
)
|
||||
max_connections_per_download = Integer(
|
||||
"Maximum number of peers to connect to while downloading a blob", 8,
|
||||
"Maximum number of peers to connect to while downloading a blob", 4,
|
||||
previous_names=['max_connections_per_stream']
|
||||
)
|
||||
fixed_peer_delay = Float(
|
||||
|
||||
@@ -13,55 +13,44 @@ class BlobAnnouncer:
|
||||
self.loop = loop
|
||||
self.node = node
|
||||
self.storage = storage
|
||||
self.pending_call: asyncio.Handle = None
|
||||
self.announce_task: asyncio.Task = None
|
||||
self.running = False
|
||||
self.announce_queue: typing.List[str] = []
|
||||
|
||||
async def _announce(self, batch_size: typing.Optional[int] = 10):
|
||||
if not batch_size:
|
||||
return
|
||||
if not self.node.joined.is_set():
|
||||
await self.node.joined.wait()
|
||||
blob_hashes = await self.storage.get_blobs_to_announce()
|
||||
if blob_hashes:
|
||||
self.announce_queue.extend(blob_hashes)
|
||||
log.info("%i blobs to announce", len(blob_hashes))
|
||||
batch = []
|
||||
while len(self.announce_queue):
|
||||
cnt = 0
|
||||
announced = []
|
||||
while self.announce_queue and cnt < batch_size:
|
||||
blob_hash = self.announce_queue.pop()
|
||||
announced.append(blob_hash)
|
||||
batch.append(self.node.announce_blob(blob_hash))
|
||||
cnt += 1
|
||||
to_await = []
|
||||
while batch:
|
||||
to_await.append(batch.pop())
|
||||
if to_await:
|
||||
await asyncio.gather(*tuple(to_await), loop=self.loop)
|
||||
await self.storage.update_last_announced_blobs(announced)
|
||||
log.info("announced %i blobs", len(announced))
|
||||
if self.running:
|
||||
self.pending_call = self.loop.call_later(60, self.announce, batch_size)
|
||||
async def _submit_announcement(self, blob_hash):
|
||||
try:
|
||||
peers = len(await self.node.announce_blob(blob_hash))
|
||||
if peers > 4:
|
||||
return blob_hash
|
||||
else:
|
||||
log.warning("failed to announce %s, could only find %d peers, retrying soon.", blob_hash[:8], peers)
|
||||
except Exception as err:
|
||||
if isinstance(err, asyncio.CancelledError):
|
||||
raise err
|
||||
log.warning("error announcing %s: %s", blob_hash[:8], str(err))
|
||||
|
||||
def announce(self, batch_size: typing.Optional[int] = 10):
|
||||
self.announce_task = self.loop.create_task(self._announce(batch_size))
|
||||
|
||||
async def _announce(self, batch_size: typing.Optional[int] = 10):
|
||||
while batch_size:
|
||||
if not self.node.joined.is_set():
|
||||
await self.node.joined.wait()
|
||||
self.announce_queue.extend(await self.storage.get_blobs_to_announce())
|
||||
log.debug("announcer task wake up, %d blobs to announce", len(self.announce_queue))
|
||||
while len(self.announce_queue):
|
||||
log.info("%i blobs to announce", len(self.announce_queue))
|
||||
announced = await asyncio.gather(*[
|
||||
self._submit_announcement(
|
||||
self.announce_queue.pop()) for _ in range(batch_size) if self.announce_queue
|
||||
], loop=self.loop)
|
||||
announced = list(filter(None, announced))
|
||||
if announced:
|
||||
await self.storage.update_last_announced_blobs(announced)
|
||||
log.info("announced %i blobs", len(announced))
|
||||
await asyncio.sleep(60)
|
||||
|
||||
def start(self, batch_size: typing.Optional[int] = 10):
|
||||
if self.running:
|
||||
raise Exception("already running")
|
||||
self.running = True
|
||||
self.announce(batch_size)
|
||||
assert not self.announce_task or self.announce_task.done(), "already running"
|
||||
self.announce_task = self.loop.create_task(self._announce(batch_size))
|
||||
|
||||
def stop(self):
|
||||
self.running = False
|
||||
if self.pending_call:
|
||||
if not self.pending_call.cancelled():
|
||||
self.pending_call.cancel()
|
||||
self.pending_call = None
|
||||
if self.announce_task:
|
||||
if not (self.announce_task.done() or self.announce_task.cancelled()):
|
||||
self.announce_task.cancel()
|
||||
self.announce_task = None
|
||||
if self.announce_task and not self.announce_task.done():
|
||||
self.announce_task.cancel()
|
||||
@@ -201,7 +201,6 @@ class Node:
|
||||
try:
|
||||
async with peer_generator as junction:
|
||||
yield junction
|
||||
await peer_generator.finished.wait()
|
||||
finally:
|
||||
if add_hashes_task and not (add_hashes_task.done() or add_hashes_task.cancelled()):
|
||||
add_hashes_task.cancel()
|
||||
|
||||
@@ -135,6 +135,15 @@ class PeerManager:
|
||||
|
||||
|
||||
class KademliaPeer:
|
||||
__slots__ = [
|
||||
'loop',
|
||||
'_node_id',
|
||||
'address',
|
||||
'udp_port',
|
||||
'tcp_port',
|
||||
'protocol_version',
|
||||
]
|
||||
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, 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:
|
||||
|
||||
@@ -26,12 +26,11 @@ class AsyncGeneratorJunction:
|
||||
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, queue: typing.Optional[asyncio.Queue] = None):
|
||||
self.loop = loop
|
||||
self.__iterator_queue = asyncio.Queue(loop=loop)
|
||||
self.result_queue = queue or asyncio.Queue(loop=loop)
|
||||
self.tasks: typing.List[asyncio.Task] = []
|
||||
self.running_iterators: typing.Dict[typing.AsyncGenerator, bool] = {}
|
||||
self.generator_queue: asyncio.Queue = asyncio.Queue(loop=self.loop)
|
||||
self.can_iterate = asyncio.Event(loop=self.loop)
|
||||
self.finished = asyncio.Event(loop=self.loop)
|
||||
|
||||
@property
|
||||
def running(self):
|
||||
@@ -42,15 +41,16 @@ class AsyncGeneratorJunction:
|
||||
try:
|
||||
async for item in iterator:
|
||||
self.result_queue.put_nowait(item)
|
||||
self.__iterator_queue.put_nowait(item)
|
||||
finally:
|
||||
self.running_iterators[iterator] = False
|
||||
if not self.running:
|
||||
self.__iterator_queue.put_nowait(StopAsyncIteration)
|
||||
|
||||
while True:
|
||||
async_gen: typing.Union[typing.AsyncGenerator, 'AsyncGeneratorType'] = await self.generator_queue.get()
|
||||
self.running_iterators[async_gen] = True
|
||||
self.tasks.append(self.loop.create_task(iterate(async_gen)))
|
||||
if not self.can_iterate.is_set():
|
||||
self.can_iterate.set()
|
||||
|
||||
def add_generator(self, async_gen: typing.Union[typing.AsyncGenerator, 'AsyncGeneratorType']):
|
||||
"""
|
||||
@@ -62,14 +62,10 @@ class AsyncGeneratorJunction:
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
if not self.can_iterate.is_set():
|
||||
await self.can_iterate.wait()
|
||||
if not self.running:
|
||||
raise StopAsyncIteration()
|
||||
try:
|
||||
return await self.result_queue.get()
|
||||
finally:
|
||||
self.awaiting = None
|
||||
result = await self.__iterator_queue.get()
|
||||
if result is StopAsyncIteration:
|
||||
raise result
|
||||
return result
|
||||
|
||||
def aclose(self):
|
||||
async def _aclose():
|
||||
@@ -80,8 +76,6 @@ class AsyncGeneratorJunction:
|
||||
self.running_iterators[iterator] = False
|
||||
drain_tasks(self.tasks)
|
||||
raise StopAsyncIteration()
|
||||
if not self.finished.is_set():
|
||||
self.finished.set()
|
||||
return self.loop.create_task(_aclose())
|
||||
|
||||
async def __aenter__(self):
|
||||
|
||||
@@ -169,7 +169,9 @@ class IterativeFinder:
|
||||
log.warning(str(err))
|
||||
self.active.discard(peer)
|
||||
return
|
||||
except (RemoteException, TransportNotConnected):
|
||||
except TransportNotConnected:
|
||||
return self.aclose()
|
||||
except RemoteException:
|
||||
return
|
||||
return await self._handle_probe_result(peer, response)
|
||||
|
||||
|
||||
@@ -35,10 +35,7 @@ async def execute_command(conf, method, params, callback=display):
|
||||
if 'result' in data:
|
||||
return callback(data['result'])
|
||||
elif 'error' in data:
|
||||
if 'message' in data['error']:
|
||||
return callback(data['error']['message'])
|
||||
else:
|
||||
return callback(data['error'])
|
||||
return callback(data['error'])
|
||||
except Exception as e:
|
||||
log.exception('Could not process response from server:', exc_info=e)
|
||||
except aiohttp.ClientConnectionError:
|
||||
|
||||
@@ -63,7 +63,7 @@ class DatabaseComponent(Component):
|
||||
|
||||
@staticmethod
|
||||
def get_current_db_revision():
|
||||
return 9
|
||||
return 11
|
||||
|
||||
@property
|
||||
def revision_filename(self):
|
||||
|
||||
+156
-151
@@ -18,7 +18,7 @@ from torba.client.baseaccount import SingleKey, HierarchicalDeterministic
|
||||
|
||||
from lbrynet import utils
|
||||
from lbrynet.conf import Config, Setting
|
||||
from lbrynet.blob.blob_file import is_valid_blobhash
|
||||
from lbrynet.blob.blob_file import is_valid_blobhash, BlobBuffer
|
||||
from lbrynet.blob_exchange.downloader import download_blob
|
||||
from lbrynet.error import DownloadSDTimeout, ComponentsNotStarted
|
||||
from lbrynet.error import NullFundsError, NegativeFundsError, ComponentStartConditionNotMet
|
||||
@@ -199,7 +199,7 @@ class JSONRPCError:
|
||||
self.data = {} if data is None else data
|
||||
self.traceback = []
|
||||
if traceback is not None:
|
||||
trace_lines = traceback.split("\n")
|
||||
self.traceback = trace_lines = traceback.split("\n")
|
||||
for i, t in enumerate(trace_lines):
|
||||
if "--- <exception caught here> ---" in t:
|
||||
if len(trace_lines) > i + 1:
|
||||
@@ -310,7 +310,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
@classmethod
|
||||
def get_api_definitions(cls):
|
||||
prefix = 'jsonrpc_'
|
||||
not_grouped = ['block_show', 'report_bug', 'routing_table_get']
|
||||
not_grouped = ['routing_table_get']
|
||||
api = {
|
||||
'groups': {
|
||||
group_name[:-len('_DOC')].lower(): getattr(cls, group_name).strip()
|
||||
@@ -403,7 +403,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
await self.runner.setup()
|
||||
|
||||
try:
|
||||
site = web.TCPSite(self.runner, self.conf.api_host, self.conf.api_port)
|
||||
site = web.TCPSite(self.runner, self.conf.api_host, self.conf.api_port, shutdown_timeout=.5)
|
||||
await site.start()
|
||||
log.info('lbrynet API listening on TCP %s:%i', *site._server.sockets[0].getsockname()[:2])
|
||||
except OSError as e:
|
||||
@@ -433,15 +433,20 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
self.component_startup_task = asyncio.create_task(self.component_manager.start())
|
||||
await self.component_startup_task
|
||||
|
||||
async def stop(self):
|
||||
async def stop(self, shutdown_runner=True):
|
||||
if self.component_startup_task is not None:
|
||||
if self.component_startup_task.done():
|
||||
await self.component_manager.stop()
|
||||
else:
|
||||
self.component_startup_task.cancel()
|
||||
log.info("stopped api components")
|
||||
if shutdown_runner:
|
||||
await self.runner.shutdown()
|
||||
await self.runner.cleanup()
|
||||
log.info("stopped api server")
|
||||
if self.analytics_manager.is_started:
|
||||
self.analytics_manager.stop()
|
||||
log.info("finished shutting down")
|
||||
|
||||
async def handle_old_jsonrpc(self, request):
|
||||
data = await request.json()
|
||||
@@ -451,8 +456,17 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
if 'wallet' in self.component_manager.get_components_status():
|
||||
# self.ledger only available if wallet component is not skipped
|
||||
ledger = self.ledger
|
||||
try:
|
||||
encoded_result = jsonrpc_dumps_pretty(
|
||||
result, ledger=ledger, include_protobuf=include_protobuf)
|
||||
except:
|
||||
log.exception('Failed to encode JSON RPC result:')
|
||||
encoded_result = jsonrpc_dumps_pretty(JSONRPCError(
|
||||
'After successfully executing the command, failed to encode result for JSON RPC response.',
|
||||
JSONRPCError.CODE_APPLICATION_ERROR, format_exc()
|
||||
), ledger=ledger)
|
||||
return web.Response(
|
||||
text=jsonrpc_dumps_pretty(result, ledger=ledger, include_protobuf=include_protobuf),
|
||||
text=encoded_result,
|
||||
content_type='application/json'
|
||||
)
|
||||
|
||||
@@ -463,64 +477,20 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
else:
|
||||
name, claim_id = name_and_claim_id.split("/")
|
||||
uri = f"lbry://{name}#{claim_id}"
|
||||
if not self.stream_manager.started.is_set():
|
||||
await self.stream_manager.started.wait()
|
||||
stream = await self.jsonrpc_get(uri)
|
||||
if isinstance(stream, dict):
|
||||
raise web.HTTPServerError(text=stream['error'])
|
||||
raise web.HTTPFound(f"/stream/{stream.sd_hash}")
|
||||
|
||||
@staticmethod
|
||||
def prepare_range_response_headers(get_range: str, stream: 'ManagedStream') -> typing.Tuple[typing.Dict[str, str],
|
||||
int, int]:
|
||||
if '=' in get_range:
|
||||
get_range = get_range.split('=')[1]
|
||||
start, end = get_range.split('-')
|
||||
size = 0
|
||||
for blob in stream.descriptor.blobs[:-1]:
|
||||
size += blob.length - 1
|
||||
start = int(start)
|
||||
end = int(end) if end else size - 1
|
||||
skip_blobs = start // 2097150
|
||||
skip = skip_blobs * 2097151
|
||||
start = skip
|
||||
final_size = end - start + 1
|
||||
|
||||
headers = {
|
||||
'Accept-Ranges': 'bytes',
|
||||
'Content-Range': f'bytes {start}-{end}/{size}',
|
||||
'Content-Length': str(final_size),
|
||||
'Content-Type': stream.mime_type
|
||||
}
|
||||
return headers, size, skip_blobs
|
||||
|
||||
async def handle_stream_range_request(self, request: web.Request):
|
||||
sd_hash = request.path.split("/stream/")[1]
|
||||
if not self.stream_manager.started.is_set():
|
||||
await self.stream_manager.started.wait()
|
||||
if sd_hash not in self.stream_manager.streams:
|
||||
return web.HTTPNotFound()
|
||||
stream = self.stream_manager.streams[sd_hash]
|
||||
if stream.status == 'stopped':
|
||||
await self.stream_manager.start_stream(stream)
|
||||
if stream.delayed_stop:
|
||||
stream.delayed_stop.cancel()
|
||||
headers, size, skip_blobs = self.prepare_range_response_headers(
|
||||
request.headers.get('range', 'bytes=0-'), stream
|
||||
)
|
||||
response = web.StreamResponse(
|
||||
status=206,
|
||||
headers=headers
|
||||
)
|
||||
await response.prepare(request)
|
||||
wrote = 0
|
||||
async for blob_info, decrypted in stream.aiter_read_stream(skip_blobs):
|
||||
log.info("streamed blob %i/%i", blob_info.blob_num + 1, len(stream.descriptor.blobs) - 1)
|
||||
if (blob_info.blob_num == len(stream.descriptor.blobs) - 2) or (len(decrypted) + wrote >= size):
|
||||
decrypted += b'\x00' * (size - len(decrypted) - wrote)
|
||||
await response.write_eof(decrypted)
|
||||
break
|
||||
else:
|
||||
await response.write(decrypted)
|
||||
wrote += len(decrypted)
|
||||
response.force_close()
|
||||
return response
|
||||
return await self.stream_manager.stream_partial_content(request, sd_hash)
|
||||
|
||||
async def _process_rpc_call(self, data):
|
||||
args = data.get('params', {})
|
||||
@@ -833,7 +803,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
'claim_sequence': (int) claim sequence number (or -1 if unknown),
|
||||
'decoded_claim': (bool) whether or not the claim value was decoded,
|
||||
'height': (int) claim height,
|
||||
'depth': (int) claim depth,
|
||||
'confirmations': (int) claim depth,
|
||||
'timestamp': (int) timestamp of the block that included this claim tx,
|
||||
'has_signature': (bool) included if decoded_claim
|
||||
'name': (str) claim name,
|
||||
'permanent_url': (str) permanent url of the certificate claim,
|
||||
@@ -897,26 +868,30 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
|
||||
STREAM_MANAGER_COMPONENT,
|
||||
conditions=[WALLET_IS_UNLOCKED])
|
||||
async def jsonrpc_get(self, uri, file_name=None, timeout=None, save_file=None):
|
||||
async def jsonrpc_get(self, uri, file_name=None, download_directory=None, timeout=None, save_file=None):
|
||||
"""
|
||||
Download stream from a LBRY name.
|
||||
|
||||
Usage:
|
||||
get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>] [--save_file]
|
||||
get <uri> [<file_name> | --file_name=<file_name>]
|
||||
[<download_directory> | --download_directory=<download_directory>] [<timeout> | --timeout=<timeout>]
|
||||
[--save_file=<save_file>]
|
||||
|
||||
|
||||
Options:
|
||||
--uri=<uri> : (str) uri of the content to download
|
||||
--file_name=<file_name> : (str) specified name for the downloaded file, overrides the stream file name
|
||||
--download_directory=<download_directory> : (str) full path to the directory to download into
|
||||
--timeout=<timeout> : (int) download timeout in number of seconds
|
||||
--save_file : (bool) save the file to the downloads directory
|
||||
--save_file=<save_file> : (bool) save the file to the downloads directory
|
||||
|
||||
Returns: {File}
|
||||
"""
|
||||
save_file = save_file if save_file is not None else self.conf.save_files
|
||||
if download_directory and not os.path.isdir(download_directory):
|
||||
return {"error": f"specified download directory \"{download_directory}\" does not exist"}
|
||||
try:
|
||||
stream = await self.stream_manager.download_stream_from_uri(
|
||||
uri, self.exchange_rate_manager, timeout, file_name, save_file=save_file
|
||||
uri, self.exchange_rate_manager, timeout, file_name, download_directory, save_file=save_file
|
||||
)
|
||||
if not stream:
|
||||
raise DownloadSDTimeout(uri)
|
||||
@@ -969,7 +944,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
"""
|
||||
|
||||
@requires("wallet")
|
||||
def jsonrpc_account_list(self, account_id=None, confirmations=6,
|
||||
def jsonrpc_account_list(self, account_id=None, confirmations=0,
|
||||
include_claims=False, show_seed=False):
|
||||
"""
|
||||
List details of all of the accounts or a specific account.
|
||||
@@ -1540,10 +1515,10 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
raise Exception(f'Unable to find a file for {kwargs}')
|
||||
stream = streams[0]
|
||||
if status == 'start' and not stream.running:
|
||||
await self.stream_manager.start_stream(stream)
|
||||
await stream.save_file(node=self.stream_manager.node)
|
||||
msg = "Resumed download"
|
||||
elif status == 'stop' and stream.running:
|
||||
await self.stream_manager.stop_stream(stream)
|
||||
await stream.stop()
|
||||
msg = "Stopped download"
|
||||
else:
|
||||
msg = (
|
||||
@@ -1675,25 +1650,27 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
@requires(WALLET_COMPONENT)
|
||||
async def jsonrpc_claim_search(
|
||||
self, name=None, claim_id=None, txid=None, nout=None,
|
||||
channel_id=None, winning=False, page=1, page_size=10):
|
||||
channel_id=None, channel_name=None, winning=False, page=1, page_size=10):
|
||||
"""
|
||||
Search for stream and channel claims on the blockchain.
|
||||
|
||||
Use --channel_id=<channel_id> to list all stream claims in a channel.
|
||||
Use --channel_id=<channel_id> or --channel_name=<channel_name> to list all stream claims in a channel.
|
||||
|
||||
Usage:
|
||||
claim_search [<name> | --name=<name>] [--claim_id=<claim_id>] [--txid=<txid> --nout=<nout>]
|
||||
[--channel_id=<channel_id>] [--winning] [--page=<page>] [--page_size=<page_size>]
|
||||
[--channel_id=<channel_id>] [--channel_name=<channel_name>] [--winning] [--page=<page>]
|
||||
[--page_size=<page_size>]
|
||||
|
||||
Options:
|
||||
--name=<name> : (str) find claims with this name
|
||||
--claim_id=<claim_id> : (str) find a claim with this claim_id
|
||||
--txid=<txid> : (str) find a claim with this txid:nout
|
||||
--nout=<nout> : (str) find a claim with this txid:nout
|
||||
--channel_id=<channel_id> : (str) limit search to specific channel claim id (returns stream claims)
|
||||
--winning : (bool) limit to winning claims
|
||||
--page=<page> : (int) page to return during paginating
|
||||
--page_size=<page_size> : (int) number of items on page during pagination
|
||||
--name=<name> : (str) find claims with this name
|
||||
--claim_id=<claim_id> : (str) find a claim with this claim_id
|
||||
--txid=<txid> : (str) find a claim with this txid:nout
|
||||
--nout=<nout> : (str) find a claim with this txid:nout
|
||||
--channel_id=<channel_id> : (str) limit search to specific channel claim id (returns stream claims)
|
||||
--channel_name=<channel_name> : (str) limit search to specific channel name (returns stream claims)
|
||||
--winning : (bool) limit to winning claims
|
||||
--page=<page> : (int) page to return during paginating
|
||||
--page_size=<page_size> : (int) number of items on page during pagination
|
||||
|
||||
Returns: {Paginated[Output]}
|
||||
"""
|
||||
@@ -1708,10 +1685,13 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
claim = await self.wallet_manager.get_claim_by_outpoint(txid, int(nout))
|
||||
if claim and claim != 'claim not found':
|
||||
claims = {'claims': [claim]}
|
||||
elif channel_id is not None:
|
||||
claim = await self.wallet_manager.get_claim_by_claim_id(channel_id)
|
||||
if claim and claim != 'claim not found':
|
||||
channel_url = f"{claim['name']}#{claim['claim_id']}"
|
||||
elif channel_id is not None or channel_name is not None:
|
||||
channel_url = f"{channel_name}{('#' + str(channel_id)) if channel_id else ''}" if channel_name else None
|
||||
if channel_id and not channel_name:
|
||||
claim = await self.wallet_manager.get_claim_by_claim_id(channel_id)
|
||||
if claim and claim != 'claim not found':
|
||||
channel_url = f"{claim['name']}#{claim['claim_id']}"
|
||||
if channel_url:
|
||||
resolve = await self.resolve(channel_url, page=page, page_size=page_size)
|
||||
resolve = resolve.get(channel_url, {})
|
||||
claims = resolve.get('claims_in_channel', []) or []
|
||||
@@ -1746,18 +1726,21 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
Usage:
|
||||
channel_create (<name> | --name=<name>) (<bid> | --bid=<bid>)
|
||||
[--allow_duplicate_name=<allow_duplicate_name>]
|
||||
[--title=<title>] [--description=<description>] [--email=<email>] [--featured=<featured>...]
|
||||
[--title=<title>] [--description=<description>] [--email=<email>]
|
||||
[--website_url=<website_url>] [--featured=<featured>...]
|
||||
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
|
||||
[--website_url=<website_url>] [--thumbnail_url=<thumbnail_url>] [--cover_url=<cover_url>]
|
||||
[--thumbnail_url=<thumbnail_url>] [--cover_url=<cover_url>]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
|
||||
|
||||
Options:
|
||||
--name=<name> : (str) name of the channel prefixed with '@'
|
||||
--bid=<bid> : (decimal) amount to back the claim
|
||||
--allow_duplicate_name=<allow_duplicate_name> : (bool) create new channel even if one already exists with
|
||||
given name. default: false.
|
||||
--bid=<bid> : (decimal) amount to back the claim
|
||||
--title=<title> : (str) title of the publication
|
||||
--description=<description> : (str) description of the publication
|
||||
--email=<email> : (str) email of channel owner
|
||||
--website_url=<website_url> : (str) website url
|
||||
--featured=<featured> : (list) claim_ids of featured content in channel
|
||||
--tags=<tags> : (list) content tags
|
||||
--languages=<languages> : (list) languages used by the channel,
|
||||
@@ -1798,8 +1781,6 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
... --locations="{'country': 'US', 'state': 'NH'}"
|
||||
|
||||
--email=<email> : (str) email of channel owner
|
||||
--website_url=<website_url> : (str) website url
|
||||
--thumbnail_url=<thumbnail_url>: (str) thumbnail url
|
||||
--cover_url=<cover_url> : (str) url of cover image
|
||||
--account_id=<account_id> : (str) id of the account to store channel
|
||||
@@ -1847,31 +1828,33 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
@requires(WALLET_COMPONENT, conditions=[WALLET_IS_UNLOCKED])
|
||||
async def jsonrpc_channel_update(
|
||||
self, claim_id, bid=None, account_id=None, claim_address=None,
|
||||
new_signing_key=False, preview=False, **kwargs):
|
||||
new_signing_key=False, preview=False, replace=False, **kwargs):
|
||||
"""
|
||||
Update an existing channel claim.
|
||||
|
||||
Usage:
|
||||
channel_update (<claim_id> | --claim_id=<claim_id>) [<bid> | --bid=<bid>]
|
||||
[--title=<title>] [--description=<description>]
|
||||
[--title=<title>] [--description=<description>] [--email=<email>]
|
||||
[--website_url=<website_url>]
|
||||
[--featured=<featured>...] [--clear_featured]
|
||||
[--tags=<tags>...] [--clear_tags]
|
||||
[--languages=<languages>...] [--clear_languages]
|
||||
[--locations=<locations>...] [--clear_locations]
|
||||
[--email=<email>]
|
||||
[--website_url=<website_url>] [--thumbnail_url=<thumbnail_url>] [--cover_url=<cover_url>]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--new_signing_key] [--preview]
|
||||
[--thumbnail_url=<thumbnail_url>] [--cover_url=<cover_url>]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--new_signing_key]
|
||||
[--preview] [--replace]
|
||||
|
||||
Options:
|
||||
--claim_id=<claim_id> : (str) claim_id of the channel to update
|
||||
--bid=<bid> : (decimal) amount to back the claim
|
||||
--title=<title> : (str) title of the publication
|
||||
--description=<description> : (str) description of the publication
|
||||
--clear_featured : (bool) clear existing featured content (prior to adding new ones)
|
||||
--email=<email> : (str) email of channel owner
|
||||
--website_url=<website_url> : (str) website url
|
||||
--featured=<featured> : (list) claim_ids of featured content in channel
|
||||
--clear_tags : (bool) clear existing tags (prior to adding new ones)
|
||||
--clear_featured : (bool) clear existing featured content (prior to adding new ones)
|
||||
--tags=<tags> : (list) add content tags
|
||||
--clear_languages : (bool) clear existing languages (prior to adding new ones)
|
||||
--clear_tags : (bool) clear existing tags (prior to adding new ones)
|
||||
--languages=<languages> : (list) languages used by the channel,
|
||||
using RFC 5646 format, eg:
|
||||
for English `--languages=en`
|
||||
@@ -1879,7 +1862,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
for Spanish (Mexican) `--languages=es-MX`
|
||||
for Chinese (Simplified) `--languages=zh-Hans`
|
||||
for Chinese (Traditional) `--languages=zh-Hant`
|
||||
--clear_locations : (bool) clear existing locations (prior to adding new ones)
|
||||
--clear_languages : (bool) clear existing languages (prior to adding new ones)
|
||||
--locations=<locations> : (list) locations of the channel, consisting of 2 letter
|
||||
`country` code and a `state`, `city` and a postal
|
||||
`code` along with a `latitude` and `longitude`.
|
||||
@@ -1911,14 +1894,17 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
... --locations="{'country': 'US', 'state': 'NH'}"
|
||||
|
||||
--email=<email> : (str) email of channel owner
|
||||
--website_url=<website_url> : (str) website url
|
||||
--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) id of the account to store channel
|
||||
--claim_address=<claim_address>: (str) address where the channel is sent
|
||||
--new_signing_key : (bool) generate a new signing key, will invalidate all previous publishes
|
||||
--preview : (bool) do not broadcast the transaction
|
||||
--replace : (bool) instead of modifying specific values on
|
||||
the channel, this will clear all existing values
|
||||
and only save passed in values, useful for form
|
||||
submissions where all values are always set
|
||||
|
||||
Returns: {Transaction}
|
||||
"""
|
||||
@@ -1945,7 +1931,11 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
else:
|
||||
claim_address = old_txo.get_address(account.ledger)
|
||||
|
||||
claim = Claim.from_bytes(old_txo.claim.to_bytes())
|
||||
if replace:
|
||||
claim = Claim()
|
||||
claim.channel.public_key_bytes = old_txo.claim.channel.public_key_bytes
|
||||
else:
|
||||
claim = Claim.from_bytes(old_txo.claim.to_bytes())
|
||||
claim.channel.update(**kwargs)
|
||||
tx = await Transaction.claim_update(
|
||||
old_txo, claim, amount, claim_address, [account], account
|
||||
@@ -2087,18 +2077,16 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
conditions=[WALLET_IS_UNLOCKED])
|
||||
async def jsonrpc_publish(self, name, **kwargs):
|
||||
"""
|
||||
Create or update a stream claim at a given name (use 'stream create/update' for more control).
|
||||
Create or replace a stream claim at a given name (use 'stream create/update' for more control).
|
||||
|
||||
Usage:
|
||||
publish (<name> | --name=<name>) [--bid=<bid>] [--file_path=<file_path>]
|
||||
[--tags=<tags>...] [--clear_tags]
|
||||
[--languages=<languages>...] [--clear_languages]
|
||||
[--locations=<locations>...] [--clear_locations]
|
||||
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
|
||||
[--title=<title>] [--description=<description>] [--author=<author>] [--language=<language>]
|
||||
[--title=<title>] [--description=<description>] [--author=<author>]
|
||||
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
|
||||
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
|
||||
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
|
||||
[--channel_id=<channel_id>] [--channel_name=<channel_name>]
|
||||
[--channel_id=<channel_id> | --channel_name=<channel_name>]
|
||||
[--channel_account_id=<channel_account_id>...]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
|
||||
|
||||
@@ -2117,9 +2105,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
who is not the publisher and is not represented by the channel. For
|
||||
example, a pdf file of 'The Odyssey' has an author of 'Homer' but may
|
||||
by published to a channel such as '@classics', or to no channel at all
|
||||
--clear_tags : (bool) clear existing tags (prior to adding new ones)
|
||||
--tags=<tags> : (list) add content tags
|
||||
--clear_languages : (bool) clear existing languages (prior to adding new ones)
|
||||
--languages=<languages> : (list) languages used by the channel,
|
||||
using RFC 5646 format, eg:
|
||||
for English `--languages=en`
|
||||
@@ -2127,7 +2113,6 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
for Spanish (Mexican) `--languages=es-MX`
|
||||
for Chinese (Simplified) `--languages=zh-Hans`
|
||||
for Chinese (Traditional) `--languages=zh-Hant`
|
||||
--clear_locations : (bool) clear existing locations (prior to adding new ones)
|
||||
--locations=<locations> : (list) locations relevant to the stream, consisting of 2 letter
|
||||
`country` code and a `state`, `city` and a postal
|
||||
`code` along with a `latitude` and `longitude`.
|
||||
@@ -2177,6 +2162,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
Returns: {Transaction}
|
||||
"""
|
||||
log.info("publishing: name: %s params: %s", name, kwargs)
|
||||
self.valid_stream_name_or_error(name)
|
||||
account = self.get_account_or_default(kwargs.get('account_id'))
|
||||
claims = await account.get_claims(claim_name=name)
|
||||
@@ -2188,7 +2174,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
return await self.jsonrpc_stream_create(name, **kwargs)
|
||||
elif len(claims) == 1:
|
||||
assert claims[0].claim.is_stream, f"Claim at name '{name}' is not a stream claim."
|
||||
return await self.jsonrpc_stream_update(claims[0].claim_id, **kwargs)
|
||||
return await self.jsonrpc_stream_update(claims[0].claim_id, replace=True, **kwargs)
|
||||
raise Exception(
|
||||
f"There are {len(claims)} claims for '{name}', please use 'stream update' command "
|
||||
f"to update a specific stream claim."
|
||||
@@ -2206,21 +2192,21 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
Usage:
|
||||
stream_create (<name> | --name=<name>) (<bid> | --bid=<bid>) (<file_path> | --file_path=<file_path>)
|
||||
[--allow_duplicate_name=<allow_duplicate_name>]
|
||||
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
|
||||
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
|
||||
[--title=<title>] [--description=<description>] [--author=<author>]
|
||||
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
|
||||
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
|
||||
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
|
||||
[--channel_id=<channel_id>] [--channel_name=<channel_name>]
|
||||
[--channel_id=<channel_id> | --channel_name=<channel_name>]
|
||||
[--channel_account_id=<channel_account_id>...]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
|
||||
|
||||
Options:
|
||||
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
|
||||
--allow_duplicate_name=<allow_duplicate_name> : (bool) create new claim even if one already exists with
|
||||
given name. default: false.
|
||||
--bid=<bid> : (decimal) amount to back the claim
|
||||
--file_path=<file_path> : (str) path to file to be associated with name.
|
||||
--allow_duplicate_name=<allow_duplicate_name> : (bool) create new claim even if one already exists with
|
||||
given name. default: false.
|
||||
--fee_currency=<fee_currency> : (string) specify fee currency
|
||||
--fee_amount=<fee_amount> : (decimal) content download fee
|
||||
--fee_address=<fee_address> : (str) address where to send fee payments, will use
|
||||
@@ -2279,6 +2265,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
--height=<height> : (int) image/video height, automatically calculated from media file
|
||||
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
|
||||
--channel_id=<channel_id> : (str) claim id of the publisher channel
|
||||
--channel_name=<channel_name> : (str) name of the publisher channel
|
||||
--channel_account_id=<channel_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 funding the transaction
|
||||
@@ -2310,13 +2297,17 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
)
|
||||
new_txo = tx.outputs[0]
|
||||
|
||||
file_stream = None
|
||||
if not preview:
|
||||
file_stream = await self.stream_manager.create_stream(file_path)
|
||||
claim.stream.source.sd_hash = file_stream.sd_hash
|
||||
new_txo.script.generate()
|
||||
if channel:
|
||||
new_txo.sign(channel)
|
||||
await tx.sign([account])
|
||||
|
||||
if channel:
|
||||
new_txo.sign(channel)
|
||||
await tx.sign([account])
|
||||
|
||||
if not preview:
|
||||
await account.ledger.broadcast(tx)
|
||||
await self.storage.save_claims([self._old_get_temp_claim_info(
|
||||
tx, new_txo, claim_address, claim, name, dewies_to_lbc(amount)
|
||||
@@ -2334,23 +2325,25 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
self, claim_id, bid=None, file_path=None,
|
||||
channel_id=None, channel_name=None, channel_account_id=None, clear_channel=False,
|
||||
account_id=None, claim_address=None,
|
||||
preview=False, **kwargs):
|
||||
preview=False, replace=False, **kwargs):
|
||||
"""
|
||||
Update an existing stream claim and if a new file is provided announce it to lbrynet.
|
||||
|
||||
Usage:
|
||||
stream_update (<claim_id> | --claim_id=<claim_id>) [--bid=<bid>] [--file_path=<file_path>]
|
||||
[--file_name=<file_name>] [--file_size=<file_size>] [--file_hash=<file_hash>]
|
||||
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>]
|
||||
[--fee_address=<fee_address>] [--clear_fee]
|
||||
[--title=<title>] [--description=<description>] [--author=<author>]
|
||||
[--tags=<tags>...] [--clear_tags]
|
||||
[--languages=<languages>...] [--clear_languages]
|
||||
[--locations=<locations>...] [--clear_locations]
|
||||
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
|
||||
[--title=<title>] [--description=<description>] [--author=<author>] [--language=<language>]
|
||||
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
|
||||
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
|
||||
[--channel_id=<channel_id>] [--channel_name=<channel_name>] [--clear_channel]
|
||||
[--channel_id=<channel_id> | --channel_name=<channel_name> | --clear_channel]
|
||||
[--channel_account_id=<channel_account_id>...]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
|
||||
[--account_id=<account_id>] [--claim_address=<claim_address>]
|
||||
[--preview] [--replace]
|
||||
|
||||
Options:
|
||||
--claim_id=<claim_id> : (str) id of the stream claim to update
|
||||
@@ -2363,6 +2356,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
--fee_amount=<fee_amount> : (decimal) content download fee
|
||||
--fee_address=<fee_address> : (str) address where to send fee payments, will use
|
||||
value from --claim_address if not provided
|
||||
--clear_fee : (bool) clear previously set fee
|
||||
--title=<title> : (str) title of the publication
|
||||
--description=<description> : (str) description of the publication
|
||||
--author=<author> : (str) author of the publication. The usage for this field is not
|
||||
@@ -2370,9 +2364,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
who is not the publisher and is not represented by the channel. For
|
||||
example, a pdf file of 'The Odyssey' has an author of 'Homer' but may
|
||||
by published to a channel such as '@classics', or to no channel at all
|
||||
--clear_tags : (bool) clear existing tags (prior to adding new ones)
|
||||
--tags=<tags> : (list) add content tags
|
||||
--clear_languages : (bool) clear existing languages (prior to adding new ones)
|
||||
--clear_tags : (bool) clear existing tags (prior to adding new ones)
|
||||
--languages=<languages> : (list) languages used by the channel,
|
||||
using RFC 5646 format, eg:
|
||||
for English `--languages=en`
|
||||
@@ -2380,7 +2373,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
for Spanish (Mexican) `--languages=es-MX`
|
||||
for Chinese (Simplified) `--languages=zh-Hans`
|
||||
for Chinese (Traditional) `--languages=zh-Hant`
|
||||
--clear_locations : (bool) clear existing locations (prior to adding new ones)
|
||||
--clear_languages : (bool) clear existing languages (prior to adding new ones)
|
||||
--locations=<locations> : (list) locations relevant to the stream, consisting of 2 letter
|
||||
`country` code and a `state`, `city` and a postal
|
||||
`code` along with a `latitude` and `longitude`.
|
||||
@@ -2412,6 +2405,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
... --locations="{'country': 'US', 'state': 'NH'}"
|
||||
|
||||
--clear_locations : (bool) clear existing locations (prior to adding new ones)
|
||||
--license=<license> : (str) publication license
|
||||
--license_url=<license_url> : (str) publication license url
|
||||
--thumbnail_url=<thumbnail_url>: (str) thumbnail url
|
||||
@@ -2420,6 +2414,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
--height=<height> : (int) image/video height, automatically calculated from media file
|
||||
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated
|
||||
--channel_id=<channel_id> : (str) claim id of the publisher channel
|
||||
--channel_name=<channel_name> : (str) name of the publisher channel
|
||||
--clear_channel : (bool) remove channel signature
|
||||
--channel_account_id=<channel_id>: (str) one or more account ids for accounts to look in
|
||||
for channel certificates, defaults to all accounts.
|
||||
@@ -2427,6 +2422,10 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
--claim_address=<claim_address>: (str) address where the claim is sent to, if not specified
|
||||
it will be determined automatically from the account
|
||||
--preview : (bool) do not broadcast the transaction
|
||||
--replace : (bool) instead of modifying specific values on
|
||||
the stream, this will clear all existing values
|
||||
and only save passed in values, useful for form
|
||||
submissions where all values are always set
|
||||
|
||||
Returns: {Transaction}
|
||||
"""
|
||||
@@ -2435,7 +2434,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
existing_claims = await account.get_claims(claim_id=claim_id)
|
||||
if len(existing_claims) != 1:
|
||||
raise Exception(
|
||||
f"Can't find the claim '{claim_id}' in account '{account_id}'."
|
||||
f"Can't find the claim '{claim_id}' in account '{account.id}'."
|
||||
)
|
||||
old_txo = existing_claims[0]
|
||||
if not old_txo.claim.is_stream:
|
||||
@@ -2456,35 +2455,56 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
channel = None
|
||||
if channel_id or channel_name:
|
||||
channel = await self.get_channel_or_error(channel_account_id, channel_id, channel_name, for_signing=True)
|
||||
elif old_txo.claim.is_signed and not clear_channel:
|
||||
elif old_txo.claim.is_signed and not clear_channel and not replace:
|
||||
channel = old_txo.channel
|
||||
|
||||
if 'fee_address' in kwargs:
|
||||
self.valid_address_or_error(kwargs['fee_address'])
|
||||
|
||||
claim = Claim.from_bytes(old_txo.claim.to_bytes())
|
||||
claim.stream.update(file_path=file_path, **kwargs)
|
||||
if replace:
|
||||
claim = Claim()
|
||||
claim.stream.message.source.CopyFrom(
|
||||
old_txo.claim.stream.message.source
|
||||
)
|
||||
stream_type = old_txo.claim.stream.stream_type
|
||||
if stream_type:
|
||||
old_stream_type = getattr(old_txo.claim.stream.message, stream_type)
|
||||
new_stream_type = getattr(claim.stream.message, stream_type)
|
||||
new_stream_type.CopyFrom(old_stream_type)
|
||||
claim.stream.update(file_path=file_path, **kwargs)
|
||||
else:
|
||||
claim = Claim.from_bytes(old_txo.claim.to_bytes())
|
||||
claim.stream.update(file_path=file_path, **kwargs)
|
||||
tx = await Transaction.claim_update(
|
||||
old_txo, claim, amount, claim_address, [account], account, channel
|
||||
)
|
||||
new_txo = tx.outputs[0]
|
||||
|
||||
stream_hash = None
|
||||
if not preview:
|
||||
old_stream_hash = await self.storage.get_stream_hash_for_sd_hash(old_txo.claim.stream.source.sd_hash)
|
||||
if file_path is not None:
|
||||
if old_stream_hash:
|
||||
stream_to_delete = self.stream_manager.get_stream_by_stream_hash(old_stream_hash)
|
||||
await self.stream_manager.delete_stream(stream_to_delete, delete_file=False)
|
||||
file_stream = await self.stream_manager.create_stream(file_path)
|
||||
new_txo.claim.stream.source.sd_hash = file_stream.sd_hash
|
||||
new_txo.script.generate()
|
||||
stream_hash = file_stream.stream_hash
|
||||
else:
|
||||
stream_hash = await self.storage.get_stream_hash_for_sd_hash(old_txo.claim.stream.source.sd_hash)
|
||||
if channel:
|
||||
new_txo.sign(channel)
|
||||
await tx.sign([account])
|
||||
stream_hash = old_stream_hash
|
||||
|
||||
if channel:
|
||||
new_txo.sign(channel)
|
||||
await tx.sign([account])
|
||||
|
||||
if not preview:
|
||||
await account.ledger.broadcast(tx)
|
||||
await self.storage.save_claims([self._old_get_temp_claim_info(
|
||||
tx, new_txo, claim_address, new_txo.claim, new_txo.claim_name, dewies_to_lbc(amount)
|
||||
)])
|
||||
await self.storage.save_content_claim(stream_hash, new_txo.id)
|
||||
if stream_hash:
|
||||
await self.storage.save_content_claim(stream_hash, new_txo.id)
|
||||
await self.analytics_manager.send_claim_action('publish')
|
||||
else:
|
||||
await account.ledger.release_tx(tx)
|
||||
@@ -2850,23 +2870,6 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
"""
|
||||
return self.get_account_or_default(account_id).release_all_outputs()
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
def jsonrpc_block_show(self, blockhash=None, height=None):
|
||||
"""
|
||||
Get contents of a block
|
||||
|
||||
Usage:
|
||||
block_show (<blockhash> | --blockhash=<blockhash>) | (<height> | --height=<height>)
|
||||
|
||||
Options:
|
||||
--blockhash=<blockhash> : (str) hash of the block to look up
|
||||
--height=<height> : (int) height of the block to look up
|
||||
|
||||
Returns:
|
||||
(dict) Requested block
|
||||
"""
|
||||
return self.wallet_manager.get_block(blockhash, height)
|
||||
|
||||
BLOB_DOC = """
|
||||
Blob management.
|
||||
"""
|
||||
@@ -2890,10 +2893,12 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
blob = await download_blob(asyncio.get_event_loop(), self.conf, self.blob_manager, self.dht_node, blob_hash)
|
||||
if read:
|
||||
with open(blob.file_path, 'rb') as handle:
|
||||
with blob.reader_context() as handle:
|
||||
return handle.read().decode()
|
||||
else:
|
||||
return "Downloaded blob %s" % blob_hash
|
||||
elif isinstance(blob, BlobBuffer):
|
||||
log.warning("manually downloaded blob buffer could have missed garbage collection, clearing it")
|
||||
blob.delete()
|
||||
return "Downloaded blob %s" % blob_hash
|
||||
|
||||
@requires(BLOB_COMPONENT, DATABASE_COMPONENT)
|
||||
async def jsonrpc_blob_delete(self, blob_hash):
|
||||
@@ -3422,7 +3427,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
async def get_channel_or_none(self, account_ids: List[str], channel_id: str = None, channel_name: str = None,
|
||||
for_signing: bool = False) -> Output:
|
||||
if channel_id is not None:
|
||||
if channel_id is not None or channel_name is not None:
|
||||
return await self.get_channel_or_error(account_ids, channel_id, channel_name, for_signing)
|
||||
|
||||
async def get_channel_or_error(self, account_ids: List[str], channel_id: str = None, channel_name: str = None,
|
||||
|
||||
@@ -144,7 +144,8 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
'height': tx_height,
|
||||
'amount': dewies_to_lbc(txo.amount),
|
||||
'address': txo.get_address(self.ledger),
|
||||
'confirmations': (best_height+1) - tx_height if tx_height > 0 else tx_height
|
||||
'confirmations': (best_height+1) - tx_height if tx_height > 0 else tx_height,
|
||||
'timestamp': self.ledger.headers[tx_height]['timestamp'] if tx_height > 0 else None
|
||||
}
|
||||
if txo.is_change is not None:
|
||||
output['is_change'] = txo.is_change
|
||||
@@ -205,9 +206,16 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
result['is_default'] = self.ledger.accounts[0] == account
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def encode_file(managed_stream):
|
||||
return managed_stream.as_dict()
|
||||
def encode_file(self, managed_stream):
|
||||
file = managed_stream.as_dict()
|
||||
tx_height = managed_stream.stream_claim_info.height
|
||||
best_height = self.ledger.headers.height
|
||||
file.update({
|
||||
'height': tx_height,
|
||||
'confirmations': (best_height+1) - tx_height if tx_height > 0 else tx_height,
|
||||
'timestamp': self.ledger.headers[tx_height]['timestamp'] if tx_height > 0 else None
|
||||
})
|
||||
return file
|
||||
|
||||
@staticmethod
|
||||
def encode_claim(claim):
|
||||
|
||||
@@ -22,6 +22,10 @@ def migrate_db(conf, start, end):
|
||||
from .migrate7to8 import do_migration
|
||||
elif current == 8:
|
||||
from .migrate8to9 import do_migration
|
||||
elif current == 9:
|
||||
from .migrate9to10 import do_migration
|
||||
elif current == 10:
|
||||
from .migrate10to11 import do_migration
|
||||
else:
|
||||
raise Exception("DB migration of version {} to {} is not available".format(current,
|
||||
current+1))
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import sqlite3
|
||||
import os
|
||||
import binascii
|
||||
|
||||
|
||||
def do_migration(conf):
|
||||
db_path = os.path.join(conf.data_dir, "lbrynet.sqlite")
|
||||
connection = sqlite3.connect(db_path)
|
||||
cursor = connection.cursor()
|
||||
|
||||
current_columns = []
|
||||
for col_info in cursor.execute("pragma table_info('file');").fetchall():
|
||||
current_columns.append(col_info[1])
|
||||
if 'content_fee' in current_columns or 'saved_file' in current_columns:
|
||||
connection.close()
|
||||
print("already migrated")
|
||||
return
|
||||
|
||||
cursor.execute(
|
||||
"pragma foreign_keys=off;"
|
||||
)
|
||||
|
||||
cursor.execute("""
|
||||
create table if not exists new_file (
|
||||
stream_hash text primary key not null references stream,
|
||||
file_name text,
|
||||
download_directory text,
|
||||
blob_data_rate real not null,
|
||||
status text not null,
|
||||
saved_file integer not null,
|
||||
content_fee text
|
||||
);
|
||||
""")
|
||||
for (stream_hash, file_name, download_dir, data_rate, status) in cursor.execute("select * from file").fetchall():
|
||||
saved_file = 0
|
||||
if download_dir != '{stream}' and file_name != '{stream}':
|
||||
try:
|
||||
if os.path.isfile(os.path.join(binascii.unhexlify(download_dir).decode(),
|
||||
binascii.unhexlify(file_name).decode())):
|
||||
saved_file = 1
|
||||
else:
|
||||
download_dir, file_name = None, None
|
||||
except Exception:
|
||||
download_dir, file_name = None, None
|
||||
else:
|
||||
download_dir, file_name = None, None
|
||||
cursor.execute(
|
||||
"insert into new_file values (?, ?, ?, ?, ?, ?, NULL)",
|
||||
(stream_hash, file_name, download_dir, data_rate, status, saved_file)
|
||||
)
|
||||
cursor.execute("drop table file")
|
||||
cursor.execute("alter table new_file rename to file")
|
||||
connection.commit()
|
||||
connection.close()
|
||||
@@ -0,0 +1,20 @@
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
|
||||
def do_migration(conf):
|
||||
db_path = os.path.join(conf.data_dir, "lbrynet.sqlite")
|
||||
connection = sqlite3.connect(db_path)
|
||||
cursor = connection.cursor()
|
||||
|
||||
query = "select stream_hash, sd_hash from main.stream"
|
||||
for stream_hash, sd_hash in cursor.execute(query).fetchall():
|
||||
head_blob_hash = cursor.execute(
|
||||
"select blob_hash from stream_blob where position = 0 and stream_hash = ?",
|
||||
(stream_hash,)
|
||||
).fetchone()
|
||||
if not head_blob_hash:
|
||||
continue
|
||||
cursor.execute("update blob set should_announce=1 where blob_hash in (?, ?)", (sd_hash, head_blob_hash[0],))
|
||||
connection.commit()
|
||||
connection.close()
|
||||
@@ -8,6 +8,7 @@ import time
|
||||
from torba.client.basedatabase import SQLiteMixin
|
||||
from lbrynet.conf import Config
|
||||
from lbrynet.wallet.dewies import dewies_to_lbc, lbc_to_dewies
|
||||
from lbrynet.wallet.transaction import Transaction
|
||||
from lbrynet.schema.claim import Claim
|
||||
from lbrynet.dht.constants import data_expiration
|
||||
from lbrynet.blob.blob_info import BlobInfo
|
||||
@@ -114,8 +115,8 @@ def _batched_select(transaction, query, parameters, batch_size=900):
|
||||
def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Dict]:
|
||||
files = []
|
||||
signed_claims = {}
|
||||
for (rowid, stream_hash, file_name, download_dir, data_rate, status, _, sd_hash, stream_key,
|
||||
stream_name, suggested_file_name, *claim_args) in _batched_select(
|
||||
for (rowid, stream_hash, file_name, download_dir, data_rate, status, saved_file, raw_content_fee, _,
|
||||
sd_hash, stream_key, stream_name, suggested_file_name, *claim_args) in _batched_select(
|
||||
transaction, "select file.rowid, file.*, stream.*, c.* "
|
||||
"from file inner join stream on file.stream_hash=stream.stream_hash "
|
||||
"inner join content_claim cc on file.stream_hash=cc.stream_hash "
|
||||
@@ -141,7 +142,11 @@ def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Di
|
||||
"key": stream_key,
|
||||
"stream_name": stream_name, # hex
|
||||
"suggested_file_name": suggested_file_name, # hex
|
||||
"claim": claim
|
||||
"claim": claim,
|
||||
"saved_file": bool(saved_file),
|
||||
"content_fee": None if not raw_content_fee else Transaction(
|
||||
binascii.unhexlify(raw_content_fee)
|
||||
)
|
||||
}
|
||||
)
|
||||
for claim_name, claim_id in _batched_select(
|
||||
@@ -153,21 +158,12 @@ def get_all_lbry_files(transaction: sqlite3.Connection) -> typing.List[typing.Di
|
||||
|
||||
|
||||
def store_stream(transaction: sqlite3.Connection, sd_blob: 'BlobFile', descriptor: 'StreamDescriptor'):
|
||||
# add the head blob and set it to be announced
|
||||
transaction.execute(
|
||||
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?)",
|
||||
(
|
||||
sd_blob.blob_hash, sd_blob.length, 0, 1, "pending", 0, 0,
|
||||
descriptor.blobs[0].blob_hash, descriptor.blobs[0].length, 0, 1, "pending", 0, 0
|
||||
)
|
||||
# add all blobs, except the last one, which is empty
|
||||
transaction.executemany(
|
||||
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?)",
|
||||
[(blob.blob_hash, blob.length, 0, 0, "pending", 0, 0)
|
||||
for blob in (descriptor.blobs[:-1] if len(descriptor.blobs) > 1 else descriptor.blobs) + [sd_blob]]
|
||||
)
|
||||
# add the rest of the blobs with announcement off
|
||||
if len(descriptor.blobs) > 2:
|
||||
transaction.executemany(
|
||||
"insert or ignore into blob values (?, ?, ?, ?, ?, ?, ?)",
|
||||
[(blob.blob_hash, blob.length, 0, 0, "pending", 0, 0)
|
||||
for blob in descriptor.blobs[1:-1]]
|
||||
)
|
||||
# associate the blobs to the stream
|
||||
transaction.execute("insert or ignore into stream values (?, ?, ?, ?, ?)",
|
||||
(descriptor.stream_hash, sd_blob.blob_hash, descriptor.key,
|
||||
@@ -179,6 +175,11 @@ def store_stream(transaction: sqlite3.Connection, sd_blob: 'BlobFile', descripto
|
||||
[(descriptor.stream_hash, blob.blob_hash, blob.blob_num, blob.iv)
|
||||
for blob in descriptor.blobs]
|
||||
)
|
||||
# ensure should_announce is set regardless if insert was ignored
|
||||
transaction.execute(
|
||||
"update blob set should_announce=1 where blob_hash in (?, ?)",
|
||||
(sd_blob.blob_hash, descriptor.blobs[0].blob_hash,)
|
||||
)
|
||||
|
||||
|
||||
def delete_stream(transaction: sqlite3.Connection, descriptor: 'StreamDescriptor'):
|
||||
@@ -192,16 +193,20 @@ def delete_stream(transaction: sqlite3.Connection, descriptor: 'StreamDescriptor
|
||||
|
||||
|
||||
def store_file(transaction: sqlite3.Connection, stream_hash: str, file_name: typing.Optional[str],
|
||||
download_directory: typing.Optional[str], data_payment_rate: float, status: str) -> int:
|
||||
download_directory: typing.Optional[str], data_payment_rate: float, status: str,
|
||||
content_fee: typing.Optional[Transaction]) -> int:
|
||||
if not file_name and not download_directory:
|
||||
encoded_file_name, encoded_download_dir = "{stream}", "{stream}"
|
||||
encoded_file_name, encoded_download_dir = None, None
|
||||
else:
|
||||
encoded_file_name = binascii.hexlify(file_name.encode()).decode()
|
||||
encoded_download_dir = binascii.hexlify(download_directory.encode()).decode()
|
||||
transaction.execute(
|
||||
"insert or replace into file values (?, ?, ?, ?, ?)",
|
||||
(stream_hash, encoded_file_name, encoded_download_dir, data_payment_rate, status)
|
||||
"insert or replace into file values (?, ?, ?, ?, ?, ?, ?)",
|
||||
(stream_hash, encoded_file_name, encoded_download_dir, data_payment_rate, status,
|
||||
1 if (file_name and download_directory and os.path.isfile(os.path.join(download_directory, file_name))) else 0,
|
||||
None if not content_fee else binascii.hexlify(content_fee.raw).decode())
|
||||
)
|
||||
|
||||
return transaction.execute("select rowid from file where stream_hash=?", (stream_hash, )).fetchone()[0]
|
||||
|
||||
|
||||
@@ -250,10 +255,12 @@ class SQLiteStorage(SQLiteMixin):
|
||||
|
||||
create table if not exists file (
|
||||
stream_hash text primary key not null references stream,
|
||||
file_name text not null,
|
||||
download_directory text not null,
|
||||
file_name text,
|
||||
download_directory text,
|
||||
blob_data_rate real not null,
|
||||
status text not null
|
||||
status text not null,
|
||||
saved_file integer not null,
|
||||
content_fee text
|
||||
);
|
||||
|
||||
create table if not exists content_claim (
|
||||
@@ -434,7 +441,7 @@ class SQLiteStorage(SQLiteMixin):
|
||||
def set_files_as_streaming(self, stream_hashes: typing.List[str]):
|
||||
def _set_streaming(transaction: sqlite3.Connection):
|
||||
transaction.executemany(
|
||||
"update file set file_name='{stream}', download_directory='{stream}' where stream_hash=?",
|
||||
"update file set file_name=null, download_directory=null where stream_hash=?",
|
||||
[(stream_hash, ) for stream_hash in stream_hashes]
|
||||
)
|
||||
|
||||
@@ -513,16 +520,42 @@ class SQLiteStorage(SQLiteMixin):
|
||||
|
||||
# # # # # # # # # file stuff # # # # # # # # #
|
||||
|
||||
def save_downloaded_file(self, stream_hash, file_name, download_directory,
|
||||
data_payment_rate) -> typing.Awaitable[int]:
|
||||
def save_downloaded_file(self, stream_hash: str, file_name: typing.Optional[str],
|
||||
download_directory: typing.Optional[str], data_payment_rate: float,
|
||||
content_fee: typing.Optional[Transaction] = None) -> typing.Awaitable[int]:
|
||||
return self.save_published_file(
|
||||
stream_hash, file_name, download_directory, data_payment_rate, status="running"
|
||||
stream_hash, file_name, download_directory, data_payment_rate, status="running",
|
||||
content_fee=content_fee
|
||||
)
|
||||
|
||||
def save_published_file(self, stream_hash: str, file_name: typing.Optional[str],
|
||||
download_directory: typing.Optional[str], data_payment_rate: float,
|
||||
status="finished") -> typing.Awaitable[int]:
|
||||
return self.db.run(store_file, stream_hash, file_name, download_directory, data_payment_rate, status)
|
||||
status: str = "finished",
|
||||
content_fee: typing.Optional[Transaction] = None) -> typing.Awaitable[int]:
|
||||
return self.db.run(store_file, stream_hash, file_name, download_directory, data_payment_rate, status,
|
||||
content_fee)
|
||||
|
||||
async def update_manually_removed_files_since_last_run(self):
|
||||
"""
|
||||
Update files that have been removed from the downloads directory since the last run
|
||||
"""
|
||||
def update_manually_removed_files(transaction: sqlite3.Connection):
|
||||
removed = []
|
||||
for (stream_hash, download_directory, file_name) in transaction.execute(
|
||||
"select stream_hash, download_directory, file_name from file where saved_file=1"
|
||||
).fetchall():
|
||||
if download_directory and file_name and os.path.isfile(
|
||||
os.path.join(binascii.unhexlify(download_directory).decode(),
|
||||
binascii.unhexlify(file_name).decode())):
|
||||
continue
|
||||
else:
|
||||
removed.append((stream_hash,))
|
||||
if removed:
|
||||
transaction.executemany(
|
||||
"update file set file_name=null, download_directory=null, saved_file=0 where stream_hash=?",
|
||||
removed
|
||||
)
|
||||
return await self.db.run(update_manually_removed_files)
|
||||
|
||||
def get_all_lbry_files(self) -> typing.Awaitable[typing.List[typing.Dict]]:
|
||||
return self.db.run(get_all_lbry_files)
|
||||
@@ -534,7 +567,7 @@ class SQLiteStorage(SQLiteMixin):
|
||||
async def change_file_download_dir_and_file_name(self, stream_hash: str, download_dir: typing.Optional[str],
|
||||
file_name: typing.Optional[str]):
|
||||
if not file_name or not download_dir:
|
||||
encoded_file_name, encoded_download_dir = "{stream}", "{stream}"
|
||||
encoded_file_name, encoded_download_dir = None, None
|
||||
else:
|
||||
encoded_file_name = binascii.hexlify(file_name.encode()).decode()
|
||||
encoded_download_dir = binascii.hexlify(download_dir.encode()).decode()
|
||||
@@ -542,18 +575,34 @@ class SQLiteStorage(SQLiteMixin):
|
||||
encoded_download_dir, encoded_file_name, stream_hash,
|
||||
))
|
||||
|
||||
async def recover_streams(self, descriptors_and_sds: typing.List[typing.Tuple['StreamDescriptor', 'BlobFile']],
|
||||
async def save_content_fee(self, stream_hash: str, content_fee: Transaction):
|
||||
return await self.db.execute("update file set content_fee=? where stream_hash=?", (
|
||||
binascii.hexlify(content_fee.raw), stream_hash,
|
||||
))
|
||||
|
||||
async def set_saved_file(self, stream_hash: str):
|
||||
return await self.db.execute("update file set saved_file=1 where stream_hash=?", (
|
||||
stream_hash,
|
||||
))
|
||||
|
||||
async def clear_saved_file(self, stream_hash: str):
|
||||
return await self.db.execute("update file set saved_file=0 where stream_hash=?", (
|
||||
stream_hash,
|
||||
))
|
||||
|
||||
async def recover_streams(self, descriptors_and_sds: typing.List[typing.Tuple['StreamDescriptor', 'BlobFile',
|
||||
typing.Optional[Transaction]]],
|
||||
download_directory: str):
|
||||
def _recover(transaction: sqlite3.Connection):
|
||||
stream_hashes = [d.stream_hash for d, s in descriptors_and_sds]
|
||||
for descriptor, sd_blob in descriptors_and_sds:
|
||||
stream_hashes = [x[0].stream_hash for x in descriptors_and_sds]
|
||||
for descriptor, sd_blob, content_fee in descriptors_and_sds:
|
||||
content_claim = transaction.execute(
|
||||
"select * from content_claim where stream_hash=?", (descriptor.stream_hash, )
|
||||
).fetchone()
|
||||
delete_stream(transaction, descriptor) # this will also delete the content claim
|
||||
store_stream(transaction, sd_blob, descriptor)
|
||||
store_file(transaction, descriptor.stream_hash, os.path.basename(descriptor.suggested_file_name),
|
||||
download_directory, 0.0, 'stopped')
|
||||
download_directory, 0.0, 'stopped', content_fee=content_fee)
|
||||
if content_claim:
|
||||
transaction.execute("insert or ignore into content_claim values (?, ?)", content_claim)
|
||||
transaction.executemany(
|
||||
|
||||
+15
-6
@@ -6,6 +6,7 @@ from typing import Tuple, List
|
||||
from string import ascii_letters
|
||||
from decimal import Decimal, ROUND_UP
|
||||
from binascii import hexlify, unhexlify
|
||||
from google.protobuf.json_format import MessageToDict
|
||||
|
||||
from torba.client.hash import Base58
|
||||
from torba.client.constants import COIN
|
||||
@@ -22,12 +23,12 @@ from lbrynet.schema.types.v2.claim_pb2 import (
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def calculate_sha256_file_hash(file_path):
|
||||
sha256 = hashlib.sha256()
|
||||
def calculate_sha384_file_hash(file_path):
|
||||
sha384 = hashlib.sha384()
|
||||
with open(file_path, 'rb') as f:
|
||||
for chunk in iter(lambda: f.read(128 * sha256.block_size), b''):
|
||||
sha256.update(chunk)
|
||||
return sha256.digest()
|
||||
for chunk in iter(lambda: f.read(128 * sha384.block_size), b''):
|
||||
sha384.update(chunk)
|
||||
return sha384.digest()
|
||||
|
||||
|
||||
class Dimmensional(Metadata):
|
||||
@@ -130,7 +131,7 @@ class Source(Metadata):
|
||||
self.size = os.path.getsize(file_path)
|
||||
if self.size == 0:
|
||||
raise Exception(f"Cannot publish empty file: {file_path}")
|
||||
self.file_hash_bytes = calculate_sha256_file_hash(file_path)
|
||||
self.file_hash_bytes = calculate_sha384_file_hash(file_path)
|
||||
return stream_type
|
||||
|
||||
@property
|
||||
@@ -446,6 +447,14 @@ class Location(Metadata):
|
||||
else:
|
||||
raise ValueError(f'Could not parse country value: {value}')
|
||||
|
||||
def to_dict(self):
|
||||
d = MessageToDict(self.message)
|
||||
if self.message.longitude:
|
||||
d['longitude'] = self.longitude
|
||||
if self.message.latitude:
|
||||
d['latitude'] = self.latitude
|
||||
return d
|
||||
|
||||
@property
|
||||
def country(self) -> str:
|
||||
if self.message.country:
|
||||
|
||||
+23
-12
@@ -115,6 +115,8 @@ class BaseClaim:
|
||||
claim.update(claim.pop(self.claim_type))
|
||||
if 'languages' in claim:
|
||||
claim['languages'] = self.langtags
|
||||
if 'locations' in claim:
|
||||
claim['locations'] = [l.to_dict() for l in self.locations]
|
||||
return claim
|
||||
|
||||
def update(self, **kwargs):
|
||||
@@ -197,23 +199,24 @@ class Stream(BaseClaim):
|
||||
if 'address' in fee:
|
||||
fee['address'] = self.fee.address
|
||||
if 'amount' in fee:
|
||||
fee['amount'] = self.fee.amount
|
||||
fee['amount'] = str(self.fee.amount)
|
||||
stream_type = self.message.WhichOneof('type')
|
||||
if stream_type:
|
||||
claim['stream_type'] = stream_type
|
||||
return claim
|
||||
|
||||
def update(self, file_path=None, height=None, width=None, duration=None, **kwargs):
|
||||
self.fee.update(
|
||||
kwargs.pop('fee_address', None),
|
||||
kwargs.pop('fee_currency', None),
|
||||
kwargs.pop('fee_amount', None)
|
||||
)
|
||||
if kwargs.pop('clear_fee', False):
|
||||
self.message.ClearField('fee')
|
||||
else:
|
||||
self.fee.update(
|
||||
kwargs.pop('fee_address', None),
|
||||
kwargs.pop('fee_currency', None),
|
||||
kwargs.pop('fee_amount', None)
|
||||
)
|
||||
|
||||
if 'sd_hash' in kwargs:
|
||||
self.source.sd_hash = kwargs.pop('sd_hash')
|
||||
if 'file_size' in kwargs:
|
||||
self.source.size = kwargs.pop('file_size')
|
||||
if 'file_name' in kwargs:
|
||||
self.source.name = kwargs.pop('file_name')
|
||||
if 'file_hash' in kwargs:
|
||||
@@ -227,13 +230,17 @@ class Stream(BaseClaim):
|
||||
elif self.source.media_type:
|
||||
stream_type = guess_stream_type(self.source.media_type)
|
||||
|
||||
if 'file_size' in kwargs:
|
||||
self.source.size = kwargs.pop('file_size')
|
||||
|
||||
if stream_type in ('image', 'video', 'audio'):
|
||||
media = getattr(self, stream_type)
|
||||
media_args = {'file_metadata': None}
|
||||
try:
|
||||
media_args['file_metadata'] = binary_file_metadata(binary_file_parser(file_path))
|
||||
except:
|
||||
log.exception('Could not read file metadata.')
|
||||
if file_path is not None:
|
||||
try:
|
||||
media_args['file_metadata'] = binary_file_metadata(binary_file_parser(file_path))
|
||||
except:
|
||||
log.exception('Could not read file metadata.')
|
||||
if isinstance(media, Playable):
|
||||
media_args['duration'] = duration
|
||||
if isinstance(media, Dimmensional):
|
||||
@@ -287,6 +294,10 @@ class Stream(BaseClaim):
|
||||
def source(self) -> Source:
|
||||
return Source(self.message.source)
|
||||
|
||||
@property
|
||||
def stream_type(self) -> str:
|
||||
return self.message.WhichOneof('type')
|
||||
|
||||
@property
|
||||
def image(self) -> Image:
|
||||
return Image(self.message.image)
|
||||
|
||||
@@ -137,7 +137,7 @@ types_map = {
|
||||
'.zip': ('application/zip', 'binary'),
|
||||
|
||||
# These are non-standard types, commonly found in the wild.
|
||||
'.cbr': ('application/vnd.comicbook+zip', 'document'),
|
||||
'.cbr': ('application/vnd.comicbook-rar', 'document'),
|
||||
'.cbz': ('application/vnd.comicbook+zip', 'document'),
|
||||
'.lbry': ('application/x-ext-lbry', 'document'),
|
||||
'.mid': ('audio/midi', 'audio'),
|
||||
|
||||
@@ -47,6 +47,17 @@ def file_reader(file_path: str):
|
||||
|
||||
|
||||
class StreamDescriptor:
|
||||
__slots__ = [
|
||||
'loop',
|
||||
'blob_dir',
|
||||
'stream_name',
|
||||
'key',
|
||||
'suggested_file_name',
|
||||
'blobs',
|
||||
'stream_hash',
|
||||
'sd_hash'
|
||||
]
|
||||
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_dir: str, stream_name: str, key: str,
|
||||
suggested_file_name: str, blobs: typing.List[BlobInfo], stream_hash: typing.Optional[str] = None,
|
||||
sd_hash: typing.Optional[str] = None):
|
||||
|
||||
@@ -58,14 +58,14 @@ class StreamDownloader:
|
||||
|
||||
self.fixed_peers_handle = self.loop.call_later(self.fixed_peers_delay, _delayed_add_fixed_peers)
|
||||
|
||||
async def load_descriptor(self):
|
||||
async def load_descriptor(self, connection_id: int = 0):
|
||||
# download or get the sd blob
|
||||
sd_blob = self.blob_manager.get_blob(self.sd_hash)
|
||||
if not sd_blob.get_is_verified():
|
||||
try:
|
||||
now = self.loop.time()
|
||||
sd_blob = await asyncio.wait_for(
|
||||
self.blob_downloader.download_blob(self.sd_hash),
|
||||
self.blob_downloader.download_blob(self.sd_hash, connection_id),
|
||||
self.config.blob_download_timeout, loop=self.loop
|
||||
)
|
||||
log.info("downloaded sd blob %s", self.sd_hash)
|
||||
@@ -79,7 +79,7 @@ class StreamDownloader:
|
||||
)
|
||||
log.info("loaded stream manifest %s", self.sd_hash)
|
||||
|
||||
async def start(self, node: typing.Optional['Node'] = None):
|
||||
async def start(self, node: typing.Optional['Node'] = None, connection_id: int = 0):
|
||||
# set up peer accumulation
|
||||
if node:
|
||||
self.node = node
|
||||
@@ -90,7 +90,7 @@ class StreamDownloader:
|
||||
log.info("searching for peers for stream %s", self.sd_hash)
|
||||
|
||||
if not self.descriptor:
|
||||
await self.load_descriptor()
|
||||
await self.load_descriptor(connection_id)
|
||||
|
||||
# add the head blob to the peer search
|
||||
self.search_queue.put_nowait(self.descriptor.blobs[0].blob_hash)
|
||||
@@ -101,10 +101,10 @@ class StreamDownloader:
|
||||
self.blob_manager.get_blob(self.sd_hash, length=self.descriptor.length), self.descriptor
|
||||
)
|
||||
|
||||
async def download_stream_blob(self, blob_info: 'BlobInfo') -> 'AbstractBlob':
|
||||
async def download_stream_blob(self, blob_info: 'BlobInfo', connection_id: int = 0) -> 'AbstractBlob':
|
||||
if not filter(lambda blob: blob.blob_hash == blob_info.blob_hash, self.descriptor.blobs[:-1]):
|
||||
raise ValueError(f"blob {blob_info.blob_hash} is not part of stream with sd hash {self.sd_hash}")
|
||||
blob = await self.blob_downloader.download_blob(blob_info.blob_hash, blob_info.length)
|
||||
blob = await self.blob_downloader.download_blob(blob_info.blob_hash, blob_info.length, connection_id)
|
||||
return blob
|
||||
|
||||
def decrypt_blob(self, blob_info: 'BlobInfo', blob: 'AbstractBlob') -> bytes:
|
||||
@@ -112,11 +112,11 @@ class StreamDownloader:
|
||||
binascii.unhexlify(self.descriptor.key.encode()), binascii.unhexlify(blob_info.iv.encode())
|
||||
)
|
||||
|
||||
async def read_blob(self, blob_info: 'BlobInfo') -> bytes:
|
||||
async def read_blob(self, blob_info: 'BlobInfo', connection_id: int = 0) -> bytes:
|
||||
start = None
|
||||
if self.time_to_first_bytes is None:
|
||||
start = self.loop.time()
|
||||
blob = await self.download_stream_blob(blob_info)
|
||||
blob = await self.download_stream_blob(blob_info, connection_id)
|
||||
decrypted = self.decrypt_blob(blob_info, blob)
|
||||
if start:
|
||||
self.time_to_first_bytes = self.loop.time() - start
|
||||
|
||||
@@ -3,7 +3,9 @@ import asyncio
|
||||
import typing
|
||||
import logging
|
||||
import binascii
|
||||
from aiohttp.web import Request, StreamResponse
|
||||
from lbrynet.utils import generate_id
|
||||
from lbrynet.error import DownloadSDTimeout
|
||||
from lbrynet.schema.mime_types import guess_media_type
|
||||
from lbrynet.stream.downloader import StreamDownloader
|
||||
from lbrynet.stream.descriptor import StreamDescriptor
|
||||
@@ -40,6 +42,33 @@ class ManagedStream:
|
||||
STATUS_STOPPED = "stopped"
|
||||
STATUS_FINISHED = "finished"
|
||||
|
||||
__slots__ = [
|
||||
'loop',
|
||||
'config',
|
||||
'blob_manager',
|
||||
'sd_hash',
|
||||
'download_directory',
|
||||
'_file_name',
|
||||
'_status',
|
||||
'stream_claim_info',
|
||||
'download_id',
|
||||
'rowid',
|
||||
'written_bytes',
|
||||
'content_fee',
|
||||
'downloader',
|
||||
'analytics_manager',
|
||||
'fully_reflected',
|
||||
'file_output_task',
|
||||
'delayed_stop_task',
|
||||
'streaming_responses',
|
||||
'streaming',
|
||||
'_running',
|
||||
'saving',
|
||||
'finished_writing',
|
||||
'started_writing',
|
||||
|
||||
]
|
||||
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
sd_hash: str, download_directory: typing.Optional[str] = None, file_name: typing.Optional[str] = None,
|
||||
status: typing.Optional[str] = STATUS_STOPPED, claim: typing.Optional[StoredStreamClaim] = None,
|
||||
@@ -61,9 +90,13 @@ class ManagedStream:
|
||||
self.content_fee = content_fee
|
||||
self.downloader = StreamDownloader(self.loop, self.config, self.blob_manager, sd_hash, descriptor)
|
||||
self.analytics_manager = analytics_manager
|
||||
|
||||
self.fully_reflected = asyncio.Event(loop=self.loop)
|
||||
self.file_output_task: typing.Optional[asyncio.Task] = None
|
||||
self.delayed_stop: typing.Optional[asyncio.Handle] = None
|
||||
self.delayed_stop_task: typing.Optional[asyncio.Task] = None
|
||||
self.streaming_responses: typing.List[typing.Tuple[Request, StreamResponse]] = []
|
||||
self.streaming = asyncio.Event(loop=self.loop)
|
||||
self._running = asyncio.Event(loop=self.loop)
|
||||
self.saving = asyncio.Event(loop=self.loop)
|
||||
self.finished_writing = asyncio.Event(loop=self.loop)
|
||||
self.started_writing = asyncio.Event(loop=self.loop)
|
||||
@@ -84,9 +117,10 @@ class ManagedStream:
|
||||
def status(self) -> str:
|
||||
return self._status
|
||||
|
||||
def update_status(self, status: str):
|
||||
async def update_status(self, status: str):
|
||||
assert status in [self.STATUS_RUNNING, self.STATUS_STOPPED, self.STATUS_FINISHED]
|
||||
self._status = status
|
||||
await self.blob_manager.storage.change_file_status(self.stream_hash, status)
|
||||
|
||||
@property
|
||||
def finished(self) -> bool:
|
||||
@@ -164,23 +198,31 @@ class ManagedStream:
|
||||
return guess_media_type(os.path.basename(self.descriptor.suggested_file_name))[0]
|
||||
|
||||
def as_dict(self) -> typing.Dict:
|
||||
if self.written_bytes:
|
||||
written_bytes = self.written_bytes
|
||||
elif self.output_file_exists:
|
||||
written_bytes = os.stat(self.full_path).st_size
|
||||
full_path = self.full_path
|
||||
file_name = self.file_name
|
||||
download_directory = self.download_directory
|
||||
if self.full_path and self.output_file_exists:
|
||||
if self.written_bytes:
|
||||
written_bytes = self.written_bytes
|
||||
else:
|
||||
written_bytes = os.stat(self.full_path).st_size
|
||||
else:
|
||||
full_path = None
|
||||
file_name = None
|
||||
download_directory = None
|
||||
written_bytes = None
|
||||
return {
|
||||
'completed': self.finished,
|
||||
'file_name': self.file_name,
|
||||
'download_directory': self.download_directory,
|
||||
'completed': (self.output_file_exists and self.status in ('stopped', 'finished')) or all(
|
||||
self.blob_manager.is_blob_verified(b.blob_hash) for b in self.descriptor.blobs[:-1]),
|
||||
'file_name': file_name,
|
||||
'download_directory': download_directory,
|
||||
'points_paid': 0.0,
|
||||
'stopped': not self.running,
|
||||
'stream_hash': self.stream_hash,
|
||||
'stream_name': self.descriptor.stream_name,
|
||||
'suggested_file_name': self.descriptor.suggested_file_name,
|
||||
'sd_hash': self.descriptor.sd_hash,
|
||||
'download_path': self.full_path,
|
||||
'download_path': full_path,
|
||||
'mime_type': self.mime_type,
|
||||
'key': self.descriptor.key,
|
||||
'total_bytes_lower_bound': self.descriptor.lower_bound_decrypted_length(),
|
||||
@@ -199,7 +241,7 @@ class ManagedStream:
|
||||
'channel_claim_id': self.channel_claim_id,
|
||||
'channel_name': self.channel_name,
|
||||
'claim_name': self.claim_name,
|
||||
'content_fee': self.content_fee # TODO: this isn't in the database
|
||||
'content_fee': self.content_fee
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@@ -218,72 +260,115 @@ class ManagedStream:
|
||||
return cls(loop, config, blob_manager, descriptor.sd_hash, os.path.dirname(file_path),
|
||||
os.path.basename(file_path), status=cls.STATUS_FINISHED, rowid=row_id, descriptor=descriptor)
|
||||
|
||||
async def setup(self, node: typing.Optional['Node'] = None, save_file: typing.Optional[bool] = True,
|
||||
file_name: typing.Optional[str] = None, download_directory: typing.Optional[str] = None):
|
||||
await self.downloader.start(node)
|
||||
if not save_file and not file_name:
|
||||
if not await self.blob_manager.storage.file_exists(self.sd_hash):
|
||||
self.rowid = await self.blob_manager.storage.save_downloaded_file(
|
||||
self.stream_hash, None, None, 0.0
|
||||
)
|
||||
self.download_directory = None
|
||||
self._file_name = None
|
||||
self.update_status(ManagedStream.STATUS_RUNNING)
|
||||
await self.blob_manager.storage.change_file_status(self.stream_hash, ManagedStream.STATUS_RUNNING)
|
||||
self.update_delayed_stop()
|
||||
elif not os.path.isfile(self.full_path):
|
||||
await self.save_file(file_name, download_directory)
|
||||
await self.started_writing.wait()
|
||||
async def start(self, node: typing.Optional['Node'] = None, timeout: typing.Optional[float] = None,
|
||||
save_now: bool = False):
|
||||
timeout = timeout or self.config.download_timeout
|
||||
if self._running.is_set():
|
||||
return
|
||||
log.info("start downloader for stream (sd hash: %s)", self.sd_hash)
|
||||
self._running.set()
|
||||
try:
|
||||
await asyncio.wait_for(self.downloader.start(node), timeout, loop=self.loop)
|
||||
except asyncio.TimeoutError:
|
||||
self._running.clear()
|
||||
raise DownloadSDTimeout(self.sd_hash)
|
||||
|
||||
def update_delayed_stop(self):
|
||||
def _delayed_stop():
|
||||
log.info("Stopping inactive download for stream %s", self.sd_hash)
|
||||
self.stop_download()
|
||||
if self.delayed_stop_task and not self.delayed_stop_task.done():
|
||||
self.delayed_stop_task.cancel()
|
||||
self.delayed_stop_task = self.loop.create_task(self._delayed_stop())
|
||||
if not await self.blob_manager.storage.file_exists(self.sd_hash):
|
||||
if save_now:
|
||||
file_name, download_dir = self._file_name, self.download_directory
|
||||
else:
|
||||
file_name, download_dir = None, None
|
||||
self.rowid = await self.blob_manager.storage.save_downloaded_file(
|
||||
self.stream_hash, file_name, download_dir, 0.0
|
||||
)
|
||||
if self.status != self.STATUS_RUNNING:
|
||||
await self.update_status(self.STATUS_RUNNING)
|
||||
|
||||
if self.delayed_stop:
|
||||
self.delayed_stop.cancel()
|
||||
self.delayed_stop = self.loop.call_later(60, _delayed_stop)
|
||||
async def stop(self, finished: bool = False):
|
||||
"""
|
||||
Stop any running save/stream tasks as well as the downloader and update the status in the database
|
||||
"""
|
||||
|
||||
async def aiter_read_stream(self, start_blob_num: typing.Optional[int] = 0) -> typing.AsyncIterator[
|
||||
typing.Tuple['BlobInfo', bytes]]:
|
||||
self.stop_tasks()
|
||||
if (finished and self.status != self.STATUS_FINISHED) or self.status == self.STATUS_RUNNING:
|
||||
await self.update_status(self.STATUS_FINISHED if finished else self.STATUS_STOPPED)
|
||||
|
||||
async def _aiter_read_stream(self, start_blob_num: typing.Optional[int] = 0, connection_id: int = 0)\
|
||||
-> typing.AsyncIterator[typing.Tuple['BlobInfo', bytes]]:
|
||||
if start_blob_num >= len(self.descriptor.blobs[:-1]):
|
||||
raise IndexError(start_blob_num)
|
||||
for i, blob_info in enumerate(self.descriptor.blobs[start_blob_num:-1]):
|
||||
assert i + start_blob_num == blob_info.blob_num
|
||||
if self.delayed_stop:
|
||||
self.delayed_stop.cancel()
|
||||
try:
|
||||
decrypted = await self.downloader.read_blob(blob_info)
|
||||
yield (blob_info, decrypted)
|
||||
except asyncio.CancelledError:
|
||||
if not self.saving.is_set() and not self.finished_writing.is_set():
|
||||
self.update_delayed_stop()
|
||||
raise
|
||||
decrypted = await self.downloader.read_blob(blob_info, connection_id)
|
||||
yield (blob_info, decrypted)
|
||||
|
||||
async def stream_file(self, request: Request, node: typing.Optional['Node'] = None) -> StreamResponse:
|
||||
log.info("stream file to browser for lbry://%s#%s (sd hash %s...)", self.claim_name, self.claim_id,
|
||||
self.sd_hash[:6])
|
||||
await self.start(node)
|
||||
headers, size, skip_blobs = self._prepare_range_response_headers(request.headers.get('range', 'bytes=0-'))
|
||||
response = StreamResponse(
|
||||
status=206,
|
||||
headers=headers
|
||||
)
|
||||
await response.prepare(request)
|
||||
self.streaming_responses.append((request, response))
|
||||
self.streaming.set()
|
||||
try:
|
||||
wrote = 0
|
||||
async for blob_info, decrypted in self._aiter_read_stream(skip_blobs, connection_id=2):
|
||||
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)))
|
||||
await response.write_eof(decrypted)
|
||||
else:
|
||||
await response.write(decrypted)
|
||||
wrote += len(decrypted)
|
||||
log.info("sent browser %sblob %i/%i", "(final) " if response._eof_sent else "",
|
||||
blob_info.blob_num + 1, len(self.descriptor.blobs) - 1)
|
||||
if response._eof_sent:
|
||||
break
|
||||
return response
|
||||
finally:
|
||||
response.force_close()
|
||||
if (request, response) in self.streaming_responses:
|
||||
self.streaming_responses.remove((request, response))
|
||||
if not self.streaming_responses:
|
||||
self.streaming.clear()
|
||||
|
||||
@staticmethod
|
||||
def _write_decrypted_blob(handle: typing.IO, data: bytes):
|
||||
handle.write(data)
|
||||
handle.flush()
|
||||
|
||||
async def _save_file(self, output_path: str):
|
||||
log.debug("save file %s -> %s", self.sd_hash, output_path)
|
||||
log.info("save file for lbry://%s#%s (sd hash %s...) -> %s", self.claim_name, self.claim_id, self.sd_hash[:6],
|
||||
output_path)
|
||||
self.saving.set()
|
||||
self.finished_writing.clear()
|
||||
self.started_writing.clear()
|
||||
try:
|
||||
with open(output_path, 'wb') as file_write_handle:
|
||||
async for blob_info, decrypted in self.aiter_read_stream():
|
||||
async for blob_info, decrypted in self._aiter_read_stream(connection_id=1):
|
||||
log.info("write blob %i/%i", blob_info.blob_num + 1, len(self.descriptor.blobs) - 1)
|
||||
file_write_handle.write(decrypted)
|
||||
file_write_handle.flush()
|
||||
await self.loop.run_in_executor(None, self._write_decrypted_blob, file_write_handle, decrypted)
|
||||
self.written_bytes += len(decrypted)
|
||||
if not self.started_writing.is_set():
|
||||
self.started_writing.set()
|
||||
self.update_status(ManagedStream.STATUS_FINISHED)
|
||||
await self.blob_manager.storage.change_file_status(self.stream_hash, ManagedStream.STATUS_FINISHED)
|
||||
await self.update_status(ManagedStream.STATUS_FINISHED)
|
||||
if self.analytics_manager:
|
||||
self.loop.create_task(self.analytics_manager.send_download_finished(
|
||||
self.download_id, self.claim_name, self.sd_hash
|
||||
))
|
||||
self.finished_writing.set()
|
||||
log.info("finished saving file for lbry://%s#%s (sd hash %s...) -> %s", self.claim_name, self.claim_id,
|
||||
self.sd_hash[:6], self.full_path)
|
||||
await self.blob_manager.storage.set_saved_file(self.stream_hash)
|
||||
except Exception as err:
|
||||
if os.path.isfile(output_path):
|
||||
log.info("removing incomplete download %s for %s", output_path, self.sd_hash)
|
||||
log.warning("removing incomplete download %s for %s", output_path, self.sd_hash)
|
||||
os.remove(output_path)
|
||||
if not isinstance(err, asyncio.CancelledError):
|
||||
log.exception("unexpected error encountered writing file for stream %s", self.sd_hash)
|
||||
@@ -291,12 +376,11 @@ class ManagedStream:
|
||||
finally:
|
||||
self.saving.clear()
|
||||
|
||||
async def save_file(self, file_name: typing.Optional[str] = None, download_directory: typing.Optional[str] = None):
|
||||
if self.file_output_task and not self.file_output_task.done():
|
||||
async def save_file(self, file_name: typing.Optional[str] = None, download_directory: typing.Optional[str] = None,
|
||||
node: typing.Optional['Node'] = None):
|
||||
await self.start(node)
|
||||
if self.file_output_task and not self.file_output_task.done(): # cancel an already running save task
|
||||
self.file_output_task.cancel()
|
||||
if self.delayed_stop:
|
||||
self.delayed_stop.cancel()
|
||||
self.delayed_stop = None
|
||||
self.download_directory = download_directory or self.download_directory or self.config.download_dir
|
||||
if not self.download_directory:
|
||||
raise ValueError("no directory to download to")
|
||||
@@ -307,26 +391,26 @@ class ManagedStream:
|
||||
os.mkdir(self.download_directory)
|
||||
self._file_name = await get_next_available_file_name(
|
||||
self.loop, self.download_directory,
|
||||
file_name or self._file_name or self.descriptor.suggested_file_name
|
||||
file_name or self.descriptor.suggested_file_name
|
||||
)
|
||||
if not await self.blob_manager.storage.file_exists(self.sd_hash):
|
||||
self.rowid = self.blob_manager.storage.save_downloaded_file(
|
||||
self.stream_hash, self.file_name, self.download_directory, 0.0
|
||||
)
|
||||
else:
|
||||
await self.blob_manager.storage.change_file_download_dir_and_file_name(
|
||||
self.stream_hash, self.download_directory, self.file_name
|
||||
)
|
||||
self.update_status(ManagedStream.STATUS_RUNNING)
|
||||
await self.blob_manager.storage.change_file_status(self.stream_hash, ManagedStream.STATUS_RUNNING)
|
||||
await self.blob_manager.storage.change_file_download_dir_and_file_name(
|
||||
self.stream_hash, self.download_directory, self.file_name
|
||||
)
|
||||
await self.update_status(ManagedStream.STATUS_RUNNING)
|
||||
self.written_bytes = 0
|
||||
self.file_output_task = self.loop.create_task(self._save_file(self.full_path))
|
||||
await self.started_writing.wait()
|
||||
|
||||
def stop_download(self):
|
||||
def stop_tasks(self):
|
||||
if self.file_output_task and not self.file_output_task.done():
|
||||
self.file_output_task.cancel()
|
||||
self.file_output_task = None
|
||||
while self.streaming_responses:
|
||||
req, response = self.streaming_responses.pop()
|
||||
response.force_close()
|
||||
req.transport.close()
|
||||
self.downloader.stop()
|
||||
self._running.clear()
|
||||
|
||||
async def upload_to_reflector(self, host: str, port: int) -> typing.List[str]:
|
||||
sent = []
|
||||
@@ -367,3 +451,54 @@ class ManagedStream:
|
||||
binascii.hexlify(claim.to_bytes()).decode(), claim.signing_channel_id, claim_info['address'],
|
||||
claim_info['claim_sequence'], claim_info.get('channel_name')
|
||||
)
|
||||
|
||||
async def update_content_claim(self, claim_info: typing.Optional[typing.Dict] = None):
|
||||
if not claim_info:
|
||||
claim_info = await self.blob_manager.storage.get_content_claim(self.stream_hash)
|
||||
self.set_claim(claim_info, claim_info['value'])
|
||||
|
||||
async def _delayed_stop(self):
|
||||
stalled_count = 0
|
||||
while self._running.is_set():
|
||||
if self.saving.is_set() or self.streaming.is_set():
|
||||
stalled_count = 0
|
||||
else:
|
||||
stalled_count += 1
|
||||
if stalled_count > 1:
|
||||
log.info("stopping inactive download for lbry://%s#%s (%s...)", self.claim_name, self.claim_id,
|
||||
self.sd_hash[:6])
|
||||
await self.stop()
|
||||
return
|
||||
await asyncio.sleep(1, loop=self.loop)
|
||||
|
||||
def _prepare_range_response_headers(self, get_range: str) -> typing.Tuple[typing.Dict[str, str], int, int]:
|
||||
if '=' in get_range:
|
||||
get_range = get_range.split('=')[1]
|
||||
start, end = get_range.split('-')
|
||||
size = 0
|
||||
|
||||
for blob in self.descriptor.blobs[:-1]:
|
||||
size += blob.length - 1
|
||||
if self.stream_claim_info and self.stream_claim_info.claim.stream.source.size:
|
||||
size_from_claim = int(self.stream_claim_info.claim.stream.source.size)
|
||||
if not size_from_claim <= size <= size_from_claim + 16:
|
||||
raise ValueError("claim contains implausible stream size")
|
||||
log.debug("using stream size from claim")
|
||||
size = size_from_claim
|
||||
elif self.stream_claim_info:
|
||||
log.debug("estimating stream size")
|
||||
|
||||
start = int(start)
|
||||
end = int(end) if end else size - 1
|
||||
skip_blobs = start // 2097150
|
||||
skip = skip_blobs * 2097151
|
||||
start = skip
|
||||
final_size = end - start + 1
|
||||
|
||||
headers = {
|
||||
'Accept-Ranges': 'bytes',
|
||||
'Content-Range': f'bytes {start}-{end}/{size}',
|
||||
'Content-Length': str(final_size),
|
||||
'Content-Type': self.mime_type
|
||||
}
|
||||
return headers, size, skip_blobs
|
||||
@@ -5,8 +5,9 @@ import binascii
|
||||
import logging
|
||||
import random
|
||||
from decimal import Decimal
|
||||
from aiohttp.web import Request
|
||||
from lbrynet.error import ResolveError, InvalidStreamDescriptorError, KeyFeeAboveMaxAllowed, InsufficientFundsError
|
||||
from lbrynet.error import DownloadSDTimeout, DownloadDataTimeout, ResolveTimeout
|
||||
from lbrynet.error import ResolveTimeout, DownloadDataTimeout
|
||||
from lbrynet.utils import cache_concurrent
|
||||
from lbrynet.stream.descriptor import StreamDescriptor
|
||||
from lbrynet.stream.managed_stream import ManagedStream
|
||||
@@ -20,6 +21,7 @@ if typing.TYPE_CHECKING:
|
||||
from lbrynet.extras.daemon.analytics import AnalyticsManager
|
||||
from lbrynet.extras.daemon.storage import SQLiteStorage, StoredStreamClaim
|
||||
from lbrynet.wallet import LbryWalletManager
|
||||
from lbrynet.wallet.transaction import Transaction
|
||||
from lbrynet.extras.daemon.exchange_rate_manager import ExchangeRateManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -54,7 +56,10 @@ comparison_operators = {
|
||||
|
||||
|
||||
def path_or_none(p) -> typing.Optional[str]:
|
||||
return None if p == '{stream}' else binascii.unhexlify(p).decode()
|
||||
if not p:
|
||||
return
|
||||
return binascii.unhexlify(p).decode()
|
||||
|
||||
|
||||
class StreamManager:
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
@@ -68,38 +73,22 @@ class StreamManager:
|
||||
self.node = node
|
||||
self.analytics_manager = analytics_manager
|
||||
self.streams: typing.Dict[str, ManagedStream] = {}
|
||||
self.resume_downloading_task: asyncio.Task = None
|
||||
self.re_reflect_task: asyncio.Task = None
|
||||
self.resume_saving_task: typing.Optional[asyncio.Task] = None
|
||||
self.re_reflect_task: typing.Optional[asyncio.Task] = None
|
||||
self.update_stream_finished_futs: typing.List[asyncio.Future] = []
|
||||
self.running_reflector_uploads: typing.List[asyncio.Task] = []
|
||||
self.started = asyncio.Event(loop=self.loop)
|
||||
|
||||
async def _update_content_claim(self, stream: ManagedStream):
|
||||
claim_info = await self.storage.get_content_claim(stream.stream_hash)
|
||||
stream.set_claim(claim_info, claim_info['value'])
|
||||
|
||||
async def stop_stream(self, stream: ManagedStream):
|
||||
stream.stop_download()
|
||||
if not stream.finished and stream.output_file_exists:
|
||||
try:
|
||||
os.remove(stream.full_path)
|
||||
except OSError as err:
|
||||
log.warning("Failed to delete partial download %s from downloads directory: %s", stream.full_path,
|
||||
str(err))
|
||||
if stream.running:
|
||||
stream.update_status(ManagedStream.STATUS_STOPPED)
|
||||
await self.storage.change_file_status(stream.stream_hash, ManagedStream.STATUS_STOPPED)
|
||||
|
||||
async def start_stream(self, stream: ManagedStream):
|
||||
stream.update_status(ManagedStream.STATUS_RUNNING)
|
||||
await self.storage.change_file_status(stream.stream_hash, ManagedStream.STATUS_RUNNING)
|
||||
await stream.setup(self.node, save_file=self.config.save_files)
|
||||
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
|
||||
self.streams.setdefault(stream.sd_hash, stream).set_claim(claim_info, claim_info['value'])
|
||||
|
||||
async def recover_streams(self, file_infos: typing.List[typing.Dict]):
|
||||
to_restore = []
|
||||
|
||||
async def recover_stream(sd_hash: str, stream_hash: str, stream_name: str,
|
||||
suggested_file_name: str, key: str) -> typing.Optional[StreamDescriptor]:
|
||||
suggested_file_name: str, key: str,
|
||||
content_fee: typing.Optional['Transaction']) -> typing.Optional[StreamDescriptor]:
|
||||
sd_blob = self.blob_manager.get_blob(sd_hash)
|
||||
blobs = await self.storage.get_blobs_for_stream(stream_hash)
|
||||
descriptor = await StreamDescriptor.recover(
|
||||
@@ -107,12 +96,13 @@ class StreamManager:
|
||||
)
|
||||
if not descriptor:
|
||||
return
|
||||
to_restore.append((descriptor, sd_blob))
|
||||
to_restore.append((descriptor, sd_blob, content_fee))
|
||||
|
||||
await asyncio.gather(*[
|
||||
recover_stream(
|
||||
file_info['sd_hash'], file_info['stream_hash'], binascii.unhexlify(file_info['stream_name']).decode(),
|
||||
binascii.unhexlify(file_info['suggested_file_name']).decode(), file_info['key']
|
||||
binascii.unhexlify(file_info['suggested_file_name']).decode(), file_info['key'],
|
||||
file_info['content_fee']
|
||||
) for file_info in file_infos
|
||||
])
|
||||
|
||||
@@ -124,7 +114,7 @@ class StreamManager:
|
||||
|
||||
async def add_stream(self, rowid: int, sd_hash: str, file_name: typing.Optional[str],
|
||||
download_directory: typing.Optional[str], status: str,
|
||||
claim: typing.Optional['StoredStreamClaim']):
|
||||
claim: typing.Optional['StoredStreamClaim'], content_fee: typing.Optional['Transaction']):
|
||||
try:
|
||||
descriptor = await self.blob_manager.get_stream_descriptor(sd_hash)
|
||||
except InvalidStreamDescriptorError as err:
|
||||
@@ -132,56 +122,56 @@ class StreamManager:
|
||||
return
|
||||
stream = ManagedStream(
|
||||
self.loop, self.config, self.blob_manager, descriptor.sd_hash, download_directory, file_name, status,
|
||||
claim, rowid=rowid, descriptor=descriptor, analytics_manager=self.analytics_manager
|
||||
claim, content_fee=content_fee, rowid=rowid, descriptor=descriptor,
|
||||
analytics_manager=self.analytics_manager
|
||||
)
|
||||
self.streams[sd_hash] = stream
|
||||
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
|
||||
|
||||
async def load_streams_from_database(self):
|
||||
async def load_and_resume_streams_from_database(self):
|
||||
to_recover = []
|
||||
to_start = []
|
||||
await self.storage.sync_files_to_blobs()
|
||||
|
||||
await self.storage.update_manually_removed_files_since_last_run()
|
||||
|
||||
for file_info in await self.storage.get_all_lbry_files():
|
||||
# if the sd blob is not verified, try to reconstruct it from the database
|
||||
# this could either be because the blob files were deleted manually or save_blobs was not true when
|
||||
# the stream was downloaded
|
||||
if not self.blob_manager.is_blob_verified(file_info['sd_hash']):
|
||||
to_recover.append(file_info)
|
||||
to_start.append(file_info)
|
||||
if to_recover:
|
||||
# if self.blob_manager._save_blobs:
|
||||
# log.info("Attempting to recover %i streams", len(to_recover))
|
||||
await self.recover_streams(to_recover)
|
||||
|
||||
if not self.config.save_files:
|
||||
to_set_as_streaming = []
|
||||
for file_info in to_start:
|
||||
file_name = path_or_none(file_info['file_name'])
|
||||
download_dir = path_or_none(file_info['download_directory'])
|
||||
if file_name and download_dir and not os.path.isfile(os.path.join(file_name, download_dir)):
|
||||
file_info['file_name'], file_info['download_directory'] = '{stream}', '{stream}'
|
||||
to_set_as_streaming.append(file_info['stream_hash'])
|
||||
|
||||
if to_set_as_streaming:
|
||||
await self.storage.set_files_as_streaming(to_set_as_streaming)
|
||||
|
||||
log.info("Initializing %i files", len(to_start))
|
||||
if to_start:
|
||||
await asyncio.gather(*[
|
||||
self.add_stream(
|
||||
file_info['rowid'], file_info['sd_hash'], path_or_none(file_info['file_name']),
|
||||
path_or_none(file_info['download_directory']), file_info['status'],
|
||||
file_info['claim']
|
||||
) for file_info in to_start
|
||||
])
|
||||
to_resume_saving = []
|
||||
add_stream_tasks = []
|
||||
for file_info in to_start:
|
||||
file_name = path_or_none(file_info['file_name'])
|
||||
download_directory = path_or_none(file_info['download_directory'])
|
||||
if file_name and download_directory and not file_info['saved_file'] and file_info['status'] == 'running':
|
||||
to_resume_saving.append((file_name, download_directory, file_info['sd_hash']))
|
||||
add_stream_tasks.append(self.loop.create_task(self.add_stream(
|
||||
file_info['rowid'], file_info['sd_hash'], file_name,
|
||||
download_directory, file_info['status'],
|
||||
file_info['claim'], file_info['content_fee']
|
||||
)))
|
||||
if add_stream_tasks:
|
||||
await asyncio.gather(*add_stream_tasks, loop=self.loop)
|
||||
log.info("Started stream manager with %i files", len(self.streams))
|
||||
|
||||
async def resume(self):
|
||||
if not self.node:
|
||||
log.warning("no DHT node given, resuming downloads trusting that we can contact reflector")
|
||||
t = [
|
||||
self.loop.create_task(self.start_stream(stream)) for stream in self.streams.values()
|
||||
if stream.running
|
||||
]
|
||||
if t:
|
||||
log.info("resuming %i downloads", len(t))
|
||||
await asyncio.gather(*t, loop=self.loop)
|
||||
if to_resume_saving:
|
||||
self.resume_saving_task = self.loop.create_task(self.resume(to_resume_saving))
|
||||
|
||||
async def resume(self, to_resume_saving):
|
||||
log.info("Resuming saving %i files", len(to_resume_saving))
|
||||
await asyncio.gather(
|
||||
*(self.streams[sd_hash].save_file(file_name, download_directory, node=self.node)
|
||||
for (file_name, download_directory, sd_hash) in to_resume_saving),
|
||||
loop=self.loop
|
||||
)
|
||||
|
||||
async def reflect_streams(self):
|
||||
while True:
|
||||
@@ -203,22 +193,24 @@ class StreamManager:
|
||||
await asyncio.sleep(300, loop=self.loop)
|
||||
|
||||
async def start(self):
|
||||
await self.load_streams_from_database()
|
||||
self.resume_downloading_task = self.loop.create_task(self.resume())
|
||||
await self.load_and_resume_streams_from_database()
|
||||
self.re_reflect_task = self.loop.create_task(self.reflect_streams())
|
||||
self.started.set()
|
||||
|
||||
def stop(self):
|
||||
if self.resume_downloading_task and not self.resume_downloading_task.done():
|
||||
self.resume_downloading_task.cancel()
|
||||
if self.resume_saving_task and not self.resume_saving_task.done():
|
||||
self.resume_saving_task.cancel()
|
||||
if self.re_reflect_task and not self.re_reflect_task.done():
|
||||
self.re_reflect_task.cancel()
|
||||
while self.streams:
|
||||
_, stream = self.streams.popitem()
|
||||
stream.stop_download()
|
||||
stream.stop_tasks()
|
||||
while self.update_stream_finished_futs:
|
||||
self.update_stream_finished_futs.pop().cancel()
|
||||
while self.running_reflector_uploads:
|
||||
self.running_reflector_uploads.pop().cancel()
|
||||
self.started.clear()
|
||||
log.info("finished stopping the stream manager")
|
||||
|
||||
async def create_stream(self, file_path: str, key: typing.Optional[bytes] = None,
|
||||
iv_generator: typing.Optional[typing.Generator[bytes, None, None]] = None) -> ManagedStream:
|
||||
@@ -236,7 +228,7 @@ class StreamManager:
|
||||
return stream
|
||||
|
||||
async def delete_stream(self, stream: ManagedStream, delete_file: typing.Optional[bool] = False):
|
||||
await self.stop_stream(stream)
|
||||
stream.stop_tasks()
|
||||
if stream.sd_hash in self.streams:
|
||||
del self.streams[stream.sd_hash]
|
||||
blob_hashes = [stream.sd_hash] + [b.blob_hash for b in stream.descriptor.blobs[:-1]]
|
||||
@@ -290,21 +282,16 @@ class StreamManager:
|
||||
typing.Optional[ManagedStream], typing.Optional[ManagedStream]]:
|
||||
existing = self.get_filtered_streams(outpoint=outpoint)
|
||||
if existing:
|
||||
if existing[0].status == ManagedStream.STATUS_STOPPED:
|
||||
await self.start_stream(existing[0])
|
||||
return existing[0], None
|
||||
existing = self.get_filtered_streams(sd_hash=claim.stream.source.sd_hash)
|
||||
if existing and existing[0].claim_id != claim_id:
|
||||
raise ResolveError(f"stream for {existing[0].claim_id} collides with existing "
|
||||
f"download {claim_id}")
|
||||
raise ResolveError(f"stream for {existing[0].claim_id} collides with existing download {claim_id}")
|
||||
if existing:
|
||||
log.info("claim contains a metadata only update to a stream we have")
|
||||
await self.storage.save_content_claim(
|
||||
existing[0].stream_hash, outpoint
|
||||
)
|
||||
await self._update_content_claim(existing[0])
|
||||
if not existing[0].running:
|
||||
await self.start_stream(existing[0])
|
||||
return existing[0], None
|
||||
else:
|
||||
existing_for_claim_id = self.get_filtered_streams(claim_id=claim_id)
|
||||
@@ -318,13 +305,23 @@ class StreamManager:
|
||||
timeout: typing.Optional[float] = None,
|
||||
file_name: typing.Optional[str] = None,
|
||||
download_directory: typing.Optional[str] = None,
|
||||
save_file: bool = True, resolve_timeout: float = 3.0) -> ManagedStream:
|
||||
save_file: typing.Optional[bool] = None,
|
||||
resolve_timeout: float = 3.0) -> ManagedStream:
|
||||
timeout = timeout or self.config.download_timeout
|
||||
start_time = self.loop.time()
|
||||
resolved_time = None
|
||||
stream = None
|
||||
error = None
|
||||
outpoint = None
|
||||
if save_file is None:
|
||||
save_file = self.config.save_files
|
||||
if file_name and not save_file:
|
||||
save_file = True
|
||||
if save_file:
|
||||
download_directory = download_directory or self.config.download_dir
|
||||
else:
|
||||
download_directory = None
|
||||
|
||||
try:
|
||||
# resolve the claim
|
||||
parsed_uri = parse_lbry_uri(uri)
|
||||
@@ -351,9 +348,18 @@ class StreamManager:
|
||||
# resume or update an existing stream, if the stream changed download it and delete the old one after
|
||||
updated_stream, to_replace = await self._check_update_or_replace(outpoint, resolved['claim_id'], claim)
|
||||
if updated_stream:
|
||||
log.info("already have stream for %s", uri)
|
||||
if save_file and updated_stream.output_file_exists:
|
||||
save_file = False
|
||||
await updated_stream.start(node=self.node, timeout=timeout, save_now=save_file)
|
||||
if not updated_stream.output_file_exists and (save_file or file_name or download_directory):
|
||||
await updated_stream.save_file(
|
||||
file_name=file_name, download_directory=download_directory, node=self.node
|
||||
)
|
||||
return updated_stream
|
||||
|
||||
content_fee = None
|
||||
fee_amount, fee_address = None, None
|
||||
|
||||
# check that the fee is payable
|
||||
if not to_replace and claim.stream.has_fee:
|
||||
@@ -374,40 +380,38 @@ class StreamManager:
|
||||
raise InsufficientFundsError(msg)
|
||||
fee_address = claim.stream.fee.address
|
||||
|
||||
content_fee = await self.wallet.send_amount_to_address(
|
||||
lbc_to_dewies(str(fee_amount)), fee_address.encode('latin1')
|
||||
)
|
||||
|
||||
log.info("paid fee of %s for %s", fee_amount, uri)
|
||||
|
||||
download_directory = download_directory or self.config.download_dir
|
||||
if not file_name and (not self.config.save_files or not save_file):
|
||||
download_dir, file_name = None, None
|
||||
stream = ManagedStream(
|
||||
self.loop, self.config, self.blob_manager, claim.stream.source.sd_hash, download_directory,
|
||||
file_name, ManagedStream.STATUS_RUNNING, content_fee=content_fee,
|
||||
analytics_manager=self.analytics_manager
|
||||
)
|
||||
log.info("starting download for %s", uri)
|
||||
try:
|
||||
await asyncio.wait_for(stream.setup(
|
||||
self.node, save_file=save_file, file_name=file_name, download_directory=download_directory
|
||||
), timeout, loop=self.loop)
|
||||
except asyncio.TimeoutError:
|
||||
if not stream.descriptor:
|
||||
raise DownloadSDTimeout(stream.sd_hash)
|
||||
raise DownloadDataTimeout(stream.sd_hash)
|
||||
|
||||
before_download = self.loop.time()
|
||||
await stream.start(self.node, timeout)
|
||||
stream.set_claim(resolved, claim)
|
||||
if to_replace: # delete old stream now that the replacement has started downloading
|
||||
await self.delete_stream(to_replace)
|
||||
stream.set_claim(resolved, claim)
|
||||
await self.storage.save_content_claim(stream.stream_hash, outpoint)
|
||||
elif fee_address:
|
||||
stream.content_fee = await self.wallet.send_amount_to_address(
|
||||
lbc_to_dewies(str(fee_amount)), fee_address.encode('latin1')
|
||||
)
|
||||
log.info("paid fee of %s for %s", fee_amount, uri)
|
||||
await self.storage.save_content_fee(stream.stream_hash, stream.content_fee)
|
||||
|
||||
self.streams[stream.sd_hash] = stream
|
||||
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
|
||||
await self.storage.save_content_claim(stream.stream_hash, outpoint)
|
||||
if save_file:
|
||||
await asyncio.wait_for(stream.save_file(node=self.node), timeout - (self.loop.time() - before_download),
|
||||
loop=self.loop)
|
||||
return stream
|
||||
except Exception as err:
|
||||
except asyncio.TimeoutError:
|
||||
error = DownloadDataTimeout(stream.sd_hash)
|
||||
raise error
|
||||
except Exception as err: # forgive data timeout, dont delete stream
|
||||
error = err
|
||||
if stream and stream.descriptor:
|
||||
await self.storage.delete_stream(stream.descriptor)
|
||||
await self.blob_manager.delete_blob(stream.sd_hash)
|
||||
raise
|
||||
finally:
|
||||
if self.analytics_manager and (error or (stream and (stream.downloader.time_to_descriptor or
|
||||
stream.downloader.time_to_first_bytes))):
|
||||
@@ -427,5 +431,6 @@ class StreamManager:
|
||||
None if not error else error.__class__.__name__
|
||||
)
|
||||
)
|
||||
if error:
|
||||
raise error
|
||||
|
||||
async def stream_partial_content(self, request: Request, sd_hash: str):
|
||||
return await self.streams[sd_hash].stream_file(request, self.node)
|
||||
+46
-21
@@ -124,7 +124,7 @@ class CommandTestCase(IntegrationTestCase):
|
||||
async def asyncTearDown(self):
|
||||
await super().asyncTearDown()
|
||||
self.wallet_component._running = False
|
||||
await self.daemon.stop()
|
||||
await self.daemon.stop(shutdown_runner=False)
|
||||
|
||||
async def confirm_tx(self, txid):
|
||||
""" Wait for tx to be in mempool, then generate a block, wait for tx to be in a block. """
|
||||
@@ -151,8 +151,17 @@ class CommandTestCase(IntegrationTestCase):
|
||||
await self.blockchain.generate(blocks)
|
||||
await self.ledger.on_header.where(self.blockchain.is_expected_block)
|
||||
|
||||
def blockchain_claim_name(self, name: str, value: str, amount: str):
|
||||
return self.blockchain._cli_cmnd('claimname', name, value, amount)
|
||||
async def blockchain_claim_name(self, name: str, value: str, amount: str, confirm=True):
|
||||
txid = await self.blockchain._cli_cmnd('claimname', name, value, amount)
|
||||
if confirm:
|
||||
await self.generate(1)
|
||||
return txid
|
||||
|
||||
async def blockchain_update_name(self, txid: str, value: str, amount: str, confirm=True):
|
||||
txid = await self.blockchain._cli_cmnd('updateclaim', txid, value, amount)
|
||||
if confirm:
|
||||
await self.generate(1)
|
||||
return txid
|
||||
|
||||
async def out(self, awaitable):
|
||||
""" Serializes lbrynet API results to JSON then loads and returns it as dictionary. """
|
||||
@@ -163,27 +172,43 @@ class CommandTestCase(IntegrationTestCase):
|
||||
return json.loads(jsonrpc_dumps_pretty(value, ledger=self.ledger))['result']
|
||||
|
||||
async def stream_create(self, name='hovercraft', bid='1.0', data=b'hi!', confirm=True, **kwargs):
|
||||
with tempfile.NamedTemporaryFile() as file:
|
||||
file.write(data)
|
||||
file.flush()
|
||||
claim = await self.out(
|
||||
self.daemon.jsonrpc_stream_create(name, bid, file_path=file.name, **kwargs)
|
||||
)
|
||||
self.assertEqual(claim['outputs'][0]['name'], name)
|
||||
if confirm:
|
||||
await self.on_transaction_dict(claim)
|
||||
await self.generate(1)
|
||||
await self.on_transaction_dict(claim)
|
||||
return claim
|
||||
file = tempfile.NamedTemporaryFile()
|
||||
|
||||
def cleanup():
|
||||
try:
|
||||
file.close()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
self.addCleanup(cleanup)
|
||||
file.write(data)
|
||||
file.flush()
|
||||
claim = await self.out(
|
||||
self.daemon.jsonrpc_stream_create(name, bid, file_path=file.name, **kwargs)
|
||||
)
|
||||
self.assertEqual(claim['outputs'][0]['name'], name)
|
||||
if confirm:
|
||||
await self.on_transaction_dict(claim)
|
||||
await self.generate(1)
|
||||
await self.on_transaction_dict(claim)
|
||||
return claim
|
||||
|
||||
async def stream_update(self, claim_id, data=None, confirm=True, **kwargs):
|
||||
if data:
|
||||
with tempfile.NamedTemporaryFile() as file:
|
||||
file.write(data)
|
||||
file.flush()
|
||||
claim = await self.out(
|
||||
self.daemon.jsonrpc_stream_update(claim_id, file_path=file.name, **kwargs)
|
||||
)
|
||||
file = tempfile.NamedTemporaryFile()
|
||||
file.write(data)
|
||||
file.flush()
|
||||
|
||||
def cleanup():
|
||||
try:
|
||||
file.close()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
self.addCleanup(cleanup)
|
||||
claim = await self.out(
|
||||
self.daemon.jsonrpc_stream_update(claim_id, file_path=file.name, **kwargs)
|
||||
)
|
||||
else:
|
||||
claim = await self.out(self.daemon.jsonrpc_stream_update(claim_id, **kwargs))
|
||||
self.assertIsNotNone(claim['outputs'][0]['name'])
|
||||
|
||||
@@ -4,7 +4,7 @@ import binascii
|
||||
from hashlib import sha256
|
||||
from string import hexdigits
|
||||
|
||||
from torba.client.baseaccount import BaseAccount
|
||||
from torba.client.baseaccount import BaseAccount, HierarchicalDeterministic
|
||||
from torba.client.basetransaction import TXORef
|
||||
|
||||
|
||||
@@ -167,10 +167,11 @@ class Account(BaseAccount):
|
||||
))
|
||||
|
||||
async def save_max_gap(self):
|
||||
gap = await self.get_max_gap()
|
||||
self.receiving.gap = max(20, gap['max_receiving_gap'] + 1)
|
||||
self.change.gap = max(6, gap['max_change_gap'] + 1)
|
||||
self.wallet.save()
|
||||
if issubclass(self.address_generator, HierarchicalDeterministic):
|
||||
gap = await self.get_max_gap()
|
||||
self.receiving.gap = max(20, gap['max_receiving_gap'] + 1)
|
||||
self.change.gap = max(6, gap['max_change_gap'] + 1)
|
||||
self.wallet.save()
|
||||
|
||||
def get_balance(self, confirmations=0, include_claims=False, **constraints):
|
||||
if not include_claims:
|
||||
|
||||
@@ -308,13 +308,6 @@ class LbryWalletManager(BaseWalletManager):
|
||||
for wallet in self.wallets:
|
||||
wallet.save()
|
||||
|
||||
def get_block(self, block_hash=None, height=None):
|
||||
if height is None:
|
||||
height = self.ledger.headers.height
|
||||
if block_hash is None:
|
||||
block_hash = self.ledger.headers.hash(height).decode()
|
||||
return self.ledger.network.get_block(block_hash)
|
||||
|
||||
def get_claim_by_claim_id(self, claim_id):
|
||||
return self.ledger.get_claim_by_claim_id(claim_id)
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@ from torba.client.basenetwork import BaseNetwork
|
||||
|
||||
class Network(BaseNetwork):
|
||||
|
||||
def get_block(self, block_hash):
|
||||
return self.rpc('blockchain.block.get_block', block_hash)
|
||||
|
||||
def get_server_height(self):
|
||||
return self.rpc('blockchain.block.get_server_height')
|
||||
|
||||
|
||||
@@ -152,6 +152,10 @@ class Resolver:
|
||||
if not claim_result or 'value' not in claim_result:
|
||||
return claim_result
|
||||
claim_result = _decode_claim_result(claim_result)
|
||||
if claim_result.get('height'):
|
||||
claim_result['timestamp'] = self.ledger.headers[claim_result['height']]['timestamp']
|
||||
if claim_result.get('depth'):
|
||||
claim_result['confirmations'] = claim_result.pop('depth')
|
||||
|
||||
if claim_result['value']:
|
||||
claim_result['has_signature'] = False
|
||||
@@ -296,10 +300,11 @@ def _verify_proof(name, claim_trie_root, result, ledger):
|
||||
'amount': output.amount,
|
||||
'effective_amount': output.amount + support_amount,
|
||||
'height': result['height'],
|
||||
'depth': result['depth'],
|
||||
'confirmations': result['depth'],
|
||||
'claim_sequence': result['claim_sequence'],
|
||||
'address': output.get_address(ledger),
|
||||
'valid_at_height': result['valid_at_height'],
|
||||
'timestamp': ledger.headers[result['height']]['timestamp'],
|
||||
'supports': result['supports']
|
||||
}
|
||||
return r
|
||||
|
||||
@@ -41,7 +41,6 @@ class LBRYElectrumX(ElectrumX):
|
||||
'blockchain.claimtrie.getvaluesforuris': self.claimtrie_getvalueforuris,
|
||||
'blockchain.claimtrie.getclaimssignedbyid': self.claimtrie_getclaimssignedbyid,
|
||||
'blockchain.block.get_server_height': self.get_server_height,
|
||||
'blockchain.block.get_block': self.get_block,
|
||||
}
|
||||
# fixme: methods we use but shouldnt be using anymore. To be removed when torba goes out
|
||||
handlers.update({
|
||||
@@ -104,9 +103,6 @@ class LBRYElectrumX(ElectrumX):
|
||||
verbose = False
|
||||
return await self.daemon_request('getrawtransaction', tx_hash, verbose)
|
||||
|
||||
async def get_block(self, block_hash):
|
||||
return await self.daemon.deserialised_block(block_hash)
|
||||
|
||||
async def get_server_height(self):
|
||||
return self.bp.height
|
||||
|
||||
|
||||
@@ -82,10 +82,6 @@ class Examples(CommandTestCase):
|
||||
'Get settings',
|
||||
'settings', 'get'
|
||||
)
|
||||
await r(
|
||||
'Show contents of the first block.',
|
||||
'block_show', '--height=1'
|
||||
)
|
||||
|
||||
# accounts
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from lbrynet.blob.blob_file import MAX_BLOB_SIZE
|
||||
from lbrynet.conf import Config
|
||||
from lbrynet.schema.uri import parse_lbry_uri
|
||||
from lbrynet.extras.daemon.client import daemon_rpc
|
||||
from lbrynet.extras import system_info, cli
|
||||
from lbrynet.extras import system_info
|
||||
|
||||
|
||||
def extract_uris(response):
|
||||
@@ -58,7 +58,7 @@ def variance(times):
|
||||
return round(sum(((i - mean) ** 2.0 for i in times)) / (len(times) - 1), 3)
|
||||
|
||||
|
||||
async def wait_for_done(conf, uri):
|
||||
async def wait_for_done(conf, uri, timeout):
|
||||
name = uri.split("#")[0]
|
||||
last_complete = 0
|
||||
hang_count = 0
|
||||
@@ -73,11 +73,11 @@ async def wait_for_done(conf, uri):
|
||||
else:
|
||||
hang_count += 1
|
||||
await asyncio.sleep(1.0)
|
||||
if hang_count > 10:
|
||||
if hang_count > timeout:
|
||||
return False, file['blobs_completed'], file['blobs_in_stream']
|
||||
|
||||
|
||||
async def main(uris=None, allow_fees=False):
|
||||
async def main(uris=None, cmd_args=None):
|
||||
if not uris:
|
||||
uris = await get_frontpage_uris()
|
||||
conf = Config()
|
||||
@@ -93,7 +93,7 @@ async def main(uris=None, allow_fees=False):
|
||||
async def __resolve(name):
|
||||
resolved = await daemon_rpc(conf, 'resolve', urls=[name])
|
||||
if 'error' not in resolved.get(name, {}):
|
||||
if ("fee" not in resolved[name]['claim']['value']) or allow_fees:
|
||||
if ("fee" not in resolved[name]['claim']['value']) or cmd_args.allow_fees:
|
||||
resolvable.append(name)
|
||||
else:
|
||||
print(f"{name} has a fee, skipping it")
|
||||
@@ -114,24 +114,29 @@ async def main(uris=None, allow_fees=False):
|
||||
for i, uri in enumerate(resolvable):
|
||||
start = time.time()
|
||||
try:
|
||||
await daemon_rpc(conf, 'get', uri=uri)
|
||||
await daemon_rpc(conf, 'get', uri=uri, save_file=True)
|
||||
first_byte = time.time()
|
||||
first_byte_times.append(first_byte - start)
|
||||
print(f"{i + 1}/{len(resolvable)} - {first_byte - start} {uri}")
|
||||
downloaded, amount_downloaded, blobs_in_stream = await wait_for_done(conf, uri)
|
||||
if downloaded:
|
||||
download_successes.append(uri)
|
||||
else:
|
||||
download_failures.append(uri)
|
||||
mbs = round((blobs_in_stream * (MAX_BLOB_SIZE - 1)) / (time.time() - start) / 1000000, 2)
|
||||
download_speeds.append(mbs)
|
||||
print(f"downloaded {amount_downloaded}/{blobs_in_stream} blobs for {uri} at "
|
||||
f"{mbs}mb/s")
|
||||
except:
|
||||
print(f"{i + 1}/{len(uris)} - failed to start {uri}")
|
||||
if not cmd_args.head_blob_only:
|
||||
downloaded, amount_downloaded, blobs_in_stream = await wait_for_done(
|
||||
conf, uri, cmd_args.stall_download_timeout
|
||||
)
|
||||
if downloaded:
|
||||
download_successes.append(uri)
|
||||
else:
|
||||
download_failures.append(uri)
|
||||
mbs = round((blobs_in_stream * (MAX_BLOB_SIZE - 1)) / (time.time() - start) / 1000000, 2)
|
||||
download_speeds.append(mbs)
|
||||
print(f"downloaded {amount_downloaded}/{blobs_in_stream} blobs for {uri} at "
|
||||
f"{mbs}mb/s")
|
||||
except Exception as e:
|
||||
print(f"{i + 1}/{len(uris)} - failed to start {uri}: {e}")
|
||||
failed_to_start.append(uri)
|
||||
return
|
||||
# await daemon_rpc(conf, 'file_delete', delete_from_download_dir=True, claim_name=parse_lbry_uri(uri).name)
|
||||
if cmd_args.exit_on_error:
|
||||
return
|
||||
if cmd_args.delete_after_download or cmd_args.head_blob_only:
|
||||
await daemon_rpc(conf, 'file_delete', delete_from_download_dir=True, claim_name=parse_lbry_uri(uri).name)
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
print("**********************************************")
|
||||
@@ -140,12 +145,13 @@ async def main(uris=None, allow_fees=False):
|
||||
f"Best first byte time: {round(min(first_byte_times), 2)}\n" \
|
||||
f"95% confidence time-to-first-byte: {confidence(first_byte_times, 1.984)}s\n" \
|
||||
f"99% confidence time-to-first-byte: {confidence(first_byte_times, 2.626)}s\n" \
|
||||
f"Variance: {variance(first_byte_times)}\n" \
|
||||
f"Downloaded {len(download_successes)}/{len(resolvable)}\n" \
|
||||
f"Best stream download speed: {round(max(download_speeds), 2)}mb/s\n" \
|
||||
f"Worst stream download speed: {round(min(download_speeds), 2)}mb/s\n" \
|
||||
f"95% confidence download speed: {confidence(download_speeds, 1.984, False)}mb/s\n" \
|
||||
f"99% confidence download speed: {confidence(download_speeds, 2.626, False)}mb/s\n"
|
||||
f"Variance: {variance(first_byte_times)}\n"
|
||||
if not cmd_args.head_blob_only:
|
||||
result += f"Downloaded {len(download_successes)}/{len(resolvable)}\n" \
|
||||
f"Best stream download speed: {round(max(download_speeds), 2)}mb/s\n" \
|
||||
f"Worst stream download speed: {round(min(download_speeds), 2)}mb/s\n" \
|
||||
f"95% confidence download speed: {confidence(download_speeds, 1.984, False)}mb/s\n" \
|
||||
f"99% confidence download speed: {confidence(download_speeds, 2.626, False)}mb/s\n"
|
||||
|
||||
if failed_to_start:
|
||||
result += "\nFailed to start:" + "\n".join([f for f in failed_to_start])
|
||||
@@ -160,9 +166,12 @@ async def main(uris=None, allow_fees=False):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--data_dir")
|
||||
parser.add_argument("--wallet_dir")
|
||||
parser.add_argument("--download_directory")
|
||||
#parser.add_argument("--data_dir")
|
||||
#parser.add_argument("--wallet_dir")
|
||||
#parser.add_argument("--download_directory")
|
||||
parser.add_argument("--allow_fees", action='store_true')
|
||||
args = parser.parse_args()
|
||||
asyncio.run(main(allow_fees=args.allow_fees))
|
||||
parser.add_argument("--exit_on_error", action='store_true')
|
||||
parser.add_argument("--stall_download_timeout", default=10, type=int)
|
||||
parser.add_argument("--delete_after_download", action='store_true')
|
||||
parser.add_argument("--head_blob_only", action='store_true')
|
||||
asyncio.run(main(cmd_args=parser.parse_args()))
|
||||
@@ -92,7 +92,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
|
||||
# After abandoning he just waits for his LBCs to be returned to his account
|
||||
await self.generate(5)
|
||||
result = await self.daemon.jsonrpc_account_balance()
|
||||
self.assertEqual(result, '8.9693545')
|
||||
self.assertEqual(result, '8.9693455')
|
||||
|
||||
# Amidst all this Chris receives a call from his friend Ramsey
|
||||
# who says that it is of utmost urgency that Chris transfer him
|
||||
@@ -108,7 +108,7 @@ class EpicAdventuresOfChris45(CommandTestCase):
|
||||
await self.generate(5)
|
||||
result = await self.daemon.jsonrpc_account_balance()
|
||||
# Chris' balance was correct
|
||||
self.assertEqual(result, '7.9692305')
|
||||
self.assertEqual(result, '7.9692215')
|
||||
|
||||
# Ramsey too assured him that he had received the 1 LBC and thanks him
|
||||
result = await self.daemon.jsonrpc_account_balance(ramsey_account_id)
|
||||
|
||||
@@ -125,6 +125,13 @@ class ChannelCommands(CommandTestCase):
|
||||
channel = tx['outputs'][0]['value']
|
||||
self.assertNotEqual(channel['public_key'], fixed_values['public_key'])
|
||||
|
||||
# replace mode (clears everything except public_key)
|
||||
tx = await self.out(self.channel_update(claim_id, replace=True, title='foo', email='new@email.com'))
|
||||
self.assertEqual(
|
||||
tx['outputs'][0]['value'],
|
||||
{'public_key': channel['public_key'], 'title': 'foo', 'email': 'new@email.com'}
|
||||
)
|
||||
|
||||
# send channel to someone else
|
||||
new_account = await self.out(self.daemon.jsonrpc_account_create('second account'))
|
||||
account2_id, account2 = new_account['id'], self.daemon.get_account_or_error(new_account['id'])
|
||||
@@ -207,14 +214,14 @@ class StreamCommands(CommandTestCase):
|
||||
tx = await self.stream_update(claim_id, bid='3.0')
|
||||
self.assertEqual(tx['outputs'][0]['amount'], '3.0')
|
||||
|
||||
await self.assertBalance(self.account, '6.993337')
|
||||
await self.assertBalance(self.account, '6.993319')
|
||||
|
||||
# not enough funds
|
||||
with self.assertRaisesRegex(
|
||||
InsufficientFundsError, "Not enough funds to cover this transaction."):
|
||||
await self.stream_create('foo2', '9.0')
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 1)
|
||||
await self.assertBalance(self.account, '6.993337')
|
||||
await self.assertBalance(self.account, '6.993319')
|
||||
|
||||
# spend exactly amount available, no change
|
||||
tx = await self.stream_create('foo3', '6.98523')
|
||||
@@ -251,16 +258,57 @@ class StreamCommands(CommandTestCase):
|
||||
self.assertEqual(channels[0]['name'], '@baz')
|
||||
|
||||
# defaults to using all accounts to lookup channel
|
||||
await self.stream_create('hovercraft1', channel_id=baz_id)
|
||||
await self.stream_create('hovercraft1', '0.1', channel_id=baz_id)
|
||||
self.assertEqual((await self.claim_search('hovercraft1'))[0]['channel_name'], '@baz')
|
||||
# uses only the specific accounts which contains the channel
|
||||
await self.stream_create('hovercraft2', channel_id=baz_id, channel_account_id=[account2_id])
|
||||
# lookup by channel_name in all accounts
|
||||
await self.stream_create('hovercraft2', '0.1', channel_name='@baz')
|
||||
self.assertEqual((await self.claim_search('hovercraft2'))[0]['channel_name'], '@baz')
|
||||
# uses only the specific accounts which contains the channel
|
||||
await self.stream_create('hovercraft3', '0.1', channel_id=baz_id, channel_account_id=[account2_id])
|
||||
self.assertEqual((await self.claim_search('hovercraft3'))[0]['channel_name'], '@baz')
|
||||
# lookup by channel_name in specific account
|
||||
await self.stream_create('hovercraft4', '0.1', channel_name='@baz', channel_account_id=[account2_id])
|
||||
self.assertEqual((await self.claim_search('hovercraft4'))[0]['channel_name'], '@baz')
|
||||
# fails when specifying account which does not contain channel
|
||||
with self.assertRaisesRegex(ValueError, "Couldn't find channel with channel_id"):
|
||||
await self.stream_create(
|
||||
'hovercraft3', channel_id=baz_id, channel_account_id=[account1_id]
|
||||
'hovercraft5', '0.1', channel_id=baz_id, channel_account_id=[account1_id]
|
||||
)
|
||||
# fail with channel_name
|
||||
with self.assertRaisesRegex(ValueError, "Couldn't find channel with channel_name '@baz'"):
|
||||
await self.stream_create(
|
||||
'hovercraft5', '0.1', channel_name='@baz', channel_account_id=[account1_id]
|
||||
)
|
||||
|
||||
async def test_preview_works_with_signed_streams(self):
|
||||
await self.out(self.channel_create('@spam', '1.0'))
|
||||
signed = await self.out(self.stream_create('bar', '1.0', channel_name='@spam', preview=True, confirm=False))
|
||||
self.assertTrue(signed['outputs'][0]['is_channel_signature_valid'])
|
||||
|
||||
async def test_publish_updates_file_list(self):
|
||||
tx = await self.out(self.stream_create(title='created'))
|
||||
txo = tx['outputs'][0]
|
||||
claim_id, expected = txo['claim_id'], txo['value']
|
||||
files = self.sout(self.daemon.jsonrpc_file_list())
|
||||
self.assertEqual(1, len(files))
|
||||
self.assertEqual(tx['txid'], files[0]['txid'])
|
||||
self.assertEqual(expected, files[0]['metadata'])
|
||||
|
||||
# update with metadata-only changes
|
||||
tx = await self.out(self.stream_update(claim_id, title='update 1'))
|
||||
files = self.sout(self.daemon.jsonrpc_file_list())
|
||||
expected['title'] = 'update 1'
|
||||
self.assertEqual(1, len(files))
|
||||
self.assertEqual(tx['txid'], files[0]['txid'])
|
||||
self.assertEqual(expected, files[0]['metadata'])
|
||||
|
||||
# update with new data
|
||||
tx = await self.out(self.stream_update(claim_id, title='update 2', data=b'updated data'))
|
||||
expected = tx['outputs'][0]['value']
|
||||
files = self.sout(self.daemon.jsonrpc_file_list())
|
||||
self.assertEqual(1, len(files))
|
||||
self.assertEqual(tx['txid'], files[0]['txid'])
|
||||
self.assertEqual(expected, files[0]['metadata'])
|
||||
|
||||
async def test_setting_stream_fields(self):
|
||||
values = {
|
||||
@@ -269,7 +317,7 @@ class StreamCommands(CommandTestCase):
|
||||
'thumbnail_url': "https://co.ol/thumbnail.png",
|
||||
'tags': ["cool", "awesome"],
|
||||
'languages': ["en"],
|
||||
'locations': ['{"country": "US"}'],
|
||||
'locations': ['US:NH:Manchester:03101:42.990605:-71.460989'],
|
||||
|
||||
'author': "Jules Verne",
|
||||
'license': 'Public Domain',
|
||||
@@ -281,17 +329,24 @@ class StreamCommands(CommandTestCase):
|
||||
'fee_address': 'mmCsWAiXMUVecFQ3fVzUwvpT9XFMXno2Ca',
|
||||
}
|
||||
fixed_values = values.copy()
|
||||
fixed_values['locations'] = [{'country': 'US'}]
|
||||
fixed_values['locations'] = [{
|
||||
'country': 'US',
|
||||
'state': 'NH',
|
||||
'city': 'Manchester',
|
||||
'code': '03101',
|
||||
'latitude': '42.990605',
|
||||
'longitude': '-71.460989'
|
||||
}]
|
||||
fixed_values['thumbnail'] = {'url': fixed_values.pop('thumbnail_url')}
|
||||
fixed_values['release_time'] = str(values['release_time'])
|
||||
fixed_values['source'] = {
|
||||
'hash': 'c0ddd62c7717180e7ffb8a15bb9674d3ec92592e0b7ac7d1d5289836b4553be2',
|
||||
'hash': '56bf5dbae43f77a63d075b0f2ae9c7c3e3098db93779c7f9840da0f4db9c2f8c8454f4edd1373e2b64ee2e68350d916e',
|
||||
'media_type': 'application/octet-stream',
|
||||
'size': '3'
|
||||
}
|
||||
fixed_values['fee'] = {
|
||||
'address': fixed_values.pop('fee_address'),
|
||||
'amount': float(fixed_values.pop('fee_amount')),
|
||||
'amount': fixed_values.pop('fee_amount'),
|
||||
'currency': fixed_values.pop('fee_currency').upper()
|
||||
}
|
||||
|
||||
@@ -311,7 +366,7 @@ class StreamCommands(CommandTestCase):
|
||||
'size': '3',
|
||||
'media_type': 'application/octet-stream',
|
||||
'name': stream['source']['name'],
|
||||
'hash': 'c0ddd62c7717180e7ffb8a15bb9674d3ec92592e0b7ac7d1d5289836b4553be2',
|
||||
'hash': '56bf5dbae43f77a63d075b0f2ae9c7c3e3098db93779c7f9840da0f4db9c2f8c8454f4edd1373e2b64ee2e68350d916e',
|
||||
'sd_hash': stream['source']['sd_hash']
|
||||
},
|
||||
}
|
||||
@@ -329,7 +384,7 @@ class StreamCommands(CommandTestCase):
|
||||
'size': '3',
|
||||
'media_type': 'application/octet-stream',
|
||||
'name': fixed_values['source']['name'],
|
||||
'hash': 'c0ddd62c7717180e7ffb8a15bb9674d3ec92592e0b7ac7d1d5289836b4553be2',
|
||||
'hash': '56bf5dbae43f77a63d075b0f2ae9c7c3e3098db93779c7f9840da0f4db9c2f8c8454f4edd1373e2b64ee2e68350d916e',
|
||||
'sd_hash': fixed_values['source']['sd_hash'],
|
||||
},
|
||||
'tags': ['blah'],
|
||||
@@ -346,7 +401,7 @@ class StreamCommands(CommandTestCase):
|
||||
fixed_values['locations'].insert(0, {'country': 'UA', 'city': 'Kyiv'}) # existing location
|
||||
self.assertEqual(stream, fixed_values)
|
||||
|
||||
# clearing and settings tags
|
||||
# clearing and settings tags, languages and locations
|
||||
tx = await self.out(self.stream_update(
|
||||
claim_id, tags='single', clear_tags=True,
|
||||
languages='pt', clear_languages=True,
|
||||
@@ -358,6 +413,12 @@ class StreamCommands(CommandTestCase):
|
||||
fixed_values['locations'] = [{'country': 'BR'}]
|
||||
self.assertEqual(txo['value'], fixed_values)
|
||||
|
||||
# clearing fee
|
||||
tx = await self.out(self.stream_update(claim_id, clear_fee=True))
|
||||
txo = tx['outputs'][0]
|
||||
del fixed_values['fee']
|
||||
self.assertEqual(txo['value'], fixed_values)
|
||||
|
||||
# modifying hash/size/name
|
||||
fixed_values['source']['name'] = 'changed_name'
|
||||
fixed_values['source']['hash'] = 'cafebeef'
|
||||
@@ -367,19 +428,27 @@ class StreamCommands(CommandTestCase):
|
||||
))
|
||||
self.assertEqual(tx['outputs'][0]['value'], fixed_values)
|
||||
|
||||
# stream_update re-signs with the same channel
|
||||
channel_id = (await self.channel_create('@chan'))['outputs'][0]['claim_id']
|
||||
tx = await self.stream_update(claim_id, channel_id=channel_id)
|
||||
self.assertEqual(tx['outputs'][0]['signing_channel']['name'], '@chan')
|
||||
tx = await self.stream_update(claim_id, title='channel re-signs')
|
||||
self.assertEqual(tx['outputs'][0]['value']['title'], 'channel re-signs')
|
||||
self.assertEqual(tx['outputs'][0]['signing_channel']['name'], '@chan')
|
||||
|
||||
# send claim to someone else
|
||||
new_account = await self.out(self.daemon.jsonrpc_account_create('second account'))
|
||||
account2_id, account2 = new_account['id'], self.daemon.get_account_or_error(new_account['id'])
|
||||
|
||||
# before sending
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 3)
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 4)
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list(account_id=account2_id)), 0)
|
||||
|
||||
other_address = await account2.receiving.get_or_create_usable_address()
|
||||
tx = await self.out(self.stream_update(claim_id, claim_address=other_address))
|
||||
|
||||
# after sending
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 2)
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list()), 3)
|
||||
self.assertEqual(len(await self.daemon.jsonrpc_claim_list(account_id=account2_id)), 1)
|
||||
|
||||
async def test_automatic_type_and_metadata_detection_for_image(self):
|
||||
@@ -403,7 +472,7 @@ class StreamCommands(CommandTestCase):
|
||||
'size': '99',
|
||||
'name': os.path.basename(file.name),
|
||||
'media_type': 'image/png',
|
||||
'hash': '06003bbee8aece0543ed9d9cecc48be1d996cfeff9837a1aed1d961caeda82af',
|
||||
'hash': '6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545',
|
||||
'sd_hash': txo['value']['source']['sd_hash'],
|
||||
},
|
||||
'stream_type': 'image',
|
||||
@@ -427,7 +496,7 @@ class StreamCommands(CommandTestCase):
|
||||
'size': '2299653',
|
||||
'name': 'ForBiggerEscapes.mp4',
|
||||
'media_type': 'video/mp4',
|
||||
'hash': 'f846d9c7f5ed28f0ed47e9d9b4198a03075e6df967ac54078af85ea1bf0ddd87',
|
||||
'hash': '5f6811c83c1616df06f10bf5309ca61edb5ff949a9c1212ce784602d837bfdfc1c3db1e0580ef7bd1dadde41d8acf315',
|
||||
'sd_hash': txo['value']['source']['sd_hash'],
|
||||
},
|
||||
'stream_type': 'video',
|
||||
@@ -452,7 +521,7 @@ class StreamCommands(CommandTestCase):
|
||||
'size': '2299653',
|
||||
'name': 'ForBiggerEscapes.mp4',
|
||||
'media_type': 'video/mp4',
|
||||
'hash': 'f846d9c7f5ed28f0ed47e9d9b4198a03075e6df967ac54078af85ea1bf0ddd87',
|
||||
'hash': '5f6811c83c1616df06f10bf5309ca61edb5ff949a9c1212ce784602d837bfdfc1c3db1e0580ef7bd1dadde41d8acf315',
|
||||
'sd_hash': txo['value']['source']['sd_hash'],
|
||||
},
|
||||
'stream_type': 'video',
|
||||
@@ -464,6 +533,46 @@ class StreamCommands(CommandTestCase):
|
||||
}
|
||||
)
|
||||
|
||||
async def test_replace_mode_preserves_source_and_type(self):
|
||||
expected = {
|
||||
'tags': ['blah'],
|
||||
'languages': ['uk'],
|
||||
'locations': [{'country': 'UA', 'city': 'Kyiv'}],
|
||||
'source': {
|
||||
'size': '2299653',
|
||||
'name': 'ForBiggerEscapes.mp4',
|
||||
'media_type': 'video/mp4',
|
||||
'hash': '5f6811c83c1616df06f10bf5309ca61edb5ff949a9c1212ce784602d837bfdfc1c3db1e0580ef7bd1dadde41d8acf315',
|
||||
},
|
||||
'stream_type': 'video',
|
||||
'video': {
|
||||
'width': 1280,
|
||||
'height': 720,
|
||||
'duration': 15
|
||||
}
|
||||
}
|
||||
channel = await self.channel_create('@chan')
|
||||
tx = await self.out(self.daemon.jsonrpc_stream_create(
|
||||
'chrome', '1.0', file_path=self.video_file_name,
|
||||
tags='blah', languages='uk', locations='UA::Kyiv',
|
||||
channel_id=channel['outputs'][0]['claim_id']
|
||||
))
|
||||
await self.on_transaction_dict(tx)
|
||||
txo = tx['outputs'][0]
|
||||
expected['source']['sd_hash'] = txo['value']['source']['sd_hash']
|
||||
self.assertEqual(txo['value'], expected)
|
||||
self.assertEqual(txo['signing_channel']['name'], '@chan')
|
||||
tx = await self.out(self.daemon.jsonrpc_stream_update(
|
||||
txo['claim_id'], title='new title', replace=True
|
||||
))
|
||||
txo = tx['outputs'][0]
|
||||
expected['title'] = 'new title'
|
||||
del expected['tags']
|
||||
del expected['languages']
|
||||
del expected['locations']
|
||||
self.assertEqual(txo['value'], expected)
|
||||
self.assertNotIn('signing_channel', txo)
|
||||
|
||||
async def test_create_update_and_abandon_stream(self):
|
||||
await self.assertBalance(self.account, '10.0')
|
||||
|
||||
@@ -477,6 +586,10 @@ class StreamCommands(CommandTestCase):
|
||||
self.assertEqual(txs[0]['value'], '0.0')
|
||||
self.assertEqual(txs[0]['fee'], '-0.020107')
|
||||
await self.assertBalance(self.account, '7.479893')
|
||||
self.assertEqual(1, len(self.daemon.jsonrpc_file_list()))
|
||||
|
||||
await self.daemon.jsonrpc_file_delete(delete_all=True)
|
||||
self.assertEqual(0, len(self.daemon.jsonrpc_file_list()))
|
||||
|
||||
await self.stream_update(claim_id, bid='1.0') # updates previous claim
|
||||
txs = await self.out(self.daemon.jsonrpc_transaction_list())
|
||||
@@ -484,8 +597,8 @@ class StreamCommands(CommandTestCase):
|
||||
self.assertEqual(txs[0]['update_info'][0]['balance_delta'], '1.5')
|
||||
self.assertEqual(txs[0]['update_info'][0]['claim_id'], claim_id)
|
||||
self.assertEqual(txs[0]['value'], '0.0')
|
||||
self.assertEqual(txs[0]['fee'], '-0.0002075')
|
||||
await self.assertBalance(self.account, '8.9796855')
|
||||
self.assertEqual(txs[0]['fee'], '-0.0002165')
|
||||
await self.assertBalance(self.account, '8.9796765')
|
||||
|
||||
await self.stream_abandon(claim_id)
|
||||
txs = await self.out(self.daemon.jsonrpc_transaction_list())
|
||||
@@ -494,7 +607,7 @@ class StreamCommands(CommandTestCase):
|
||||
self.assertEqual(txs[0]['abandon_info'][0]['claim_id'], claim_id)
|
||||
self.assertEqual(txs[0]['value'], '0.0')
|
||||
self.assertEqual(txs[0]['fee'], '-0.000107')
|
||||
await self.assertBalance(self.account, '9.9795785')
|
||||
await self.assertBalance(self.account, '9.9795695')
|
||||
|
||||
async def test_abandoning_stream_at_loss(self):
|
||||
await self.assertBalance(self.account, '10.0')
|
||||
@@ -548,14 +661,13 @@ class StreamCommands(CommandTestCase):
|
||||
tx3['outputs'][0]['claim_id']
|
||||
)
|
||||
|
||||
# publishing again re-signs with the same channel
|
||||
# publishing again clears channel
|
||||
tx4 = await self.publish('foo', languages='uk-UA')
|
||||
self.assertEqual(2, len(self.daemon.jsonrpc_file_list()))
|
||||
r = await self.resolve('lbry://@abc/foo')
|
||||
claim = r['lbry://@abc/foo']['claim']
|
||||
r = await self.resolve('lbry://foo')
|
||||
claim = r['lbry://foo']['claim']
|
||||
self.assertEqual(claim['txid'], tx4['outputs'][0]['txid'])
|
||||
self.assertEqual(claim['channel_name'], '@abc')
|
||||
self.assertEqual(claim['signature_is_valid'], True)
|
||||
self.assertNotIn('channel_name', claim)
|
||||
self.assertEqual(claim['value']['languages'], ['uk-UA'])
|
||||
|
||||
async def test_claim_search(self):
|
||||
@@ -595,6 +707,13 @@ class StreamCommands(CommandTestCase):
|
||||
|
||||
claims = await self.claim_search(channel_id=channel_id)
|
||||
self.assertEqual(len(claims), 3)
|
||||
# same is expected using name or name#claim_id urls
|
||||
claims = await self.claim_search(channel_name="@abc")
|
||||
self.assertEqual(len(claims), 3)
|
||||
claims = await self.claim_search(channel_name="@abc", channel_id=channel_id)
|
||||
self.assertEqual(len(claims), 3)
|
||||
claims = await self.claim_search(channel_name=f"@abc#{channel_id}")
|
||||
self.assertEqual(len(claims), 3)
|
||||
|
||||
await self.stream_abandon(claim_id=claims[0]['claim_id'])
|
||||
await self.stream_abandon(claim_id=claims[1]['claim_id'])
|
||||
@@ -686,8 +805,7 @@ class StreamCommands(CommandTestCase):
|
||||
self.assertNotEqual(r1c, r2c)
|
||||
|
||||
await self.generate(50)
|
||||
head = await self.daemon.jsonrpc_block_show()
|
||||
self.assertTrue(head['height'] > 250)
|
||||
self.assertTrue(self.ledger.headers.height > 250)
|
||||
|
||||
r3 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣίσυφοςfiÆ')
|
||||
r4 = await self.daemon.jsonrpc_resolve(urls='lbry://ΣΊΣΥΦΟσFIæ')
|
||||
|
||||
@@ -29,7 +29,7 @@ class CLIIntegrationTest(AsyncioTestCase):
|
||||
await self.daemon.start()
|
||||
|
||||
async def asyncTearDown(self):
|
||||
await self.daemon.stop()
|
||||
await self.daemon.stop(shutdown_runner=False)
|
||||
|
||||
def test_cli_status_command_with_auth(self):
|
||||
actual_output = StringIO()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from binascii import unhexlify, hexlify
|
||||
|
||||
from lbrynet.schema import Claim
|
||||
from lbrynet.testcase import CommandTestCase
|
||||
from lbrynet.blob_exchange.downloader import BlobDownloader
|
||||
|
||||
@@ -26,6 +28,67 @@ class FileCommands(CommandTestCase):
|
||||
await self.daemon.jsonrpc_get('lbry://foo')
|
||||
self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1)
|
||||
|
||||
async def test_announces(self):
|
||||
# announces on publish
|
||||
self.assertEqual(await self.daemon.storage.get_blobs_to_announce(), [])
|
||||
await self.stream_create('foo', '0.01')
|
||||
stream = self.daemon.jsonrpc_file_list()[0]
|
||||
self.assertSetEqual(
|
||||
set(await self.daemon.storage.get_blobs_to_announce()),
|
||||
{stream.sd_hash, stream.descriptor.blobs[0].blob_hash}
|
||||
)
|
||||
self.assertTrue(await self.daemon.jsonrpc_file_delete(delete_all=True))
|
||||
# announces on download
|
||||
self.assertEqual(await self.daemon.storage.get_blobs_to_announce(), [])
|
||||
stream = await self.daemon.jsonrpc_get('foo')
|
||||
self.assertSetEqual(
|
||||
set(await self.daemon.storage.get_blobs_to_announce()),
|
||||
{stream.sd_hash, stream.descriptor.blobs[0].blob_hash}
|
||||
)
|
||||
|
||||
async def test_file_list_fields(self):
|
||||
await self.stream_create('foo', '0.01')
|
||||
file_list = self.sout(self.daemon.jsonrpc_file_list())
|
||||
self.assertEqual(
|
||||
file_list[0]['timestamp'],
|
||||
None
|
||||
)
|
||||
self.assertEqual(file_list[0]['confirmations'], -1)
|
||||
await self.daemon.jsonrpc_resolve('foo')
|
||||
file_list = self.sout(self.daemon.jsonrpc_file_list())
|
||||
self.assertEqual(
|
||||
file_list[0]['timestamp'],
|
||||
self.ledger.headers[file_list[0]['height']]['timestamp']
|
||||
)
|
||||
self.assertEqual(file_list[0]['confirmations'], 1)
|
||||
|
||||
async def test_get_doesnt_touch_user_written_files_between_calls(self):
|
||||
await self.stream_create('foo', '0.01', data=bytes([0] * (2 << 23)))
|
||||
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'))
|
||||
first_path = (await self.daemon.jsonrpc_get('lbry://foo', save_file=True)).full_path
|
||||
await self.wait_files_to_complete()
|
||||
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'))
|
||||
with open(first_path, 'wb') as f:
|
||||
f.write(b' ')
|
||||
f.flush()
|
||||
second_path = await self.daemon.jsonrpc_get('lbry://foo', save_file=True)
|
||||
await self.wait_files_to_complete()
|
||||
self.assertNotEquals(first_path, second_path)
|
||||
|
||||
async def test_file_list_updated_metadata_on_resolve(self):
|
||||
await self.stream_create('foo', '0.01')
|
||||
claim = await self.daemon.resolve('lbry://foo')
|
||||
claim = claim['lbry://foo']['claim']['protobuf'].decode()
|
||||
await self.daemon.jsonrpc_file_delete(claim_name='foo')
|
||||
txid = await self.blockchain_claim_name('bar', claim, '0.01')
|
||||
await self.daemon.jsonrpc_get('lbry://bar')
|
||||
claim = Claim.from_bytes(unhexlify(claim))
|
||||
claim.stream.description = "fix typos, fix the world"
|
||||
await self.blockchain_update_name(txid, hexlify(claim.to_bytes()).decode(), '0.01')
|
||||
await self.daemon.jsonrpc_resolve('lbry://bar')
|
||||
file_list = self.daemon.jsonrpc_file_list()
|
||||
self.assertEqual(file_list[0].stream_claim_info.claim.stream.description, claim.stream.description)
|
||||
|
||||
async def test_download_different_timeouts(self):
|
||||
tx = await self.stream_create('foo', '0.01')
|
||||
sd_hash = tx['outputs'][0]['value']['source']['sd_hash']
|
||||
@@ -34,12 +97,12 @@ class FileCommands(CommandTestCase):
|
||||
blob_hash for blob_hash in self.server.blob_manager.completed_blob_hashes if blob_hash != sd_hash
|
||||
]
|
||||
await self.server.blob_manager.delete_blobs(all_except_sd)
|
||||
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2)
|
||||
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'])
|
||||
await self.daemon.jsonrpc_file_delete(claim_name='foo')
|
||||
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='foo'), "data timeout didnt create a file")
|
||||
await self.server.blob_manager.delete_blobs([sd_hash])
|
||||
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2)
|
||||
resp = await self.daemon.jsonrpc_get('lbry://foo', timeout=2, save_file=True)
|
||||
self.assertIn('error', resp)
|
||||
self.assertEqual('Failed to download sd blob %s within timeout' % sd_hash, resp['error'])
|
||||
|
||||
@@ -126,7 +189,7 @@ class FileCommands(CommandTestCase):
|
||||
self.assertEqual('finished', file_info['status'])
|
||||
|
||||
async def test_unban_recovers_stream(self):
|
||||
BlobDownloader.BAN_TIME = .5 # fixme: temporary field, will move to connection manager or a conf
|
||||
BlobDownloader.BAN_FACTOR = .5 # fixme: temporary field, will move to connection manager or a conf
|
||||
tx = await self.stream_create('foo', '0.01', data=bytes([0] * (1 << 23)))
|
||||
sd_hash = tx['outputs'][0]['value']['source']['sd_hash']
|
||||
missing_blob_hash = (await self.daemon.jsonrpc_blob_list(sd_hash=sd_hash))[-2]
|
||||
@@ -176,6 +239,7 @@ class FileCommands(CommandTestCase):
|
||||
await self.daemon.jsonrpc_file_delete(claim_name='icanpay')
|
||||
await self.assertBalance(self.account, '9.925679')
|
||||
response = await self.daemon.jsonrpc_get('lbry://icanpay')
|
||||
raw_content_fee = response.content_fee.raw
|
||||
await self.ledger.wait(response.content_fee)
|
||||
await self.assertBalance(self.account, '8.925555')
|
||||
self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1)
|
||||
@@ -189,3 +253,10 @@ class FileCommands(CommandTestCase):
|
||||
self.assertEqual(
|
||||
await self.blockchain.get_balance(), starting_balance + block_reward_and_claim_fee
|
||||
)
|
||||
|
||||
# restart the daemon and make sure the fee is still there
|
||||
|
||||
self.daemon.stream_manager.stop()
|
||||
await self.daemon.stream_manager.start()
|
||||
self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1)
|
||||
self.assertEqual(self.daemon.jsonrpc_file_list()[0].content_fee.raw, raw_content_fee)
|
||||
@@ -38,6 +38,14 @@ class ResolveCommand(CommandTestCase):
|
||||
self.assertEqual(claim['claim']['channel_name'], '@abc')
|
||||
self.assertEqual(claim['certificate']['name'], '@abc')
|
||||
self.assertEqual(claim['claims_in_channel'], 0)
|
||||
self.assertEqual(
|
||||
claim['claim']['timestamp'],
|
||||
self.ledger.headers[claim['claim']['height']]['timestamp']
|
||||
)
|
||||
self.assertEqual(
|
||||
claim['certificate']['timestamp'],
|
||||
self.ledger.headers[claim['certificate']['height']]['timestamp']
|
||||
)
|
||||
|
||||
# resolving claim foo by itself
|
||||
response = await self.resolve('lbry://foo')
|
||||
@@ -65,14 +73,13 @@ class ResolveCommand(CommandTestCase):
|
||||
self.assertEqual(claim['certificate']['name'], '@abc')
|
||||
self.assertEqual(claim['claims_in_channel'], 0)
|
||||
|
||||
# resolve has correct depth
|
||||
# resolve has correct confirmations
|
||||
tx_details = await self.blockchain.get_raw_transaction(claim['claim']['txid'])
|
||||
self.assertEqual(claim['claim']['depth'], json.loads(tx_details)['confirmations'])
|
||||
self.assertEqual(claim['claim']['confirmations'], json.loads(tx_details)['confirmations'])
|
||||
|
||||
# resolve handles invalid data
|
||||
txid = await self.blockchain_claim_name(
|
||||
"gibberish", hexlify(b"{'invalid':'json'}").decode(), "0.1")
|
||||
await self.generate(1)
|
||||
response = await self.resolve("lbry://gibberish")
|
||||
self.assertSetEqual({'lbry://gibberish'}, set(response))
|
||||
claim = response['lbry://gibberish']['claim']
|
||||
|
||||
@@ -24,11 +24,11 @@ class RangeRequests(CommandTestCase):
|
||||
await self.daemon.stream_manager.start()
|
||||
return
|
||||
|
||||
async def _setup_stream(self, data: bytes, save_blobs: bool = True, save_files: bool = False):
|
||||
async def _setup_stream(self, data: bytes, save_blobs: bool = True, save_files: bool = False, file_size=0):
|
||||
self.daemon.conf.save_blobs = save_blobs
|
||||
self.daemon.conf.save_files = save_files
|
||||
self.data = data
|
||||
await self.stream_create('foo', '0.01', data=self.data)
|
||||
await self.stream_create('foo', '0.01', data=self.data, file_size=file_size)
|
||||
if save_blobs:
|
||||
self.assertTrue(len(os.listdir(self.daemon.blob_manager.blob_dir)) > 1)
|
||||
await self.daemon.jsonrpc_file_list()[0].fully_reflected.wait()
|
||||
@@ -70,9 +70,10 @@ class RangeRequests(CommandTestCase):
|
||||
self.assertEqual('bytes 0-14/15', content_range)
|
||||
|
||||
async def test_range_requests_0_padded_bytes(self, size: int = (MAX_BLOB_SIZE - 1) * 4,
|
||||
expected_range: str = 'bytes 0-8388603/8388604', padding=b''):
|
||||
expected_range: str = 'bytes 0-8388603/8388604', padding=b'',
|
||||
file_size=0):
|
||||
self.data = get_random_bytes(size)
|
||||
await self._setup_stream(self.data)
|
||||
await self._setup_stream(self.data, file_size=file_size)
|
||||
streamed, content_range, content_length = await self._test_range_requests()
|
||||
self.assertEqual(len(self.data + padding), content_length)
|
||||
self.assertEqual(streamed, self.data + padding)
|
||||
@@ -93,6 +94,11 @@ class RangeRequests(CommandTestCase):
|
||||
((MAX_BLOB_SIZE - 1) * 4) - 14, padding=b'\x00' * 14
|
||||
)
|
||||
|
||||
async def test_range_requests_no_padding_size_from_claim(self):
|
||||
size = ((MAX_BLOB_SIZE - 1) * 4) - 14
|
||||
await self.test_range_requests_0_padded_bytes(size, padding=b'', file_size=size,
|
||||
expected_range=f"bytes 0-{size-1}/{size}")
|
||||
|
||||
async def test_range_requests_15_padded_bytes(self):
|
||||
await self.test_range_requests_0_padded_bytes(
|
||||
((MAX_BLOB_SIZE - 1) * 4) - 15, padding=b'\x00' * 15
|
||||
@@ -340,9 +346,11 @@ class RangeRequests(CommandTestCase):
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
await self._restart_stream_manager()
|
||||
stream = self.daemon.jsonrpc_file_list()[0]
|
||||
|
||||
self.assertIsNone(stream.full_path)
|
||||
self.assertIsNotNone(stream.full_path)
|
||||
self.assertFalse(os.path.isfile(path))
|
||||
if wait_for_start_writing:
|
||||
await stream.started_writing.wait()
|
||||
self.assertTrue(os.path.isfile(path))
|
||||
|
||||
async def test_file_save_stop_before_finished_streaming_only_wait_for_start(self):
|
||||
return await self.test_file_save_stop_before_finished_streaming_only(wait_for_start_writing=True)
|
||||
|
||||
@@ -54,7 +54,7 @@ class AccountSynchronization(AsyncioTestCase):
|
||||
|
||||
async def asyncTearDown(self):
|
||||
self.wallet_component._running = False
|
||||
await self.daemon.stop()
|
||||
await self.daemon.stop(shutdown_runner=False)
|
||||
|
||||
@mock.patch('time.time', mock.Mock(return_value=12345))
|
||||
def test_sync(self):
|
||||
|
||||
@@ -133,6 +133,22 @@ class TestBlob(AsyncioTestCase):
|
||||
await self._test_close_writers_on_finished(BlobBuffer)
|
||||
await self._test_close_writers_on_finished(BlobFile, tmp_dir)
|
||||
|
||||
async def test_concurrency_and_premature_closes(self):
|
||||
blob_directory = tempfile.mkdtemp()
|
||||
self.addCleanup(lambda: shutil.rmtree(blob_directory))
|
||||
blob = self._get_blob(BlobBuffer, blob_directory=blob_directory)
|
||||
writer = blob.get_blob_writer('1.1.1.1', 1337)
|
||||
self.assertEqual(1, len(blob.writers))
|
||||
with self.assertRaises(OSError):
|
||||
blob.get_blob_writer('1.1.1.1', 1337)
|
||||
writer.close_handle()
|
||||
self.assertTrue(blob.writers[('1.1.1.1', 1337)].closed())
|
||||
writer = blob.get_blob_writer('1.1.1.1', 1337)
|
||||
self.assertEqual(blob.writers[('1.1.1.1', 1337)], writer)
|
||||
writer.close_handle()
|
||||
await asyncio.sleep(0.000000001) # flush callbacks
|
||||
self.assertEqual(0, len(blob.writers))
|
||||
|
||||
async def test_delete(self):
|
||||
blob_buffer = await self._test_create_blob(BlobBuffer)
|
||||
self.assertIsInstance(blob_buffer, BlobBuffer)
|
||||
|
||||
@@ -17,10 +17,10 @@ class MockAsyncGen:
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
await asyncio.sleep(self.delay, loop=self.loop)
|
||||
if self.count > self.stop_cnt - 1:
|
||||
raise StopAsyncIteration()
|
||||
self.count += 1
|
||||
await asyncio.sleep(self.delay, loop=self.loop)
|
||||
return self.result
|
||||
|
||||
async def aclose(self):
|
||||
@@ -48,6 +48,18 @@ class TestAsyncGeneratorJunction(AsyncioTestCase):
|
||||
self.assertEqual(fast_gen.called_close, True)
|
||||
self.assertEqual(slow_gen.called_close, True)
|
||||
|
||||
async def test_nothing_to_yield(self):
|
||||
async def __nothing():
|
||||
for _ in []:
|
||||
yield self.fail("nada")
|
||||
await self._test_junction([], __nothing())
|
||||
|
||||
async def test_fast_iteratiors(self):
|
||||
async def __gotta_go_fast():
|
||||
for _ in range(10):
|
||||
yield 0
|
||||
await self._test_junction([0]*40, __gotta_go_fast(), __gotta_go_fast(), __gotta_go_fast(), __gotta_go_fast())
|
||||
|
||||
@unittest.SkipTest
|
||||
async def test_one_stopped_first(self):
|
||||
expected_order = [1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2]
|
||||
|
||||
@@ -85,7 +85,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
|
||||
)
|
||||
to_announce = await self.storage.get_blobs_to_announce()
|
||||
self.assertEqual(2, len(to_announce))
|
||||
self.blob_announcer.start()
|
||||
self.blob_announcer.start(batch_size=1) # so it covers batching logic
|
||||
await self.advance(61.0)
|
||||
to_announce = await self.storage.get_blobs_to_announce()
|
||||
self.assertEqual(0, len(to_announce))
|
||||
@@ -105,7 +105,7 @@ class TestBlobAnnouncer(AsyncioTestCase):
|
||||
|
||||
_, task = last.accumulate_peers(search_q, peer_q)
|
||||
found_peers = await peer_q.get()
|
||||
task.cancel()
|
||||
await task
|
||||
|
||||
self.assertEqual(1, len(found_peers))
|
||||
self.assertEqual(self.node.protocol.node_id, found_peers[0].node_id)
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
self.loop, self.client_config, self.client_blob_manager, self.sd_hash, self.client_dir
|
||||
)
|
||||
|
||||
async def _test_transfer_stream(self, blob_count: int, mock_accumulate_peers=None):
|
||||
async def _test_transfer_stream(self, blob_count: int, mock_accumulate_peers=None, stop_when_done=True):
|
||||
await self.setup_stream(blob_count)
|
||||
mock_node = mock.Mock(spec=Node)
|
||||
|
||||
@@ -51,10 +51,11 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
return q2, self.loop.create_task(_task())
|
||||
|
||||
mock_node.accumulate_peers = mock_accumulate_peers or _mock_accumulate_peers
|
||||
await self.stream.setup(mock_node, save_file=True)
|
||||
await self.stream.save_file(node=mock_node)
|
||||
await self.stream.finished_writing.wait()
|
||||
self.assertTrue(os.path.isfile(self.stream.full_path))
|
||||
self.stream.stop_download()
|
||||
if stop_when_done:
|
||||
await self.stream.stop()
|
||||
self.assertTrue(os.path.isfile(self.stream.full_path))
|
||||
with open(self.stream.full_path, 'rb') as f:
|
||||
self.assertEqual(f.read(), self.stream_bytes)
|
||||
@@ -62,6 +63,18 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
|
||||
async def test_transfer_stream(self):
|
||||
await self._test_transfer_stream(10)
|
||||
self.assertEqual(self.stream.status, "finished")
|
||||
self.assertFalse(self.stream._running.is_set())
|
||||
|
||||
async def test_delayed_stop(self):
|
||||
await self._test_transfer_stream(10, stop_when_done=False)
|
||||
self.assertEqual(self.stream.status, "finished")
|
||||
self.assertTrue(self.stream._running.is_set())
|
||||
await asyncio.sleep(0.5, loop=self.loop)
|
||||
self.assertTrue(self.stream._running.is_set())
|
||||
await asyncio.sleep(0.6, loop=self.loop)
|
||||
self.assertEqual(self.stream.status, "finished")
|
||||
self.assertFalse(self.stream._running.is_set())
|
||||
|
||||
@unittest.SkipTest
|
||||
async def test_transfer_hundred_blob_stream(self):
|
||||
@@ -85,11 +98,12 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
|
||||
mock_node.accumulate_peers = _mock_accumulate_peers
|
||||
|
||||
await self.stream.setup(mock_node, save_file=True)
|
||||
await self.stream.save_file(node=mock_node)
|
||||
await self.stream.finished_writing.wait()
|
||||
self.assertTrue(os.path.isfile(self.stream.full_path))
|
||||
with open(self.stream.full_path, 'rb') as f:
|
||||
self.assertEqual(f.read(), self.stream_bytes)
|
||||
await self.stream.stop()
|
||||
# self.assertIs(self.server_from_client.tcp_last_down, None)
|
||||
# self.assertIsNot(bad_peer.tcp_last_down, None)
|
||||
|
||||
@@ -125,7 +139,7 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
with open(os.path.join(self.client_blob_manager.blob_dir, blob_info.blob_hash), "rb+") as handle:
|
||||
handle.truncate()
|
||||
handle.flush()
|
||||
await self.stream.setup()
|
||||
await self.stream.save_file()
|
||||
await self.stream.finished_writing.wait()
|
||||
if corrupt:
|
||||
return self.assertFalse(os.path.isfile(os.path.join(self.client_dir, "test_file")))
|
||||
@@ -151,26 +165,6 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
async def test_create_and_decrypt_multi_blob_stream(self):
|
||||
await self.test_create_and_decrypt_one_blob_stream(10)
|
||||
|
||||
# async def test_create_managed_stream_announces(self):
|
||||
# # setup a blob manager
|
||||
# storage = SQLiteStorage(Config(), ":memory:")
|
||||
# await storage.open()
|
||||
# tmp_dir = tempfile.mkdtemp()
|
||||
# self.addCleanup(lambda: shutil.rmtree(tmp_dir))
|
||||
# blob_manager = BlobManager(self.loop, tmp_dir, storage)
|
||||
# stream_manager = StreamManager(self.loop, Config(), blob_manager, None, storage, None)
|
||||
# # create the stream
|
||||
# download_dir = tempfile.mkdtemp()
|
||||
# self.addCleanup(lambda: shutil.rmtree(download_dir))
|
||||
# file_path = os.path.join(download_dir, "test_file")
|
||||
# with open(file_path, 'wb') as f:
|
||||
# f.write(b'testtest')
|
||||
#
|
||||
# stream = await stream_manager.create_stream(file_path)
|
||||
# self.assertEqual(
|
||||
# [stream.sd_hash, stream.descriptor.blobs[0].blob_hash],
|
||||
# await storage.get_blobs_to_announce())
|
||||
|
||||
# async def test_create_truncate_and_handle_stream(self):
|
||||
# # The purpose of this test is just to make sure it can finish even if a blob is corrupt/truncated
|
||||
# await asyncio.wait_for(self.test_create_and_decrypt_one_blob_stream(corrupt=True), timeout=5)
|
||||
@@ -62,3 +62,8 @@ class TestStreamAssembler(AsyncioTestCase):
|
||||
|
||||
sent = await self.stream.upload_to_reflector('127.0.0.1', 5566)
|
||||
self.assertListEqual(sent, [])
|
||||
|
||||
async def test_announces(self):
|
||||
to_announce = await self.storage.get_blobs_to_announce()
|
||||
self.assertIn(self.stream.sd_hash, to_announce, "sd blob not set to announce")
|
||||
self.assertIn(self.stream.descriptor.blobs[0].blob_hash, to_announce, "head blob not set to announce")
|
||||
@@ -45,7 +45,7 @@ def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
|
||||
"claim_id": "c49566d631226492317d06ad7fdbe1ed32925124",
|
||||
"claim_sequence": 1,
|
||||
"decoded_claim": True,
|
||||
"depth": 1057,
|
||||
"confirmations": 1057,
|
||||
"effective_amount": "0.1",
|
||||
"has_signature": False,
|
||||
"height": 514081,
|
||||
@@ -225,7 +225,7 @@ class TestStreamManager(BlobExchangeTestBase):
|
||||
)
|
||||
self.assertEqual(stored_status, "running")
|
||||
|
||||
await self.stream_manager.stop_stream(stream)
|
||||
await stream.stop()
|
||||
|
||||
self.assertFalse(stream.finished)
|
||||
self.assertFalse(stream.running)
|
||||
@@ -235,7 +235,7 @@ class TestStreamManager(BlobExchangeTestBase):
|
||||
)
|
||||
self.assertEqual(stored_status, "stopped")
|
||||
|
||||
await self.stream_manager.start_stream(stream)
|
||||
await stream.save_file(node=self.stream_manager.node)
|
||||
await stream.finished_writing.wait()
|
||||
await asyncio.sleep(0, loop=self.loop)
|
||||
self.assertTrue(stream.finished)
|
||||
@@ -337,7 +337,7 @@ class TestStreamManager(BlobExchangeTestBase):
|
||||
for blob_hash in [stream.sd_hash] + [b.blob_hash for b in stream.descriptor.blobs[:-1]]:
|
||||
blob_status = await self.client_storage.get_blob_status(blob_hash)
|
||||
self.assertEqual('pending', blob_status)
|
||||
self.assertEqual('stopped', self.stream_manager.streams[self.sd_hash].status)
|
||||
self.assertEqual('finished', self.stream_manager.streams[self.sd_hash].status)
|
||||
|
||||
sd_blob = self.client_blob_manager.get_blob(stream.sd_hash)
|
||||
self.assertTrue(sd_blob.file_exists)
|
||||
|
||||
@@ -61,7 +61,7 @@ class CLITest(AsyncioTestCase):
|
||||
# publish is ungrouped command, returns usage only implicitly
|
||||
self.assertIn('publish (<name> | --name=<name>)', self.shell(['publish']))
|
||||
# publish is ungrouped command, with explicit --help
|
||||
self.assertIn('Create or update a stream claim at a given name', self.shell(['publish', '--help']))
|
||||
self.assertIn('Create or replace a stream claim at a given name', self.shell(['publish', '--help']))
|
||||
# account is a group, returns help implicitly
|
||||
self.assertIn('Return the balance of an account', self.shell(['account']))
|
||||
# account is a group, with explicit --help
|
||||
|
||||
@@ -95,3 +95,20 @@ class TestAccount(AsyncioTestCase):
|
||||
account = Account.from_dict(self.ledger, Wallet(), account_data)
|
||||
account_data['ledger'] = 'lbc_mainnet'
|
||||
self.assertDictEqual(account_data, account.to_dict())
|
||||
|
||||
async def test_save_max_gap(self):
|
||||
account = Account.generate(
|
||||
self.ledger, Wallet(), 'lbryum', {
|
||||
'name': 'deterministic-chain',
|
||||
'receiving': {'gap': 3, 'maximum_uses_per_address': 2},
|
||||
'change': {'gap': 4, 'maximum_uses_per_address': 2}
|
||||
}
|
||||
)
|
||||
self.assertEqual(account.receiving.gap, 3)
|
||||
self.assertEqual(account.change.gap, 4)
|
||||
await account.save_max_gap()
|
||||
self.assertEqual(account.receiving.gap, 20)
|
||||
self.assertEqual(account.change.gap, 6)
|
||||
# doesn't fail for single-address account
|
||||
account2 = Account.generate(self.ledger, Wallet(), 'lbryum', {'name': 'single-address'})
|
||||
await account2.save_max_gap()
|
||||
Reference in new issue
Block a user